22 if (selectCells.empty())
return;
24 vector<TCell> selectCellsDepth1;
25 vector<TCell> selectCellsHighDepth;
34 for (vector<TCell>::iterator i_it = selectCells.begin(); i_it != selectCells.end(); ++i_it) {
36 selectCellsDepth1.push_back(*i_it);
39 selectCellsHighDepth.push_back(*i_it);
47 for (vector<TCell>::iterator i_it2 = selectCellsHighDepth.begin(); i_it2 != selectCellsHighDepth.end(); ++i_it2) {
52 cout <<
"ERROR!!! there are no HB cells with depth>1 for iEta<15!\n" 53 <<
"Check the input data..." << endl;
59 bool foundDepthOne =
false;
60 for (vector<TCell>::iterator i_it = selectCellsDepth1.begin(); i_it != selectCellsDepth1.end(); ++i_it) {
74 selectCellsDepth1.push_back(
TCell(newId, 0.0));
79 for (vector<TCell>::iterator i_it = selectCellsDepth1.begin(); i_it != selectCellsDepth1.end(); ++i_it) {
80 for (vector<TCell>::iterator i_it2 = selectCellsHighDepth.begin(); i_it2 != selectCellsHighDepth.end(); ++i_it2) {
83 i_it->SetE(i_it->e()+i_it2->e());
90 selectCells = selectCellsDepth1;
101 if (selectCells.empty())
return;
106 vector<TCell> combinedCells;
108 map<UInt_t, vector<Float_t> > etaSliceE;
111 vector<TCell>::iterator i_it = selectCells.begin();
112 for (; i_it != selectCells.end(); ++i_it) {
115 etaSliceE[thisKey].push_back(i_it->e());
118 map<UInt_t, vector<Float_t> >::iterator m_it = etaSliceE.begin();
119 for (; m_it != etaSliceE.end(); ++m_it) {
120 combinedCells.push_back(
TCell(m_it->first, accumulate(m_it->second.begin(), m_it->second.end(), 0.0) ) );
124 selectCells = combinedCells;
129 void combinePhi(vector<TCell> &selectCells, vector<TCell> &combinedCells) {
134 if (selectCells.empty())
return;
136 map<UInt_t, vector<Float_t> > etaSliceE;
139 vector<TCell>::iterator i_it = selectCells.begin();
140 for (; i_it != selectCells.end(); ++i_it) {
143 etaSliceE[thisKey].push_back(i_it->e());
146 map<UInt_t, vector<Float_t> >::iterator m_it = etaSliceE.begin();
147 for (; m_it != etaSliceE.end(); ++m_it) {
148 combinedCells.push_back(
TCell(m_it->first, accumulate(m_it->second.begin(), m_it->second.end(), 0.0) ) );
158 vector<TCell> summedDepthsCells = selectCells;
161 vector<TCell>::iterator highCell = summedDepthsCells.begin();
165 Float_t highE = -999;
167 for (vector<TCell>::iterator it=summedDepthsCells.begin(); it!=summedDepthsCells.end(); ++it) {
168 if (highE < it->
e()) {
174 iEtaMostE =
HcalDetId(highCell->id()).ieta();
175 iPhiMostE =
HcalDetId(highCell->id()).iphi();
187 void filterCells3x3(vector<TCell>& selectCells, Int_t iEtaMaxE, UInt_t iPhiMaxE) {
189 vector<TCell> filteredCells;
193 for (vector<TCell>::iterator it=selectCells.begin(); it!=selectCells.end(); ++it) {
195 Bool_t passDEta =
false;
196 Bool_t passDPhi =
false;
198 dEta =
HcalDetId(it->id()).ieta() - iEtaMaxE;
199 dPhi =
HcalDetId(it->id()).iphi() - iPhiMaxE;
201 if (dPhi > 36) dPhi -= 72;
202 if (dPhi < -36) dPhi += 72;
204 if (
abs(dEta)<=1 || (iEtaMaxE *
HcalDetId(it->id()).ieta() == -1)) passDEta =
true;
206 if (
abs(iEtaMaxE)<=20) {
209 if (
abs(dPhi)<=1) passDPhi =
true;
214 if (
abs(dPhi)<=1) passDPhi =
true;
217 if (dPhi== -2 || dPhi==0) passDPhi =
true;
225 if (
abs(dPhi)<=1 || dPhi==2) passDPhi =
true;
228 if (
abs(dPhi)<=2) passDPhi =
true;
232 if (passDEta && passDPhi) filteredCells.push_back(*it);
235 selectCells = filteredCells;
248 void filterCells5x5(vector<TCell>& selectCells, Int_t iEtaMaxE, UInt_t iPhiMaxE) {
250 vector<TCell> filteredCells;
254 for (vector<TCell>::iterator it=selectCells.begin(); it!=selectCells.end(); ++it) {
256 dEta =
HcalDetId(it->id()).ieta() - iEtaMaxE;
257 dPhi =
HcalDetId(it->id()).iphi() - iPhiMaxE;
259 if (dPhi > 36) dPhi -= 72;
260 if (dPhi < -36) dPhi += 72;
262 bool passDPhi = (
abs(dPhi)<3);
264 bool passDEta = (
abs(dEta)<3 || (iEtaMaxE *
HcalDetId(it->id()).ieta() == -2) );
267 if (passDPhi && passDEta) filteredCells.push_back(*it);
271 selectCells = filteredCells;
284 if (selectCells.empty())
return;
286 vector<TCell> newCells;
287 vector<TCell> manipulatedCells;
289 for (vector<TCell>::iterator i_it = selectCells.begin(); i_it != selectCells.end(); ++i_it) {
293 manipulatedCells.push_back(*i_it);
296 newCells.push_back(*i_it);
304 if (manipulatedCells.empty()) {
313 vector<UInt_t> dummyIds;
314 vector<TCell> createdCells;
316 for (vector<TCell>::iterator i_it = manipulatedCells.begin(); i_it!=manipulatedCells.end(); ++i_it) {
318 if (
find(dummyIds.begin(), dummyIds.end(), dummyId)==dummyIds.end()) {
319 dummyIds.push_back(dummyId);
320 createdCells.push_back(
TCell(dummyId, 0.0));
324 for (vector<TCell>::iterator i_it = createdCells.begin(); i_it!=createdCells.end(); ++i_it) {
325 for (vector<TCell>::iterator i_it2 = manipulatedCells.begin(); i_it2!=manipulatedCells.end(); ++i_it2) {
329 i_it->SetE(i_it->e()+i_it2->e());
334 for (vector<TCell>::iterator i_it = createdCells.begin(); i_it!=createdCells.end(); ++i_it) {
335 newCells.push_back(*i_it);
340 selectCells = newCells;
347 Float_t maxConeDist,
const CaloGeometry* theCaloGeometry) {
349 vector<TCell> filteredCells;
351 for (vector<TCell>::iterator it=selectCells.begin(); it!=selectCells.end(); ++it) {
362 filteredCells.push_back(*it);
365 selectCells = filteredCells;
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Global3DPoint GlobalPoint
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void filterCells5x5(vector< TCell > &selectCells, Int_t iEtaMaxE, UInt_t iPhiMaxE)
void sumDepths(vector< TCell > &selectCells)
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Abs< T >::type abs(const T &t)
void sumSmallDepths(vector< TCell > &selectCells)
void getIEtaIPhiForHighestE(vector< TCell > &selectCells, Int_t &iEtaMostE, UInt_t &iPhiMostE)
void filterCellsInCone(std::vector< TCell > &selectCells, const GlobalPoint hitPositionHcal, Float_t maxConeDist, const CaloGeometry *theCaloGeometry)
void combinePhi(vector< TCell > &selectCells)
double getDistInPlaneSimple(const GlobalPoint caloPoint, const GlobalPoint rechitPoint)
void filterCells3x3(vector< TCell > &selectCells, Int_t iEtaMaxE, UInt_t iPhiMaxE)