CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 using namespace reco;
13 
14 // default constructor
16  : idnumber_(0),
17  totalZeros_(0),
18  maxZeros_(0),
19  bigCharge_(HBHEDataFrame::MAXSAMPLES, 0.0),
20  big5Charge_(HBHEDataFrame::MAXSAMPLES, 0.0) {
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 // accessors
30 int HcalNoiseHPD::idnumber(void) const { return idnumber_; }
31 
32 const std::vector<float> HcalNoiseHPD::bigCharge(void) const { return bigCharge_; }
33 
34 float HcalNoiseHPD::bigChargeTotal(void) const {
35  float total = 0;
36  for (unsigned int i = 0; i < bigCharge_.size(); i++) {
37  total += bigCharge_[i];
38  }
39  return total;
40 }
41 
42 float HcalNoiseHPD::bigChargeHighest2TS(unsigned int firstts) const {
43  float total = 0;
44  for (unsigned int i = firstts; i < firstts + 2 && i < bigCharge_.size(); i++)
45  total += bigCharge_[i];
46  return total;
47 }
48 
49 float HcalNoiseHPD::bigChargeHighest3TS(unsigned int firstts) const {
50  float total = 0;
51  for (unsigned int i = firstts; i < firstts + 3 && i < bigCharge_.size(); i++)
52  total += bigCharge_[i];
53  return total;
54 }
55 
56 const std::vector<float> HcalNoiseHPD::big5Charge(void) const { return big5Charge_; }
57 
58 float HcalNoiseHPD::big5ChargeTotal(void) const {
59  float total = 0;
60  for (unsigned int i = 0; i < big5Charge_.size(); i++) {
61  total += big5Charge_[i];
62  }
63  return total;
64 }
65 
66 float HcalNoiseHPD::big5ChargeHighest2TS(unsigned int firstts) const {
67  float total = 0;
68  for (unsigned int i = firstts; i < firstts + 2 && i < big5Charge_.size(); i++)
69  total += big5Charge_[i];
70  return total;
71 }
72 
73 float HcalNoiseHPD::big5ChargeHighest3TS(unsigned int firstts) const {
74  float total = 0;
75  for (unsigned int i = firstts; i < firstts + 2 && i < big5Charge_.size(); i++)
76  total += big5Charge_[i];
77  return total;
78 }
79 
80 int HcalNoiseHPD::totalZeros(void) const { return totalZeros_; }
81 
82 int HcalNoiseHPD::maxZeros(void) const { return maxZeros_; }
83 
85 
86 float HcalNoiseHPD::recHitEnergy(const float threshold) const {
87  double total = 0.0;
88  for (edm::RefVector<HBHERecHitCollection>::const_iterator it = rechits_.begin(); it != rechits_.end(); ++it) {
89  const float energy = (*it)->eraw();
90  if (energy >= threshold)
91  total += energy;
92  }
93  return total;
94 }
95 
96 float HcalNoiseHPD::recHitEnergyFailR45(const float threshold) const {
97  double total = 0.0;
98  for (edm::RefVector<HBHERecHitCollection>::const_iterator it = rechits_.begin(); it != rechits_.end(); ++it) {
99  const float energy = (*it)->eraw();
100  if ((*it)->flagField(HcalCaloFlagLabels::HBHETS4TS5Noise) && !(*it)->flagField(HcalCaloFlagLabels::HBHEOOTPU))
101  if (energy >= threshold)
102  total += energy;
103  }
104  return total;
105 }
106 
107 float HcalNoiseHPD::minRecHitTime(const float threshold) const {
108  float mintime = 9999999;
109  for (edm::RefVector<HBHERecHitCollection>::const_iterator it = rechits_.begin(); it != rechits_.end(); ++it) {
110  if ((*it)->energy() < threshold)
111  continue;
112  float time = (*it)->time();
113  if (mintime > time)
114  mintime = time;
115  }
116  return mintime;
117 }
118 
119 float HcalNoiseHPD::maxRecHitTime(const float threshold) const {
120  float maxtime = -9999999;
121  for (edm::RefVector<HBHERecHitCollection>::const_iterator it = rechits_.begin(); it != rechits_.end(); ++it) {
122  if ((*it)->energy() < threshold)
123  continue;
124  float time = (*it)->time();
125  if (maxtime < time)
126  maxtime = time;
127  }
128  return maxtime;
129 }
130 
131 int HcalNoiseHPD::numRecHits(const float threshold) const {
132  int count = 0;
133  for (edm::RefVector<HBHERecHitCollection>::const_iterator it = rechits_.begin(); it != rechits_.end(); ++it) {
134  // Exclude uncollapsed QIE11 channels
137  continue;
138  if ((*it)->eraw() >= threshold)
139  ++count;
140  }
141  return count;
142 }
143 
145  int count = 0;
146  for (edm::RefVector<HBHERecHitCollection>::const_iterator it = rechits_.begin(); it != rechits_.end(); ++it)
147  if ((*it)->flagField(HcalCaloFlagLabels::HBHETS4TS5Noise) && !(*it)->flagField(HcalCaloFlagLabels::HBHEOOTPU))
148  if ((*it)->eraw() >= threshold)
149  ++count;
150  return count;
151 }
152 
154 
155 double HcalNoiseHPD::caloTowerHadE(void) const {
156  double total = 0;
158  total += (*it)->hadEnergy();
159  return total;
160 }
161 
162 double HcalNoiseHPD::caloTowerEmE(void) const {
163  double total = 0;
165  total += (*it)->emEnergy();
166  return total;
167 }
168 
169 double HcalNoiseHPD::caloTowerTotalE(void) const {
170  double total = 0;
172  total += (*it)->emEnergy() + (*it)->hadEnergy();
173  return total;
174 }
175 
177  double h = 0, e = 0;
178  for (edm::RefVector<CaloTowerCollection>::const_iterator it = calotowers_.begin(); it != calotowers_.end(); ++it) {
179  e += (*it)->emEnergy();
180  h += (*it)->hadEnergy();
181  }
182  return (e + h) != 0 ? e / (e + h) : 999.;
183 }
float maxRecHitTime(float threshold=10.0) const
float big5ChargeHighest3TS(unsigned int firstts=4) const
Definition: HcalNoiseHPD.cc:73
float recHitEnergyFailR45(float threshold=1.5) const
Definition: HcalNoiseHPD.cc:96
int idnumber(void) const
Definition: HcalNoiseHPD.cc:30
std::vector< float > bigCharge_
Definition: HcalNoiseHPD.h:137
std::vector< float > big5Charge_
Definition: HcalNoiseHPD.h:138
int maxZeros(void) const
Definition: HcalNoiseHPD.cc:82
const edm::RefVector< HBHERecHitCollection > recHits(void) const
Definition: HcalNoiseHPD.cc:84
edm::RefVector< HBHERecHitCollection > rechits_
Definition: HcalNoiseHPD.h:141
static const unsigned OFF_TDC_TIME
float big5ChargeHighest2TS(unsigned int firstts=4) const
Definition: HcalNoiseHPD.cc:66
virtual ~HcalNoiseHPD()
Definition: HcalNoiseHPD.cc:27
int numRecHits(float threshold=1.5) const
float bigChargeHighest2TS(unsigned int firstts=4) const
Definition: HcalNoiseHPD.cc:42
float bigChargeHighest3TS(unsigned int firstts=4) const
Definition: HcalNoiseHPD.cc:49
float big5ChargeTotal(void) const
Definition: HcalNoiseHPD.cc:58
float minRecHitTime(float threshold=10.0) const
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:148
const edm::RefVector< CaloTowerCollection > caloTowers(void) const
double caloTowerEmFraction(void) const
static const unsigned OFF_COMBINED
int numRecHitsFailR45(float threshold=1.5) const
float recHitEnergy(float threshold=1.5) const
Definition: HcalNoiseHPD.cc:86
double caloTowerTotalE(void) const
const std::vector< float > big5Charge(void) const
Definition: HcalNoiseHPD.cc:56
int totalZeros(void) const
Definition: HcalNoiseHPD.cc:80
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
float bigChargeTotal(void) const
Definition: HcalNoiseHPD.cc:34
const std::vector< float > bigCharge(void) const
Definition: HcalNoiseHPD.cc:32