SimpleCalorimeterDigi.h
Go to the documentation of this file.
1 #ifndef NPdet_SimpleCalorimeterDigi_H
2 #define NPdet_SimpleCalorimeterDigi_H
3 
4 #include <vector>
5 #include <tuple>
6 #include <random>
7 
8 namespace npdet {
9  namespace calorimeters {
10 
11  template<typename H1, typename H2>
12  auto digitize_simple_hits(const std::vector<H1>& hits) -> std::vector<H2> {
13  std::vector<H2> digi_hits;
14 
15  std::random_device rd;
16  std::mt19937 gen(rd());
17  std::normal_distribution<> time_dist(0,2.0);
18  std::normal_distribution<> adc_dist(5.0,3.0);
19 
20  for(const auto& h: hits) {
21  auto pos = h->position; //cm
22 
23  H2 ahit;
24  ahit.cellID0 = (int)h->cellID;
25  ahit.cellID1 = (int)h->cellID;
26  ahit.channelID = (int)h->cellID;
27  // time is not kept from dd4hep hit, instead using z position as crude substitute
28  ahit.time = pos.z() + time_dist(gen);
29  ahit.adc = adc_dist(gen);
30  digi_hits.push_back(ahit);
31  }
32  return digi_hits;
33  };
34 
35  }
36 }
37 
38 #endif
39 
Framework include files.
auto digitize_simple_hits(const std::vector< H1 > &hits) -> std::vector< H2 >