22 HBRecHitEnergyThreshold = 0.;
23 HERecHitEnergyThreshold = 0.;
24 SumEnergyThreshold = 0.;
30 return Calculate(TheCaloGeometry, TheHBHERecHits, TheCaloTowers);
42 float MinTimeHits[73];
44 float MaxTimeHits[73];
45 for(
unsigned int i = 0 ;
i < 73 ;
i++ )
56 switch (
id.subdet() )
59 if(
hit->energy() < HBRecHitEnergyThreshold )
continue;
62 if(
hit->energy() < HERecHitEnergyThreshold )
continue;
72 SumE[iPhi]+=
hit->energy();
76 MinTimeHits[iPhi] = time < MinTimeHits[iPhi] ? time : MinTimeHits[iPhi];
77 MaxTimeHits[iPhi] = time > MaxTimeHits[iPhi] ? time : MaxTimeHits[iPhi];
81 for(
int iPhi = 1 ; iPhi < 73 ; iPhi++ )
83 if( SumE[iPhi] >= SumEnergyThreshold && NumHits[iPhi] > NHitsThreshold )
86 PhiWedge wedge(SumE[iPhi], iPhi, NumHits[iPhi], MinTimeHits[iPhi], MaxTimeHits[iPhi]);
89 std::vector<const HBHERecHit*> Hits;
94 if(
id.iphi() != iPhi )
continue;
96 switch (
id.subdet() )
99 if(
hit->energy() < HBRecHitEnergyThreshold )
continue;
102 if(
hit->energy() < HERecHitEnergyThreshold )
continue;
107 Hits.push_back(&(*
hit));
111 float MinusToPlus = 0.;
112 float PlusToMinus = 0.;
113 for(
unsigned int i = 0 ;
i < Hits.size() ;
i++ )
116 int ieta_i = id_i.
ieta();
117 for(
unsigned int j = (
i+1) ;
j < Hits.size() ;
j++ )
120 int ieta_j = id_j.
ieta();
121 if( ieta_i > ieta_j ) PlusToMinus +=
TMath::Abs(ieta_i - ieta_j ) ;
122 else MinusToPlus +=
TMath::Abs(ieta_i - ieta_j);
125 float PlusZOriginConfidence = (PlusToMinus + MinusToPlus )? PlusToMinus / ( PlusToMinus + MinusToPlus ) : -1. ;
133 std::vector<const CaloTower*> sortedCaloTowers;
135 if(
abs(tower->ieta()) <= maxAbsIEta && tower->numProblematicHcalCells() > 0)
136 sortedCaloTowers.push_back(&(*tower));
145 int prevIEta = -99, prevIPhi = -99;
146 float prevHadEt = 0.;
147 std::pair<uint8_t, CaloTowerDetId> prevPair, towerPair;
148 bool wasContiguous =
true;
150 for(
unsigned int i = 0;
i < sortedCaloTowers.size();
i++) {
155 bool newIPhi = tower->
iphi() != prevIPhi;
156 bool isContiguous = tower->
ieta() == 1 ? tower->
ieta() - 2 == prevIEta : tower->
ieta() - 1 == prevIEta;
158 isContiguous = isContiguous || (tower->
ieta() == -maxAbsIEta);
159 if(newIPhi) isContiguous =
false;
161 if(!wasContiguous && isContiguous) {
162 strip.cellTowerIds.push_back(prevPair);
163 strip.cellTowerIds.push_back(towerPair);
164 strip.hadEt += prevHadEt + tower->
hadEt();
167 if(wasContiguous && isContiguous) {
168 strip.cellTowerIds.push_back(towerPair);
169 strip.hadEt += tower->
hadEt();
172 if((wasContiguous && !isContiguous) ||
i == sortedCaloTowers.size()-1) {
173 if(strip.cellTowerIds.size() > 2) {
179 wasContiguous = isContiguous;
180 prevPair = towerPair;
181 prevIPhi = tower->
iphi();
182 prevIEta = tower->
ieta();
183 prevHadEt = tower->
hadEt();
186 return TheHcalHaloData;
std::vector< HBHERecHit >::const_iterator const_iterator
Helper class for the calculation of a top and a W boson mass estime.
int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
void SetPlusZOriginConfidence(float x)
reco::HcalHaloData Calculate(const CaloGeometry &TheCaloGeometry, edm::Handle< HBHERecHitCollection > &TheHBHERecHits, edm::Handle< CaloTowerCollection > &TheCaloTowers)
CaloTowerDetId id() const
unsigned int numProblematicHcalCells() const
bool CompareTowers(const CaloTower *x, const CaloTower *y)
const std::vector< HaloTowerStrip > & getProblematicStrips() const
bool CompareTime(const EcalRecHit *x, const EcalRecHit *y)
const std::vector< PhiWedge > & GetPhiWedges() const