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