CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
13 using namespace reco;
14 
15 // default constructor
17  idnumber_(0), hpds_(4),
18  allCharge_(HBHEDataFrame::MAXSAMPLES, 0.0)
19 {
20 }
21 
22 // destructor
24 {
25 }
26 
27 // accessors
28 int HcalNoiseRBX::idnumber(void) const
29 {
30  return idnumber_;
31 }
32 
33 const std::vector<HcalNoiseHPD> HcalNoiseRBX::HPDs(void) const
34 {
35  return hpds_;
36 }
37 
38 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBX::maxHPD(double threshold) const
39 {
40  std::vector<HcalNoiseHPD>::const_iterator maxit=hpds_.end();
41  double maxenergy=-99999999.;
42  for(std::vector<HcalNoiseHPD>::const_iterator it=hpds_.begin(); it!=hpds_.end(); ++it) {
43  double tempenergy=it->recHitEnergy();
44  if(tempenergy>maxenergy) {
45  maxenergy=tempenergy;
46  maxit=it;
47  }
48  }
49  return maxit;
50 }
51 
52 const std::vector<float> HcalNoiseRBX::allCharge(void) const
53 {
54  return allCharge_;
55 }
56 
58 {
59  float total=0;
60  for(unsigned int i=0; i<allCharge_.size(); i++)
61  total += allCharge_[i];
62  return total;
63 }
64 
65 float HcalNoiseRBX::allChargeHighest2TS(unsigned int firstts) const
66 {
67  float total=0;
68  for(unsigned int i=firstts; i<firstts+2 && allCharge_.size(); i++)
69  total += allCharge_[i];
70  return total;
71 }
72 
73 float HcalNoiseRBX::allChargeHighest3TS(unsigned int firstts) const
74 {
75  float total=0;
76  for(unsigned int i=firstts; i<firstts+3 && allCharge_.size(); i++)
77  total += allCharge_[i];
78  return total;
79 }
80 
81 
82 int HcalNoiseRBX::totalZeros(void) const
83 {
84  int tot=0;
85  for(unsigned int i=0; i<hpds_.size(); i++)
86  tot += hpds_[i].totalZeros();
87  return tot;
88 }
89 
90 int HcalNoiseRBX::maxZeros(void) const
91 {
92  int max=0;
93  for(unsigned int i=0; i<hpds_.size(); i++)
94  if(hpds_[i].maxZeros()>max)
95  max=hpds_[i].maxZeros();
96  return max;
97 }
98 
100 {
101  double total=0;
102  for(unsigned int i=0; i<hpds_.size(); i++)
103  total += hpds_[i].recHitEnergy(threshold);
104  return total;
105 }
106 
108 {
109  double total=0;
110  for(unsigned int i=0; i<hpds_.size(); i++)
111  total += hpds_[i].recHitEnergyFailR45(threshold);
112  return total;
113 }
114 
116 {
117  double mintime=9999999.;
118  for(unsigned int i=0; i<hpds_.size(); i++) {
119  double temptime=hpds_[i].minRecHitTime(threshold);
120  if(temptime<mintime) mintime=temptime;
121  }
122  return mintime;
123 }
124 
126 {
127  double maxtime=-9999999.;
128  for(unsigned int i=0; i<hpds_.size(); i++) {
129  double temptime=hpds_[i].maxRecHitTime(threshold);
130  if(temptime>maxtime) maxtime=temptime;
131  }
132  return maxtime;
133 }
134 
136 {
137  int total=0;
138  for(unsigned int i=0; i<hpds_.size(); i++)
139  total += hpds_[i].numRecHits(threshold);
140  return total;
141 }
142 
144 {
145  int total=0;
146  for(unsigned int i=0; i<hpds_.size(); i++)
147  total += hpds_[i].numRecHitsFailR45(threshold);
148  return total;
149 }
150 
151 double HcalNoiseRBX::caloTowerHadE(void) const
152 {
153  double h=0;
154  towerset_t twrs;
155  uniqueTowers(twrs);
156  for(towerset_t::const_iterator it=twrs.begin(); it!=twrs.end(); ++it) {
157  h += it->hadEnergy();
158  }
159  return h;
160 }
161 
162 double HcalNoiseRBX::caloTowerEmE(void) const
163 {
164  double e=0;
165  towerset_t twrs;
166  uniqueTowers(twrs);
167  for(towerset_t::const_iterator it=twrs.begin(); it!=twrs.end(); ++it) {
168  e += it->emEnergy();
169  }
170  return e;
171 }
172 
174 {
175  double e=0;
176  towerset_t twrs;
177  uniqueTowers(twrs);
178  for(towerset_t::const_iterator it=twrs.begin(); it!=twrs.end(); ++it) {
179  e += it->hadEnergy() + it->emEnergy();
180  }
181  return e;
182 }
183 
185 {
186  double e=0, h=0;
187  towerset_t twrs;
188  uniqueTowers(twrs);
189  for(towerset_t::const_iterator it=twrs.begin(); it!=twrs.end(); ++it) {
190  h += it->hadEnergy();
191  e += it->emEnergy();
192  }
193  return (e+h)==0 ? 999 : e/(e+h);
194 }
195 
197 {
198  twrs_.clear();
199  for(std::vector<HcalNoiseHPD>::const_iterator it1=hpds_.begin(); it1!=hpds_.end(); ++it1) {
200  edm::RefVector<CaloTowerCollection> twrsref=it1->caloTowers();
201  for(edm::RefVector<CaloTowerCollection>::const_iterator it2=twrsref.begin(); it2!=twrsref.end(); ++it2) {
202  CaloTower twr=**it2;
203  twrs_.insert(twr);
204  }
205  }
206  return;
207 }
int i
Definition: DBlmapReader.cc:9
int numRecHitsFailR45(double threshold=1.5) const
float allChargeHighest3TS(unsigned int firstts=4) const
Definition: HcalNoiseRBX.cc:73
float allChargeHighest2TS(unsigned int firstts=4) const
Definition: HcalNoiseRBX.cc:65
int maxZeros(void) const
Definition: HcalNoiseRBX.cc:90
int numRecHits(double threshold=1.5) const
virtual ~HcalNoiseRBX()
Definition: HcalNoiseRBX.cc:23
std::vector< HcalNoiseHPD >::const_iterator maxHPD(double threshold=1.5) const
Definition: HcalNoiseRBX.cc:38
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
double caloTowerEmE(void) const
double caloTowerTotalE(void) const
double recHitEnergy(double theshold=1.5) const
Definition: HcalNoiseRBX.cc:99
float allChargeTotal(void) const
Definition: HcalNoiseRBX.cc:57
std::vector< HcalNoiseHPD > hpds_
Definition: HcalNoiseRBX.h:112
double caloTowerHadE(void) const
std::set< CaloTower, twrcomp > towerset_t
Definition: HcalNoiseRBX.h:104
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
double caloTowerEmFraction(void) const
std::vector< float > allCharge_
Definition: HcalNoiseRBX.h:115
double minRecHitTime(double threshold=20.0) const
void uniqueTowers(towerset_t &twrs_) const
int totalZeros(void) const
Definition: HcalNoiseRBX.cc:82
double recHitEnergyFailR45(double threshold=1.5) const
const std::vector< HcalNoiseHPD > HPDs(void) const
Definition: HcalNoiseRBX.cc:33
int idnumber(void) const
Definition: HcalNoiseRBX.cc:28
double maxRecHitTime(double threshold=20.0) const
const std::vector< float > allCharge(void) const
Definition: HcalNoiseRBX.cc:52