Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "RecoEgamma/EgammaHLTAlgos/interface/EgammaHLTHcalIsolation.h"
00017
00018 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h"
00019 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
00020
00021 #include "DataFormats/Math/interface/deltaR.h"
00022 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00023
00024
00025 std::pair<float,float> EgammaHLTHcalIsolation::getSum(const float candEta,const float candPhi, const HBHERecHitCollection* hbhe, const CaloGeometry* geometry,const HcalSeverityLevelComputer* hcalSevLvlAlgo,const HcalChannelQuality* dbHcalChStatus)const
00026 {
00027 float sumE=0.;
00028 float sumEt=0.;
00029
00030 for(HBHERecHitCollection::const_iterator hbheItr = hbhe->begin(); hbheItr != hbhe->end(); ++hbheItr){
00031 if(passCleaning_(&(*hbheItr),hcalSevLvlAlgo,dbHcalChStatus)){
00032
00033
00034 HcalDetId id = hbheItr->id();
00035 if(!(id.ietaAbs()==28 && id.depth()==3)){
00036 float energy = hbheItr->energy();
00037 const GlobalPoint& pos = geometry->getPosition(id);
00038 if(acceptHit_(id,pos,energy,candEta,candPhi)){
00039 sumE+=energy;
00040 sumEt+=energy*sin(pos.theta());
00041 }
00042 }else{
00043
00044 float energy = hbheItr->energy()/2.;
00045 HcalDetId tower28Id(id.subdet(),28*id.zside(),id.iphi(),2);
00046 const GlobalPoint& tower28Pos = geometry->getPosition(tower28Id);
00047 if(acceptHit_(id,tower28Pos,energy,candEta,candPhi)){
00048 sumE+=energy;
00049 sumEt+=energy*sin(tower28Pos.theta());
00050 }
00051 HcalDetId tower29Id(id.subdet(),29*id.zside(),id.iphi(),2);
00052 const GlobalPoint& tower29Pos = geometry->getPosition(tower29Id);
00053 if(acceptHit_(id,tower29Pos,energy,candEta,candPhi)){
00054 sumE+=energy;
00055 sumEt+=energy*sin(tower29Pos.theta());
00056 }
00057 }
00058 }
00059 }
00060 return std::make_pair(sumE,sumEt);
00061
00062 }
00063
00064
00065
00066 bool EgammaHLTHcalIsolation::acceptHit_(const HcalDetId id,const GlobalPoint& pos,const float hitEnergy,const float candEta,const float candPhi)const
00067 {
00068 if(passMinE_(hitEnergy,id) && passDepth_(id)){
00069 float innerConeSq = innerCone_*innerCone_;
00070 float outerConeSq = outerCone_*outerCone_;
00071
00072 float hitEta = pos.eta();
00073 float hitPhi = pos.phi();
00074
00075 float dR2 = reco::deltaR2(candEta,candPhi,hitEta,hitPhi);
00076
00077 if(dR2>=innerConeSq && dR2<outerConeSq) {
00078 float hitEt = hitEnergy*sin(2*atan(exp(-hitEta)));
00079 if(passMinEt_(hitEt,id)) return true;
00080 }
00081 }
00082
00083 return false;
00084 }
00085
00086 bool EgammaHLTHcalIsolation::passMinE_(float energy,const HcalDetId id)const
00087 {
00088 if(id.subdet()==HcalBarrel && energy>=eMinHB_) return true;
00089 else if(id.subdet()==HcalEndcap && energy>=eMinHE_) return true;
00090 else return false;
00091 }
00092
00093 bool EgammaHLTHcalIsolation::passMinEt_(float et,const HcalDetId id)const
00094 {
00095 if(id.subdet()==HcalBarrel && et>=etMinHB_) return true;
00096 else if(id.subdet()==HcalEndcap && et>=etMinHE_) return true;
00097 else return false;
00098
00099 }
00100
00101 bool EgammaHLTHcalIsolation::passDepth_(const HcalDetId id)const
00102 {
00103 if(depth_==-1) return true;
00104 else if(getEffectiveDepth(id)==depth_) return true;
00105 else return false;
00106
00107 }
00108
00109
00110 bool EgammaHLTHcalIsolation::passCleaning_(const CaloRecHit* hit,const HcalSeverityLevelComputer* hcalSevLvlComp,
00111 const HcalChannelQuality* hcalChanStatus)const
00112 {
00113 if(hcalSevLvlComp==NULL || hcalChanStatus==NULL) return true;
00114
00115 const DetId id = hit->detid();
00116
00117 const uint32_t recHitFlag = hit->flags();
00118 const uint32_t dbStatusFlag = hcalChanStatus->getValues(id)->getValue();
00119
00120 int severityLevel = hcalSevLvlComp->getSeverityLevel(id,recHitFlag,dbStatusFlag);
00121 bool isRecovered = hcalSevLvlComp->recoveredRecHit(id,recHitFlag);
00122
00123 if(severityLevel == 0) return true;
00124 else if(isRecovered) return useRecoveredHcalHits_;
00125 else if(severityLevel <= hcalAcceptSeverityLevel_) return true;
00126 else return false;
00127 }
00128
00129
00130
00131
00132 int EgammaHLTHcalIsolation::getEffectiveDepth(const HcalDetId id)
00133 {
00134 int iEtaAbs = id.ietaAbs();
00135 int depth = id.depth();
00136 if(iEtaAbs<=17 ||
00137 (iEtaAbs<=29 && depth==1) ||
00138 (iEtaAbs>=27 && iEtaAbs<=29 && depth==2)){
00139 return 1;
00140 }else return 2;
00141
00142 }