test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalTimeMapDigitizer.h
Go to the documentation of this file.
1 #ifndef EcalSimAlgos_EcalTimeMapDigitizer_h
2 #define EcalSimAlgos_EcalTimeMapDigitizer_h
3 
16 
18 
20 {
21  public:
22 
23  struct time_average{
24 
25  static const unsigned short time_average_capacity=10;
26 
31 
32  time_average(const DetId& myId):
33  id(myId)
34  {
35  for (unsigned int i(0);i<time_average_capacity;++i)
36  {
37  average_time[i]=0;
38  nhits[i]=0;
39  tot_energy[i]=0;
40  }
41 
42  };
43 
44  void
46  {
47  for (unsigned int i(0);i<time_average_capacity;++i)
48  {
49  if (nhits[i]>0)
51  else
52  average_time[i]=0;
53  }
54  };
55 
56  void
58  {
59  for (unsigned int i(0);i<time_average_capacity;++i)
60  {
61  average_time[i]=0;
62  nhits[i]=0;
63  tot_energy[i]=0;
64  }
65  };
66 
67  bool
68  zero()
69  {
70  for (unsigned int i(0);i<time_average_capacity;++i)
71  {
72  if(nhits[i]>0)
73  return false;
74  }
75  return true;
76  };
77 
78  };
79 
81 
82  typedef EcalTimeDigi Digi;
83 
84  typedef std::vector< unsigned int > VecInd ;
85 
86  explicit EcalTimeMapDigitizer(EcalSubdetector myDet);
87 
88  virtual ~EcalTimeMapDigitizer();
89 
90  void add(const std::vector<PCaloHit> & hits, int bunchCrossing);
91 
93 
94  void initializeMap();
95 
97 
98  void finalizeHits();
99 
100  inline void setTimeLayerId( const int& layerId ) { m_timeLayerId = layerId; };
101 
102  int getTimeLayerId() { return m_timeLayerId; };
103 
105 
106  int minBunch() const ;
107 
108  int maxBunch() const ;
109 
110  void blankOutUsedSamples() ; // blank out previously used elements
111 
112 
113 /* const CaloVHitFilter* hitFilter() const ; */
114 
115  private:
116 
117  TimeSamples* findSignal( const DetId& detId );
118 
119  VecInd& index() ;
120 
121  const VecInd& index() const ;
122 
123  unsigned int samplesSize() const;
124 
125  unsigned int samplesSizeAll() const;
126 
127  const TimeSamples* operator[]( unsigned int i ) const;
128 
129  TimeSamples* operator[]( unsigned int i );
130 
131  TimeSamples* vSam( unsigned int i );
132 
133  TimeSamples* vSamAll( unsigned int i );
134 
135  const TimeSamples* vSamAll( unsigned int i ) const;
136 
138  //time difference between bunches
139 
140  static const int BUNCHSPACE=25;
141 
142  static const float MIN_ENERGY_THRESHOLD; //50 KeV threshold to consider a valid hit in the timing detector
143 
144  static const int m_minBunch=-4;
145  static const int m_maxBunch=5;
146 
148 
150 
151  double timeOfFlight( const DetId& detId , int layer) const;
152 
153  std::vector<TimeSamples> m_vSam;
154 
156 
157 };
158 
159 #endif
int i
Definition: DBlmapReader.cc:9
unsigned int samplesSizeAll() const
void run(EcalTimeDigiCollection &output)
static const int m_maxBunch
const CaloSubdetectorGeometry * m_geometry
const TimeSamples * operator[](unsigned int i) const
unsigned int nhits[time_average_capacity]
std::vector< TimeSamples > m_vSam
void setGeometry(const CaloSubdetectorGeometry *geometry)
void setTimeLayerId(const int &layerId)
unsigned int samplesSize() const
static const int BUNCHSPACE
TimeSamples * vSamAll(unsigned int i)
EcalSubdetector subdetector()
static const unsigned short time_average_capacity
Definition: DetId.h:18
static const int m_minBunch
TimeSamples * findSignal(const DetId &detId)
double timeOfFlight(const DetId &detId, int layer) const
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
ESHandle< TrackerGeometry > geometry
EcalTimeMapDigitizer(EcalSubdetector myDet)
float average_time[time_average_capacity]
float tot_energy[time_average_capacity]
std::vector< unsigned int > VecInd
EcalSubdetector
static const float MIN_ENERGY_THRESHOLD
TimeSamples * vSam(unsigned int i)