CMS 3D CMS Logo

HcalNoiseHPD.cc
Go to the documentation of this file.
1 //
2 // HcalNoiseHPD.cc
3 //
4 // description: container class of HPD information for analyzing HCAL Noise
5 //
6 // author: J.P. Chou, Brown
7 //
8 //
9 
11 
12 
13 using namespace reco;
14 
15 // default constructor
17  : idnumber_(0), totalZeros_(0), maxZeros_(0),
18  bigCharge_(HBHEDataFrame::MAXSAMPLES, 0.0),
19  big5Charge_(HBHEDataFrame::MAXSAMPLES, 0.0)
20 {
21  // reserve some space, so that there's no reallocation issues
22  rechits_.reserve(19);
23  calotowers_.reserve(19);
24 }
25 
26 // destructor
28 {
29 }
30 
31 // accessors
32 int HcalNoiseHPD::idnumber(void) const
33 {
34  return idnumber_;
35 }
36 
37 const std::vector<float> HcalNoiseHPD::bigCharge(void) const
38 {
39  return bigCharge_;
40 }
41 
43 {
44  float total=0;
45  for(unsigned int i=0; i<bigCharge_.size(); i++) {
46  total += bigCharge_[i];
47  }
48  return total;
49 }
50 
51 float HcalNoiseHPD::bigChargeHighest2TS(unsigned int firstts) const
52 {
53  float total=0;
54  for(unsigned int i=firstts; i<firstts+2 && i<bigCharge_.size(); i++)
55  total += bigCharge_[i];
56  return total;
57 }
58 
59 
60 float HcalNoiseHPD::bigChargeHighest3TS(unsigned int firstts) const
61 {
62  float total=0;
63  for(unsigned int i=firstts; i<firstts+3 && i<bigCharge_.size(); i++)
64  total += bigCharge_[i];
65  return total;
66 }
67 
68 const std::vector<float> HcalNoiseHPD::big5Charge(void) const
69 {
70  return big5Charge_;
71 }
72 
74 {
75  float total=0;
76  for(unsigned int i=0; i<big5Charge_.size(); i++) {
77  total += big5Charge_[i];
78  }
79  return total;
80 }
81 
82 float HcalNoiseHPD::big5ChargeHighest2TS(unsigned int firstts) const
83 {
84  float total=0;
85  for(unsigned int i=firstts; i<firstts+2 && i<big5Charge_.size(); i++)
86  total += big5Charge_[i];
87  return total;
88 }
89 
90 float HcalNoiseHPD::big5ChargeHighest3TS(unsigned int firstts) const
91 {
92  float total=0;
93  for(unsigned int i=firstts; i<firstts+2 && i<big5Charge_.size(); i++)
94  total += big5Charge_[i];
95  return total;
96 }
97 
98 int HcalNoiseHPD::totalZeros(void) const
99 {
100  return totalZeros_;
101 }
102 
103 int HcalNoiseHPD::maxZeros(void) const
104 {
105  return maxZeros_;
106 }
107 
109 {
110  return rechits_;
111 }
112 
113 float HcalNoiseHPD::recHitEnergy(const float threshold) const
114 {
115  double total=0.0;
117  const float energy=(*it)->eraw();
118  if(energy>=threshold) total+=energy;
119  }
120  return total;
121 }
122 
124 {
125  double total=0.0;
127  const float energy=(*it)->eraw();
128  if( (*it)->flagField(HcalCaloFlagLabels::HBHETS4TS5Noise) &&
129  !(*it)->flagField(HcalCaloFlagLabels::HBHEOOTPU) )
130  if(energy>=threshold) total+=energy;
131  }
132  return total;
133 }
134 
135 float HcalNoiseHPD::minRecHitTime(const float threshold) const
136 {
137  float mintime=9999999;
139  if((*it)->energy()<threshold) continue;
140  float time=(*it)->time();
141  if(mintime>time) mintime=time;
142  }
143  return mintime;
144 }
145 
146 float HcalNoiseHPD::maxRecHitTime(const float threshold) const
147 {
148  float maxtime=-9999999;
150  if((*it)->energy()<threshold) continue;
151  float time=(*it)->time();
152  if(maxtime<time) maxtime=time;
153  }
154  return maxtime;
155 }
156 
157 int HcalNoiseHPD::numRecHits(const float threshold) const
158 {
159  int count=0;
161  // Exclude uncollapsed QIE11 channels
163  !CaloRecHitAuxSetter::getBit((*it)->auxPhase1(), HBHERecHitAuxSetter::OFF_COMBINED) ) continue;
164  if((*it)->eraw()>=threshold) ++count;
165  }
166  return count;
167 }
168 
170 {
171  int count=0;
173  if( (*it)->flagField(HcalCaloFlagLabels::HBHETS4TS5Noise) &&
174  !(*it)->flagField(HcalCaloFlagLabels::HBHEOOTPU) )
175  if((*it)->eraw()>=threshold) ++count;
176  return count;
177 }
178 
180 {
181  return calotowers_;
182 }
183 
184 double HcalNoiseHPD::caloTowerHadE(void) const
185 {
186  double total=0;
188  total += (*it)->hadEnergy();
189  return total;
190 }
191 
192 double HcalNoiseHPD::caloTowerEmE(void) const
193 {
194  double total=0;
196  total += (*it)->emEnergy();
197  return total;
198 }
199 
201 {
202  double total=0;
204  total += (*it)->emEnergy()+(*it)->hadEnergy();
205  return total;
206 }
207 
209 {
210  double h=0, e=0;
212  e += (*it)->emEnergy();
213  h += (*it)->hadEnergy();
214  }
215  return (e+h)!=0 ? e/(e+h) : 999.;
216 }
float maxRecHitTime(float threshold=10.0) const
float big5ChargeHighest3TS(unsigned int firstts=4) const
Definition: HcalNoiseHPD.cc:90
float recHitEnergyFailR45(float threshold=1.5) const
int idnumber(void) const
Definition: HcalNoiseHPD.cc:32
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< float > bigCharge_
Definition: HcalNoiseHPD.h:139
std::vector< float > big5Charge_
Definition: HcalNoiseHPD.h:140
int maxZeros(void) const
const edm::RefVector< HBHERecHitCollection > recHits(void) const
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:253
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:248
edm::RefVector< HBHERecHitCollection > rechits_
Definition: HcalNoiseHPD.h:143
static const unsigned OFF_TDC_TIME
float big5ChargeHighest2TS(unsigned int firstts=4) const
Definition: HcalNoiseHPD.cc:82
virtual ~HcalNoiseHPD()
Definition: HcalNoiseHPD.cc:27
int numRecHits(float threshold=1.5) const
float bigChargeHighest2TS(unsigned int firstts=4) const
Definition: HcalNoiseHPD.cc:51
float bigChargeHighest3TS(unsigned int firstts=4) const
Definition: HcalNoiseHPD.cc:60
float big5ChargeTotal(void) const
Definition: HcalNoiseHPD.cc:73
float minRecHitTime(float threshold=10.0) const
void reserve(size_type n)
Reserve space for RefVector.
Definition: RefVector.h:113
double caloTowerEmE(void) const
constexpr bool getBit(const uint32_t u, const unsigned bitnum)
double caloTowerHadE(void) const
edm::RefVector< CaloTowerCollection > calotowers_
Definition: HcalNoiseHPD.h:150
const edm::RefVector< CaloTowerCollection > caloTowers(void) const
double caloTowerEmFraction(void) const
fixed size matrix
static const unsigned OFF_COMBINED
int numRecHitsFailR45(float threshold=1.5) const
float recHitEnergy(float threshold=1.5) const
double caloTowerTotalE(void) const
const std::vector< float > big5Charge(void) const
Definition: HcalNoiseHPD.cc:68
int totalZeros(void) const
Definition: HcalNoiseHPD.cc:98
float bigChargeTotal(void) const
Definition: HcalNoiseHPD.cc:42
const std::vector< float > bigCharge(void) const
Definition: HcalNoiseHPD.cc:37