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
EcalTimeMapDigitizer
Definition: EcalTimeMapDigitizer.h:19
EcalTimeMapDigitizer::MIN_ENERGY_THRESHOLD
static const float MIN_ENERGY_THRESHOLD
Definition: EcalTimeMapDigitizer.h:123
mps_fire.i
i
Definition: mps_fire.py:428
EcalTimeMapDigitizer::m_maxBunch
static const int m_maxBunch
Definition: EcalTimeMapDigitizer.h:126
EcalTimeMapDigitizer::run
void run(EcalTimeDigiCollection &output)
Definition: EcalTimeMapDigitizer.cc:168
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
CaloTSamplesBase.h
geometry
Definition: geometry.py:1
edm::SortedCollection
Definition: SortedCollection.h:49
EcalTimeMapDigitizer::m_vSam
std::vector< TimeSamples > m_vSam
Definition: EcalTimeMapDigitizer.h:134
EcalSubdetector
EcalSubdetector
Definition: EcalSubdetector.h:10
EcalTimeMapDigitizer::setGeometry
void setGeometry(const CaloSubdetectorGeometry *geometry)
Definition: EcalTimeMapDigitizer.cc:124
EcalTimeMapDigitizer::setTimeLayerId
void setTimeLayerId(const int &layerId)
Definition: EcalTimeMapDigitizer.h:83
EcalTimeMapDigitizer::vSamAll
TimeSamples * vSamAll(unsigned int i)
Definition: EcalTimeMapDigitizer.cc:245
DetId
Definition: DetId.h:17
EcalTimeMapDigitizer::time_average::tot_energy
float tot_energy[time_average_capacity]
Definition: EcalTimeMapDigitizer.h:27
EcalTimeMapDigitizer::time_average
Definition: EcalTimeMapDigitizer.h:21
MixCollection.h
EcalTimeMapDigitizer::finalizeHits
void finalizeHits()
Definition: EcalTimeMapDigitizer.cc:141
EcalTimeDigi
Definition: EcalTimeDigi.h:8
EcalTimeMapDigitizer::add
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
Definition: EcalTimeMapDigitizer.cc:76
EcalDigiCollections.h
EcalTimeMapDigitizer::time_average::calculateAverage
void calculateAverage()
Definition: EcalTimeMapDigitizer.h:37
EcalTimeMapDigitizer::BUNCHSPACE
static const int BUNCHSPACE
Definition: EcalTimeMapDigitizer.h:121
EcalTimeMapDigitizer::samplesSizeAll
unsigned int samplesSizeAll() const
Definition: EcalTimeMapDigitizer.cc:237
EcalTimeMapDigitizer::time_average::average_time
float average_time[time_average_capacity]
Definition: EcalTimeMapDigitizer.h:25
EcalTimeMapDigitizer::time_average::id
DetId id
Definition: EcalTimeMapDigitizer.h:24
EcalTimeMapDigitizer::operator[]
const TimeSamples * operator[](unsigned int i) const
Definition: EcalTimeMapDigitizer.cc:239
EcalTimeMapDigitizer::initializeMap
void initializeMap()
Definition: EcalTimeMapDigitizer.cc:161
EcalTimeMapDigitizer::minBunch
int minBunch() const
Definition: EcalTimeMapDigitizer.cc:249
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CaloTSamples.h
EcalSubdetector.h
EcalTimeMapDigitizer::time_average::time_average
time_average(const DetId &myId)
Definition: EcalTimeMapDigitizer.h:29
EcalTimeMapDigitizer::subdetector
EcalSubdetector subdetector()
Definition: EcalTimeMapDigitizer.h:87
EcalTimeMapDigitizer::m_timeLayerId
int m_timeLayerId
Definition: EcalTimeMapDigitizer.h:128
EcalTimeMapDigitizer::EcalTimeMapDigitizer
EcalTimeMapDigitizer(EcalSubdetector myDet)
Definition: EcalTimeMapDigitizer.cc:28
EcalTimeMapDigitizer::m_index
VecInd m_index
Definition: EcalTimeMapDigitizer.h:136
EcalTimeMapDigitizer::samplesSize
unsigned int samplesSize() const
Definition: EcalTimeMapDigitizer.cc:235
EcalTimeMapDigitizer::timeOfFlight
double timeOfFlight(const DetId &detId, int layer) const
Definition: EcalTimeMapDigitizer.cc:226
EcalTimeMapDigitizer::getTimeLayerId
int getTimeLayerId()
Definition: EcalTimeMapDigitizer.h:85
PCaloHit.h
EcalTimeMapDigitizer::blankOutUsedSamples
void blankOutUsedSamples()
Definition: EcalTimeMapDigitizer.cc:126
EcalTimeMapDigitizer::time_average::nhits
unsigned int nhits[time_average_capacity]
Definition: EcalTimeMapDigitizer.h:26
EcalTimeMapDigitizer::~EcalTimeMapDigitizer
virtual ~EcalTimeMapDigitizer()
Definition: EcalTimeMapDigitizer.cc:74
EcalTimeMapDigitizer::VecInd
std::vector< unsigned int > VecInd
Definition: EcalTimeMapDigitizer.h:67
EcalTimeMapDigitizer::vSam
TimeSamples * vSam(unsigned int i)
Definition: EcalTimeMapDigitizer.cc:243
EcalTimeMapDigitizer::index
VecInd & index()
Definition: EcalTimeMapDigitizer.cc:253
DetId.h
EcalTimeMapDigitizer::time_average::setZero
void setZero()
Definition: EcalTimeMapDigitizer.h:46
EcalTimeMapDigitizer::m_minBunch
static const int m_minBunch
Definition: EcalTimeMapDigitizer.h:125
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
EcalTimeMapDigitizer::findSignal
TimeSamples * findSignal(const DetId &detId)
Definition: EcalTimeMapDigitizer.cc:116
EcalTimeMapDigitizer::time_average::time_average_capacity
static const unsigned short time_average_capacity
Definition: EcalTimeMapDigitizer.h:22
EcalTimeMapDigitizer::TimeSamples
time_average TimeSamples
Definition: EcalTimeMapDigitizer.h:63
EcalTimeMapDigitizer::m_geometry
const CaloSubdetectorGeometry * m_geometry
Definition: EcalTimeMapDigitizer.h:130
EcalTimeMapDigitizer::Digi
EcalTimeDigi Digi
Definition: EcalTimeMapDigitizer.h:65
EcalTimeMapDigitizer::maxBunch
int maxBunch() const
Definition: EcalTimeMapDigitizer.cc:251
EcalTimeMapDigitizer::time_average::zero
bool zero()
Definition: EcalTimeMapDigitizer.h:54
EcalTimeMapDigitizer::m_subDet
EcalSubdetector m_subDet
Definition: EcalTimeMapDigitizer.h:118