CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
12 
13 using namespace reco;
14 
15 // constructor sets the idnumbers for the rbx's and the hpd's
17 {
18  for(unsigned int i=0; i<size(); i++) {
19  HcalNoiseRBX& rbx=at(i);
20 
21  // set the rbxnumber here
22  rbx.idnumber_=i;
23 
24  // set the hpdnumber here
25  boost::array<int, HcalHPDRBXMap::NUM_HPDS_PER_RBX> hpdindices;
27  for(int j=0; j<HcalHPDRBXMap::NUM_HPDS_PER_RBX; j++) {
28  rbx.hpds_[j].idnumber_=hpdindices[j];
29  }
30  }
31 }
32 
34 {
35 }
36 
37 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBXArray::endHPD(void) const
38 {
39  // the choice of which rbx to use is arbitrary,
40  // as long as we're consistent
41  return at(0).hpds_.end();
42 }
43 
44 // code here should be same as above (modulo 'const'ness)
45 std::vector<HcalNoiseHPD>::iterator HcalNoiseRBXArray::endHPD(void)
46 {
47  // the choice of which rbx to use is arbitrary,
48  // as long as we're consistent
49  return at(0).hpds_.end();
50 }
51 
52 std::vector<HcalNoiseHPD>::iterator HcalNoiseRBXArray::findHPD(int hpdindex)
53 {
54  // if the hpdindex is invalid
55  if(!HcalHPDRBXMap::isValidHPD(hpdindex)) return endHPD();
56 
57  int rbxindex=HcalHPDRBXMap::indexRBXfromHPD(hpdindex);
58 
59  // find the HPD in the RBX
60  HcalNoiseRBX& rbx=at(rbxindex);
61  for(std::vector<HcalNoiseHPD>::iterator it=rbx.hpds_.begin(); it!=rbx.hpds_.end(); ++it) {
62  if(it->idnumber_==hpdindex) return it;
63  }
64 
65  // if we're here, this is a bug
67  << "Could not find hpdindex " << hpdindex << " in HcalNoiseRBXArray::findHPDfromDetID(). This is a bug.\n";
68  return endHPD();
69 }
70 
71 // code here should be same as above (modulo 'const'ness)
72 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBXArray::findHPD(int hpdindex) const
73 {
74  // if the hpdindex is invalid
75  if(!HcalHPDRBXMap::isValidHPD(hpdindex)) return endHPD();
76 
77  int rbxindex=HcalHPDRBXMap::indexRBXfromHPD(hpdindex);
78 
79  // find the HPD in the RBX
80  const HcalNoiseRBX& rbx=at(rbxindex);
81  for(std::vector<HcalNoiseHPD>::const_iterator it=rbx.hpds_.begin(); it!=rbx.hpds_.end(); ++it) {
82  if(it->idnumber_==hpdindex) return it;
83  }
84 
85  // if we're here, this is a bug
87  << "Could not find hpdindex " << hpdindex << " in HcalNoiseRBXArray::findHPDfromDetID(). This is a bug.\n";
88  return endHPD();
89 }
90 
91 HcalNoiseRBXArray::iterator
93 {
94  if(!HcalHPDRBXMap::isValidRBX(rbxindex)) return endRBX();
95  return begin()+rbxindex;
96 }
97 
98 HcalNoiseRBXArray::const_iterator
99 HcalNoiseRBXArray::findRBX(int rbxindex) const
100 {
101  if(!HcalHPDRBXMap::isValidRBX(rbxindex)) return endRBX();
102  return begin()+rbxindex;
103 }
104 
105 std::vector<HcalNoiseHPD>::iterator
107 {
108  if(!HcalHPDRBXMap::isValid(id)) return endHPD();
109  return findHPD(HcalHPDRBXMap::indexHPD(id));
110 }
111 
112 std::vector<HcalNoiseHPD>::const_iterator
114 {
115  if(!HcalHPDRBXMap::isValid(id)) return endHPD();
116  return findHPD(HcalHPDRBXMap::indexHPD(id));
117 }
118 
119 HcalNoiseRBXArray::iterator
121 {
122  if(!HcalHPDRBXMap::isValid(id)) return endRBX();
123  return findRBX(HcalHPDRBXMap::indexRBX(id));
124 }
125 
126 HcalNoiseRBXArray::const_iterator
128 {
129  if(!HcalHPDRBXMap::isValid(id)) return endRBX();
130  return findRBX(HcalHPDRBXMap::indexRBX(id));
131 }
132 
133 std::vector<HcalNoiseHPD>::iterator
135 { return findHPD(f.id()); }
136 
137 std::vector<HcalNoiseHPD>::const_iterator
139 { return findHPD(f.id()); }
140 
141 HcalNoiseRBXArray::iterator
143 { return findRBX(f.id()); }
144 
145 HcalNoiseRBXArray::const_iterator
147 { return findRBX(f.id()); }
148 
149 std::vector<HcalNoiseHPD>::iterator
151 { return findHPD(h.id()); }
152 
153 std::vector<HcalNoiseHPD>::const_iterator
155 { return findHPD(h.id()); }
156 
157 HcalNoiseRBXArray::iterator
159 { return findRBX(h.id()); }
160 
161 HcalNoiseRBXArray::const_iterator
163 { return findRBX(h.id()); }
164 
165 
166 void HcalNoiseRBXArray::findHPD(const CaloTower& tower, std::vector<std::vector<HcalNoiseHPD>::const_iterator>& vec) const
167 {
168  // clear the vector
169  vec.clear();
170 
171  // check if the tower corresponds to a valid HPD/RBX
172  if(!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi())) return;
173 
174  // find the HPD indices
175  std::vector<int> hpdindices;
176  HcalHPDRBXMap::indexHPDfromEtaPhi(tower.ieta(), tower.iphi(), hpdindices);
177  for(std::vector<int>::const_iterator it=hpdindices.begin(); it!=hpdindices.end(); ++it)
178  vec.push_back(findHPD(*it));
179 
180  return;
181 }
182 
183 void HcalNoiseRBXArray::findHPD(const CaloTower& tower, std::vector<std::vector<HcalNoiseHPD>::iterator>& vec)
184 {
185  // clear the vector
186  vec.clear();
187 
188  // check if the tower corresponds to a valid HPD/RBX
189  if(!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi())) return;
190 
191  // find the HPD indices
192  std::vector<int> hpdindices;
193  HcalHPDRBXMap::indexHPDfromEtaPhi(tower.ieta(), tower.iphi(), hpdindices);
194  for(std::vector<int>::const_iterator it=hpdindices.begin(); it!=hpdindices.end(); ++it)
195  vec.push_back(findHPD(*it));
196 
197  return;
198 }
199 
200 void HcalNoiseRBXArray::findRBX(const CaloTower& tower, std::vector<HcalNoiseRBXArray::iterator>& vec)
201 {
202  // clear the vector
203  vec.clear();
204 
205  // check if the tower corresponds to a valid HPD/RBX
206  if(!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi())) return;
207 
208  // find the RBX indices
209  std::vector<int> rbxindices;
210  HcalHPDRBXMap::indexRBXfromEtaPhi(tower.ieta(), tower.iphi(), rbxindices);
211  for(std::vector<int>::const_iterator it=rbxindices.begin(); it!=rbxindices.end(); ++it)
212  vec.push_back(findRBX(*it));
213 
214  return;
215 }
216 
217 void HcalNoiseRBXArray::findRBX(const CaloTower& tower, std::vector<HcalNoiseRBXArray::const_iterator>& vec) const
218 {
219  // clear the vector
220  vec.clear();
221 
222  // check if the tower corresponds to a valid HPD/RBX
223  if(!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi())) return;
224 
225  // find the RBX indices
226  std::vector<int> rbxindices;
227  HcalHPDRBXMap::indexRBXfromEtaPhi(tower.ieta(), tower.iphi(), rbxindices);
228  for(std::vector<int>::const_iterator it=rbxindices.begin(); it!=rbxindices.end(); ++it)
229  vec.push_back(findRBX(*it));
230 
231  return;
232 }
static const int NUM_HPDS_PER_RBX
Definition: HcalHPDRBXMap.h:33
int i
Definition: DBlmapReader.cc:9
static int indexRBXfromHPD(int hpdindex)
std::vector< HcalNoiseHPD >::iterator endHPD(void)
int ieta() const
Definition: CaloTower.h:154
static int indexRBX(const HcalDetId &)
HcalDetId id() const
get the id
Definition: HBHERecHit.h:21
int iphi() const
Definition: CaloTower.h:156
static void indexHPDfromEtaPhi(int ieta, int iphi, std::vector< int > &hpdindices)
HcalNoiseRBXArray::iterator findRBX(int rbxindex)
static bool isValidRBX(int index)
static void indexRBXfromEtaPhi(int ieta, int iphi, std::vector< int > &rbxindices)
static bool isValidHPD(int index)
std::vector< HcalNoiseHPD > hpds_
Definition: HcalNoiseRBX.h:102
std::vector< HcalNoiseHPD >::iterator findHPD(int hpdindex)
int j
Definition: DBlmapReader.cc:9
double f[11][100]
HcalNoiseRBXArray::iterator endRBX(void)
static bool isValid(const HcalDetId &)
static void indicesHPDfromRBX(int rbxindex, boost::array< int, NUM_HPDS_PER_RBX > &hpdindices)
#define begin
Definition: vmac.h:31
const HcalDetId & id() const
Definition: HBHEDataFrame.h:22
static int indexHPD(const HcalDetId &)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
tuple size
Write out results.
list at
Definition: asciidump.py:428