CMS 3D CMS Logo

HcalNoiseRBX.cc
Go to the documentation of this file.
1 //
2 // HcalNoiseRBX.cc
3 //
4 // description: container class of RBX information for studying the HCAL Noise
5 //
6 // author: J.P. Chou, Brown
7 //
8 //
9 
11 
12 using namespace reco;
13 
14 // default constructor
15 HcalNoiseRBX::HcalNoiseRBX() : idnumber_(0), hpds_(4), allCharge_(HBHEDataFrame::MAXSAMPLES, 0.0) {}
16 
17 // destructor
19 
20 // accessors
21 int HcalNoiseRBX::idnumber(void) const { return idnumber_; }
22 
23 const std::vector<HcalNoiseHPD> HcalNoiseRBX::HPDs(void) const { return hpds_; }
24 
25 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBX::maxHPD(double threshold) const {
26  std::vector<HcalNoiseHPD>::const_iterator maxit = hpds_.end();
27  double maxenergy = -99999999.;
28  for (std::vector<HcalNoiseHPD>::const_iterator it = hpds_.begin(); it != hpds_.end(); ++it) {
29  double tempenergy = it->recHitEnergy();
30  if (tempenergy > maxenergy) {
31  maxenergy = tempenergy;
32  maxit = it;
33  }
34  }
35  return maxit;
36 }
37 
38 const std::vector<float> HcalNoiseRBX::allCharge(void) const { return allCharge_; }
39 
40 float HcalNoiseRBX::allChargeTotal(void) const {
41  float total = 0;
42  for (unsigned int i = 0; i < allCharge_.size(); i++)
43  total += allCharge_[i];
44  return total;
45 }
46 
47 float HcalNoiseRBX::allChargeHighest2TS(unsigned int firstts) const {
48  float total = 0;
49  for (unsigned int i = firstts; i < firstts + 2 && !allCharge_.empty(); i++)
50  total += allCharge_[i];
51  return total;
52 }
53 
54 float HcalNoiseRBX::allChargeHighest3TS(unsigned int firstts) const {
55  float total = 0;
56  for (unsigned int i = firstts; i < firstts + 3 && !allCharge_.empty(); i++)
57  total += allCharge_[i];
58  return total;
59 }
60 
61 int HcalNoiseRBX::totalZeros(void) const {
62  int tot = 0;
63  for (unsigned int i = 0; i < hpds_.size(); i++)
64  tot += hpds_[i].totalZeros();
65  return tot;
66 }
67 
68 int HcalNoiseRBX::maxZeros(void) const {
69  int max = 0;
70  for (unsigned int i = 0; i < hpds_.size(); i++)
71  if (hpds_[i].maxZeros() > max)
72  max = hpds_[i].maxZeros();
73  return max;
74 }
75 
76 double HcalNoiseRBX::recHitEnergy(double threshold) const {
77  double total = 0;
78  for (unsigned int i = 0; i < hpds_.size(); i++)
79  total += hpds_[i].recHitEnergy(threshold);
80  return total;
81 }
82 
84  double total = 0;
85  for (unsigned int i = 0; i < hpds_.size(); i++)
86  total += hpds_[i].recHitEnergyFailR45(threshold);
87  return total;
88 }
89 
90 double HcalNoiseRBX::minRecHitTime(double threshold) const {
91  double mintime = 9999999.;
92  for (unsigned int i = 0; i < hpds_.size(); i++) {
93  double temptime = hpds_[i].minRecHitTime(threshold);
94  if (temptime < mintime)
95  mintime = temptime;
96  }
97  return mintime;
98 }
99 
101  double maxtime = -9999999.;
102  for (unsigned int i = 0; i < hpds_.size(); i++) {
103  double temptime = hpds_[i].maxRecHitTime(threshold);
104  if (temptime > maxtime)
105  maxtime = temptime;
106  }
107  return maxtime;
108 }
109 
111  int total = 0;
112  for (unsigned int i = 0; i < hpds_.size(); i++)
113  total += hpds_[i].numRecHits(threshold);
114  return total;
115 }
116 
118  int total = 0;
119  for (unsigned int i = 0; i < hpds_.size(); i++)
120  total += hpds_[i].numRecHitsFailR45(threshold);
121  return total;
122 }
123 
124 double HcalNoiseRBX::caloTowerHadE(void) const {
125  double h = 0;
126  towerset_t twrs;
127  uniqueTowers(twrs);
128  for (towerset_t::const_iterator it = twrs.begin(); it != twrs.end(); ++it) {
129  h += it->hadEnergy();
130  }
131  return h;
132 }
133 
134 double HcalNoiseRBX::caloTowerEmE(void) const {
135  double e = 0;
136  towerset_t twrs;
137  uniqueTowers(twrs);
138  for (towerset_t::const_iterator it = twrs.begin(); it != twrs.end(); ++it) {
139  e += it->emEnergy();
140  }
141  return e;
142 }
143 
144 double HcalNoiseRBX::caloTowerTotalE(void) const {
145  double e = 0;
146  towerset_t twrs;
147  uniqueTowers(twrs);
148  for (towerset_t::const_iterator it = twrs.begin(); it != twrs.end(); ++it) {
149  e += it->hadEnergy() + it->emEnergy();
150  }
151  return e;
152 }
153 
155  double e = 0, h = 0;
156  towerset_t twrs;
157  uniqueTowers(twrs);
158  for (towerset_t::const_iterator it = twrs.begin(); it != twrs.end(); ++it) {
159  h += it->hadEnergy();
160  e += it->emEnergy();
161  }
162  return (e + h) == 0 ? 999 : e / (e + h);
163 }
164 
166  twrs_.clear();
167  for (std::vector<HcalNoiseHPD>::const_iterator it1 = hpds_.begin(); it1 != hpds_.end(); ++it1) {
168  edm::RefVector<CaloTowerCollection> twrsref = it1->caloTowers();
169  for (edm::RefVector<CaloTowerCollection>::const_iterator it2 = twrsref.begin(); it2 != twrsref.end(); ++it2) {
170  CaloTower twr = **it2;
171  twrs_.insert(twr);
172  }
173  }
174  return;
175 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
int numRecHitsFailR45(double threshold=1.5) const
float allChargeHighest3TS(unsigned int firstts=4) const
Definition: HcalNoiseRBX.cc:54
float allChargeHighest2TS(unsigned int firstts=4) const
Definition: HcalNoiseRBX.cc:47
int maxZeros(void) const
Definition: HcalNoiseRBX.cc:68
int numRecHits(double threshold=1.5) const
std::vector< HcalNoiseHPD >::const_iterator maxHPD(double threshold=1.5) const
Definition: HcalNoiseRBX.cc:25
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
double caloTowerEmE(void) const
double caloTowerTotalE(void) const
double recHitEnergy(double theshold=1.5) const
Definition: HcalNoiseRBX.cc:76
float allChargeTotal(void) const
Definition: HcalNoiseRBX.cc:40
std::vector< HcalNoiseHPD > hpds_
Definition: HcalNoiseRBX.h:105
double caloTowerHadE(void) const
std::set< CaloTower, twrcomp > towerset_t
Definition: HcalNoiseRBX.h:98
double caloTowerEmFraction(void) const
std::vector< float > allCharge_
Definition: HcalNoiseRBX.h:108
double minRecHitTime(double threshold=20.0) const
Definition: HcalNoiseRBX.cc:90
void uniqueTowers(towerset_t &twrs_) const
int totalZeros(void) const
Definition: HcalNoiseRBX.cc:61
double recHitEnergyFailR45(double threshold=1.5) const
Definition: HcalNoiseRBX.cc:83
const std::vector< HcalNoiseHPD > HPDs(void) const
Definition: HcalNoiseRBX.cc:23
fixed size matrix
int idnumber(void) const
Definition: HcalNoiseRBX.cc:21
double maxRecHitTime(double threshold=20.0) const
const std::vector< float > allCharge(void) const
Definition: HcalNoiseRBX.cc:38