17 if (selectCells.size()==0)
return;
19 vector<TCell> selectCellsDepth1;
20 vector<TCell> selectCellsHighDepth;
29 for (vector<TCell>::iterator i_it = selectCells.begin(); i_it != selectCells.end(); ++i_it) {
31 selectCellsDepth1.push_back(*i_it);
34 selectCellsHighDepth.push_back(*i_it);
42 for (vector<TCell>::iterator i_it2 = selectCellsHighDepth.begin(); i_it2 != selectCellsHighDepth.end(); ++i_it2) {
47 cout <<
"ERROR!!! there are no HB cells with depth>1 for iEta<15!\n"
48 <<
"Check the input data..." << endl;
54 bool foundDepthOne =
false;
55 for (vector<TCell>::iterator i_it = selectCellsDepth1.begin(); i_it != selectCellsDepth1.end(); ++i_it) {
69 selectCellsDepth1.push_back(
TCell(newId, 0.0));
74 for (vector<TCell>::iterator i_it = selectCellsDepth1.begin(); i_it != selectCellsDepth1.end(); ++i_it) {
75 for (vector<TCell>::iterator i_it2 = selectCellsHighDepth.begin(); i_it2 != selectCellsHighDepth.end(); ++i_it2) {
78 i_it->SetE(i_it->e()+i_it2->e());
85 selectCells = selectCellsDepth1;
96 if (selectCells.size()==0)
return;
101 vector<TCell> combinedCells;
103 map<UInt_t, vector<Float_t> > etaSliceE;
106 vector<TCell>::iterator i_it = selectCells.begin();
107 for (; i_it != selectCells.end(); ++i_it) {
110 etaSliceE[thisKey].push_back(i_it->e());
113 map<UInt_t, vector<Float_t> >::iterator m_it = etaSliceE.begin();
114 for (; m_it != etaSliceE.end(); ++m_it) {
115 combinedCells.push_back(
TCell(m_it->first, accumulate(m_it->second.begin(), m_it->second.end(), 0.0) ) );
119 selectCells = combinedCells;
124 void combinePhi(vector<TCell> &selectCells, vector<TCell> &combinedCells) {
129 if (selectCells.size()==0)
return;
131 map<UInt_t, vector<Float_t> > etaSliceE;
134 vector<TCell>::iterator i_it = selectCells.begin();
135 for (; i_it != selectCells.end(); ++i_it) {
138 etaSliceE[thisKey].push_back(i_it->e());
141 map<UInt_t, vector<Float_t> >::iterator m_it = etaSliceE.begin();
142 for (; m_it != etaSliceE.end(); ++m_it) {
143 combinedCells.push_back(
TCell(m_it->first, accumulate(m_it->second.begin(), m_it->second.end(), 0.0) ) );
153 vector<TCell> summedDepthsCells = selectCells;
156 vector<TCell>::iterator highCell = summedDepthsCells.begin();
160 Float_t highE = -999;
162 for (vector<TCell>::iterator it=summedDepthsCells.begin(); it!=summedDepthsCells.end(); ++it) {
163 if (highE < it->e()) {
169 iEtaMostE =
HcalDetId(highCell->id()).ieta();
170 iPhiMostE =
HcalDetId(highCell->id()).iphi();
184 vector<TCell> filteredCells;
188 for (vector<TCell>::iterator it=selectCells.begin(); it!=selectCells.end(); ++it) {
190 Bool_t passDEta =
false;
191 Bool_t passDPhi =
false;
193 dEta =
HcalDetId(it->id()).ieta() - iEtaMaxE;
194 dPhi =
HcalDetId(it->id()).iphi() - iPhiMaxE;
196 if (dPhi > 36) dPhi -= 72;
197 if (dPhi < -36) dPhi += 72;
199 if (
abs(dEta)<=1 || (iEtaMaxE *
HcalDetId(it->id()).ieta() == -1)) passDEta =
true;
201 if (
abs(iEtaMaxE)<=20) {
204 if (
abs(dPhi)<=1) passDPhi =
true;
209 if (
abs(dPhi)<=1) passDPhi =
true;
212 if (dPhi== -2 || dPhi==0) passDPhi =
true;
220 if (
abs(dPhi)<=1 || dPhi==2) passDPhi =
true;
223 if (
abs(dPhi)<=2) passDPhi =
true;
227 if (passDEta && passDPhi) filteredCells.push_back(*it);
230 selectCells = filteredCells;
245 vector<TCell> filteredCells;
249 for (vector<TCell>::iterator it=selectCells.begin(); it!=selectCells.end(); ++it) {
251 dEta =
HcalDetId(it->id()).ieta() - iEtaMaxE;
252 dPhi =
HcalDetId(it->id()).iphi() - iPhiMaxE;
254 if (dPhi > 36) dPhi -= 72;
255 if (dPhi < -36) dPhi += 72;
257 bool passDPhi = (
abs(dPhi)<3);
259 bool passDEta = (
abs(dEta)<3 || (iEtaMaxE *
HcalDetId(it->id()).ieta() == -2) );
262 if (passDPhi && passDEta) filteredCells.push_back(*it);
266 selectCells = filteredCells;
279 if (selectCells.size()==0)
return;
281 vector<TCell> newCells;
282 vector<TCell> manipulatedCells;
284 for (vector<TCell>::iterator i_it = selectCells.begin(); i_it != selectCells.end(); ++i_it) {
288 manipulatedCells.push_back(*i_it);
291 newCells.push_back(*i_it);
299 if (manipulatedCells.size()<1) {
308 vector<UInt_t> dummyIds;
309 vector<TCell> createdCells;
311 for (vector<TCell>::iterator i_it = manipulatedCells.begin(); i_it!=manipulatedCells.end(); ++i_it) {
313 if (
find(dummyIds.begin(), dummyIds.end(), dummyId)==dummyIds.end()) {
314 dummyIds.push_back(dummyId);
315 createdCells.push_back(
TCell(dummyId, 0.0));
319 for (vector<TCell>::iterator i_it = createdCells.begin(); i_it!=createdCells.end(); ++i_it) {
320 for (vector<TCell>::iterator i_it2 = manipulatedCells.begin(); i_it2!=manipulatedCells.end(); ++i_it2) {
324 i_it->SetE(i_it->e()+i_it2->e());
329 for (vector<TCell>::iterator i_it = createdCells.begin(); i_it!=createdCells.end(); ++i_it) {
330 newCells.push_back(*i_it);
335 selectCells = newCells;
344 vector<TCell> filteredCells;
346 for (vector<TCell>::iterator it=selectCells.begin(); it!=selectCells.end(); ++it) {
351 filteredCells.push_back(*it);
354 selectCells = filteredCells;
378 double dotprod = caloIntersectUnitVector.
dot(rechitUnitVector);
379 double rechitdist = caloIntersectVector.mag()/dotprod;
382 const GlobalVector effectiveRechitVector = rechitdist*rechitUnitVector;
383 const GlobalPoint effectiveRechitPoint(effectiveRechitVector.
x(),
384 effectiveRechitVector.
y(),
385 effectiveRechitVector.
z());
388 GlobalVector distance_vector = effectiveRechitPoint-caloPoint;
392 return distance_vector.
mag();
void filterCellsInCone(std::vector< TCell > &selectCells, const GlobalPoint hitPositionHcal, Float_t maxConeDist, const CaloGeometry *theCaloGeometry)
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
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)
Vector3DBase unit() const
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)