CMS 3D CMS Logo

EcalTimeMapDigitizer.h
Go to the documentation of this file.
1 #ifndef EcalSimAlgos_EcalTimeMapDigitizer_h
2 #define EcalSimAlgos_EcalTimeMapDigitizer_h
3 
16 
18 
20 public:
21  struct time_average {
22  static const unsigned short time_average_capacity = 10;
23 
28 
29  time_average(const DetId& myId) : id(myId) {
30  for (unsigned int i(0); i < time_average_capacity; ++i) {
31  average_time[i] = 0;
32  nhits[i] = 0;
33  tot_energy[i] = 0;
34  }
35  };
36 
38  for (unsigned int i(0); i < time_average_capacity; ++i) {
39  if (nhits[i] > 0)
41  else
42  average_time[i] = 0;
43  }
44  };
45 
46  void setZero() {
47  for (unsigned int i(0); i < time_average_capacity; ++i) {
48  average_time[i] = 0;
49  nhits[i] = 0;
50  tot_energy[i] = 0;
51  }
52  };
53 
54  bool zero() {
55  for (unsigned int i(0); i < time_average_capacity; ++i) {
56  if (nhits[i] > 0)
57  return false;
58  }
59  return true;
60  };
61  };
62 
64 
65  typedef EcalTimeDigi Digi;
66 
67  typedef std::vector<unsigned int> VecInd;
68 
69  explicit EcalTimeMapDigitizer(EcalSubdetector myDet);
70 
71  virtual ~EcalTimeMapDigitizer();
72 
73  void add(const std::vector<PCaloHit>& hits, int bunchCrossing);
74 
76 
77  void initializeMap();
78 
80 
81  void finalizeHits();
82 
83  inline void setTimeLayerId(const int& layerId) { m_timeLayerId = layerId; };
84 
85  int getTimeLayerId() { return m_timeLayerId; };
86 
88 
89  int minBunch() const;
90 
91  int maxBunch() const;
92 
93  void blankOutUsedSamples(); // blank out previously used elements
94 
95  /* const CaloVHitFilter* hitFilter() const ; */
96 
97 private:
98  TimeSamples* findSignal(const DetId& detId);
99 
100  VecInd& index();
101 
102  const VecInd& index() const;
103 
104  unsigned int samplesSize() const;
105 
106  unsigned int samplesSizeAll() const;
107 
108  const TimeSamples* operator[](unsigned int i) const;
109 
110  TimeSamples* operator[](unsigned int i);
111 
112  TimeSamples* vSam(unsigned int i);
113 
114  TimeSamples* vSamAll(unsigned int i);
115 
116  const TimeSamples* vSamAll(unsigned int i) const;
117 
119  //time difference between bunches
120 
121  static const int BUNCHSPACE = 25;
122 
123  static const float MIN_ENERGY_THRESHOLD; //50 KeV threshold to consider a valid hit in the timing detector
124 
125  static const int m_minBunch = -4;
126  static const int m_maxBunch = 5;
127 
129 
131 
132  double timeOfFlight(const DetId& detId, int layer) const;
133 
134  std::vector<TimeSamples> m_vSam;
135 
137 };
138 
139 #endif
unsigned int samplesSizeAll() const
void run(EcalTimeDigiCollection &output)
static const int m_maxBunch
const CaloSubdetectorGeometry * m_geometry
unsigned int samplesSize() const
unsigned int nhits[time_average_capacity]
std::vector< TimeSamples > m_vSam
void setGeometry(const CaloSubdetectorGeometry *geometry)
double timeOfFlight(const DetId &detId, int layer) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void setTimeLayerId(const int &layerId)
static const int BUNCHSPACE
const TimeSamples * operator[](unsigned int i) const
std::vector< unsigned int > VecInd
TimeSamples * vSamAll(unsigned int i)
EcalSubdetector subdetector()
static const unsigned short time_average_capacity
Definition: DetId.h:17
static const int m_minBunch
TimeSamples * findSignal(const DetId &detId)
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
EcalTimeMapDigitizer(EcalSubdetector myDet)
float average_time[time_average_capacity]
float tot_energy[time_average_capacity]
EcalSubdetector
static const float MIN_ENERGY_THRESHOLD
TimeSamples * vSam(unsigned int i)