21 if (selectCells.empty())
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);
38 selectCellsHighDepth.push_back(*i_it);
44 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;
53 bool foundDepthOne =
false;
54 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;
94 if (selectCells.empty())
100 vector<TCell> combinedCells;
102 map<UInt_t, vector<Float_t> > etaSliceE;
105 vector<TCell>::iterator i_it = selectCells.begin();
106 for (; i_it != selectCells.end(); ++i_it) {
109 etaSliceE[thisKey].push_back(i_it->e());
112 map<UInt_t, vector<Float_t> >::iterator m_it = etaSliceE.begin();
113 for (; m_it != etaSliceE.end(); ++m_it) {
114 combinedCells.push_back(
TCell(m_it->first, accumulate(m_it->second.begin(), m_it->second.end(), 0.0)));
118 selectCells = combinedCells;
121 void combinePhi(vector<TCell>& selectCells, vector<TCell>& combinedCells) {
125 if (selectCells.empty())
128 map<UInt_t, vector<Float_t> > etaSliceE;
131 vector<TCell>::iterator i_it = selectCells.begin();
132 for (; i_it != selectCells.end(); ++i_it) {
135 etaSliceE[thisKey].push_back(i_it->e());
138 map<UInt_t, vector<Float_t> >::iterator m_it = etaSliceE.begin();
139 for (; m_it != etaSliceE.end(); ++m_it) {
140 combinedCells.push_back(
TCell(m_it->first, accumulate(m_it->second.begin(), m_it->second.end(), 0.0)));
145 vector<TCell> summedDepthsCells = selectCells;
148 vector<TCell>::iterator highCell = summedDepthsCells.begin();
152 Float_t highE = -999;
154 for (vector<TCell>::iterator it = summedDepthsCells.begin(); it != summedDepthsCells.end(); ++it) {
155 if (highE < it->
e()) {
161 iEtaMostE =
HcalDetId(highCell->id()).ieta();
162 iPhiMostE =
HcalDetId(highCell->id()).iphi();
173 void filterCells3x3(vector<TCell>& selectCells, Int_t iEtaMaxE, UInt_t iPhiMaxE) {
174 vector<TCell> filteredCells;
178 for (vector<TCell>::iterator it = selectCells.begin(); it != selectCells.end(); ++it) {
179 Bool_t passDEta =
false;
180 Bool_t passDPhi =
false;
182 dEta =
HcalDetId(it->id()).ieta() - iEtaMaxE;
183 dPhi =
HcalDetId(it->id()).iphi() - iPhiMaxE;
190 if (
abs(dEta) <= 1 || (iEtaMaxE *
HcalDetId(it->id()).ieta() == -1))
193 if (
abs(iEtaMaxE) <= 20) {
199 if (iPhiMaxE % 2 == 0) {
203 if (dPhi == -2 || dPhi == 0)
212 if (
abs(dPhi) <= 1 || dPhi == 2)
220 if (passDEta && passDPhi)
221 filteredCells.push_back(*it);
224 selectCells = filteredCells;
237 void filterCells5x5(vector<TCell>& selectCells, Int_t iEtaMaxE, UInt_t iPhiMaxE) {
238 vector<TCell> filteredCells;
242 for (vector<TCell>::iterator it = selectCells.begin(); it != selectCells.end(); ++it) {
243 dEta =
HcalDetId(it->id()).ieta() - iEtaMaxE;
244 dPhi =
HcalDetId(it->id()).iphi() - iPhiMaxE;
251 bool passDPhi = (
abs(dPhi) < 3);
253 bool passDEta = (
abs(dEta) < 3 || (iEtaMaxE *
HcalDetId(it->id()).ieta() == -2));
256 if (passDPhi && passDEta)
257 filteredCells.push_back(*it);
260 selectCells = filteredCells;
269 if (selectCells.empty())
272 vector<TCell> newCells;
273 vector<TCell> manipulatedCells;
275 for (vector<TCell>::iterator i_it = selectCells.begin(); i_it != selectCells.end(); ++i_it) {
278 manipulatedCells.push_back(*i_it);
280 newCells.push_back(*i_it);
287 if (manipulatedCells.empty()) {
295 vector<UInt_t> dummyIds;
296 vector<TCell> createdCells;
298 for (vector<TCell>::iterator i_it = manipulatedCells.begin(); i_it != manipulatedCells.end(); ++i_it) {
301 if (
find(dummyIds.begin(), dummyIds.end(), dummyId) == dummyIds.end()) {
302 dummyIds.push_back(dummyId);
303 createdCells.push_back(
TCell(dummyId, 0.0));
307 for (vector<TCell>::iterator i_it = createdCells.begin(); i_it != createdCells.end(); ++i_it) {
308 for (vector<TCell>::iterator i_it2 = manipulatedCells.begin(); i_it2 != manipulatedCells.end(); ++i_it2) {
311 i_it->SetE(i_it->e() + i_it2->e());
316 for (vector<TCell>::iterator i_it = createdCells.begin(); i_it != createdCells.end(); ++i_it) {
317 newCells.push_back(*i_it);
321 selectCells = newCells;
330 vector<TCell> filteredCells;
332 for (vector<TCell>::iterator it = selectCells.begin(); it != selectCells.end(); ++it) {
342 filteredCells.push_back(*it);
345 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)