LArSoft  v06_85_00
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 label = "bogus"; // fixme: make configurable
28 
30  : m_cfg(params())
31  , m_count(0)
32 {
33  produces< std::vector<sim::SimEnergyDeposit> >(label);
34 }
36 {
37 }
39 {
40  ++m_count;
41  const double jump = m_count*1e9; // each call jump forward in time.
42 
43  auto out = std::make_unique< std::vector<sim::SimEnergyDeposit> >();
44 
45  const int nphotons = 0;
46  const int nelepercm = 50000;
47  const double mevpercm = 2.0;
48 
49  const double t0 = 0.;
50  const double t1 = 0.;
51  const int trackid = 0;
52 
53 
54  // implicit units are cm, ns and MeV.
55  const sim::SimEnergyDeposit::Point_t start = {100.,0.,0.};
56  const sim::SimEnergyDeposit::Point_t end = {150.,10.,50.};
57  const auto vdiff = end-start;
58  const auto vlen = sqrt(vdiff.Mag2());
59  const auto vdir = vdiff.unit();
60 
61  const double stepsize = 0.1; // cm
62  const int nsteps = vlen/stepsize;
63 
64  sim::SimEnergyDeposit::Point_t last = start;
65  for (int istep=1; istep<nsteps; ++istep) {
66  const sim::SimEnergyDeposit::Point_t next(start + stepsize*istep*vdir);
67  //std::cerr << last << " -> " << next << "\n";
68  out->emplace_back(sim::SimEnergyDeposit(nphotons,
69  stepsize * nelepercm,
70  stepsize * mevpercm,
71  last, next,
72  jump + t0,
73  jump + t1, trackid));
74  last = next;
75  }
76 
77  std::cerr << "BlipMaker making " << out->size() << " depos to label: " << label << std::endl;
78 
79 
80  event.put(std::move(out), label);
81 }
82 
83 
84 namespace bogoblip {
86 }
87 
code to link reconstructed objects back to the MC truth information
TTree * t1
Definition: plottest35.C:26
const std::string label
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< Length_t > > Point_t
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)
const BlipMakerConfig m_cfg
Event finding and building.