Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "RecoMET/METAlgorithms/interface/HcalNoiseRBXArray.h"
00011 #include "FWCore/Utilities/interface/CodedException.h"
00012
00013 using namespace reco;
00014
00015
00016 HcalNoiseRBXArray::HcalNoiseRBXArray()
00017 {
00018 for(unsigned int i=0; i<size(); i++) {
00019 HcalNoiseRBX& rbx=at(i);
00020
00021
00022 rbx.idnumber_=i;
00023
00024
00025 boost::array<int, HcalHPDRBXMap::NUM_HPDS_PER_RBX> hpdindices;
00026 HcalHPDRBXMap::indicesHPDfromRBX(i, hpdindices);
00027 for(int j=0; j<HcalHPDRBXMap::NUM_HPDS_PER_RBX; j++) {
00028 rbx.hpds_[j].idnumber_=hpdindices[j];
00029 }
00030 }
00031 }
00032
00033 HcalNoiseRBXArray::~HcalNoiseRBXArray()
00034 {
00035 }
00036
00037 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBXArray::endHPD(void) const
00038 {
00039
00040
00041 return at(0).hpds_.end();
00042 }
00043
00044
00045 std::vector<HcalNoiseHPD>::iterator HcalNoiseRBXArray::endHPD(void)
00046 {
00047
00048
00049 return at(0).hpds_.end();
00050 }
00051
00052 std::vector<HcalNoiseHPD>::iterator HcalNoiseRBXArray::findHPD(int hpdindex)
00053 {
00054
00055 if(!HcalHPDRBXMap::isValidHPD(hpdindex)) return endHPD();
00056
00057 int rbxindex=HcalHPDRBXMap::indexRBXfromHPD(hpdindex);
00058
00059
00060 HcalNoiseRBX& rbx=at(rbxindex);
00061 for(std::vector<HcalNoiseHPD>::iterator it=rbx.hpds_.begin(); it!=rbx.hpds_.end(); ++it) {
00062 if(it->idnumber_==hpdindex) return it;
00063 }
00064
00065
00066 throw edm::Exception(edm::errors::LogicError)
00067 << "Could not find hpdindex " << hpdindex << " in HcalNoiseRBXArray::findHPDfromDetID(). This is a bug.\n";
00068 return endHPD();
00069 }
00070
00071
00072 std::vector<HcalNoiseHPD>::const_iterator HcalNoiseRBXArray::findHPD(int hpdindex) const
00073 {
00074
00075 if(!HcalHPDRBXMap::isValidHPD(hpdindex)) return endHPD();
00076
00077 int rbxindex=HcalHPDRBXMap::indexRBXfromHPD(hpdindex);
00078
00079
00080 const HcalNoiseRBX& rbx=at(rbxindex);
00081 for(std::vector<HcalNoiseHPD>::const_iterator it=rbx.hpds_.begin(); it!=rbx.hpds_.end(); ++it) {
00082 if(it->idnumber_==hpdindex) return it;
00083 }
00084
00085
00086 throw edm::Exception(edm::errors::LogicError)
00087 << "Could not find hpdindex " << hpdindex << " in HcalNoiseRBXArray::findHPDfromDetID(). This is a bug.\n";
00088 return endHPD();
00089 }
00090
00091 HcalNoiseRBXArray::iterator
00092 HcalNoiseRBXArray::findRBX(int rbxindex)
00093 {
00094 if(!HcalHPDRBXMap::isValidRBX(rbxindex)) return endRBX();
00095 return begin()+rbxindex;
00096 }
00097
00098 HcalNoiseRBXArray::const_iterator
00099 HcalNoiseRBXArray::findRBX(int rbxindex) const
00100 {
00101 if(!HcalHPDRBXMap::isValidRBX(rbxindex)) return endRBX();
00102 return begin()+rbxindex;
00103 }
00104
00105 std::vector<HcalNoiseHPD>::iterator
00106 HcalNoiseRBXArray::findHPD(const HcalDetId& id)
00107 {
00108 if(!HcalHPDRBXMap::isValid(id)) return endHPD();
00109 return findHPD(HcalHPDRBXMap::indexHPD(id));
00110 }
00111
00112 std::vector<HcalNoiseHPD>::const_iterator
00113 HcalNoiseRBXArray::findHPD(const HcalDetId& id) const
00114 {
00115 if(!HcalHPDRBXMap::isValid(id)) return endHPD();
00116 return findHPD(HcalHPDRBXMap::indexHPD(id));
00117 }
00118
00119 HcalNoiseRBXArray::iterator
00120 HcalNoiseRBXArray::findRBX(const HcalDetId& id)
00121 {
00122 if(!HcalHPDRBXMap::isValid(id)) return endRBX();
00123 return findRBX(HcalHPDRBXMap::indexRBX(id));
00124 }
00125
00126 HcalNoiseRBXArray::const_iterator
00127 HcalNoiseRBXArray::findRBX(const HcalDetId& id) const
00128 {
00129 if(!HcalHPDRBXMap::isValid(id)) return endRBX();
00130 return findRBX(HcalHPDRBXMap::indexRBX(id));
00131 }
00132
00133 std::vector<HcalNoiseHPD>::iterator
00134 HcalNoiseRBXArray::findHPD(const HBHEDataFrame& f)
00135 { return findHPD(f.id()); }
00136
00137 std::vector<HcalNoiseHPD>::const_iterator
00138 HcalNoiseRBXArray::findHPD(const HBHEDataFrame& f) const
00139 { return findHPD(f.id()); }
00140
00141 HcalNoiseRBXArray::iterator
00142 HcalNoiseRBXArray::findRBX(const HBHEDataFrame& f)
00143 { return findRBX(f.id()); }
00144
00145 HcalNoiseRBXArray::const_iterator
00146 HcalNoiseRBXArray::findRBX(const HBHEDataFrame& f) const
00147 { return findRBX(f.id()); }
00148
00149 std::vector<HcalNoiseHPD>::iterator
00150 HcalNoiseRBXArray::findHPD(const HBHERecHit& h)
00151 { return findHPD(h.id()); }
00152
00153 std::vector<HcalNoiseHPD>::const_iterator
00154 HcalNoiseRBXArray::findHPD(const HBHERecHit& h) const
00155 { return findHPD(h.id()); }
00156
00157 HcalNoiseRBXArray::iterator
00158 HcalNoiseRBXArray::findRBX(const HBHERecHit& h)
00159 { return findRBX(h.id()); }
00160
00161 HcalNoiseRBXArray::const_iterator
00162 HcalNoiseRBXArray::findRBX(const HBHERecHit& h) const
00163 { return findRBX(h.id()); }
00164
00165
00166 void HcalNoiseRBXArray::findHPD(const CaloTower& tower, std::vector<std::vector<HcalNoiseHPD>::const_iterator>& vec) const
00167 {
00168
00169 vec.clear();
00170
00171
00172 if(!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi())) return;
00173
00174
00175 std::vector<int> hpdindices;
00176 HcalHPDRBXMap::indexHPDfromEtaPhi(tower.ieta(), tower.iphi(), hpdindices);
00177 for(std::vector<int>::const_iterator it=hpdindices.begin(); it!=hpdindices.end(); ++it)
00178 vec.push_back(findHPD(*it));
00179
00180 return;
00181 }
00182
00183 void HcalNoiseRBXArray::findHPD(const CaloTower& tower, std::vector<std::vector<HcalNoiseHPD>::iterator>& vec)
00184 {
00185
00186 vec.clear();
00187
00188
00189 if(!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi())) return;
00190
00191
00192 std::vector<int> hpdindices;
00193 HcalHPDRBXMap::indexHPDfromEtaPhi(tower.ieta(), tower.iphi(), hpdindices);
00194 for(std::vector<int>::const_iterator it=hpdindices.begin(); it!=hpdindices.end(); ++it)
00195 vec.push_back(findHPD(*it));
00196
00197 return;
00198 }
00199
00200 void HcalNoiseRBXArray::findRBX(const CaloTower& tower, std::vector<HcalNoiseRBXArray::iterator>& vec)
00201 {
00202
00203 vec.clear();
00204
00205
00206 if(!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi())) return;
00207
00208
00209 std::vector<int> rbxindices;
00210 HcalHPDRBXMap::indexRBXfromEtaPhi(tower.ieta(), tower.iphi(), rbxindices);
00211 for(std::vector<int>::const_iterator it=rbxindices.begin(); it!=rbxindices.end(); ++it)
00212 vec.push_back(findRBX(*it));
00213
00214 return;
00215 }
00216
00217 void HcalNoiseRBXArray::findRBX(const CaloTower& tower, std::vector<HcalNoiseRBXArray::const_iterator>& vec) const
00218 {
00219
00220 vec.clear();
00221
00222
00223 if(!HcalHPDRBXMap::isValid(tower.ieta(), tower.iphi())) return;
00224
00225
00226 std::vector<int> rbxindices;
00227 HcalHPDRBXMap::indexRBXfromEtaPhi(tower.ieta(), tower.iphi(), rbxindices);
00228 for(std::vector<int>::const_iterator it=rbxindices.begin(); it!=rbxindices.end(); ++it)
00229 vec.push_back(findRBX(*it));
00230
00231 return;
00232 }