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 mintime=9999999.;
110  for(unsigned int i=0; i<hpds_.size(); i++) {
111  double temptime=hpds_[i].minRecHitTime(threshold);
112  if(temptime<mintime) mintime=temptime;
113  }
114  return mintime;
115 }
116 
118 {
119  double maxtime=-9999999.;
120  for(unsigned int i=0; i<hpds_.size(); i++) {
121  double temptime=hpds_[i].maxRecHitTime(threshold);
122  if(temptime>maxtime) maxtime=temptime;
123  }
124  return maxtime;
125 }
126 
128 {
129  int total=0;
130  for(unsigned int i=0; i<hpds_.size(); i++)
131  total += hpds_[i].numRecHits(threshold);
132  return total;
133 }
134 
135 double HcalNoiseRBX::caloTowerHadE(void) const
136 {
137  double h=0;
138  towerset_t twrs;
139  uniqueTowers(twrs);
140  for(towerset_t::const_iterator it=twrs.begin(); it!=twrs.end(); ++it) {
141  h += it->hadEnergy();
142  }
143  return h;
144 }
145 
146 double HcalNoiseRBX::caloTowerEmE(void) const
147 {
148  double e=0;
149  towerset_t twrs;
150  uniqueTowers(twrs);
151  for(towerset_t::const_iterator it=twrs.begin(); it!=twrs.end(); ++it) {
152  e += it->emEnergy();
153  }
154  return e;
155 }
156 
158 {
159  double e=0;
160  towerset_t twrs;
161  uniqueTowers(twrs);
162  for(towerset_t::const_iterator it=twrs.begin(); it!=twrs.end(); ++it) {
163  e += it->hadEnergy() + it->emEnergy();
164  }
165  return e;
166 }
167 
169 {
170  double e=0, h=0;
171  towerset_t twrs;
172  uniqueTowers(twrs);
173  for(towerset_t::const_iterator it=twrs.begin(); it!=twrs.end(); ++it) {
174  h += it->hadEnergy();
175  e += it->emEnergy();
176  }
177  return (e+h)==0 ? 999 : e/(e+h);
178 }
179 
181 {
182  twrs_.clear();
183  for(std::vector<HcalNoiseHPD>::const_iterator it1=hpds_.begin(); it1!=hpds_.end(); ++it1) {
184  edm::RefVector<CaloTowerCollection> twrsref=it1->caloTowers();
185  for(edm::RefVector<CaloTowerCollection>::const_iterator it2=twrsref.begin(); it2!=twrsref.end(); ++it2) {
186  CaloTower twr=**it2;
187  twrs_.insert(twr);
188  }
189  }
190  return;
191 }
int i
Definition: DBlmapReader.cc:9
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
const T & max(const T &a, const T &b)
std::vector< HcalNoiseHPD > hpds_
Definition: HcalNoiseRBX.h:102
double caloTowerHadE(void) const
std::set< CaloTower, twrcomp > towerset_t
Definition: HcalNoiseRBX.h:113
double caloTowerEmFraction(void) const
std::vector< float > allCharge_
Definition: HcalNoiseRBX.h:105
double minRecHitTime(double threshold=20.0) const
void uniqueTowers(towerset_t &twrs_) const
int totalZeros(void) const
Definition: HcalNoiseRBX.cc:82
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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