#include <GsfElectronAlgo.h>
Definition at line 49 of file GsfElectronAlgo.h.
typedef std::list<reco::GsfElectron *> GsfElectronAlgo::GsfElectronPtrCollection |
Definition at line 188 of file GsfElectronAlgo.h.
GsfElectronAlgo::GsfElectronAlgo | ( | const InputTagsConfiguration & | inputCfg, |
const StrategyConfiguration & | strategyCfg, | ||
const CutsConfiguration & | cutsCfg, | ||
const CutsConfiguration & | cutsCfgPflow, | ||
const ElectronHcalHelper::Configuration & | hcalCfg, | ||
const ElectronHcalHelper::Configuration & | hcalCfgPflow, | ||
const IsolationConfiguration & | isoCfg, | ||
const SpikeConfiguration & | spikeCfg, | ||
EcalClusterFunctionBaseClass * | superClusterErrorFunction | ||
) |
Definition at line 556 of file GsfElectronAlgo.cc.
: generalData_(new GeneralData(inputCfg,strategyCfg,cutsCfg,cutsCfgPflow,hcalCfg,hcalCfgPflow,isoCfg,spikeCfg,superClusterErrorFunction)), eventSetupData_(new EventSetupData), eventData_(0), electronData_(0) {}
GsfElectronAlgo::~GsfElectronAlgo | ( | ) |
Definition at line 571 of file GsfElectronAlgo.cc.
References electronData_, eventData_, eventSetupData_, and generalData_.
{ delete generalData_ ; delete eventSetupData_ ; delete eventData_ ; delete electronData_ ; }
void GsfElectronAlgo::addPflowInfo | ( | ) |
Definition at line 806 of file GsfElectronAlgo.cc.
References calculateShowerShape(), GsfElectronAlgo::EventData::electrons, eventData_, Exception, funct::false, newFWLiteAna::found, python::pfElectrons_cff::pfElectrons, GsfElectronAlgo::EventData::pflowElectrons, edm::Handle< T >::product(), setMvaPreselectionFlag(), and funct::true.
Referenced by GsfElectronProducer::produce().
{ bool found ; const GsfElectronCollection * pfElectrons = eventData_->pflowElectrons.product() ; GsfElectronCollection::const_iterator pfElectron ; GsfElectronPtrCollection::iterator el ; for ( el = eventData_->electrons->begin() ; el != eventData_->electrons->end() ; el++ ) { // // MVA // // we check that the value is never inferior to the no-cut value // // we generally use in the configuration file for minMVA. // GsfTrackRef gsfTrackRef = (*el)->gsfTrack() ; // float mva = (*eventData_->pfMva.product())[gsfTrackRef] ; // if (mva<noCutMin) { throw cms::Exception("GsfElectronAlgo|UnexpectedMvaValue")<<"unexpected MVA value: "<<mva ; } // // // Mva Output // GsfElectron::MvaOutput mvaOutput ; // mvaOutput.mva = mva ; // (*el)->setMvaOutput(mvaOutput) ; // Retreive info from pflow electrons found = false ; for ( pfElectron = pfElectrons->begin() ; pfElectron != pfElectrons->end() ; pfElectron++ ) { if (pfElectron->gsfTrack()==(*el)->gsfTrack()) { if (found) { edm::LogWarning("GsfElectronProducer")<<"associated pfGsfElectron already found" ; } else { found = true ; (*el)->setPfIsolationVariables(pfElectron->pfIsolationVariables()) ; (*el)->setMvaInput(pfElectron->mvaInput()) ; (*el)->setMvaOutput(pfElectron->mvaOutput()) ; if ((*el)->ecalDrivenSeed()) { (*el)->setP4(GsfElectron::P4_PFLOW_COMBINATION,pfElectron->p4(GsfElectron::P4_PFLOW_COMBINATION),pfElectron->p4Error(GsfElectron::P4_PFLOW_COMBINATION),false) ; } else { (*el)->setP4(GsfElectron::P4_PFLOW_COMBINATION,pfElectron->p4(GsfElectron::P4_PFLOW_COMBINATION),pfElectron->p4Error(GsfElectron::P4_PFLOW_COMBINATION),true) ; } double noCutMin = -999999999 ; if ((*el)->mva()<noCutMin) { throw cms::Exception("GsfElectronAlgo|UnexpectedMvaValue")<<"unexpected MVA value: "<<(*el)->mva() ; } } } } // Preselection setMvaPreselectionFlag(*el) ; // Shower Shape of pflow cluster if (!((*el)->pflowSuperCluster().isNull())) { reco::GsfElectron::ShowerShape pflowShowerShape ; calculateShowerShape((*el)->pflowSuperCluster(),true,pflowShowerShape) ; (*el)->setPfShowerShape(pflowShowerShape) ; } else if ((*el)->passingMvaPreselection()) { edm::LogError("GsfElectronCoreProducer")<<"Preselected tracker driven GsfTrack with no associated pflow SuperCluster." ; } } }
void GsfElectronAlgo::beginEvent | ( | edm::Event & | event | ) |
Definition at line 641 of file GsfElectronAlgo.cc.
References GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::InputTagsConfiguration::beamSpotTag, GsfElectronAlgo::EventSetupData::caloGeom, GsfElectronAlgo::EventSetupData::chStatus, GsfElectronAlgo::EventData::coreElectrons, GsfElectronAlgo::InputTagsConfiguration::ctfTracks, GsfElectronAlgo::EventData::currentCtfTracks, EgammaRecHitIsolation::doFlagChecks(), EgammaRecHitIsolation::doSpikeRemoval(), DetId::Ecal, GsfElectronAlgo::EventData::ecalBarrelHitsMeta, GsfElectronAlgo::EventData::ecalBarrelIsol03, GsfElectronAlgo::EventData::ecalBarrelIsol04, GsfElectronAlgo::EventData::ecalEndcapHitsMeta, GsfElectronAlgo::EventData::ecalEndcapIsol03, GsfElectronAlgo::EventData::ecalEndcapIsol04, GsfElectronAlgo::IsolationConfiguration::eMinBarrel, GsfElectronAlgo::IsolationConfiguration::eMinEndcaps, GsfElectronAlgo::IsolationConfiguration::etMinBarrel, GsfElectronAlgo::IsolationConfiguration::etMinEndcaps, GsfElectronAlgo::IsolationConfiguration::etMinHcal, event(), GsfElectronAlgo::EventData::event, eventData_, eventSetupData_, Exception, generalData_, GsfElectronAlgo::InputTagsConfiguration::gsfElectronCores, GsfElectronAlgo::EventData::gsfPfRecTracks, GsfElectronAlgo::InputTagsConfiguration::gsfPfRecTracksTag, GsfElectronAlgo::EventData::hadDepth1Isolation03, GsfElectronAlgo::EventData::hadDepth1Isolation03Bc, GsfElectronAlgo::EventData::hadDepth1Isolation04, GsfElectronAlgo::EventData::hadDepth1Isolation04Bc, GsfElectronAlgo::EventData::hadDepth2Isolation03, GsfElectronAlgo::EventData::hadDepth2Isolation03Bc, GsfElectronAlgo::EventData::hadDepth2Isolation04, GsfElectronAlgo::EventData::hadDepth2Isolation04Bc, GsfElectronAlgo::GeneralData::hcalHelper, GsfElectronAlgo::GeneralData::hcalHelperPflow, GsfElectronAlgo::InputTagsConfiguration::hcalTowersTag, GsfElectronAlgo::GeneralData::inputCfg, GsfElectronAlgo::IsolationConfiguration::intRadiusBarrelTk, GsfElectronAlgo::IsolationConfiguration::intRadiusEcalBarrel, GsfElectronAlgo::IsolationConfiguration::intRadiusEcalEndcaps, GsfElectronAlgo::IsolationConfiguration::intRadiusEndcapTk, GsfElectronAlgo::IsolationConfiguration::intRadiusHcal, GsfElectronAlgo::GeneralData::isoCfg, GsfElectronAlgo::IsolationConfiguration::jurassicWidth, GsfElectronAlgo::IsolationConfiguration::maxDrbTk, GsfElectronAlgo::IsolationConfiguration::maxVtxDistTk, GsfElectronAlgo::EventData::pflowElectrons, GsfElectronAlgo::InputTagsConfiguration::pflowGsfElectronsTag, GsfElectronAlgo::EventData::pfMva, GsfElectronAlgo::InputTagsConfiguration::pfMVA, reco::BeamSpot::position(), GsfElectronAlgo::EventData::previousElectrons, GsfElectronAlgo::InputTagsConfiguration::previousGsfElectrons, edm::ESHandle< T >::product(), edm::Handle< T >::product(), PtMinSelector_cfg::ptMin, GsfElectronAlgo::IsolationConfiguration::ptMinTk, ElectronHcalHelper::readEvent(), GsfElectronAlgo::SpikeConfiguration::recHitFlagsToBeExcluded, GsfElectronAlgo::InputTagsConfiguration::reducedBarrelRecHitCollection, GsfElectronAlgo::EventData::reducedEBRecHits, GsfElectronAlgo::EventData::reducedEERecHits, GsfElectronAlgo::InputTagsConfiguration::reducedEndcapRecHitCollection, GsfElectronAlgo::EventData::seeds, GsfElectronAlgo::InputTagsConfiguration::seedsTag, EgammaRecHitIsolation::setUseNumCrystals(), EgammaRecHitIsolation::setVetoClustered(), GsfElectronAlgo::SpikeConfiguration::severityLevelCut, GsfElectronAlgo::EventSetupData::sevLevel, GsfElectronAlgo::GeneralData::spikeCfg, GsfElectronAlgo::GeneralData::strategyCfg, GsfElectronAlgo::IsolationConfiguration::stripBarrelTk, GsfElectronAlgo::IsolationConfiguration::stripEndcapTk, GsfElectronAlgo::EventData::tkIsolation03, GsfElectronAlgo::EventData::tkIsolation04, GsfElectronAlgo::EventData::towers, GsfElectronAlgo::StrategyConfiguration::useGsfPfRecTracks, GsfElectronAlgo::IsolationConfiguration::useNumCrystals, and GsfElectronAlgo::IsolationConfiguration::vetoClustered.
Referenced by GsfElectronBaseProducer::beginEvent().
{ if (eventData_!=0) { throw cms::Exception("GsfElectronAlgo|InternalError")<<"unexpected event data" ; } eventData_ = new EventData ; // init the handles linked to the current event eventData_->event = &event ; event.getByLabel(generalData_->inputCfg.previousGsfElectrons,eventData_->previousElectrons) ; event.getByLabel(generalData_->inputCfg.pflowGsfElectronsTag,eventData_->pflowElectrons) ; event.getByLabel(generalData_->inputCfg.gsfElectronCores,eventData_->coreElectrons) ; event.getByLabel(generalData_->inputCfg.ctfTracks,eventData_->currentCtfTracks) ; event.getByLabel(generalData_->inputCfg.reducedBarrelRecHitCollection,eventData_->reducedEBRecHits) ; event.getByLabel(generalData_->inputCfg.reducedEndcapRecHitCollection,eventData_->reducedEERecHits) ; event.getByLabel(generalData_->inputCfg.hcalTowersTag,eventData_->towers) ; event.getByLabel(generalData_->inputCfg.pfMVA,eventData_->pfMva) ; event.getByLabel(generalData_->inputCfg.seedsTag,eventData_->seeds) ; if (generalData_->strategyCfg.useGsfPfRecTracks) { event.getByLabel(generalData_->inputCfg.gsfPfRecTracksTag,eventData_->gsfPfRecTracks) ; } // get the beamspot from the Event: edm::Handle<reco::BeamSpot> recoBeamSpotHandle ; event.getByLabel(generalData_->inputCfg.beamSpotTag,recoBeamSpotHandle) ; eventData_->beamspot = recoBeamSpotHandle.product() ; // prepare access to hcal data generalData_->hcalHelper->readEvent(event) ; generalData_->hcalHelperPflow->readEvent(event) ; // Isolation algos float extRadiusSmall=0.3, extRadiusLarge=0.4 ; float intRadiusBarrel=generalData_->isoCfg.intRadiusBarrelTk, intRadiusEndcap=generalData_->isoCfg.intRadiusEndcapTk, stripBarrel=generalData_->isoCfg.stripBarrelTk, stripEndcap=generalData_->isoCfg.stripEndcapTk ; float ptMin=generalData_->isoCfg.ptMinTk, maxVtxDist=generalData_->isoCfg.maxVtxDistTk, drb=generalData_->isoCfg.maxDrbTk; eventData_->tkIsolation03 = new ElectronTkIsolation(extRadiusSmall,intRadiusBarrel,intRadiusEndcap,stripBarrel,stripEndcap,ptMin,maxVtxDist,drb,eventData_->currentCtfTracks.product(),eventData_->beamspot->position()) ; eventData_->tkIsolation04 = new ElectronTkIsolation(extRadiusLarge,intRadiusBarrel,intRadiusEndcap,stripBarrel,stripEndcap,ptMin,maxVtxDist,drb,eventData_->currentCtfTracks.product(),eventData_->beamspot->position()) ; float egHcalIsoConeSizeOutSmall=0.3, egHcalIsoConeSizeOutLarge=0.4; float egHcalIsoConeSizeIn=generalData_->isoCfg.intRadiusHcal,egHcalIsoPtMin=generalData_->isoCfg.etMinHcal; int egHcalDepth1=1, egHcalDepth2=2; eventData_->hadDepth1Isolation03 = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ; eventData_->hadDepth2Isolation03 = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ; eventData_->hadDepth1Isolation04 = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ; eventData_->hadDepth2Isolation04 = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ; eventData_->hadDepth1Isolation03Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,0.,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ; eventData_->hadDepth2Isolation03Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,0.,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ; eventData_->hadDepth1Isolation04Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,0.,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ; eventData_->hadDepth2Isolation04Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,0.,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ; float egIsoConeSizeOutSmall=0.3, egIsoConeSizeOutLarge=0.4, egIsoJurassicWidth=generalData_->isoCfg.jurassicWidth; float egIsoPtMinBarrel=generalData_->isoCfg.etMinBarrel,egIsoEMinBarrel=generalData_->isoCfg.eMinBarrel, egIsoConeSizeInBarrel=generalData_->isoCfg.intRadiusEcalBarrel; float egIsoPtMinEndcap=generalData_->isoCfg.etMinEndcaps,egIsoEMinEndcap=generalData_->isoCfg.eMinEndcaps, egIsoConeSizeInEndcap=generalData_->isoCfg.intRadiusEcalEndcaps; eventData_->ecalBarrelHitsMeta = new EcalRecHitMetaCollection(*eventData_->reducedEBRecHits) ; eventData_->ecalEndcapHitsMeta = new EcalRecHitMetaCollection(*eventData_->reducedEERecHits) ; eventData_->ecalBarrelIsol03 = new EgammaRecHitIsolation(egIsoConeSizeOutSmall,egIsoConeSizeInBarrel,egIsoJurassicWidth,egIsoPtMinBarrel,egIsoEMinBarrel,eventSetupData_->caloGeom,eventData_->ecalBarrelHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal); eventData_->ecalBarrelIsol04 = new EgammaRecHitIsolation(egIsoConeSizeOutLarge,egIsoConeSizeInBarrel,egIsoJurassicWidth,egIsoPtMinBarrel,egIsoEMinBarrel,eventSetupData_->caloGeom,eventData_->ecalBarrelHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal); eventData_->ecalEndcapIsol03 = new EgammaRecHitIsolation(egIsoConeSizeOutSmall,egIsoConeSizeInEndcap,egIsoJurassicWidth,egIsoPtMinEndcap,egIsoEMinEndcap,eventSetupData_->caloGeom,eventData_->ecalEndcapHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal); eventData_->ecalEndcapIsol04 = new EgammaRecHitIsolation(egIsoConeSizeOutLarge,egIsoConeSizeInEndcap,egIsoJurassicWidth,egIsoPtMinEndcap,egIsoEMinEndcap,eventSetupData_->caloGeom,eventData_->ecalEndcapHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal); eventData_->ecalBarrelIsol03->setUseNumCrystals(generalData_->isoCfg.useNumCrystals); eventData_->ecalBarrelIsol03->setVetoClustered(generalData_->isoCfg.vetoClustered); //eventData_->ecalBarrelIsol03->doSpikeRemoval(eventData_->reducedEBRecHits.product(),eventSetupData_->chStatus.product(),generalData_->spikeCfg.severityLevelCut,generalData_->spikeCfg.severityRecHitThreshold,generalData_->spikeCfg.spikeId,generalData_->spikeCfg.spikeIdThreshold); eventData_->ecalBarrelIsol03->doSpikeRemoval(eventData_->reducedEBRecHits.product(),eventSetupData_->chStatus.product(),generalData_->spikeCfg.severityLevelCut); eventData_->ecalBarrelIsol03->doFlagChecks(generalData_->spikeCfg.recHitFlagsToBeExcluded); eventData_->ecalBarrelIsol04->setUseNumCrystals(generalData_->isoCfg.useNumCrystals); eventData_->ecalBarrelIsol04->setVetoClustered(generalData_->isoCfg.vetoClustered); //eventData_->ecalBarrelIsol04->doSpikeRemoval(eventData_->reducedEBRecHits.product(),eventSetupData_->chStatus.product(),generalData_->spikeCfg.severityLevelCut,generalData_->spikeCfg.severityRecHitThreshold,generalData_->spikeCfg.spikeId,generalData_->spikeCfg.spikeIdThreshold); eventData_->ecalBarrelIsol04->doSpikeRemoval(eventData_->reducedEBRecHits.product(),eventSetupData_->chStatus.product(),generalData_->spikeCfg.severityLevelCut); eventData_->ecalBarrelIsol04->doFlagChecks(generalData_->spikeCfg.recHitFlagsToBeExcluded); eventData_->ecalEndcapIsol03->setUseNumCrystals(generalData_->isoCfg.useNumCrystals); eventData_->ecalEndcapIsol03->setVetoClustered(generalData_->isoCfg.vetoClustered); eventData_->ecalEndcapIsol03->doFlagChecks(generalData_->spikeCfg.recHitFlagsToBeExcluded); eventData_->ecalEndcapIsol04->setUseNumCrystals(generalData_->isoCfg.useNumCrystals); eventData_->ecalEndcapIsol04->setVetoClustered(generalData_->isoCfg.vetoClustered); eventData_->ecalEndcapIsol04->doFlagChecks(generalData_->spikeCfg.recHitFlagsToBeExcluded); }
void GsfElectronAlgo::calculateShowerShape | ( | const reco::SuperClusterRef & | theClus, |
bool | pflow, | ||
reco::GsfElectron::ShowerShape & | showerShape | ||
) | [private] |
Definition at line 509 of file GsfElectronAlgo.cc.
References GsfElectronAlgo::EventSetupData::caloGeom, GsfElectronAlgo::EventSetupData::caloTopo, EcalClusterTools::covariances(), EcalClusterTools::e1x5(), reco::GsfElectron::ShowerShape::e1x5, EcalClusterTools::e2x5Max(), reco::GsfElectron::ShowerShape::e2x5Max, EcalClusterTools::e5x5(), reco::GsfElectron::ShowerShape::e5x5, EcalBarrel, eventData_, eventSetupData_, generalData_, geometry, reco::GsfElectron::ShowerShape::hcalDepth1OverEcal, reco::GsfElectron::ShowerShape::hcalDepth1OverEcalBc, reco::GsfElectron::ShowerShape::hcalDepth2OverEcal, reco::GsfElectron::ShowerShape::hcalDepth2OverEcalBc, ElectronHcalHelper::hcalESumDepth1(), ElectronHcalHelper::hcalESumDepth1BehindClusters(), ElectronHcalHelper::hcalESumDepth2(), ElectronHcalHelper::hcalESumDepth2BehindClusters(), GsfElectronAlgo::GeneralData::hcalHelper, GsfElectronAlgo::GeneralData::hcalHelperPflow, reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, ElectronHcalHelper::hcalTowersBehindClusters(), reco::CaloCluster::hitsAndFractions(), EcalClusterTools::localCovariances(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), GsfElectronAlgo::EventData::reducedEBRecHits, GsfElectronAlgo::EventData::reducedEERecHits, Reconstruction_cff::reducedRecHits, reco::GsfElectron::ShowerShape::sigmaEtaEta, reco::GsfElectron::ShowerShape::sigmaIetaIeta, mathSSE::sqrt(), and DetId::subdetId().
Referenced by addPflowInfo(), and createElectron().
{ const reco::CaloCluster & seedCluster = *(theClus->seed()) ; // temporary, till CaloCluster->seed() is made available DetId seedXtalId = seedCluster.hitsAndFractions()[0].first ; int detector = seedXtalId.subdetId() ; const CaloTopology * topology = eventSetupData_->caloTopo.product() ; const CaloGeometry * geometry = eventSetupData_->caloGeom.product() ; const EcalRecHitCollection * reducedRecHits = 0 ; if (detector==EcalBarrel) { reducedRecHits = eventData_->reducedEBRecHits.product() ; } else { reducedRecHits = eventData_->reducedEERecHits.product() ; } std::vector<float> covariances = EcalClusterTools::covariances(seedCluster,reducedRecHits,topology,geometry) ; std::vector<float> localCovariances = EcalClusterTools::localCovariances(seedCluster,reducedRecHits,topology) ; showerShape.sigmaEtaEta = sqrt(covariances[0]) ; showerShape.sigmaIetaIeta = sqrt(localCovariances[0]) ; showerShape.e1x5 = EcalClusterTools::e1x5(seedCluster,reducedRecHits,topology) ; showerShape.e2x5Max = EcalClusterTools::e2x5Max(seedCluster,reducedRecHits,topology) ; showerShape.e5x5 = EcalClusterTools::e5x5(seedCluster,reducedRecHits,topology) ; if (pflow) { showerShape.hcalDepth1OverEcal = generalData_->hcalHelperPflow->hcalESumDepth1(*theClus)/theClus->energy() ; showerShape.hcalDepth2OverEcal = generalData_->hcalHelperPflow->hcalESumDepth2(*theClus)/theClus->energy() ; showerShape.hcalTowersBehindClusters = generalData_->hcalHelperPflow->hcalTowersBehindClusters(*theClus) ; showerShape.hcalDepth1OverEcalBc = generalData_->hcalHelperPflow->hcalESumDepth1BehindClusters(showerShape.hcalTowersBehindClusters)/theClus->energy() ; showerShape.hcalDepth2OverEcalBc = generalData_->hcalHelperPflow->hcalESumDepth2BehindClusters(showerShape.hcalTowersBehindClusters)/theClus->energy() ; } else { showerShape.hcalDepth1OverEcal = generalData_->hcalHelper->hcalESumDepth1(*theClus)/theClus->energy() ; showerShape.hcalDepth2OverEcal = generalData_->hcalHelper->hcalESumDepth2(*theClus)/theClus->energy() ; showerShape.hcalTowersBehindClusters = generalData_->hcalHelper->hcalTowersBehindClusters(*theClus) ; showerShape.hcalDepth1OverEcalBc = generalData_->hcalHelper->hcalESumDepth1BehindClusters(showerShape.hcalTowersBehindClusters)/theClus->energy() ; showerShape.hcalDepth2OverEcalBc = generalData_->hcalHelper->hcalESumDepth2BehindClusters(showerShape.hcalTowersBehindClusters)/theClus->energy() ; } }
void GsfElectronAlgo::checkSetup | ( | const edm::EventSetup & | es | ) |
Definition at line 579 of file GsfElectronAlgo.cc.
References GsfElectronAlgo::EventSetupData::cacheChStatus, edm::eventsetup::EventSetupRecord::cacheIdentifier(), GsfElectronAlgo::EventSetupData::cacheIDGeom, GsfElectronAlgo::EventSetupData::cacheIDMagField, GsfElectronAlgo::EventSetupData::cacheIDTDGeom, GsfElectronAlgo::EventSetupData::cacheIDTopo, GsfElectronAlgo::EventSetupData::cacheSevLevel, GsfElectronAlgo::EventSetupData::caloGeom, GsfElectronAlgo::EventSetupData::caloTopo, ElectronHcalHelper::checkSetup(), GsfElectronAlgo::EventSetupData::chStatus, GsfElectronAlgo::EventSetupData::constraintAtVtx, eventSetupData_, generalData_, edm::EventSetup::get(), GsfElectronAlgo::GeneralData::hcalHelper, GsfElectronAlgo::GeneralData::hcalHelperPflow, EcalClusterFunctionBaseClass::init(), GsfElectronAlgo::EventSetupData::magField, GsfElectronAlgo::EventSetupData::mtsTransform, edm::ESHandle< T >::product(), GsfElectronAlgo::EventSetupData::sevLevel, GsfElectronAlgo::GeneralData::superClusterErrorFunction, and GsfElectronAlgo::EventSetupData::trackerHandle.
Referenced by GsfElectronBaseProducer::beginEvent().
{ // get EventSetupRecords if needed bool updateField(false); if (eventSetupData_->cacheIDMagField!=es.get<IdealMagneticFieldRecord>().cacheIdentifier()){ updateField = true; eventSetupData_->cacheIDMagField=es.get<IdealMagneticFieldRecord>().cacheIdentifier(); es.get<IdealMagneticFieldRecord>().get(eventSetupData_->magField); } bool updateGeometry(false); if (eventSetupData_->cacheIDTDGeom!=es.get<TrackerDigiGeometryRecord>().cacheIdentifier()){ updateGeometry = true; eventSetupData_->cacheIDTDGeom=es.get<TrackerDigiGeometryRecord>().cacheIdentifier(); es.get<TrackerDigiGeometryRecord>().get(eventSetupData_->trackerHandle); } if ( updateField || updateGeometry ) { delete eventSetupData_->mtsTransform ; eventSetupData_->mtsTransform = new MultiTrajectoryStateTransform(eventSetupData_->trackerHandle.product(),eventSetupData_->magField.product()); delete eventSetupData_->constraintAtVtx ; eventSetupData_->constraintAtVtx = new GsfConstraintAtVertex(es) ; } if (eventSetupData_->cacheIDGeom!=es.get<CaloGeometryRecord>().cacheIdentifier()){ eventSetupData_->cacheIDGeom=es.get<CaloGeometryRecord>().cacheIdentifier(); es.get<CaloGeometryRecord>().get(eventSetupData_->caloGeom); } if (eventSetupData_->cacheIDTopo!=es.get<CaloTopologyRecord>().cacheIdentifier()){ eventSetupData_->cacheIDTopo=es.get<CaloTopologyRecord>().cacheIdentifier(); es.get<CaloTopologyRecord>().get(eventSetupData_->caloTopo); } generalData_->hcalHelper->checkSetup(es) ; generalData_->hcalHelperPflow->checkSetup(es) ; if (generalData_->superClusterErrorFunction) { generalData_->superClusterErrorFunction->init(es) ; } if(eventSetupData_->cacheChStatus!=es.get<EcalChannelStatusRcd>().cacheIdentifier()){ eventSetupData_->cacheChStatus=es.get<EcalChannelStatusRcd>().cacheIdentifier(); es.get<EcalChannelStatusRcd>().get(eventSetupData_->chStatus); } if(eventSetupData_->cacheSevLevel != es.get<EcalSeverityLevelAlgoRcd>().cacheIdentifier()){ eventSetupData_->cacheSevLevel = es.get<EcalSeverityLevelAlgoRcd>().cacheIdentifier(); es.get<EcalSeverityLevelAlgoRcd>().get(eventSetupData_->sevLevel); } }
void GsfElectronAlgo::clonePreviousElectrons | ( | ) |
Definition at line 781 of file GsfElectronAlgo.cc.
References GsfElectronAlgo::EventData::coreElectrons, GsfElectronAlgo::EventData::electrons, eventData_, GsfElectronAlgo::EventData::previousElectrons, and edm::Handle< T >::product().
Referenced by GsfElectronProducer::produce().
{ const GsfElectronCollection * oldElectrons = eventData_->previousElectrons.product() ; const GsfElectronCoreCollection * newCores = eventData_->coreElectrons.product() ; GsfElectronCollection::const_iterator oldElectron ; for ( oldElectron = oldElectrons->begin() ; oldElectron != oldElectrons->end() ; ++oldElectron ) { const GsfElectronCoreRef oldCoreRef = oldElectron->core() ; const GsfTrackRef oldElectronGsfTrackRef = oldCoreRef->gsfTrack() ; unsigned int icore ; for ( icore=0 ; icore<newCores->size() ; ++icore ) { if (oldElectronGsfTrackRef==(*newCores)[icore].gsfTrack()) { const GsfElectronCoreRef coreRef = edm::Ref<GsfElectronCoreCollection>(eventData_->coreElectrons,icore) ; eventData_->electrons->push_back(new GsfElectron(*oldElectron,coreRef)) ; break ; } } } }
void GsfElectronAlgo::completeElectrons | ( | ) |
Definition at line 738 of file GsfElectronAlgo.cc.
References GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::ElectronData::calculateTSOS(), GsfElectronAlgo::EventSetupData::constraintAtVtx, GsfElectronAlgo::EventData::coreElectrons, createElectron(), electronData_, GsfElectronAlgo::EventData::electrons, eventData_, eventSetupData_, Exception, funct::false, i, edm::Ref< C, T, F >::isNull(), GsfElectronAlgo::EventSetupData::mtsTransform, edm::Handle< T >::product(), and funct::true.
Referenced by GsfElectronEcalDrivenProducer::produce(), and GsfElectronProducer::produce().
{ if (electronData_!=0) { throw cms::Exception("GsfElectronAlgo|InternalError")<<"unexpected electron data" ; } const GsfElectronCoreCollection * coreCollection = eventData_->coreElectrons.product() ; for ( unsigned int i=0 ; i<coreCollection->size() ; ++i ) { // check there is no existing electron with this core const GsfElectronCoreRef coreRef = edm::Ref<GsfElectronCoreCollection>(eventData_->coreElectrons,i) ; bool coreFound = false ; GsfElectronPtrCollection::const_iterator itrEle ; for ( itrEle = eventData_->electrons->begin() ; itrEle != eventData_->electrons->end() ; itrEle++ ) { if ((*itrEle)->core()==coreRef) { coreFound = true ; break ; } } if (coreFound) continue ; // check there is a super-cluster if (coreRef->superCluster().isNull()) continue ; // prepare internal structure for electron specific data delete electronData_ ; electronData_ = new ElectronData(coreRef,*eventData_->beamspot) ; // calculate and check Trajectory StatesOnSurface.... if ( !electronData_->calculateTSOS( eventSetupData_->mtsTransform, eventSetupData_->constraintAtVtx ) ) continue ; createElectron() ; } // loop over tracks delete electronData_ ; electronData_ = 0 ; }
void GsfElectronAlgo::copyElectrons | ( | reco::GsfElectronCollection & | outEle | ) |
Definition at line 631 of file GsfElectronAlgo.cc.
References GsfElectronAlgo::EventData::electrons, and eventData_.
Referenced by GsfElectronBaseProducer::fillEvent().
{ GsfElectronPtrCollection::const_iterator it ; for ( it = eventData_->electrons->begin() ; it != eventData_->electrons->end() ; it++ ) { outEle.push_back(**it) ; } }
void GsfElectronAlgo::createElectron | ( | ) | [private] |
Definition at line 985 of file GsfElectronAlgo.cc.
References abs, GsfElectronAlgo::StrategyConfiguration::applyEtaCorrection, GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::ElectronData::calculateMode(), GsfElectronAlgo::ElectronData::calculateMomentum(), calculateShowerShape(), GsfElectronAlgo::ElectronData::checkCtfTrack(), GsfElectronAlgo::ElectronData::computeCharge(), ConversionInfo::conversionPartnerCtfTk(), ConversionInfo::conversionPartnerGsfTk(), reco::GsfElectron::core(), GsfElectronAlgo::ElectronData::coreRef, ElectronEnergyCorrector::correct(), ElectronMomentumCorrector::correct(), ElectronClassification::correct(), reco::GsfElectron::ClosestCtfTrack::ctfTrack, GsfElectronAlgo::ElectronData::ctfTrackRef, GsfElectronAlgo::StrategyConfiguration::ctfTracksCheck, GsfElectronAlgo::EventData::currentCtfTracks, ConversionInfo::dcot(), reco::GsfElectron::ConversionRejection::dcot, reco::GsfElectron::TrackClusterMatching::deltaEtaEleClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaEtaSeedClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaEtaSuperClusterAtVtx, reco::GsfElectron::TrackClusterMatching::deltaPhiEleClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaPhiSeedClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaPhiSuperClusterAtVtx, ConversionInfo::dist(), reco::GsfElectron::ConversionRejection::dist, EcalBarrel, GsfElectronAlgo::EventData::ecalBarrelIsol03, GsfElectronAlgo::EventData::ecalBarrelIsol04, EcalEndcap, GsfElectronAlgo::EventData::ecalEndcapIsol03, GsfElectronAlgo::EventData::ecalEndcapIsol04, reco::GsfElectron::IsolationVariables::ecalRecHitSumEt, reco::GsfElectron::TrackClusterMatching::eEleClusterOverPout, ele_convert(), reco::GsfElectron::TrackClusterMatching::electronCluster, electronData_, GsfElectronAlgo::EventData::electrons, GsfElectronAlgo::ElectronData::eleMom, GsfElectronAlgo::ElectronData::elePos, reco::CaloCluster::energy(), reco::GsfElectron::TrackClusterMatching::eSeedClusterOverP, reco::GsfElectron::TrackClusterMatching::eSeedClusterOverPout, reco::GsfElectron::TrackClusterMatching::eSuperClusterOverP, eventData_, eventSetupData_, Exception, ConversionInfo::flag(), reco::GsfElectron::ConversionRejection::flags, generalData_, GsfElectronAlgo::ElectronData::getEleBasicCluster(), EgammaRecHitIsolation::getEtSum(), ElectronTkIsolation::getPtTracks(), EgammaTowerIsolation::getTowerEtSum(), EcalClusterFunctionBaseClass::getValue(), GsfElectronAlgo::EventData::hadDepth1Isolation03, GsfElectronAlgo::EventData::hadDepth1Isolation03Bc, GsfElectronAlgo::EventData::hadDepth1Isolation04, GsfElectronAlgo::EventData::hadDepth1Isolation04Bc, GsfElectronAlgo::EventData::hadDepth2Isolation03, GsfElectronAlgo::EventData::hadDepth2Isolation03Bc, GsfElectronAlgo::EventData::hadDepth2Isolation04, GsfElectronAlgo::EventData::hadDepth2Isolation04Bc, reco::GsfElectron::IsolationVariables::hcalDepth1TowerSumEt, reco::GsfElectron::IsolationVariables::hcalDepth1TowerSumEtBc, reco::GsfElectron::IsolationVariables::hcalDepth2TowerSumEt, reco::GsfElectron::IsolationVariables::hcalDepth2TowerSumEtBc, reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, reco::CaloCluster::hitsAndFractions(), EBDetId::ietaAbs(), GsfElectronAlgo::ElectronData::innMom, reco::GsfElectron::FiducialFlags::isEB, reco::GsfElectron::FiducialFlags::isEBEEGap, reco::GsfElectron::FiducialFlags::isEBEtaGap, reco::GsfElectron::FiducialFlags::isEBPhiGap, reco::GsfElectron::FiducialFlags::isEE, reco::GsfElectron::FiducialFlags::isEEDeeGap, reco::GsfElectron::FiducialFlags::isEERingGap, EEDetId::isNextToDBoundary(), EBDetId::isNextToEtaBoundary(), EBDetId::isNextToPhiBoundary(), EEDetId::isNextToRingBoundary(), edm::HandleBase::isValid(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), GsfElectronAlgo::EventSetupData::magField, reco::GsfElectron::TrackExtrapolations::momentumAtCalo, reco::GsfElectron::TrackExtrapolations::momentumAtEleClus, reco::GsfElectron::TrackExtrapolations::momentumAtVtx, reco::GsfElectron::TrackExtrapolations::momentumAtVtxWithConstraint, reco::GsfElectron::TrackExtrapolations::momentumOut, GsfElectronAlgo::EventSetupData::mtsMode, GsfElectronAlgo::EventSetupData::mtsTransform, GsfElectronAlgo::EventData::originalCtfTracks, GsfElectronAlgo::EventData::originalGsfTracks, GsfElectronAlgo::ElectronData::outMom, reco::GsfElectron::p4(), reco::GsfElectron::ConversionRejection::partner, reco::CaloCluster::position(), reco::BeamSpot::position(), reco::GsfElectron::TrackExtrapolations::positionAtCalo, reco::GsfElectron::TrackExtrapolations::positionAtVtx, reco::GsfElectron::ConversionRejection::radius, ConversionInfo::radiusOfConversion(), GsfElectronAlgo::EventData::retreiveOriginalTrackCollections(), GsfElectronAlgo::ElectronData::sclMom, GsfElectronAlgo::ElectronData::sclPos, GsfElectronAlgo::ElectronData::seedMom, GsfElectronAlgo::ElectronData::seedPos, setCutBasedPreselectionFlag(), ElectronEnergyCorrector::setEcalEnergyError(), reco::GsfElectron::setEcalEnergyError(), reco::GsfElectron::setIsolation03(), reco::GsfElectron::setIsolation04(), reco::GsfElectron::setP4(), reco::GsfElectron::ClosestCtfTrack::shFracInnerHits, GsfElectronAlgo::ElectronData::shFracInnerHits, GsfElectronAlgo::GeneralData::strategyCfg, DetId::subdetId(), reco::GsfElectron::superCluster(), GsfElectronAlgo::GeneralData::superClusterErrorFunction, GsfElectronAlgo::ElectronData::superClusterRef, GsfElectronAlgo::EventData::tkIsolation03, GsfElectronAlgo::EventData::tkIsolation04, reco::GsfElectron::IsolationVariables::tkSumPt, funct::true, GsfElectronAlgo::ElectronData::vtxMom, GsfElectronAlgo::ElectronData::vtxMomWithConstraint, GsfElectronAlgo::ElectronData::vtxPos, and GsfElectronAlgo::ElectronData::vtxTSOS.
Referenced by completeElectrons().
{ // eventually check ctf track if (generalData_->strategyCfg.ctfTracksCheck) { electronData_->checkCtfTrack(eventData_->currentCtfTracks) ; } // charge ID int eleCharge ; GsfElectron::ChargeInfo eleChargeInfo ; electronData_->computeCharge(eleCharge,eleChargeInfo) ; // electron basic cluster CaloClusterPtr elbcRef = electronData_->getEleBasicCluster(eventSetupData_->mtsTransform) ; // Seed cluster const reco::CaloCluster & seedCluster = *(electronData_->superClusterRef->seed()) ; // seed Xtal // temporary, till CaloCluster->seed() is made available DetId seedXtalId = seedCluster.hitsAndFractions()[0].first ; electronData_->calculateMode(eventSetupData_->mtsMode) ; //==================================================== // Candidate attributes //==================================================== Candidate::LorentzVector momentum = electronData_->calculateMomentum() ; //==================================================== // Track-Cluster Matching //==================================================== reco::GsfElectron::TrackClusterMatching tcMatching ; tcMatching.electronCluster = elbcRef ; tcMatching.eSuperClusterOverP = (electronData_->vtxMom.mag()>0)?(electronData_->superClusterRef->energy()/electronData_->vtxMom.mag()):(-1.) ; tcMatching.eSeedClusterOverP = (electronData_->vtxMom.mag()>0.)?(seedCluster.energy()/electronData_->vtxMom.mag()):(-1) ; tcMatching.eSeedClusterOverPout = (electronData_->seedMom.mag()>0.)?(seedCluster.energy()/electronData_->seedMom.mag()):(-1.) ; tcMatching.eEleClusterOverPout = (electronData_->eleMom.mag()>0.)?(elbcRef->energy()/electronData_->eleMom.mag()):(-1.) ; EleRelPointPair scAtVtx(electronData_->superClusterRef->position(),electronData_->sclPos,eventData_->beamspot->position()) ; tcMatching.deltaEtaSuperClusterAtVtx = scAtVtx.dEta() ; tcMatching.deltaPhiSuperClusterAtVtx = scAtVtx.dPhi() ; EleRelPointPair seedAtCalo(seedCluster.position(),electronData_->seedPos,eventData_->beamspot->position()) ; tcMatching.deltaEtaSeedClusterAtCalo = seedAtCalo.dEta() ; tcMatching.deltaPhiSeedClusterAtCalo = seedAtCalo.dPhi() ; EleRelPointPair ecAtCalo(elbcRef->position(),electronData_->elePos,eventData_->beamspot->position()) ; tcMatching.deltaEtaEleClusterAtCalo = ecAtCalo.dEta() ; tcMatching.deltaPhiEleClusterAtCalo = ecAtCalo.dPhi() ; //======================================================= // Track extrapolations //======================================================= reco::GsfElectron::TrackExtrapolations tkExtra ; ele_convert(electronData_->vtxPos,tkExtra.positionAtVtx) ; ele_convert(electronData_->sclPos,tkExtra.positionAtCalo) ; ele_convert(electronData_->vtxMom,tkExtra.momentumAtVtx) ; ele_convert(electronData_->sclMom,tkExtra.momentumAtCalo) ; ele_convert(electronData_->seedMom,tkExtra.momentumOut) ; ele_convert(electronData_->eleMom,tkExtra.momentumAtEleClus) ; ele_convert(electronData_->vtxMomWithConstraint,tkExtra.momentumAtVtxWithConstraint) ; //======================================================= // Closest Ctf Track //======================================================= reco::GsfElectron::ClosestCtfTrack ctfInfo ; ctfInfo.ctfTrack = electronData_->ctfTrackRef ; ctfInfo.shFracInnerHits = electronData_->shFracInnerHits ; //==================================================== // FiducialFlags, using nextToBoundary definition of gaps //==================================================== reco::GsfElectron::FiducialFlags fiducialFlags ; int detector = seedXtalId.subdetId() ; double feta=std::abs(electronData_->superClusterRef->position().eta()) ; if (detector==EcalBarrel) { fiducialFlags.isEB = true ; EBDetId ebdetid(seedXtalId); if (EBDetId::isNextToEtaBoundary(ebdetid)) { if (ebdetid.ietaAbs()==85) { fiducialFlags.isEBEEGap = true ; } else { fiducialFlags.isEBEtaGap = true ; } } if (EBDetId::isNextToPhiBoundary(ebdetid)) { fiducialFlags.isEBPhiGap = true ; } } else if (detector==EcalEndcap) { fiducialFlags.isEE = true ; EEDetId eedetid(seedXtalId); if (EEDetId::isNextToRingBoundary(eedetid)) { if (std::abs(feta)<2.) { fiducialFlags.isEBEEGap = true ; } else { fiducialFlags.isEERingGap = true ; } } if (EEDetId::isNextToDBoundary(eedetid)) { fiducialFlags.isEEDeeGap = true ; } } else { throw cms::Exception("GsfElectronAlgo|UnknownXtalRegion")<<"createElectron(): do not know if it is a barrel or endcap seed cluster !!!!" ; } //==================================================== // ShowerShape //==================================================== reco::GsfElectron::ShowerShape showerShape ; calculateShowerShape(electronData_->superClusterRef,!(electronData_->coreRef->ecalDrivenSeed()),showerShape) ; //==================================================== // ConversionRejection //==================================================== eventData_->retreiveOriginalTrackCollections(electronData_->ctfTrackRef,electronData_->coreRef->gsfTrack()) ; ConversionFinder conversionFinder ; double BInTesla = eventSetupData_->magField->inTesla(GlobalPoint(0.,0.,0.)).z() ; edm::Handle<reco::TrackCollection> ctfTracks = eventData_->originalCtfTracks ; if (!ctfTracks.isValid()) { ctfTracks = eventData_->currentCtfTracks ; } // values of conversionInfo.flag() // -9999 : Partner track was not found // 0 : Partner track found in the CTF collection using // 1 : Partner track found in the CTF collection using // 2 : Partner track found in the GSF collection using // 3 : Partner track found in the GSF collection using the electron's GSF track ConversionInfo conversionInfo = conversionFinder.getConversionInfo (*electronData_->coreRef,ctfTracks,eventData_->originalGsfTracks,BInTesla) ; reco::GsfElectron::ConversionRejection conversionVars ; conversionVars.flags = conversionInfo.flag() ; conversionVars.dist = conversionInfo.dist() ; conversionVars.dcot = conversionInfo.dcot() ; conversionVars.radius = conversionInfo.radiusOfConversion() ; if ((conversionVars.flags==0)or(conversionVars.flags==1)) conversionVars.partner = TrackBaseRef(conversionInfo.conversionPartnerCtfTk()) ; else if ((conversionVars.flags==2)or(conversionVars.flags==3)) conversionVars.partner = TrackBaseRef(conversionInfo.conversionPartnerGsfTk()) ; //==================================================== // brems fraction //==================================================== float fbrem = (electronData_->outMom.mag()>0.)?((electronData_->innMom.mag()-electronData_->outMom.mag())/electronData_->innMom.mag()):1.e30 ; //==================================================== // Go ! //==================================================== GsfElectron * ele = new GsfElectron ( eleCharge,eleChargeInfo,electronData_->coreRef, tcMatching, tkExtra, ctfInfo, fiducialFlags,showerShape, conversionVars, fbrem) ; ele->setP4(GsfElectron::P4_FROM_SUPER_CLUSTER,momentum,0,true) ; // classification and corrections ElectronClassification theClassifier; theClassifier.correct(*ele); ElectronEnergyCorrector theEnCorrector ; if (!generalData_->superClusterErrorFunction) { theEnCorrector.setEcalEnergyError(*ele) ; } else { ele->setEcalEnergyError(generalData_->superClusterErrorFunction->getValue(*(ele->superCluster()),0)) ; } if (ele->core()->ecalDrivenSeed()) { theEnCorrector.correct(*ele,*eventData_->beamspot,generalData_->strategyCfg.applyEtaCorrection) ; ElectronMomentumCorrector theMomCorrector; theMomCorrector.correct(*ele,electronData_->vtxTSOS); } // now isolation variables reco::GsfElectron::IsolationVariables dr03, dr04 ; dr03.tkSumPt = eventData_->tkIsolation03->getPtTracks(ele); dr03.hcalDepth1TowerSumEt = eventData_->hadDepth1Isolation03->getTowerEtSum(ele) ; dr03.hcalDepth2TowerSumEt = eventData_->hadDepth2Isolation03->getTowerEtSum(ele) ; dr03.hcalDepth1TowerSumEtBc = eventData_->hadDepth1Isolation03Bc->getTowerEtSum(ele,&(showerShape.hcalTowersBehindClusters)) ; dr03.hcalDepth2TowerSumEtBc = eventData_->hadDepth2Isolation03Bc->getTowerEtSum(ele,&(showerShape.hcalTowersBehindClusters)) ; dr03.ecalRecHitSumEt = eventData_->ecalBarrelIsol03->getEtSum(ele)+eventData_->ecalEndcapIsol03->getEtSum(ele); dr04.tkSumPt = eventData_->tkIsolation04->getPtTracks(ele); dr04.hcalDepth1TowerSumEt = eventData_->hadDepth1Isolation04->getTowerEtSum(ele); dr04.hcalDepth2TowerSumEt = eventData_->hadDepth2Isolation04->getTowerEtSum(ele); dr04.hcalDepth1TowerSumEtBc = eventData_->hadDepth1Isolation04Bc->getTowerEtSum(ele,&(showerShape.hcalTowersBehindClusters)) ; dr04.hcalDepth2TowerSumEtBc = eventData_->hadDepth2Isolation04Bc->getTowerEtSum(ele,&(showerShape.hcalTowersBehindClusters)) ; dr04.ecalRecHitSumEt = eventData_->ecalBarrelIsol04->getEtSum(ele)+eventData_->ecalEndcapIsol04->getEtSum(ele); ele->setIsolation03(dr03); ele->setIsolation04(dr04); // preselection flag setCutBasedPreselectionFlag(ele,*eventData_->beamspot) ; LogTrace("GsfElectronAlgo")<<"Constructed new electron with energy "<< ele->p4().e() ; eventData_->electrons->push_back(ele) ; }
void GsfElectronAlgo::displayInternalElectrons | ( | const std::string & | title | ) | const |
Definition at line 724 of file GsfElectronAlgo.cc.
References GsfElectronAlgo::EventData::electrons, GsfElectronAlgo::EventData::event, eventData_, edm::EventBase::id(), and LogTrace.
Referenced by GsfElectronBaseProducer::fillEvent().
{ LogTrace("GsfElectronAlgo") << "========== " << title << " =========="; LogTrace("GsfElectronAlgo") << "Event: " << eventData_->event->id(); LogTrace("GsfElectronAlgo") << "Number of electrons: " << eventData_->electrons->size() ; GsfElectronPtrCollection::const_iterator it ; for ( it = eventData_->electrons->begin(); it != eventData_->electrons->end(); it++ ) { LogTrace("GsfElectronAlgo") << "Electron with charge, pt, eta, phi: " << (*it)->charge() << " , " << (*it)->pt() << " , " << (*it)->eta() << " , " << (*it)->phi(); } LogTrace("GsfElectronAlgo") << "================================================="; }
void GsfElectronAlgo::endEvent | ( | ) |
Definition at line 716 of file GsfElectronAlgo.cc.
References eventData_, and Exception.
Referenced by GsfElectronBaseProducer::endEvent().
{ if (eventData_==0) { throw cms::Exception("GsfElectronAlgo|InternalError")<<"lacking event data" ; } delete eventData_ ; eventData_ = 0 ; }
const reco::SuperClusterRef GsfElectronAlgo::getTrSuperCluster | ( | const reco::GsfTrackRef & | trackRef | ) | [private] |
bool GsfElectronAlgo::isPreselected | ( | reco::GsfElectron * | ele | ) | [private] |
Definition at line 872 of file GsfElectronAlgo.cc.
References reco::GsfElectron::passingCutBasedPreselection(), and reco::GsfElectron::passingMvaPreselection().
Referenced by removeNotPreselectedElectrons(), and setAmbiguityData().
{ return (ele->passingCutBasedPreselection()||ele->passingMvaPreselection()) ; }
void GsfElectronAlgo::removeAmbiguousElectrons | ( | ) |
Definition at line 1331 of file GsfElectronAlgo.cc.
References GsfElectronAlgo::EventData::electrons, eventData_, and LogTrace.
Referenced by GsfElectronBaseProducer::fillEvent().
{ GsfElectronPtrCollection::size_type ei = 1, emax = eventData_->electrons->size() ; GsfElectronPtrCollection::iterator eitr = eventData_->electrons->begin() ; while (eitr!=eventData_->electrons->end()) { LogTrace("GsfElectronAlgo")<<"========== remove ambiguous "<<ei<<"/"<<emax<<"==========" ; if ((*eitr)->ambiguous()) { delete (*eitr) ; eitr = eventData_->electrons->erase(eitr) ; ++ei ; } else { ++eitr ; ++ei ; } } }
void GsfElectronAlgo::removeNotPreselectedElectrons | ( | ) |
Definition at line 875 of file GsfElectronAlgo.cc.
References GsfElectronAlgo::EventData::electrons, eventData_, isPreselected(), and LogTrace.
Referenced by GsfElectronBaseProducer::fillEvent().
{ GsfElectronPtrCollection::size_type ei = 1, emax = eventData_->electrons->size() ; GsfElectronPtrCollection::iterator eitr = eventData_->electrons->begin() ; while (eitr!=eventData_->electrons->end()) { LogTrace("GsfElectronAlgo")<<"========== removed not preselected "<<ei<<"/"<<emax<<"==========" ; if (isPreselected(*eitr)) { ++eitr ; ++ei ; } else { delete (*eitr) ; eitr = eventData_->electrons->erase(eitr) ; ++ei ; } } }
void GsfElectronAlgo::setAmbiguityData | ( | bool | ignoreNotPreselected = true | ) |
Definition at line 1209 of file GsfElectronAlgo.cc.
References GsfElectronAlgo::StrategyConfiguration::ambClustersOverlapStrategy, GsfElectronAlgo::StrategyConfiguration::ambSortingStrategy, GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::EventData::electrons, eta(), eventData_, eventSetupData_, Exception, funct::false, newFWLiteAna::found, generalData_, edm::Ref< C, T, F >::get(), GsfElectronAlgo::EventData::gsfPfRecTracks, EgAmbiguityTools::isBetter(), isPreselected(), LogDebug, reco::BeamSpot::position(), edm::Handle< T >::product(), GsfElectronAlgo::EventData::reducedEBRecHits, GsfElectronAlgo::EventData::reducedEERecHits, EgAmbiguityTools::sharedEnergy(), GsfElectronAlgo::GeneralData::strategyCfg, dtDQMClient_cfg::threshold, GsfElectronAlgo::EventSetupData::trackerHandle, funct::true, and GsfElectronAlgo::StrategyConfiguration::useGsfPfRecTracks.
Referenced by GsfElectronBaseProducer::fillEvent().
{ GsfElectronPtrCollection::iterator e1, e2 ; if (generalData_->strategyCfg.ambSortingStrategy==0) { eventData_->electrons->sort(EgAmbiguityTools::isBetter) ; } else if (generalData_->strategyCfg.ambSortingStrategy==1) { eventData_->electrons->sort(EgAmbiguityTools::isInnerMost(eventSetupData_->trackerHandle)) ; } else { throw cms::Exception("GsfElectronAlgo|UnknownAmbiguitySortingStrategy")<<"value of generalData_->strategyCfg.ambSortingStrategy is : "<<generalData_->strategyCfg.ambSortingStrategy ; } // init for ( e1 = eventData_->electrons->begin() ; e1 != eventData_->electrons->end() ; ++e1 ) { (*e1)->clearAmbiguousGsfTracks() ; (*e1)->setAmbiguous(false) ; } // get ambiguous from GsfPfRecTracks if (generalData_->strategyCfg.useGsfPfRecTracks) { for ( e1 = eventData_->electrons->begin() ; e1 != eventData_->electrons->end() ; ++e1 ) { bool found = false ; const GsfPFRecTrackCollection * gsfPfRecTrackCollection = eventData_->gsfPfRecTracks.product() ; GsfPFRecTrackCollection::const_iterator gsfPfRecTrack ; for ( gsfPfRecTrack=gsfPfRecTrackCollection->begin() ; gsfPfRecTrack!=gsfPfRecTrackCollection->end() ; ++gsfPfRecTrack ) { if (gsfPfRecTrack->gsfTrackRef()==(*e1)->gsfTrack()) { if (found) { edm::LogWarning("GsfElectronAlgo")<<"associated gsfPfRecTrack already found" ; } else { found = true ; const std::vector<reco::GsfPFRecTrackRef> & duplicates(gsfPfRecTrack->convBremGsfPFRecTrackRef()) ; std::vector<reco::GsfPFRecTrackRef>::const_iterator duplicate ; for ( duplicate = duplicates.begin() ; duplicate != duplicates.end() ; duplicate ++ ) { (*e1)->addAmbiguousGsfTrack((*duplicate)->gsfTrackRef()) ; } } } } } } // or search overlapping clusters else { for ( e1 = eventData_->electrons->begin() ; e1 != eventData_->electrons->end() ; ++e1 ) { if ((*e1)->ambiguous()) continue ; if ( ignoreNotPreselected && !isPreselected(*e1) ) continue ; SuperClusterRef scRef1 = (*e1)->superCluster(); CaloClusterPtr eleClu1 = (*e1)->electronCluster(); LogDebug("GsfElectronAlgo") << "Blessing electron with E/P " << (*e1)->eSuperClusterOverP() << ", cluster " << scRef1.get() << " & track " << (*e1)->gsfTrack().get() ; for ( e2 = e1, ++e2 ; e2 != eventData_->electrons->end() ; ++e2 ) { if ((*e2)->ambiguous()) continue ; if ( ignoreNotPreselected && !isPreselected(*e2) ) continue ; SuperClusterRef scRef2 = (*e2)->superCluster(); CaloClusterPtr eleClu2 = (*e2)->electronCluster(); // search if same cluster bool sameCluster = false ; if (generalData_->strategyCfg.ambClustersOverlapStrategy==0) { sameCluster = (scRef1==scRef2) ; } else if (generalData_->strategyCfg.ambClustersOverlapStrategy==1) { float eMin = 1. ; float threshold = eMin*cosh(EleRelPoint(scRef1->position(),eventData_->beamspot->position()).eta()) ; sameCluster = ( (EgAmbiguityTools::sharedEnergy(&(*eleClu1),&(*eleClu2),eventData_->reducedEBRecHits,eventData_->reducedEERecHits)>=threshold) || (EgAmbiguityTools::sharedEnergy(&(*scRef1->seed()),&(*eleClu2),eventData_->reducedEBRecHits,eventData_->reducedEERecHits)>=threshold) || (EgAmbiguityTools::sharedEnergy(&(*eleClu1),&(*scRef2->seed()),eventData_->reducedEBRecHits,eventData_->reducedEERecHits)>=threshold) || (EgAmbiguityTools::sharedEnergy(&(*scRef1->seed()),&(*scRef2->seed()),eventData_->reducedEBRecHits,eventData_->reducedEERecHits)>=threshold) ) ; } else { throw cms::Exception("GsfElectronAlgo|UnknownAmbiguityClustersOverlapStrategy")<<"value of generalData_->strategyCfg.ambClustersOverlapStrategy is : "<<generalData_->strategyCfg.ambClustersOverlapStrategy ; } // main instructions if (sameCluster) { LogDebug("GsfElectronAlgo") << "Discarding electron with E/P " << (*e2)->eSuperClusterOverP() << ", cluster " << scRef2.get() << " and track " << (*e2)->gsfTrack().get() ; (*e1)->addAmbiguousGsfTrack((*e2)->gsfTrack()) ; (*e2)->setAmbiguous(true) ; } else if ((*e1)->gsfTrack()==(*e2)->gsfTrack()) { edm::LogWarning("GsfElectronAlgo") << "Forgetting electron with E/P " << (*e2)->eSuperClusterOverP() << ", cluster " << scRef2.get() << " and track " << (*e2)->gsfTrack().get() ; (*e2)->setAmbiguous(true) ; } } } } }
void GsfElectronAlgo::setCutBasedPreselectionFlag | ( | reco::GsfElectron * | ele, |
const reco::BeamSpot & | bs | ||
) | [private] |
Definition at line 889 of file GsfElectronAlgo.cc.
References abs, edm::RefToBase< T >::castTo(), reco::GsfElectron::core(), GsfElectronAlgo::GeneralData::cutsCfg, GsfElectronAlgo::GeneralData::cutsCfgPflow, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), EcalBarrel, EcalEndcap, reco::GsfElectron::eSuperClusterOverP(), eta(), Exception, funct::false, generalData_, reco::GsfElectron::gsfTrack(), reco::GsfElectron::hcalDepth1OverEcal(), reco::GsfElectron::hcalDepth2OverEcal(), reco::GsfElectron::hcalOverEcal(), reco::CaloCluster::hitsAndFractions(), GsfElectronAlgo::CutsConfiguration::isBarrel, reco::GsfElectron::isEB(), reco::GsfElectron::isEBEEGap(), reco::GsfElectron::isEBEtaGap(), reco::GsfElectron::isEBPhiGap(), reco::GsfElectron::isEE(), reco::GsfElectron::isEEDeeGap(), reco::GsfElectron::isEERingGap(), GsfElectronAlgo::CutsConfiguration::isEndcaps, GsfElectronAlgo::CutsConfiguration::isFiducial, edm::Ref< C, T, F >::isNull(), LogTrace, GsfElectronAlgo::CutsConfiguration::maxDeltaEtaBarrel, GsfElectronAlgo::CutsConfiguration::maxDeltaEtaEndcaps, GsfElectronAlgo::CutsConfiguration::maxDeltaPhiBarrel, GsfElectronAlgo::CutsConfiguration::maxDeltaPhiEndcaps, GsfElectronAlgo::CutsConfiguration::maxEOverPBarrel, GsfElectronAlgo::CutsConfiguration::maxEOverPEndcaps, GsfElectronAlgo::CutsConfiguration::maxHOverEBarrel, GsfElectronAlgo::CutsConfiguration::maxHOverEEndcaps, GsfElectronAlgo::CutsConfiguration::maxSigmaIetaIetaBarrel, GsfElectronAlgo::CutsConfiguration::maxSigmaIetaIetaEndcaps, GsfElectronAlgo::CutsConfiguration::maxTIP, GsfElectronAlgo::CutsConfiguration::minEOverPBarrel, GsfElectronAlgo::CutsConfiguration::minEOverPEndcaps, GsfElectronAlgo::CutsConfiguration::minSCEtBarrel, GsfElectronAlgo::CutsConfiguration::minSCEtEndcaps, reco::BeamSpot::position(), GsfElectronAlgo::CutsConfiguration::seedFromTEC, reco::GsfElectron::setPassCutBasedPreselection(), reco::GsfElectron::sigmaIetaIeta(), and reco::GsfElectron::superCluster().
Referenced by createElectron().
{ // default value ele->setPassCutBasedPreselection(false) ; // kind of seeding bool eg = ele->core()->ecalDrivenSeed() ; bool pf = ele->core()->trackerDrivenSeed() && !ele->core()->ecalDrivenSeed() ; if (eg&&pf) { throw cms::Exception("GsfElectronAlgo|BothEcalAndPureTrackerDriven")<<"An electron cannot be both egamma and purely pflow" ; } if ((!eg)&&(!pf)) { throw cms::Exception("GsfElectronAlgo|NeitherEcalNorPureTrackerDriven")<<"An electron cannot be neither egamma nor purely pflow" ; } const CutsConfiguration * cfg = (eg?&generalData_->cutsCfg:&generalData_->cutsCfgPflow) ; // Et cut double etaValue = EleRelPoint(ele->superCluster()->position(),bs.position()).eta() ; double etValue = ele->superCluster()->energy()/cosh(etaValue) ; LogTrace("GsfElectronAlgo") << "Et : " << etValue ; if (ele->isEB() && (etValue < cfg->minSCEtBarrel)) return ; if (ele->isEE() && (etValue < cfg->minSCEtEndcaps)) return ; LogTrace("GsfElectronAlgo") << "Et criteria are satisfied"; // E/p cut double eopValue = ele->eSuperClusterOverP() ; LogTrace("GsfElectronAlgo") << "E/p : " << eopValue ; if (ele->isEB() && (eopValue > cfg->maxEOverPBarrel)) return ; if (ele->isEE() && (eopValue > cfg->maxEOverPEndcaps)) return ; if (ele->isEB() && (eopValue < cfg->minEOverPBarrel)) return ; if (ele->isEE() && (eopValue < cfg->minEOverPEndcaps)) return ; LogTrace("GsfElectronAlgo") << "E/p criteria are satisfied"; // HoE cuts LogTrace("GsfElectronAlgo") << "HoE1 : " << ele->hcalDepth1OverEcal() << ", HoE2 : " << ele->hcalDepth2OverEcal(); double had = ele->hcalOverEcal()*ele->superCluster()->energy() ; const reco::CaloCluster & seedCluster = *(ele->superCluster()->seed()) ; int detector = seedCluster.hitsAndFractions()[0].first.subdetId() ; bool HoEveto = false ; if (detector==EcalBarrel && (had<cfg->maxHBarrel || (had/ele->superCluster()->energy())<cfg->maxHOverEBarrel)) HoEveto=true; else if (detector==EcalEndcap && (had<cfg->maxHEndcaps || (had/ele->superCluster()->energy())<cfg->maxHOverEEndcaps)) HoEveto=true; if ( !HoEveto ) return ; LogTrace("GsfElectronAlgo") << "H/E criteria are satisfied"; // delta eta criteria double deta = ele->deltaEtaSuperClusterTrackAtVtx() ; LogTrace("GsfElectronAlgo") << "delta eta : " << deta ; if (ele->isEB() && (std::abs(deta) > cfg->maxDeltaEtaBarrel)) return ; if (ele->isEE() && (std::abs(deta) > cfg->maxDeltaEtaEndcaps)) return ; LogTrace("GsfElectronAlgo") << "Delta eta criteria are satisfied"; // delta phi criteria double dphi = ele->deltaPhiSuperClusterTrackAtVtx(); LogTrace("GsfElectronAlgo") << "delta phi : " << dphi; if (ele->isEB() && (std::abs(dphi) > cfg->maxDeltaPhiBarrel)) return ; if (ele->isEE() && (std::abs(dphi) > cfg->maxDeltaPhiEndcaps)) return ; LogTrace("GsfElectronAlgo") << "Delta phi criteria are satisfied"; // sigma ieta ieta LogTrace("GsfElectronAlgo") << "sigma ieta ieta : " << ele->sigmaIetaIeta(); if (ele->isEB() && (ele->sigmaIetaIeta() > cfg->maxSigmaIetaIetaBarrel)) return ; if (ele->isEE() && (ele->sigmaIetaIeta() > cfg->maxSigmaIetaIetaEndcaps)) return ; LogTrace("GsfElectronAlgo") << "Sigma ieta ieta criteria are satisfied"; // fiducial if (!ele->isEB() && cfg->isBarrel) return ; if (!ele->isEE() && cfg->isEndcaps) return ; if (cfg->isFiducial && (ele->isEBEEGap()||ele->isEBEtaGap()||ele->isEBPhiGap()||ele->isEERingGap()||ele->isEEDeeGap())) return ; LogTrace("GsfElectronAlgo") << "Fiducial flags criteria are satisfied"; // seed in TEC edm::RefToBase<TrajectorySeed> seed = ele->gsfTrack()->extra()->seedRef() ; ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>() ; if (eg && !generalData_->cutsCfg.seedFromTEC) { if (elseed.isNull()) { throw cms::Exception("GsfElectronAlgo|NotElectronSeed")<<"The GsfTrack seed is not an ElectronSeed ?!" ; } else { if (elseed->subDet2()==6) return ; } } // transverse impact parameter if (std::abs(ele->gsfTrack()->dxy(bs.position()))>cfg->maxTIP) return ; LogTrace("GsfElectronAlgo") << "TIP criterion is satisfied" ; LogTrace("GsfElectronAlgo") << "All cut based criteria are satisfied" ; ele->setPassCutBasedPreselection(true) ; }
void GsfElectronAlgo::setMvaPreselectionFlag | ( | reco::GsfElectron * | ele | ) | [private] |
Definition at line 974 of file GsfElectronAlgo.cc.
References reco::GsfElectron::core(), GsfElectronAlgo::GeneralData::cutsCfg, GsfElectronAlgo::GeneralData::cutsCfgPflow, generalData_, LogTrace, GsfElectronAlgo::CutsConfiguration::minMVA, reco::GsfElectron::mva(), reco::GsfElectron::passingMvaPreselection(), and reco::GsfElectron::setPassMvaPreselection().
Referenced by addPflowInfo().
{ ele->setPassMvaPreselection(false) ; if (ele->core()->ecalDrivenSeed()) { if (ele->mva()>=generalData_->cutsCfg.minMVA) ele->setPassMvaPreselection(true) ; } else { if (ele->mva()>=generalData_->cutsCfgPflow.minMVA) ele->setPassMvaPreselection(true) ; } if (ele->passingMvaPreselection()) { LogTrace("GsfElectronAlgo") << "Mva criterion is satisfied" ; } }
ElectronData* GsfElectronAlgo::electronData_ [private] |
Definition at line 214 of file GsfElectronAlgo.h.
Referenced by completeElectrons(), createElectron(), and ~GsfElectronAlgo().
EventData* GsfElectronAlgo::eventData_ [private] |
Definition at line 213 of file GsfElectronAlgo.h.
Referenced by addPflowInfo(), beginEvent(), calculateShowerShape(), clonePreviousElectrons(), completeElectrons(), copyElectrons(), createElectron(), displayInternalElectrons(), endEvent(), removeAmbiguousElectrons(), removeNotPreselectedElectrons(), setAmbiguityData(), and ~GsfElectronAlgo().
EventSetupData* GsfElectronAlgo::eventSetupData_ [private] |
Definition at line 212 of file GsfElectronAlgo.h.
Referenced by beginEvent(), calculateShowerShape(), checkSetup(), completeElectrons(), createElectron(), setAmbiguityData(), and ~GsfElectronAlgo().
GeneralData* GsfElectronAlgo::generalData_ [private] |
Definition at line 210 of file GsfElectronAlgo.h.
Referenced by beginEvent(), calculateShowerShape(), checkSetup(), createElectron(), setAmbiguityData(), setCutBasedPreselectionFlag(), setMvaPreselectionFlag(), and ~GsfElectronAlgo().