LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
BlipMaker_module.cc
Go to the documentation of this file.
3 
5 
6 namespace bogoblip {
7  struct BlipMakerConfig {
8  };
9  class BlipMaker : public art::EDProducer {
10  public:
11 
13 
14  explicit BlipMaker(Parameters const& params);
15  virtual ~BlipMaker();
16 
17  void produce(art::Event & evt);
18 
19  private:
20 
22  int m_count;
23  };
24 }
25 
26 #include <string>
27 const std::string instance = "bogus"; // fixme: make configurable
28 
30  : m_cfg(params())
31  , m_count(0)
32 {
33  produces< std::vector<sim::SimEnergyDeposit> >(instance);
34 }
36 {
37 }
39 {
40  ++m_count;
41 
42  auto out = std::make_unique< std::vector<sim::SimEnergyDeposit> >();
43 
44  int nphotons = 0;
45  const int nelepercm = 50000;
46  const double mevpercm = 2.0;
47 
48  double t0 = 0.;
49  double t1 = 0.;
50  int trackid = 0;
51 
52  // implicit units are cm, ns and MeV.
53  sim::SimEnergyDeposit::Point_t start = {100.,0.,0.};
54  sim::SimEnergyDeposit::Point_t end = {150.,10.,50.};
55  const auto vdiff = end-start;
56  const auto vlen = sqrt(vdiff.Mag2());
57  const auto vdir = vdiff.unit();
58 
59  const double stepsize = 0.1; // cm
60  const int nsteps = vlen/stepsize;
61 
62  // larsoft works in ns
63  const double ns = 1.0;
64  const double us = 1000.0*ns;
65  const double ms = 1000.0*us;
66 
67  // MB: WCT sim should cut the first, the second should just be on
68  // the edge of time acceptance. The last two bracket the BNB beam
69  // gate.
70  for (double jump : { -1.6*ms, -1*ms, +3125*ns, (3125+1600)*ns, }) {
71  sim::SimEnergyDeposit::Point_t last = start;
72  for (int istep=1; istep<nsteps; ++istep) {
73  const sim::SimEnergyDeposit::Point_t next(start + stepsize*istep*vdir);
74  //std::cerr << last << " -> " << next << "\n";
75  out->emplace_back(sim::SimEnergyDeposit(nphotons,
76  stepsize * nelepercm,
77  stepsize * mevpercm,
78  last, next,
79  jump + t0,
80  jump + t1, trackid));
81  last = next;
82  }
83  }
84 
85  std::cerr << "BlipMaker making " << out->size() << " depos to instance: " << instance << std::endl;
86 
87 
88  event.put(std::move(out), instance);
89 }
90 
91 
92 namespace bogoblip {
94 }
95 
code to link reconstructed objects back to the MC truth information
TTree * t1
Definition: plottest35.C:26
const std::string instance
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
void produce(art::Event &evt)
contains information for a single step in the detector simulation
BlipMaker(Parameters const &params)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
TCEvent evt
Definition: DataStructs.cxx:5
const BlipMakerConfig m_cfg
Event finding and building.