20 if (selectCells.empty())
23 std::vector<TCell> selectCellsDepth1;
24 std::vector<TCell> selectCellsHighDepth;
33 for (std::vector<TCell>::iterator i_it = selectCells.begin(); i_it != selectCells.end(); ++i_it) {
35 selectCellsDepth1.push_back(*i_it);
37 selectCellsHighDepth.push_back(*i_it);
43 for (std::vector<TCell>::iterator i_it2 = selectCellsHighDepth.begin(); i_it2 != selectCellsHighDepth.end();
47 edm::LogWarning(
"HcalCalib") <<
"ERROR!!! there are no HB cells with depth>1 for iEta<15!\n"
48 <<
"Check the input data...\nHCalDetId: " <<
HcalDetId(i_it2->id());
52 bool foundDepthOne =
false;
53 for (std::vector<TCell>::iterator i_it = selectCellsDepth1.begin(); i_it != selectCellsDepth1.end(); ++i_it) {
68 selectCellsDepth1.push_back(
TCell(newId, 0.0));
72 for (std::vector<TCell>::iterator i_it = selectCellsDepth1.begin(); i_it != selectCellsDepth1.end(); ++i_it) {
73 for (std::vector<TCell>::iterator i_it2 = selectCellsHighDepth.begin(); i_it2 != selectCellsHighDepth.end();
77 i_it->SetE(i_it->e() + i_it2->e());
84 selectCells = selectCellsDepth1;
93 if (selectCells.empty())
99 std::vector<TCell> combinedCells;
101 std::map<UInt_t, std::vector<Float_t> > etaSliceE;
104 std::vector<TCell>::iterator i_it = selectCells.begin();
105 for (; i_it != selectCells.end(); ++i_it) {
108 etaSliceE[thisKey].push_back(i_it->e());
111 std::map<UInt_t, std::vector<Float_t> >::iterator m_it = etaSliceE.begin();
112 for (; m_it != etaSliceE.end(); ++m_it) {
113 combinedCells.push_back(
TCell(m_it->first, accumulate(m_it->second.begin(), m_it->second.end(), 0.0)));
117 selectCells = combinedCells;
120 void combinePhi(std::vector<TCell>& selectCells, std::vector<TCell>& combinedCells) {
124 if (selectCells.empty())
127 std::map<UInt_t, std::vector<Float_t> > etaSliceE;
130 std::vector<TCell>::iterator i_it = selectCells.begin();
131 for (; i_it != selectCells.end(); ++i_it) {
134 etaSliceE[thisKey].push_back(i_it->e());
137 std::map<UInt_t, std::vector<Float_t> >::iterator m_it = etaSliceE.begin();
138 for (; m_it != etaSliceE.end(); ++m_it) {
139 combinedCells.push_back(
TCell(m_it->first, accumulate(m_it->second.begin(), m_it->second.end(), 0.0)));
144 std::vector<TCell> summedDepthsCells = selectCells;
147 std::vector<TCell>::iterator highCell = summedDepthsCells.begin();
151 Float_t highE = -999;
153 for (std::vector<TCell>::iterator it = summedDepthsCells.begin(); it != summedDepthsCells.end(); ++it) {
154 if (highE < it->
e()) {
160 iEtaMostE =
HcalDetId(highCell->id()).ieta();
161 iPhiMostE =
HcalDetId(highCell->id()).iphi();
172 void filterCells3x3(std::vector<TCell>& selectCells, Int_t iEtaMaxE, UInt_t iPhiMaxE) {
173 std::vector<TCell> filteredCells;
177 for (std::vector<TCell>::iterator it = selectCells.begin(); it != selectCells.end(); ++it) {
178 Bool_t passDEta =
false;
179 Bool_t passDPhi =
false;
181 dEta =
HcalDetId(it->id()).ieta() - iEtaMaxE;
182 dPhi =
HcalDetId(it->id()).iphi() - iPhiMaxE;
189 if (
abs(dEta) <= 1 || (iEtaMaxE *
HcalDetId(it->id()).ieta() == -1))
192 if (
abs(iEtaMaxE) <= 20) {
198 if (iPhiMaxE % 2 == 0) {
202 if (dPhi == -2 || dPhi == 0)
211 if (
abs(dPhi) <= 1 || dPhi == 2)
219 if (passDEta && passDPhi)
220 filteredCells.push_back(*it);
223 selectCells = filteredCells;
236 void filterCells5x5(std::vector<TCell>& selectCells, Int_t iEtaMaxE, UInt_t iPhiMaxE) {
237 std::vector<TCell> filteredCells;
241 for (std::vector<TCell>::iterator it = selectCells.begin(); it != selectCells.end(); ++it) {
242 dEta =
HcalDetId(it->id()).ieta() - iEtaMaxE;
243 dPhi =
HcalDetId(it->id()).iphi() - iPhiMaxE;
250 bool passDPhi = (
abs(dPhi) < 3);
252 bool passDEta = (
abs(dEta) < 3 || (iEtaMaxE *
HcalDetId(it->id()).ieta() == -2));
255 if (passDPhi && passDEta)
256 filteredCells.push_back(*it);
259 selectCells = filteredCells;
268 if (selectCells.empty())
271 std::vector<TCell> newCells;
272 std::vector<TCell> manipulatedCells;
274 for (std::vector<TCell>::iterator i_it = selectCells.begin(); i_it != selectCells.end(); ++i_it) {
277 manipulatedCells.push_back(*i_it);
279 newCells.push_back(*i_it);
286 if (manipulatedCells.empty()) {
294 std::vector<UInt_t> dummyIds;
295 std::vector<TCell> createdCells;
297 for (std::vector<TCell>::iterator i_it = manipulatedCells.begin(); i_it != manipulatedCells.end(); ++i_it) {
300 if (
find(dummyIds.begin(), dummyIds.end(), dummyId) == dummyIds.end()) {
301 dummyIds.push_back(dummyId);
302 createdCells.push_back(
TCell(dummyId, 0.0));
306 for (std::vector<TCell>::iterator i_it = createdCells.begin(); i_it != createdCells.end(); ++i_it) {
307 for (std::vector<TCell>::iterator i_it2 = manipulatedCells.begin(); i_it2 != manipulatedCells.end(); ++i_it2) {
310 i_it->SetE(i_it->e() + i_it2->e());
315 for (std::vector<TCell>::iterator i_it = createdCells.begin(); i_it != createdCells.end(); ++i_it) {
316 newCells.push_back(*i_it);
320 selectCells = newCells;
329 std::vector<TCell> filteredCells;
331 for (std::vector<TCell>::iterator it = selectCells.begin(); it != selectCells.end(); ++it) {
341 filteredCells.push_back(*it);
344 selectCells = filteredCells;
void filterCellsInCone(std::vector< TCell > &selectCells, const GlobalPoint hitPositionHcal, Float_t maxConeDist, const CaloGeometry *theCaloGeometry)
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)
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Abs< T >::type abs(const T &t)
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)
Log< level::Warning, false > LogWarning
void getIEtaIPhiForHighestE(std::vector< TCell > &selectCells, Int_t &iEta, UInt_t &iPhi)