#include <EgammaRecHitIsolation.h>
Public Member Functions | |
void | doFlagChecks (const std::vector< int > v) |
void | doSpikeRemoval (const EcalRecHitCollection *const recHits, const EcalChannelStatus *const chStatus, const int &severityLevelCut=3) |
EgammaRecHitIsolation (double extRadius, double intRadius, double etaSlice, double etLow, double eLow, edm::ESHandle< CaloGeometry >, CaloRecHitMetaCollectionV *, const EcalSeverityLevelAlgo *, DetId::Detector detector) | |
double | getEnergySum (const reco::SuperCluster *emObject) const |
double | getEnergySum (const reco::Candidate *emObject) const |
double | getEtSum (const reco::SuperCluster *emObject) const |
double | getEtSum (const reco::Candidate *emObject) const |
void | setUseNumCrystals (bool b=true) |
void | setVetoClustered (bool b=true) |
~EgammaRecHitIsolation () | |
Private Member Functions | |
double | getSum_ (const reco::Candidate *, bool returnEt) const |
double | getSum_ (const reco::SuperCluster *, bool returnEt) const |
Private Attributes | |
CaloRecHitMetaCollectionV * | caloHits_ |
const EcalChannelStatus * | chStatus_ |
const EcalRecHitCollection * | ecalBarHits_ |
double | eLow_ |
double | etaSlice_ |
double | etLow_ |
double | extRadius_ |
double | intRadius_ |
int | severityLevelCut_ |
const EcalSeverityLevelAlgo * | sevLevel_ |
const CaloSubdetectorGeometry * | subdet_ [2] |
edm::ESHandle< CaloGeometry > | theCaloGeom_ |
bool | useNumCrystals_ |
std::vector< int > | v_chstatus_ |
bool | vetoClustered_ |
Definition at line 27 of file EgammaRecHitIsolation.h.
EgammaRecHitIsolation::EgammaRecHitIsolation | ( | double | extRadius, |
double | intRadius, | ||
double | etaSlice, | ||
double | etLow, | ||
double | eLow, | ||
edm::ESHandle< CaloGeometry > | theCaloGeom, | ||
CaloRecHitMetaCollectionV * | caloHits, | ||
const EcalSeverityLevelAlgo * | sl, | ||
DetId::Detector | detector | ||
) |
Definition at line 32 of file EgammaRecHitIsolation.cc.
References DetId::Ecal, EcalBarrel, EcalEndcap, CaloGeometry::getSubdetectorGeometry(), edm::ESHandle< T >::product(), subdet_, and theCaloGeom_.
: // not used anymore, kept for compatibility extRadius_(extRadius), intRadius_(intRadius), etaSlice_(etaSlice), etLow_(etLow), eLow_(eLow), theCaloGeom_(theCaloGeom) , caloHits_(caloHits), sevLevel_(sl), useNumCrystals_(false), vetoClustered_(false), ecalBarHits_(0), chStatus_(0), severityLevelCut_(-1), //severityRecHitThreshold_(0), //spId_(EcalSeverityLevelAlgo::kSwissCross), //spIdThreshold_(0), v_chstatus_(0) { //set up the geometry and selector const CaloGeometry* caloGeom = theCaloGeom_.product(); subdet_[0] = caloGeom->getSubdetectorGeometry(DetId::Ecal,EcalBarrel); subdet_[1] = caloGeom->getSubdetectorGeometry(DetId::Ecal,EcalEndcap); }
EgammaRecHitIsolation::~EgammaRecHitIsolation | ( | ) |
Definition at line 66 of file EgammaRecHitIsolation.cc.
{ }
void EgammaRecHitIsolation::doFlagChecks | ( | const std::vector< int > | v | ) | [inline] |
Definition at line 64 of file EgammaRecHitIsolation.h.
References python::multivaluedict::sort(), and v_chstatus_.
Referenced by GsfElectronAlgo::beginEvent(), ConversionTrackCandidateProducer::buildCollections(), and PhotonIsolationCalculator::calculateEcalRecHitIso().
{ v_chstatus_.clear(); v_chstatus_.insert(v_chstatus_.begin(),v.begin(),v.end()); std::sort( v_chstatus_.begin(), v_chstatus_.end() ); }
void EgammaRecHitIsolation::doSpikeRemoval | ( | const EcalRecHitCollection *const | recHits, |
const EcalChannelStatus *const | chStatus, | ||
const int & | severityLevelCut = 3 |
||
) | [inline] |
Definition at line 49 of file EgammaRecHitIsolation.h.
References chStatus_, ecalBarHits_, and severityLevelCut_.
Referenced by GsfElectronAlgo::beginEvent(), ConversionTrackCandidateProducer::buildCollections(), and PhotonIsolationCalculator::calculateEcalRecHitIso().
{ ecalBarHits_ = recHits; chStatus_ = chStatus; severityLevelCut_ = severityLevelCut; //severityRecHitThreshold_ = sevRecHitThresh; //spId_ = id; //spIdThreshold_ = spIdThresh; }
double EgammaRecHitIsolation::getEnergySum | ( | const reco::SuperCluster * | emObject | ) | const [inline] |
Definition at line 45 of file EgammaRecHitIsolation.h.
References getSum_().
{ return getSum_(emObject,false);}
double EgammaRecHitIsolation::getEnergySum | ( | const reco::Candidate * | emObject | ) | const [inline] |
Definition at line 42 of file EgammaRecHitIsolation.h.
References getSum_().
Referenced by EgammaHLTEcalRecIsolationProducer::produce(), and EgammaEcalRecHitIsolationProducer::produce().
{ return getSum_(emObject,false);}
double EgammaRecHitIsolation::getEtSum | ( | const reco::Candidate * | emObject | ) | const [inline] |
Definition at line 41 of file EgammaRecHitIsolation.h.
References getSum_().
Referenced by ConversionTrackCandidateProducer::buildCollections(), PhotonIsolationCalculator::calculateEcalRecHitIso(), GsfElectronAlgo::createElectron(), EgammaHLTEcalRecIsolationProducer::produce(), and EgammaEcalRecHitIsolationProducer::produce().
{return getSum_(emObject,true);}
double EgammaRecHitIsolation::getEtSum | ( | const reco::SuperCluster * | emObject | ) | const [inline] |
Definition at line 44 of file EgammaRecHitIsolation.h.
References getSum_().
{return getSum_(emObject,true);}
double EgammaRecHitIsolation::getSum_ | ( | const reco::SuperCluster * | sc, |
bool | returnEt | ||
) | const [private] |
Definition at line 177 of file EgammaRecHitIsolation.cc.
References caloHits_, reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), SiPixelRawToDigiRegional_cfi::deltaPhi, ecalBarHits_, eLow_, CaloRecHitMetaCollectionV::end(), relval_parameters_module::energy, CastorDataFrameFilter_impl::energySum(), eta(), PV3DBase< T, PVType, FrameType >::eta(), etaSlice_, etLow_, extRadius_, CaloRecHitMetaCollectionV::find(), spr::find(), CaloSubdetectorGeometry::getCells(), i, intRadius_, j, PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), phi, reco::CaloCluster::position(), position, edm::ESHandle< T >::product(), diffTwoXMLs::r2, EcalSeverityLevelAlgo::severityLevel(), severityLevelCut_, sevLevel_, mathSSE::sqrt(), subdet_, theCaloGeom_, useNumCrystals_, v_chstatus_, and vetoClustered_.
{ double energySum = 0.; if (caloHits_){ //Take the SC position math::XYZPoint theCaloPosition = sc->position(); GlobalPoint pclu (theCaloPosition.x () , theCaloPosition.y () , theCaloPosition.z () ); double etaclus = pclu.eta(); double phiclus = pclu.phi(); double r2 = intRadius_*intRadius_; std::vector< std::pair<DetId, float> >::const_iterator rhIt; for(int subdetnr=0; subdetnr<=1 ; subdetnr++){ // look in barrel and endcap CaloSubdetectorGeometry::DetIdSet chosen = subdet_[subdetnr]->getCells(pclu,extRadius_);// select cells around cluster CaloRecHitMetaCollectionV::const_iterator j=caloHits_->end(); for (CaloSubdetectorGeometry::DetIdSet::const_iterator i = chosen.begin ();i!= chosen.end ();++i){//loop selected cells j=caloHits_->find(*i); // find selected cell among rechits if( j!=caloHits_->end()){ // add rechit only if available const GlobalPoint & position = theCaloGeom_.product()->getPosition(*i); double eta = position.eta(); double phi = position.phi(); double etaDiff = eta - etaclus; double phiDiff= reco::deltaPhi(phi,phiclus); double energy = j->energy(); if(useNumCrystals_) { if( fabs(etaclus) < 1.479 ) { // Barrel num crystals, crystal width = 0.0174 if ( fabs(etaDiff) < 0.0174*etaSlice_) continue; if ( sqrt(etaDiff*etaDiff + phiDiff*phiDiff) < 0.0174*intRadius_) continue; } else { // Endcap num crystals, crystal width = 0.00864*fabs(sinh(eta)) if ( fabs(etaDiff) < 0.00864*fabs(sinh(eta))*etaSlice_) continue; if ( sqrt(etaDiff*etaDiff + phiDiff*phiDiff) < 0.00864*fabs(sinh(eta))*intRadius_) continue; } } else { if ( fabs(etaDiff) < etaSlice_) continue; // jurassic strip cut if ( etaDiff*etaDiff + phiDiff*phiDiff < r2) continue; // jurassic exclusion cone cut } //Check if RecHit is in SC if(vetoClustered_) { //Loop over basic clusters: bool isClustered = false; for(reco::CaloCluster_iterator bcIt = sc->clustersBegin();bcIt != sc->clustersEnd(); ++bcIt) { for(rhIt = (*bcIt)->hitsAndFractions().begin();rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) { if( rhIt->first == *i ) isClustered = true; if( isClustered ) break; } if( isClustered ) break; } //end loop over basic clusters if(isClustered) continue; } //end if removeClustered //Severity level check //make sure we have a barrel rechit //call the severity level method //passing the EBDetId //the rechit collection in order to calculate the swiss crss //and the EcalChannelRecHitRcd //only consider rechits with ET > //the SpikeId method (currently kE1OverE9 or kSwissCross) //cut value for above //then if the severity level is too high, we continue to the next rechit if( severityLevelCut_!=-1 && ecalBarHits_ && sevLevel_->severityLevel(EBDetId(j->detid()), *ecalBarHits_) >= severityLevelCut_) continue; // *chStatus_, // severityRecHitThreshold_, // spId_, // spIdThreshold_ // ) >= severityLevelCut_) continue; //Check based on flags to protect from recovered channels from non-read towers //Assumption is that v_chstatus_ is empty unless doFlagChecks() has been called std::vector<int>::const_iterator vit = std::find( v_chstatus_.begin(), v_chstatus_.end(), ((EcalRecHit*)(&*j))->recoFlag() ); if ( vit != v_chstatus_.end() ) continue; // the recHit has to be excluded from the iso sum double et = energy*position.perp()/position.mag(); if ( fabs(et) > etLow_ && fabs(energy) > eLow_){ //Changed energy --> fabs(energy) if(returnEt) energySum+=et; else energySum+=energy; } } //End if not end of list } //End loop over rechits } //End loop over barrel/endcap } //End if caloHits_ return energySum; }
double EgammaRecHitIsolation::getSum_ | ( | const reco::Candidate * | emObject, |
bool | returnEt | ||
) | const [private] |
Definition at line 70 of file EgammaRecHitIsolation.cc.
References caloHits_, SiPixelRawToDigiRegional_cfi::deltaPhi, ecalBarHits_, eLow_, CaloRecHitMetaCollectionV::end(), relval_parameters_module::energy, CastorDataFrameFilter_impl::energySum(), eta(), PV3DBase< T, PVType, FrameType >::eta(), etaSlice_, etLow_, extRadius_, CaloRecHitMetaCollectionV::find(), spr::find(), reco::Candidate::get(), edm::Ref< C, T, F >::get(), CaloSubdetectorGeometry::getCells(), i, intRadius_, j, PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), phi, position, edm::ESHandle< T >::product(), diffTwoXMLs::r2, EcalSeverityLevelAlgo::severityLevel(), severityLevelCut_, sevLevel_, mathSSE::sqrt(), subdet_, theCaloGeom_, useNumCrystals_, v_chstatus_, and vetoClustered_.
Referenced by getEnergySum(), and getEtSum().
{ double energySum = 0.; if (caloHits_){ //Take the SC position reco::SuperClusterRef sc = emObject->get<reco::SuperClusterRef>(); math::XYZPoint theCaloPosition = sc.get()->position(); GlobalPoint pclu (theCaloPosition.x () , theCaloPosition.y () , theCaloPosition.z () ); double etaclus = pclu.eta(); double phiclus = pclu.phi(); double r2 = intRadius_*intRadius_; std::vector< std::pair<DetId, float> >::const_iterator rhIt; for(int subdetnr=0; subdetnr<=1 ; subdetnr++){ // look in barrel and endcap CaloSubdetectorGeometry::DetIdSet chosen = subdet_[subdetnr]->getCells(pclu,extRadius_);// select cells around cluster CaloRecHitMetaCollectionV::const_iterator j=caloHits_->end(); for (CaloSubdetectorGeometry::DetIdSet::const_iterator i = chosen.begin ();i!= chosen.end ();++i){//loop selected cells j=caloHits_->find(*i); // find selected cell among rechits if( j!=caloHits_->end()){ // add rechit only if available const GlobalPoint & position = theCaloGeom_.product()->getPosition(*i); double eta = position.eta(); double phi = position.phi(); double etaDiff = eta - etaclus; double phiDiff= reco::deltaPhi(phi,phiclus); double energy = j->energy(); if(useNumCrystals_) { if( fabs(etaclus) < 1.479 ) { // Barrel num crystals, crystal width = 0.0174 if ( fabs(etaDiff) < 0.0174*etaSlice_) continue; if ( sqrt(etaDiff*etaDiff + phiDiff*phiDiff) < 0.0174*intRadius_) continue; } else { // Endcap num crystals, crystal width = 0.00864*fabs(sinh(eta)) if ( fabs(etaDiff) < 0.00864*fabs(sinh(eta))*etaSlice_) continue; if ( sqrt(etaDiff*etaDiff + phiDiff*phiDiff) < 0.00864*fabs(sinh(eta))*intRadius_) continue; } } else { if ( fabs(etaDiff) < etaSlice_) continue; // jurassic strip cut if ( etaDiff*etaDiff + phiDiff*phiDiff < r2) continue; // jurassic exclusion cone cut } //Check if RecHit is in SC if(vetoClustered_) { //Loop over basic clusters: bool isClustered = false; for(reco::CaloCluster_iterator bcIt = sc->clustersBegin();bcIt != sc->clustersEnd(); ++bcIt) { for(rhIt = (*bcIt)->hitsAndFractions().begin();rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) { if( rhIt->first == *i ) isClustered = true; if( isClustered ) break; } if( isClustered ) break; } //end loop over basic clusters if(isClustered) continue; } //end if removeClustered //Severity level check //make sure we have a barrel rechit //call the severity level method //passing the EBDetId //the rechit collection in order to calculate the swiss crss //and the EcalChannelRecHitRcd //only consider rechits with ET > //the SpikeId method (currently kE1OverE9 or kSwissCross) //cut value for above //then if the severity level is too high, we continue to the next rechit if( severityLevelCut_!=-1 && ecalBarHits_ && sevLevel_->severityLevel(EBDetId(j->detid()), *ecalBarHits_) >= severityLevelCut_) continue; // *chStatus_, // severityRecHitThreshold_, // spId_, // spIdThreshold_ // ) >= severityLevelCut_) continue; //Check based on flags to protect from recovered channels from non-read towers //Assumption is that v_chstatus_ is empty unless doFlagChecks() has been called std::vector<int>::const_iterator vit = std::find( v_chstatus_.begin(), v_chstatus_.end(), ((EcalRecHit*)(&*j))->recoFlag() ); if ( vit != v_chstatus_.end() ) continue; // the recHit has to be excluded from the iso sum double et = energy*position.perp()/position.mag(); if ( fabs(et) > etLow_ && fabs(energy) > eLow_){ //Changed energy --> fabs(energy) if(returnEt) energySum+=et; else energySum+=energy; } } //End if not end of list } //End loop over rechits } //End loop over barrel/endcap } //End if caloHits_ return energySum; }
void EgammaRecHitIsolation::setUseNumCrystals | ( | bool | b = true | ) | [inline] |
Definition at line 47 of file EgammaRecHitIsolation.h.
References b, and useNumCrystals_.
Referenced by GsfElectronAlgo::beginEvent(), ConversionTrackCandidateProducer::buildCollections(), PhotonIsolationCalculator::calculateEcalRecHitIso(), EgammaHLTEcalRecIsolationProducer::produce(), and EgammaEcalRecHitIsolationProducer::produce().
{ useNumCrystals_ = b; }
void EgammaRecHitIsolation::setVetoClustered | ( | bool | b = true | ) | [inline] |
Definition at line 48 of file EgammaRecHitIsolation.h.
References b, and vetoClustered_.
Referenced by GsfElectronAlgo::beginEvent(), ConversionTrackCandidateProducer::buildCollections(), PhotonIsolationCalculator::calculateEcalRecHitIso(), and EgammaEcalRecHitIsolationProducer::produce().
{ vetoClustered_ = b; }
Definition at line 85 of file EgammaRecHitIsolation.h.
Referenced by getSum_().
const EcalChannelStatus* EgammaRecHitIsolation::chStatus_ [private] |
Definition at line 91 of file EgammaRecHitIsolation.h.
Referenced by doSpikeRemoval().
const EcalRecHitCollection* EgammaRecHitIsolation::ecalBarHits_ [private] |
Definition at line 90 of file EgammaRecHitIsolation.h.
Referenced by doSpikeRemoval(), and getSum_().
double EgammaRecHitIsolation::eLow_ [private] |
Definition at line 81 of file EgammaRecHitIsolation.h.
Referenced by getSum_().
double EgammaRecHitIsolation::etaSlice_ [private] |
Definition at line 79 of file EgammaRecHitIsolation.h.
Referenced by getSum_().
double EgammaRecHitIsolation::etLow_ [private] |
Definition at line 80 of file EgammaRecHitIsolation.h.
Referenced by getSum_().
double EgammaRecHitIsolation::extRadius_ [private] |
Definition at line 77 of file EgammaRecHitIsolation.h.
Referenced by getSum_().
double EgammaRecHitIsolation::intRadius_ [private] |
Definition at line 78 of file EgammaRecHitIsolation.h.
Referenced by getSum_().
int EgammaRecHitIsolation::severityLevelCut_ [private] |
Definition at line 92 of file EgammaRecHitIsolation.h.
Referenced by doSpikeRemoval(), and getSum_().
const EcalSeverityLevelAlgo* EgammaRecHitIsolation::sevLevel_ [private] |
Definition at line 86 of file EgammaRecHitIsolation.h.
Referenced by getSum_().
const CaloSubdetectorGeometry* EgammaRecHitIsolation::subdet_[2] [private] |
Definition at line 98 of file EgammaRecHitIsolation.h.
Referenced by EgammaRecHitIsolation(), and getSum_().
Definition at line 84 of file EgammaRecHitIsolation.h.
Referenced by EgammaRecHitIsolation(), and getSum_().
bool EgammaRecHitIsolation::useNumCrystals_ [private] |
Definition at line 88 of file EgammaRecHitIsolation.h.
Referenced by getSum_(), and setUseNumCrystals().
std::vector<int> EgammaRecHitIsolation::v_chstatus_ [private] |
Definition at line 96 of file EgammaRecHitIsolation.h.
Referenced by doFlagChecks(), and getSum_().
bool EgammaRecHitIsolation::vetoClustered_ [private] |
Definition at line 89 of file EgammaRecHitIsolation.h.
Referenced by getSum_(), and setVetoClustered().