20 if (selectCells.size()==0)
return;
22 vector<TCell> selectCellsDepth1;
23 vector<TCell> selectCellsHighDepth;
32 for (vector<TCell>::iterator i_it = selectCells.begin(); i_it != selectCells.end(); ++i_it) {
34 selectCellsDepth1.push_back(*i_it);
37 selectCellsHighDepth.push_back(*i_it);
45 for (vector<TCell>::iterator i_it2 = selectCellsHighDepth.begin(); i_it2 != selectCellsHighDepth.end(); ++i_it2) {
50 cout <<
"ERROR!!! there are no HB cells with depth>1 for iEta<15!\n"
51 <<
"Check the input data..." << endl;
57 bool foundDepthOne =
false;
58 for (vector<TCell>::iterator i_it = selectCellsDepth1.begin(); i_it != selectCellsDepth1.end(); ++i_it) {
72 selectCellsDepth1.push_back(
TCell(newId, 0.0));
77 for (vector<TCell>::iterator i_it = selectCellsDepth1.begin(); i_it != selectCellsDepth1.end(); ++i_it) {
78 for (vector<TCell>::iterator i_it2 = selectCellsHighDepth.begin(); i_it2 != selectCellsHighDepth.end(); ++i_it2) {
81 i_it->SetE(i_it->e()+i_it2->e());
88 selectCells = selectCellsDepth1;
99 if (selectCells.size()==0)
return;
104 vector<TCell> combinedCells;
106 map<UInt_t, vector<Float_t> > etaSliceE;
109 vector<TCell>::iterator i_it = selectCells.begin();
110 for (; i_it != selectCells.end(); ++i_it) {
113 etaSliceE[thisKey].push_back(i_it->e());
116 map<UInt_t, vector<Float_t> >::iterator m_it = etaSliceE.begin();
117 for (; m_it != etaSliceE.end(); ++m_it) {
118 combinedCells.push_back(
TCell(m_it->first, accumulate(m_it->second.begin(), m_it->second.end(), 0.0) ) );
122 selectCells = combinedCells;
127 void combinePhi(vector<TCell> &selectCells, vector<TCell> &combinedCells) {
132 if (selectCells.size()==0)
return;
134 map<UInt_t, vector<Float_t> > etaSliceE;
137 vector<TCell>::iterator i_it = selectCells.begin();
138 for (; i_it != selectCells.end(); ++i_it) {
141 etaSliceE[thisKey].push_back(i_it->e());
144 map<UInt_t, vector<Float_t> >::iterator m_it = etaSliceE.begin();
145 for (; m_it != etaSliceE.end(); ++m_it) {
146 combinedCells.push_back(
TCell(m_it->first, accumulate(m_it->second.begin(), m_it->second.end(), 0.0) ) );
156 vector<TCell> summedDepthsCells = selectCells;
159 vector<TCell>::iterator highCell = summedDepthsCells.begin();
163 Float_t highE = -999;
165 for (vector<TCell>::iterator it=summedDepthsCells.begin(); it!=summedDepthsCells.end(); ++it) {
166 if (highE < it->
e()) {
172 iEtaMostE =
HcalDetId(highCell->id()).ieta();
173 iPhiMostE =
HcalDetId(highCell->id()).iphi();
187 vector<TCell> filteredCells;
191 for (vector<TCell>::iterator it=selectCells.begin(); it!=selectCells.end(); ++it) {
193 Bool_t passDEta =
false;
194 Bool_t passDPhi =
false;
196 dEta =
HcalDetId(it->id()).ieta() - iEtaMaxE;
197 dPhi =
HcalDetId(it->id()).iphi() - iPhiMaxE;
199 if (dPhi > 36) dPhi -= 72;
200 if (dPhi < -36) dPhi += 72;
202 if (
abs(dEta)<=1 || (iEtaMaxE *
HcalDetId(it->id()).ieta() == -1)) passDEta =
true;
204 if (
abs(iEtaMaxE)<=20) {
207 if (
abs(dPhi)<=1) passDPhi =
true;
212 if (
abs(dPhi)<=1) passDPhi =
true;
215 if (dPhi== -2 || dPhi==0) passDPhi =
true;
223 if (
abs(dPhi)<=1 || dPhi==2) passDPhi =
true;
226 if (
abs(dPhi)<=2) passDPhi =
true;
230 if (passDEta && passDPhi) filteredCells.push_back(*it);
233 selectCells = filteredCells;
248 vector<TCell> filteredCells;
252 for (vector<TCell>::iterator it=selectCells.begin(); it!=selectCells.end(); ++it) {
254 dEta =
HcalDetId(it->id()).ieta() - iEtaMaxE;
255 dPhi =
HcalDetId(it->id()).iphi() - iPhiMaxE;
257 if (dPhi > 36) dPhi -= 72;
258 if (dPhi < -36) dPhi += 72;
260 bool passDPhi = (
abs(dPhi)<3);
262 bool passDEta = (
abs(dEta)<3 || (iEtaMaxE *
HcalDetId(it->id()).ieta() == -2) );
265 if (passDPhi && passDEta) filteredCells.push_back(*it);
269 selectCells = filteredCells;
282 if (selectCells.size()==0)
return;
284 vector<TCell> newCells;
285 vector<TCell> manipulatedCells;
287 for (vector<TCell>::iterator i_it = selectCells.begin(); i_it != selectCells.end(); ++i_it) {
291 manipulatedCells.push_back(*i_it);
294 newCells.push_back(*i_it);
302 if (manipulatedCells.size()<1) {
311 vector<UInt_t> dummyIds;
312 vector<TCell> createdCells;
314 for (vector<TCell>::iterator i_it = manipulatedCells.begin(); i_it!=manipulatedCells.end(); ++i_it) {
316 if (
find(dummyIds.begin(), dummyIds.end(), dummyId)==dummyIds.end()) {
317 dummyIds.push_back(dummyId);
318 createdCells.push_back(
TCell(dummyId, 0.0));
322 for (vector<TCell>::iterator i_it = createdCells.begin(); i_it!=createdCells.end(); ++i_it) {
323 for (vector<TCell>::iterator i_it2 = manipulatedCells.begin(); i_it2!=manipulatedCells.end(); ++i_it2) {
327 i_it->SetE(i_it->e()+i_it2->e());
332 for (vector<TCell>::iterator i_it = createdCells.begin(); i_it!=createdCells.end(); ++i_it) {
333 newCells.push_back(*i_it);
338 selectCells = newCells;
347 vector<TCell> filteredCells;
349 for (vector<TCell>::iterator it=selectCells.begin(); it!=selectCells.end(); ++it) {
354 filteredCells.push_back(*it);
357 selectCells = filteredCells;
void filterCellsInCone(std::vector< TCell > &selectCells, const GlobalPoint hitPositionHcal, Float_t maxConeDist, const CaloGeometry *theCaloGeometry)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
double dPhi(double phi1, double phi2)
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
void filterCells3x3(std::vector< TCell > &selectCells, Int_t iEta, UInt_t iPhi)
void filterCells5x5(std::vector< TCell > &selectCells, Int_t iEta, UInt_t iPhi)
double getDistInPlaneSimple(const GlobalPoint caloPoint, const GlobalPoint rechitPoint)
void getIEtaIPhiForHighestE(std::vector< TCell > &selectCells, Int_t &iEta, UInt_t &iPhi)