CMS 3D CMS Logo

EcalTimeMapDigitizer.h
Go to the documentation of this file.
1 #ifndef EcalSimAlgos_EcalTimeMapDigitizer_h
2 #define EcalSimAlgos_EcalTimeMapDigitizer_h
3 
17 
19 
21 public:
22  struct time_average {
23  static const unsigned short time_average_capacity = 10; // this corresponds to the number of BX
24  static const unsigned short waveform_capacity = EcalTimeDigi::WAVEFORMSAMPLES; // this will give a waveform with
25  static constexpr double waveform_granularity = 1.; // a granularity of 1ns
26 
27  const DetId id;
32 
33  time_average(const DetId& myId) : id(myId) {
34  for (unsigned int i(0); i < time_average_capacity; ++i) {
35  average_time[i] = 0;
36  nhits[i] = 0;
37  tot_energy[i] = 0;
38  }
39  for (unsigned int i(0); i < waveform_capacity; ++i) {
40  waveform[i] = 0;
41  }
42  };
43 
45  for (unsigned int i(0); i < time_average_capacity; ++i) {
46  if (nhits[i] > 0)
48  else
49  average_time[i] = 0;
50  }
51  };
52 
53  void setZero() {
54  for (unsigned int i(0); i < time_average_capacity; ++i) {
55  average_time[i] = 0;
56  nhits[i] = 0;
57  tot_energy[i] = 0;
58  }
59  for (unsigned int i(0); i < waveform_capacity; ++i) {
60  waveform[i] = 0;
61  }
62  };
63 
64  bool zero() {
65  for (unsigned int i(0); i < time_average_capacity; ++i) {
66  if (nhits[i] > 0)
67  return false;
68  }
69  return true;
70  };
71  };
72 
74 
75  typedef EcalTimeDigi Digi;
76 
77  typedef std::vector<unsigned int> VecInd;
78 
79  explicit EcalTimeMapDigitizer(EcalSubdetector myDet, ComponentShapeCollection* componentShapes);
80 
81  virtual ~EcalTimeMapDigitizer();
82 
83  void add(const std::vector<PCaloHit>& hits, int bunchCrossing);
84 
86 
88 
89  void initializeMap();
90 
92 
93  void finalizeHits();
94 
95  inline void setTimeLayerId(const int& layerId) { m_timeLayerId = layerId; };
96 
97  int getTimeLayerId() { return m_timeLayerId; };
98 
100 
101  int minBunch() const;
102 
103  int maxBunch() const;
104 
105  void blankOutUsedSamples(); // blank out previously used elements
106 
107  /* const CaloVHitFilter* hitFilter() const ; */
108 
109 private:
111 
112  VecInd& index();
113 
114  const VecInd& index() const;
115 
116  unsigned int samplesSize() const;
117 
118  unsigned int samplesSizeAll() const;
119 
120  const TimeSamples* operator[](unsigned int i) const;
121 
122  TimeSamples* operator[](unsigned int i);
123 
124  TimeSamples* vSam(unsigned int i);
125 
126  TimeSamples* vSamAll(unsigned int i);
127 
128  const TimeSamples* vSamAll(unsigned int i) const;
129 
131  //time difference between bunches
132 
133  static const int BUNCHSPACE = 25;
134 
135  static const float MIN_ENERGY_THRESHOLD; //50 KeV threshold to consider a valid hit in the timing detector
136 
137  static const int m_minBunch = -4;
138  static const int m_maxBunch = 5;
139 
141 
143 
145 
146  double timeOfFlight(const DetId& detId, int layer) const;
147 
148  const ComponentShapeCollection* shapes() const;
149 
150  std::vector<TimeSamples> m_vSam;
151 
153 };
154 
155 #endif
EcalTimeMapDigitizer(EcalSubdetector myDet, ComponentShapeCollection *componentShapes)
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)
const ComponentShapeCollection * shapes() const
double timeOfFlight(const DetId &detId, int layer) const
ComponentShapeCollection * m_ComponentShapes
void setTimeLayerId(const int &layerId)
static const int BUNCHSPACE
static constexpr double waveform_granularity
const TimeSamples * operator[](unsigned int i) const
static const unsigned int WAVEFORMSAMPLES
Definition: EcalTimeDigi.h:37
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
void setEventSetup(const edm::EventSetup &eventSetup)
TimeSamples * findSignal(const DetId &detId)
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
float average_time[time_average_capacity]
float tot_energy[time_average_capacity]
EcalSubdetector
static const float MIN_ENERGY_THRESHOLD
TimeSamples * vSam(unsigned int i)
static const unsigned short waveform_capacity