51 float MinTimeHits[73];
53 float MaxTimeHits[73];
54 for(
unsigned int i = 0 ;
i < 73 ;
i++ )
65 switch (
id.subdet() )
81 SumE[iPhi]+=
hit->energy();
84 float time =
hit->time();
85 MinTimeHits[iPhi] = time < MinTimeHits[iPhi] ? time : MinTimeHits[iPhi];
86 MaxTimeHits[iPhi] = time > MaxTimeHits[iPhi] ? time : MaxTimeHits[iPhi];
90 for(
int iPhi = 1 ; iPhi < 73 ; iPhi++ )
95 PhiWedge wedge(SumE[iPhi], iPhi, NumHits[iPhi], MinTimeHits[iPhi], MaxTimeHits[iPhi]);
98 std::vector<const HBHERecHit*> Hits;
103 if(
id.iphi() != iPhi )
continue;
105 switch (
id.subdet() )
116 Hits.push_back(&(*
hit));
119 std::sort( Hits.begin() , Hits.end() ,
CompareTime);
120 float MinusToPlus = 0.;
121 float PlusToMinus = 0.;
122 for(
unsigned int i = 0 ;
i < Hits.size() ;
i++ )
125 int ieta_i = id_i.
ieta();
126 for(
unsigned int j = (
i+1) ;
j < Hits.size() ;
j++ )
129 int ieta_j = id_j.
ieta();
130 if( ieta_i > ieta_j ) PlusToMinus +=
TMath::Abs(ieta_i - ieta_j ) ;
131 else MinusToPlus +=
TMath::Abs(ieta_i - ieta_j);
134 float PlusZOriginConfidence = (PlusToMinus + MinusToPlus )? PlusToMinus / ( PlusToMinus + MinusToPlus ) : -1. ;
135 wedge.SetPlusZOriginConfidence( PlusZOriginConfidence );
145 std::map<int, float> iPhiHadEtMap;
146 std::vector<const CaloTower*> sortedCaloTowers;
148 if(
abs(tower->ieta()) > maxAbsIEta)
continue;
150 int iPhi = tower->iphi();
151 if(!iPhiHadEtMap.count(iPhi)) iPhiHadEtMap[iPhi] = 0.0;
152 iPhiHadEtMap[iPhi] += tower->hadEt();
154 if(tower->numProblematicHcalCells() > 0) sortedCaloTowers.push_back(&(*tower));
161 std::sort(sortedCaloTowers.begin(), sortedCaloTowers.end(),
CompareTowers);
166 int prevIEta = -99, prevIPhi = -99;
167 float prevHadEt = 0.;
169 std::pair<uint8_t, CaloTowerDetId> prevPair, towerPair;
170 bool wasContiguous =
true;
173 for(
unsigned int i = 0;
i < sortedCaloTowers.size();
i++) {
178 bool newIPhi = tower->
iphi() != prevIPhi;
179 bool isContiguous = tower->
ieta() == 1 ? tower->
ieta() - 2 == prevIEta : tower->
ieta() - 1 == prevIEta;
181 isContiguous = isContiguous || (tower->
ieta() == -maxAbsIEta);
182 if(newIPhi) isContiguous =
false;
184 if(!wasContiguous && isContiguous) {
185 strip.cellTowerIds.push_back(prevPair);
186 strip.cellTowerIds.push_back(towerPair);
187 strip.hadEt += prevHadEt + tower->
hadEt();
188 strip.emEt += prevEmEt + tower->
emEt();
191 if(wasContiguous && isContiguous) {
192 strip.cellTowerIds.push_back(towerPair);
193 strip.hadEt += tower->
hadEt();
194 strip.emEt += tower->
emEt();
197 if((wasContiguous && !isContiguous) ||
i == sortedCaloTowers.size()-1) {
199 if(strip.cellTowerIds.size() > 3) {
201 int iPhi = strip.cellTowerIds.at(0).second.iphi();
202 int iPhiLower = (iPhi == 1) ? 72 : iPhi - 1;
203 int iPhiUpper = (iPhi == 72) ? 1 : iPhi + 1;
205 float energyRatio = 0.0;
206 if(iPhiHadEtMap.count(iPhiLower)) energyRatio += iPhiHadEtMap[iPhiLower];
207 if(iPhiHadEtMap.count(iPhiUpper)) energyRatio += iPhiHadEtMap[iPhiUpper];
208 iPhiHadEtMap[iPhi] =
max(iPhiHadEtMap[iPhi], 0.001
F);
210 energyRatio /= iPhiHadEtMap[iPhi];
211 strip.energyRatio = energyRatio;
219 wasContiguous = isContiguous;
220 prevPair = towerPair;
221 prevEmEt = tower->
emEt();
222 prevIPhi = tower->
iphi();
223 prevIEta = tower->
ieta();
224 prevHadEt = tower->
hadEt();
242 std::vector<HaloClusterCandidateHCAL> haloclustercands_HB;
245 std::vector<HaloClusterCandidateHCAL> haloclustercands_HE;
252 return TheHcalHaloData;
float HERecHitEnergyThreshold
void setHaloClusterCandidatesHB(const std::vector< HaloClusterCandidateHCAL > &x)
std::vector< HBHERecHit >::const_iterator const_iterator
std::vector< reco::HaloClusterCandidateHCAL > GetHaloClusterCandidateHE(edm::Handle< EcalRecHitCollection > &eerechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)
int ieta() const
get the cell ieta
void setHaloClusterCandidatesHE(const std::vector< HaloClusterCandidateHCAL > &x)
Abs< T >::type abs(const T &t)
CaloTowerDetId id() const
unsigned int numProblematicHcalCells() const
bool CompareTowers(const CaloTower *x, const CaloTower *y)
T const * product() const
float HBRecHitEnergyThreshold
const std::vector< HaloTowerStrip > & getProblematicStrips() const
bool CompareTime(const EcalRecHit *x, const EcalRecHit *y)
const std::vector< PhiWedge > & GetPhiWedges() const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
std::vector< reco::HaloClusterCandidateHCAL > GetHaloClusterCandidateHB(edm::Handle< EcalRecHitCollection > &ebrechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)