CMS 3D CMS Logo

HcalNoiseRBXArray.cc
Go to the documentation of this file.
1 //
2 // HcalNoiseRBXArray.cc
3 //
4 // description: implementation of the HcalNoiseRBXArray
5 //
6 // author: J.P. Chou, Brown
7 //
8 //
9 
11 
12 using namespace reco;
13 
14 // constructor sets the idnumbers for the rbx's and the hpd's
16  for (unsigned int i = 0; i < size(); i++) {
17  HcalNoiseRBX& rbx = at(i);
18 
19  // set the rbxnumber here
20  rbx.idnumber_ = i;
21 
22  // set the hpdnumber here
23  std::array<int, HcalHPDRBXMap::NUM_HPDS_PER_RBX> hpdindices;
25  for (int j = 0; j < HcalHPDRBXMap::NUM_HPDS_PER_RBX; j++) {
26  rbx.hpds_[j].idnumber_ = hpdindices[j];
27  }
28  }
29 }
30 
32 
33 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBXArray::endHPD(void) const {
34  // the choice of which rbx to use is arbitrary,
35  // as long as we're consistent
36  return at(0).hpds_.end();
37 }
38 
39 // code here should be same as above (modulo 'const'ness)
40 std::vector<HcalNoiseHPD>::iterator HcalNoiseRBXArray::endHPD(void) {
41  // the choice of which rbx to use is arbitrary,
42  // as long as we're consistent
43  return at(0).hpds_.end();
44 }
45 
46 std::vector<HcalNoiseHPD>::iterator HcalNoiseRBXArray::findHPD(int hpdindex) {
47  // if the hpdindex is invalid
48  if (!HcalHPDRBXMap::isValidHPD(hpdindex))
49  return endHPD();
50 
51  int rbxindex = HcalHPDRBXMap::indexRBXfromHPD(hpdindex);
52 
53  // find the HPD in the RBX
54  HcalNoiseRBX& rbx = at(rbxindex);
55  for (std::vector<HcalNoiseHPD>::iterator it = rbx.hpds_.begin(); it != rbx.hpds_.end(); ++it) {
56  if (it->idnumber_ == hpdindex)
57  return it;
58  }
59 
60  // if we're here, this is a bug
62  << "Could not find hpdindex " << hpdindex << " in HcalNoiseRBXArray::findHPDfromDetID(). This is a bug.\n";
63  return endHPD();
64 }
65 
66 // code here should be same as above (modulo 'const'ness)
67 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBXArray::findHPD(int hpdindex) const {
68  // if the hpdindex is invalid
69  if (!HcalHPDRBXMap::isValidHPD(hpdindex))
70  return endHPD();
71 
72  int rbxindex = HcalHPDRBXMap::indexRBXfromHPD(hpdindex);
73 
74  // find the HPD in the RBX
75  const HcalNoiseRBX& rbx = at(rbxindex);
76  for (std::vector<HcalNoiseHPD>::const_iterator it = rbx.hpds_.begin(); it != rbx.hpds_.end(); ++it) {
77  if (it->idnumber_ == hpdindex)
78  return it;
79  }
80 
81  // if we're here, this is a bug
83  << "Could not find hpdindex " << hpdindex << " in HcalNoiseRBXArray::findHPDfromDetID(). This is a bug.\n";
84  return endHPD();
85 }
86 
87 HcalNoiseRBXArray::iterator HcalNoiseRBXArray::findRBX(int rbxindex) {
88  if (!HcalHPDRBXMap::isValidRBX(rbxindex))
89  return endRBX();
90  return begin() + rbxindex;
91 }
92 
93 HcalNoiseRBXArray::const_iterator HcalNoiseRBXArray::findRBX(int rbxindex) const {
94  if (!HcalHPDRBXMap::isValidRBX(rbxindex))
95  return endRBX();
96  return begin() + rbxindex;
97 }
98 
99 std::vector<HcalNoiseHPD>::iterator HcalNoiseRBXArray::findHPD(const HcalDetId& id) {
100  if (!HcalHPDRBXMap::isValid(id))
101  return endHPD();
102  return findHPD(HcalHPDRBXMap::indexHPD(id));
103 }
104 
105 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBXArray::findHPD(const HcalDetId& id) const {
106  if (!HcalHPDRBXMap::isValid(id))
107  return endHPD();
108  return findHPD(HcalHPDRBXMap::indexHPD(id));
109 }
110 
111 HcalNoiseRBXArray::iterator HcalNoiseRBXArray::findRBX(const HcalDetId& id) {
112  if (!HcalHPDRBXMap::isValid(id))
113  return endRBX();
114  return findRBX(HcalHPDRBXMap::indexRBX(id));
115 }
116 
117 HcalNoiseRBXArray::const_iterator HcalNoiseRBXArray::findRBX(const HcalDetId& id) const {
118  if (!HcalHPDRBXMap::isValid(id))
119  return endRBX();
120  return findRBX(HcalHPDRBXMap::indexRBX(id));
121 }
122 
123 std::vector<HcalNoiseHPD>::iterator HcalNoiseRBXArray::findHPD(const HBHEDataFrame& f) { return findHPD(f.id()); }
124 
125 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBXArray::findHPD(const HBHEDataFrame& f) const {
126  return findHPD(f.id());
127 }
128 
129 HcalNoiseRBXArray::iterator HcalNoiseRBXArray::findRBX(const HBHEDataFrame& f) { return findRBX(f.id()); }
130 
131 HcalNoiseRBXArray::const_iterator HcalNoiseRBXArray::findRBX(const HBHEDataFrame& f) const { return findRBX(f.id()); }
132 
133 std::vector<HcalNoiseHPD>::iterator HcalNoiseRBXArray::findHPD(const HBHERecHit& h) { return findHPD(h.id()); }
134 
135 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBXArray::findHPD(const HBHERecHit& h) const {
136  return findHPD(h.id());
137 }
138 
139 HcalNoiseRBXArray::iterator HcalNoiseRBXArray::findRBX(const HBHERecHit& h) { return findRBX(h.id()); }
140 
141 HcalNoiseRBXArray::const_iterator HcalNoiseRBXArray::findRBX(const HBHERecHit& h) const { return findRBX(h.id()); }
142 
144  std::vector<std::vector<HcalNoiseHPD>::const_iterator>& vec) const {
145  // clear the vector
146  vec.clear();
147 
148  // check if the tower corresponds to a valid HPD/RBX
149  if (!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi()))
150  return;
151 
152  // find the HPD indices
153  std::vector<int> hpdindices;
154  HcalHPDRBXMap::indexHPDfromEtaPhi(tower.ieta(), tower.iphi(), hpdindices);
155  for (std::vector<int>::const_iterator it = hpdindices.begin(); it != hpdindices.end(); ++it)
156  vec.push_back(findHPD(*it));
157 
158  return;
159 }
160 
161 void HcalNoiseRBXArray::findHPD(const CaloTower& tower, std::vector<std::vector<HcalNoiseHPD>::iterator>& vec) {
162  // clear the vector
163  vec.clear();
164 
165  // check if the tower corresponds to a valid HPD/RBX
166  if (!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi()))
167  return;
168 
169  // find the HPD indices
170  std::vector<int> hpdindices;
171  HcalHPDRBXMap::indexHPDfromEtaPhi(tower.ieta(), tower.iphi(), hpdindices);
172  for (std::vector<int>::const_iterator it = hpdindices.begin(); it != hpdindices.end(); ++it)
173  vec.push_back(findHPD(*it));
174 
175  return;
176 }
177 
178 void HcalNoiseRBXArray::findRBX(const CaloTower& tower, std::vector<HcalNoiseRBXArray::iterator>& vec) {
179  // clear the vector
180  vec.clear();
181 
182  // check if the tower corresponds to a valid HPD/RBX
183  if (!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi()))
184  return;
185 
186  // find the RBX indices
187  std::vector<int> rbxindices;
188  HcalHPDRBXMap::indexRBXfromEtaPhi(tower.ieta(), tower.iphi(), rbxindices);
189  for (std::vector<int>::const_iterator it = rbxindices.begin(); it != rbxindices.end(); ++it)
190  vec.push_back(findRBX(*it));
191 
192  return;
193 }
194 
195 void HcalNoiseRBXArray::findRBX(const CaloTower& tower, std::vector<HcalNoiseRBXArray::const_iterator>& vec) const {
196  // clear the vector
197  vec.clear();
198 
199  // check if the tower corresponds to a valid HPD/RBX
200  if (!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi()))
201  return;
202 
203  // find the RBX indices
204  std::vector<int> rbxindices;
205  HcalHPDRBXMap::indexRBXfromEtaPhi(tower.ieta(), tower.iphi(), rbxindices);
206  for (std::vector<int>::const_iterator it = rbxindices.begin(); it != rbxindices.end(); ++it)
207  vec.push_back(findRBX(*it));
208 
209  return;
210 }
HcalHPDRBXMap::indicesHPDfromRBX
static void indicesHPDfromRBX(int rbxindex, std::array< int, NUM_HPDS_PER_RBX > &hpdindices)
Definition: HcalHPDRBXMap.cc:165
mps_fire.i
i
Definition: mps_fire.py:428
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
edm::errors::LogicError
Definition: EDMException.h:37
HcalHPDRBXMap::NUM_HPDS_PER_RBX
const static int NUM_HPDS_PER_RBX
Definition: HcalHPDRBXMap.h:30
HBHERecHit
Definition: HBHERecHit.h:13
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
reco::HcalNoiseRBX::idnumber_
int idnumber_
Definition: HcalNoiseRBX.h:102
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::HcalNoiseRBXArray::findRBX
HcalNoiseRBXArray::iterator findRBX(int rbxindex)
Definition: HcalNoiseRBXArray.cc:87
h
HcalHPDRBXMap::isValidHPD
static bool isValidHPD(int index)
Definition: HcalHPDRBXMap.cc:18
reco::HcalNoiseRBX::hpds_
std::vector< HcalNoiseHPD > hpds_
Definition: HcalNoiseRBX.h:105
reco::HcalNoiseRBXArray::findHPD
std::vector< HcalNoiseHPD >::iterator findHPD(int hpdindex)
Definition: HcalNoiseRBXArray.cc:46
HcalHPDRBXMap::indexRBX
static int indexRBX(const HcalDetId &)
Definition: HcalHPDRBXMap.cc:229
HBHEDataFrame
Definition: HBHEDataFrame.h:14
reco::HcalNoiseRBXArray::~HcalNoiseRBXArray
virtual ~HcalNoiseRBXArray()
Definition: HcalNoiseRBXArray.cc:31
HcalHPDRBXMap::indexRBXfromEtaPhi
static void indexRBXfromEtaPhi(int ieta, int iphi, std::vector< int > &rbxindices)
Definition: HcalHPDRBXMap.cc:251
HcalHPDRBXMap::indexHPDfromEtaPhi
static void indexHPDfromEtaPhi(int ieta, int iphi, std::vector< int > &hpdindices)
Definition: HcalHPDRBXMap.cc:231
reco::HcalNoiseRBXArray::HcalNoiseRBXArray
HcalNoiseRBXArray()
Definition: HcalNoiseRBXArray.cc:15
reco::HcalNoiseRBXArray::endHPD
std::vector< HcalNoiseHPD >::iterator endHPD(void)
Definition: HcalNoiseRBXArray.cc:40
HcalDetId
Definition: HcalDetId.h:12
HcalNoiseRBXArray.h
CaloTower
Definition: CaloTower.h:26
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
reco::HcalNoiseRBXArray::endRBX
HcalNoiseRBXArray::iterator endRBX(void)
Definition: HcalNoiseRBXArray.h:41
HcalHPDRBXMap::isValid
static bool isValid(const HcalDetId &)
Definition: HcalHPDRBXMap.cc:23
reco::HcalNoiseRBX
Definition: HcalNoiseRBX.h:32
Exception
Definition: hltDiff.cc:246
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
HcalHPDRBXMap::indexRBXfromHPD
static int indexRBXfromHPD(int hpdindex)
Definition: HcalHPDRBXMap.cc:177
HcalHPDRBXMap::isValidRBX
static bool isValidRBX(int index)
Definition: HcalHPDRBXMap.cc:21
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
HcalHPDRBXMap::indexHPD
static int indexHPD(const HcalDetId &)
Definition: HcalHPDRBXMap.cc:186