#include <iostream>
#include <fstream>
#include <algorithm>
#include <numeric>
#include "TString.h"
#include "Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h"
#include "Calibration/HcalCalibAlgos/interface/CommonUsefulStuff.h"
Go to the source code of this file.
|
void | combinePhi (vector< TCell > &selectCells) |
|
void | combinePhi (vector< TCell > &selectCells, vector< TCell > &combinedCells) |
|
void | filterCells3x3 (vector< TCell > &selectCells, Int_t iEtaMaxE, UInt_t iPhiMaxE) |
|
void | filterCells5x5 (vector< TCell > &selectCells, Int_t iEtaMaxE, UInt_t iPhiMaxE) |
|
void | filterCellsInCone (std::vector< TCell > &selectCells, const GlobalPoint hitPositionHcal, Float_t maxConeDist, const CaloGeometry *theCaloGeometry) |
|
void | getIEtaIPhiForHighestE (vector< TCell > &selectCells, Int_t &iEtaMostE, UInt_t &iPhiMostE) |
|
void | sumDepths (vector< TCell > &selectCells) |
|
void | sumSmallDepths (vector< TCell > &selectCells) |
|
void combinePhi |
( |
vector< TCell > & |
selectCells | ) |
|
Definition at line 94 of file hcalCalibUtils.cc.
References HLT_25ns14e33_v1_cff::depth.
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;
void combinePhi |
( |
vector< TCell > & |
selectCells, |
|
|
vector< TCell > & |
combinedCells |
|
) |
| |
Definition at line 127 of file hcalCalibUtils.cc.
References HLT_25ns14e33_v1_cff::depth.
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) ) );
void filterCells3x3 |
( |
vector< TCell > & |
selectCells, |
|
|
Int_t |
iEtaMaxE, |
|
|
UInt_t |
iPhiMaxE |
|
) |
| |
Definition at line 185 of file hcalCalibUtils.cc.
References funct::abs(), and dPhi().
Referenced by hcalCalib::Process().
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;
double dPhi(double phi1, double phi2)
Abs< T >::type abs(const T &t)
void filterCells5x5 |
( |
vector< TCell > & |
selectCells, |
|
|
Int_t |
iEtaMaxE, |
|
|
UInt_t |
iPhiMaxE |
|
) |
| |
Definition at line 246 of file hcalCalibUtils.cc.
References funct::abs(), and dPhi().
Referenced by hcalCalib::Process().
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;
double dPhi(double phi1, double phi2)
Abs< T >::type abs(const T &t)
void filterCellsInCone |
( |
std::vector< TCell > & |
selectCells, |
|
|
const GlobalPoint |
hitPositionHcal, |
|
|
Float_t |
maxConeDist, |
|
|
const CaloGeometry * |
theCaloGeometry |
|
) |
| |
void getIEtaIPhiForHighestE |
( |
vector< TCell > & |
selectCells, |
|
|
Int_t & |
iEtaMostE, |
|
|
UInt_t & |
iPhiMostE |
|
) |
| |
Definition at line 153 of file hcalCalibUtils.cc.
References alignCSCRings::e, and diJetCalib::sumDepths.
Referenced by hcalCalib::Process().
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();
void sumDepths |
( |
vector< TCell > & |
selectCells | ) |
|
Definition at line 14 of file hcalCalibUtils.cc.
References funct::abs(), gather_cfg::cout, HLT_25ns14e33_v1_cff::depth, and HcalBarrel.
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;
Abs< T >::type abs(const T &t)
void sumSmallDepths |
( |
vector< TCell > & |
selectCells | ) |
|
Definition at line 280 of file hcalCalibUtils.cc.
References HLT_25ns14e33_v1_cff::depth, and spr::find().
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;
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)