CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
GsfElectronAlgo Class Reference

#include <GsfElectronAlgo.h>

Classes

struct  CutsConfiguration
 
struct  EcalRecHitsConfiguration
 
struct  ElectronData
 
struct  EventData
 
struct  EventSetupData
 
struct  GeneralData
 
struct  InputTagsConfiguration
 
struct  IsolationConfiguration
 
struct  StrategyConfiguration
 

Public Types

typedef std::list< reco::GsfElectron * > GsfElectronPtrCollection
 

Public Member Functions

void addPflowInfo ()
 
void beginEvent (edm::Event &)
 
void checkSetup (const edm::EventSetup &)
 
void clonePreviousElectrons ()
 
void completeElectrons (const gsfAlgoHelpers::HeavyObjectCache *)
 
void copyElectrons (reco::GsfElectronCollection &)
 
void displayInternalElectrons (const std::string &title) const
 
void endEvent ()
 
 GsfElectronAlgo (const InputTagsConfiguration &, const StrategyConfiguration &, const CutsConfiguration &cutsCfg, const CutsConfiguration &cutsCfgPflow, const ElectronHcalHelper::Configuration &hcalCfg, const ElectronHcalHelper::Configuration &hcalCfgPflow, const IsolationConfiguration &, const EcalRecHitsConfiguration &, EcalClusterFunctionBaseClass *superClusterErrorFunction, EcalClusterFunctionBaseClass *crackCorrectionFunction, const SoftElectronMVAEstimator::Configuration &mva_NIso_Cfg, const ElectronMVAEstimator::Configuration &mva_Iso_Cfg, const RegressionHelper::Configuration &regCfg, const edm::ParameterSet &tkIsol03Cfg, const edm::ParameterSet &tkIsol04Cfg)
 
void removeAmbiguousElectrons ()
 
void removeNotPreselectedElectrons ()
 
void setAmbiguityData (bool ignoreNotPreselected=true)
 
void setMVAInputs (const std::map< reco::GsfTrackRef, reco::GsfElectron::MvaInput > &mvaInputs)
 
void setMVAOutputs (const gsfAlgoHelpers::HeavyObjectCache *, const std::map< reco::GsfTrackRef, reco::GsfElectron::MvaOutput > &mvaOutputs)
 
 ~GsfElectronAlgo ()
 

Private Member Functions

void calculateSaturationInfo (const reco::SuperClusterRef &, reco::GsfElectron::SaturationInfo &)
 
void calculateShowerShape (const reco::SuperClusterRef &, bool pflow, reco::GsfElectron::ShowerShape &)
 
void calculateShowerShape_full5x5 (const reco::SuperClusterRef &, bool pflow, reco::GsfElectron::ShowerShape &)
 
void createElectron (const gsfAlgoHelpers::HeavyObjectCache *)
 
const reco::SuperClusterRef getTrSuperCluster (const reco::GsfTrackRef &trackRef)
 
bool isPreselected (reco::GsfElectron *ele)
 
void setCutBasedPreselectionFlag (reco::GsfElectron *ele, const reco::BeamSpot &)
 
void setMVAepiBasedPreselectionFlag (reco::GsfElectron *ele)
 
void setPflowPreselectionFlag (reco::GsfElectron *ele)
 
void setPixelMatchInfomation (reco::GsfElectron *)
 

Private Attributes

ElectronDataelectronData_
 
EventDataeventData_
 
EventSetupDataeventSetupData_
 
GeneralDatageneralData_
 
EleTkIsolFromCands tkIsol03Calc_
 
EleTkIsolFromCands tkIsol04Calc_
 

Detailed Description

Definition at line 58 of file GsfElectronAlgo.h.

Member Typedef Documentation

Definition at line 212 of file GsfElectronAlgo.h.

Constructor & Destructor Documentation

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 EcalRecHitsConfiguration recHitsCfg,
EcalClusterFunctionBaseClass superClusterErrorFunction,
EcalClusterFunctionBaseClass crackCorrectionFunction,
const SoftElectronMVAEstimator::Configuration mva_NIso_Cfg,
const ElectronMVAEstimator::Configuration mva_Iso_Cfg,
const RegressionHelper::Configuration regCfg,
const edm::ParameterSet tkIsol03Cfg,
const edm::ParameterSet tkIsol04Cfg 
)

Definition at line 737 of file GsfElectronAlgo.cc.

Referenced by calculateShowerShape_full5x5().

754  : generalData_(new GeneralData(inputCfg,strategyCfg,cutsCfg,cutsCfgPflow,hcalCfg,hcalCfgPflow,isoCfg,recHitsCfg,superClusterErrorFunction,crackCorrectionFunction,mva_NIso_Cfg,mva_Iso_Cfg,regCfg)),
755  eventSetupData_(new EventSetupData),
756  eventData_(nullptr), electronData_(nullptr),
757  tkIsol03Calc_(tkIsol03Cfg),tkIsol04Calc_(tkIsol04Cfg)
758  {}
GeneralData * generalData_
EventSetupData * eventSetupData_
EleTkIsolFromCands tkIsol04Calc_
EventData * eventData_
ElectronData * electronData_
EleTkIsolFromCands tkIsol03Calc_
GsfElectronAlgo::~GsfElectronAlgo ( )

Definition at line 760 of file GsfElectronAlgo.cc.

References electronData_, eventData_, eventSetupData_, and generalData_.

761  {
762  delete generalData_ ;
763  delete eventSetupData_ ;
764  delete eventData_ ;
765  delete electronData_ ;
766  }
GeneralData * generalData_
EventSetupData * eventSetupData_
EventData * eventData_
ElectronData * electronData_

Member Function Documentation

void GsfElectronAlgo::addPflowInfo ( )

Definition at line 1023 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::edIsolationValues, GsfElectronAlgo::EventData::electrons, eventData_, Exception, funct::false, runEdmFileComparison::found, GsfElectronAlgo::EventData::pfIsolationValues, GsfElectronAlgo::EventData::pflowElectrons, GsfElectronAlgo::EventData::previousElectrons, edm::Handle< T >::product(), setPflowPreselectionFlag(), reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, and funct::true.

Referenced by GsfElectronProducer::produce().

1024  {
1025  bool found ;
1026  const GsfElectronCollection * edElectrons = eventData_->previousElectrons.product() ;
1027  const GsfElectronCollection * pfElectrons = eventData_->pflowElectrons.product() ;
1028  GsfElectronCollection::const_iterator pfElectron, edElectron ;
1029  unsigned int edIndex, pfIndex ;
1030 
1031  GsfElectronPtrCollection::iterator el ;
1032  for
1033  ( el = eventData_->electrons->begin() ;
1034  el != eventData_->electrons->end() ;
1035  el++ )
1036  {
1037 
1038  // Retreive info from pflow electrons
1039  found = false ;
1040  for
1041  ( pfIndex = 0, pfElectron = pfElectrons->begin() ; pfElectron != pfElectrons->end() ; pfIndex++, pfElectron++ )
1042  {
1043  if (pfElectron->gsfTrack()==(*el)->gsfTrack())
1044  {
1045  if (found)
1046  {
1047  edm::LogWarning("GsfElectronProducer")<<"associated pfGsfElectron already found" ;
1048  }
1049  else
1050  {
1051  found = true ;
1052 
1053  // Isolation Values
1054  if( !(eventData_->pfIsolationValues).empty() )
1055  {
1057  pfElectronRef(eventData_->pflowElectrons, pfIndex);
1059  isoVariables.sumChargedHadronPt =(*(eventData_->pfIsolationValues)[0])[pfElectronRef];
1060  isoVariables.sumPhotonEt =(*(eventData_->pfIsolationValues)[1])[pfElectronRef];
1061  isoVariables.sumNeutralHadronEt =(*(eventData_->pfIsolationValues)[2])[pfElectronRef];
1062  (*el)->setPfIsolationVariables(isoVariables);
1063  }
1064 
1065 // (*el)->setPfIsolationVariables(pfElectron->pfIsolationVariables()) ;
1066  (*el)->setMvaInput(pfElectron->mvaInput()) ;
1067  (*el)->setMvaOutput(pfElectron->mvaOutput()) ;
1068  if ((*el)->ecalDrivenSeed())
1069  { (*el)->setP4(GsfElectron::P4_PFLOW_COMBINATION,pfElectron->p4(GsfElectron::P4_PFLOW_COMBINATION),pfElectron->p4Error(GsfElectron::P4_PFLOW_COMBINATION),false) ; }
1070  else
1071  { (*el)->setP4(GsfElectron::P4_PFLOW_COMBINATION,pfElectron->p4(GsfElectron::P4_PFLOW_COMBINATION),pfElectron->p4Error(GsfElectron::P4_PFLOW_COMBINATION),true) ; }
1072  double noCutMin = -999999999. ;
1073  if ((*el)->mva_e_pi()<noCutMin) { throw cms::Exception("GsfElectronAlgo|UnexpectedMvaValue")<<"unexpected MVA value: "<<(*el)->mva_e_pi() ; }
1074  }
1075  }
1076  }
1077 
1078  // Isolation Values
1079  // Retreive not found info from ed electrons
1080  if( !(eventData_->edIsolationValues).empty() )
1081  {
1082  edIndex = 0, edElectron = edElectrons->begin() ;
1083  while ((found == false)&&(edElectron != edElectrons->end()))
1084  {
1085  if (edElectron->gsfTrack()==(*el)->gsfTrack())
1086  {
1087  found = true ;
1088 
1089  // CONSTRUCTION D UNE REF dans le handle eventData_->previousElectrons avec l'indice edIndex,
1090  // puis recuperation dans la ValueMap ED
1091 
1093  edElectronRef(eventData_->previousElectrons, edIndex);
1095  isoVariables.sumChargedHadronPt =(*(eventData_->edIsolationValues)[0])[edElectronRef];
1096  isoVariables.sumPhotonEt =(*(eventData_->edIsolationValues)[1])[edElectronRef];
1097  isoVariables.sumNeutralHadronEt =(*(eventData_->edIsolationValues)[2])[edElectronRef];
1098  (*el)->setPfIsolationVariables(isoVariables);
1099  }
1100 
1101  edIndex++ ;
1102  edElectron++ ;
1103  }
1104  }
1105 
1106  // Preselection
1108 
1109  }
1110  }
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:631
IsolationValueMaps pfIsolationValues
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:630
GsfElectronPtrCollection * electrons
edm::Handle< reco::GsfElectronCollection > previousElectrons
edm::Handle< reco::GsfElectronCollection > pflowElectrons
T const * product() const
Definition: Handle.h:81
void setPflowPreselectionFlag(reco::GsfElectron *ele)
EventData * eventData_
IsolationValueMaps edIsolationValues
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:629
void GsfElectronAlgo::beginEvent ( edm::Event event)

Definition at line 835 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::InputTagsConfiguration::barrelRecHitCollection, GsfElectronAlgo::EventData::barrelRecHits, GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::InputTagsConfiguration::beamSpotTag, GsfElectronAlgo::EventSetupData::caloGeom, GsfElectronAlgo::EventData::coreElectrons, GsfElectronAlgo::InputTagsConfiguration::ctfTracks, GsfElectronAlgo::EventData::currentCtfTracks, EgammaRecHitIsolation::doFlagChecks(), EgammaRecHitIsolation::doSeverityChecks(), DetId::Ecal, GsfElectronAlgo::EventData::ecalBarrelIsol03, GsfElectronAlgo::EventData::ecalBarrelIsol04, GsfElectronAlgo::EventData::ecalEndcapIsol03, GsfElectronAlgo::EventData::ecalEndcapIsol04, GsfElectronAlgo::EventData::edIsolationValues, GsfElectronAlgo::InputTagsConfiguration::edIsoVals, GsfElectronAlgo::IsolationConfiguration::eMinBarrel, GsfElectronAlgo::IsolationConfiguration::eMinEndcaps, edm::ParameterSet::empty(), GsfElectronAlgo::InputTagsConfiguration::endcapRecHitCollection, GsfElectronAlgo::EventData::endcapRecHits, GsfElectronAlgo::IsolationConfiguration::etMinBarrel, GsfElectronAlgo::IsolationConfiguration::etMinEndcaps, GsfElectronAlgo::IsolationConfiguration::etMinHcal, GsfElectronAlgo::EventData::event, GsfElectronAlgo::EventData::EventData(), eventData_, eventSetupData_, Exception, generalData_, edm::Event::getByToken(), edm::ParameterSet::getParameter(), 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::intRadiusEcalBarrel, GsfElectronAlgo::IsolationConfiguration::intRadiusEcalEndcaps, GsfElectronAlgo::IsolationConfiguration::intRadiusHcal, GsfElectronAlgo::GeneralData::isoCfg, GsfElectronAlgo::IsolationConfiguration::jurassicWidth, GsfElectronAlgo::EventData::pfIsolationValues, GsfElectronAlgo::InputTagsConfiguration::pfIsoVals, GsfElectronAlgo::EventData::pflowElectrons, GsfElectronAlgo::InputTagsConfiguration::pflowGsfElectronsTag, GsfElectronAlgo::InputTagsConfiguration::pfMVA, GsfElectronAlgo::EventData::pfMva, GsfElectronAlgo::EventData::previousElectrons, GsfElectronAlgo::InputTagsConfiguration::previousGsfElectrons, edm::Handle< T >::product(), edm::ESHandle< T >::product(), ElectronHcalHelper::readEvent(), GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedEndcaps, GsfElectronAlgo::GeneralData::recHitsCfg, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedEndcaps, GsfElectronAlgo::EventData::seeds, GsfElectronAlgo::InputTagsConfiguration::seedsTag, EgammaRecHitIsolation::setUseNumCrystals(), EgammaRecHitIsolation::setVetoClustered(), GsfElectronAlgo::EventSetupData::sevLevel, GsfElectronAlgo::GeneralData::strategyCfg, GsfElectronAlgo::EventData::towers, GsfElectronAlgo::StrategyConfiguration::useGsfPfRecTracks, GsfElectronAlgo::IsolationConfiguration::useNumCrystals, GsfElectronAlgo::EventData::vertices, GsfElectronAlgo::IsolationConfiguration::vetoClustered, and GsfElectronAlgo::InputTagsConfiguration::vtxCollectionTag.

Referenced by GsfElectronBaseProducer::beginEvent().

836  {
837  if (eventData_!=nullptr)
838  { throw cms::Exception("GsfElectronAlgo|InternalError")<<"unexpected event data" ; }
839  eventData_ = new EventData ;
840 
841  // init the handles linked to the current event
842  eventData_->event = &event ;
849  event.getByToken(generalData_->inputCfg.hcalTowersTag,eventData_->towers) ;
850  event.getByToken(generalData_->inputCfg.pfMVA,eventData_->pfMva) ;
851  event.getByToken(generalData_->inputCfg.seedsTag,eventData_->seeds) ;
855 
856  // get the beamspot from the Event:
857  edm::Handle<reco::BeamSpot> recoBeamSpotHandle ;
858  event.getByToken(generalData_->inputCfg.beamSpotTag,recoBeamSpotHandle) ;
859  eventData_->beamspot = recoBeamSpotHandle.product() ;
860 
861  // prepare access to hcal data
864 
865  // Isolation algos
866  float egHcalIsoConeSizeOutSmall=0.3, egHcalIsoConeSizeOutLarge=0.4;
867  float egHcalIsoConeSizeIn=generalData_->isoCfg.intRadiusHcal,egHcalIsoPtMin=generalData_->isoCfg.etMinHcal;
868  int egHcalDepth1=1, egHcalDepth2=2;
869  eventData_->hadDepth1Isolation03 = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
870  eventData_->hadDepth2Isolation03 = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
871  eventData_->hadDepth1Isolation04 = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
872  eventData_->hadDepth2Isolation04 = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
873  eventData_->hadDepth1Isolation03Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,0.,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
874  eventData_->hadDepth2Isolation03Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,0.,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
875  eventData_->hadDepth1Isolation04Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,0.,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
876  eventData_->hadDepth2Isolation04Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,0.,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
877 
878  float egIsoConeSizeOutSmall=0.3, egIsoConeSizeOutLarge=0.4, egIsoJurassicWidth=generalData_->isoCfg.jurassicWidth;
879  float egIsoPtMinBarrel=generalData_->isoCfg.etMinBarrel,egIsoEMinBarrel=generalData_->isoCfg.eMinBarrel, egIsoConeSizeInBarrel=generalData_->isoCfg.intRadiusEcalBarrel;
880  float egIsoPtMinEndcap=generalData_->isoCfg.etMinEndcaps,egIsoEMinEndcap=generalData_->isoCfg.eMinEndcaps, egIsoConeSizeInEndcap=generalData_->isoCfg.intRadiusEcalEndcaps;
881  eventData_->ecalBarrelIsol03 = new EgammaRecHitIsolation(egIsoConeSizeOutSmall,egIsoConeSizeInBarrel,egIsoJurassicWidth,egIsoPtMinBarrel,egIsoEMinBarrel,eventSetupData_->caloGeom,*(eventData_->barrelRecHits),eventSetupData_->sevLevel.product(),DetId::Ecal);
882  eventData_->ecalBarrelIsol04 = new EgammaRecHitIsolation(egIsoConeSizeOutLarge,egIsoConeSizeInBarrel,egIsoJurassicWidth,egIsoPtMinBarrel,egIsoEMinBarrel,eventSetupData_->caloGeom,*(eventData_->barrelRecHits),eventSetupData_->sevLevel.product(),DetId::Ecal);
883  eventData_->ecalEndcapIsol03 = new EgammaRecHitIsolation(egIsoConeSizeOutSmall,egIsoConeSizeInEndcap,egIsoJurassicWidth,egIsoPtMinEndcap,egIsoEMinEndcap,eventSetupData_->caloGeom,*(eventData_->endcapRecHits),eventSetupData_->sevLevel.product(),DetId::Ecal);
884  eventData_->ecalEndcapIsol04 = new EgammaRecHitIsolation(egIsoConeSizeOutLarge,egIsoConeSizeInEndcap,egIsoJurassicWidth,egIsoPtMinEndcap,egIsoEMinEndcap,eventSetupData_->caloGeom,*(eventData_->endcapRecHits),eventSetupData_->sevLevel.product(),DetId::Ecal);
901 
902  //Fill in the Isolation Value Maps for PF and EcalDriven electrons
903  std::vector<edm::InputTag> inputTagIsoVals;
905  inputTagIsoVals.push_back(generalData_->inputCfg.pfIsoVals.getParameter<edm::InputTag>("pfSumChargedHadronPt"));
906  inputTagIsoVals.push_back(generalData_->inputCfg.pfIsoVals.getParameter<edm::InputTag>("pfSumPhotonEt"));
907  inputTagIsoVals.push_back(generalData_->inputCfg.pfIsoVals.getParameter<edm::InputTag>("pfSumNeutralHadronEt"));
908 
909  eventData_->pfIsolationValues.resize(inputTagIsoVals.size());
910 
911  for (size_t j = 0; j<inputTagIsoVals.size(); ++j) {
912  event.getByLabel(inputTagIsoVals[j], eventData_->pfIsolationValues[j]);
913  }
914 
915  }
916 
918  inputTagIsoVals.clear();
919  inputTagIsoVals.push_back(generalData_->inputCfg.edIsoVals.getParameter<edm::InputTag>("edSumChargedHadronPt"));
920  inputTagIsoVals.push_back(generalData_->inputCfg.edIsoVals.getParameter<edm::InputTag>("edSumPhotonEt"));
921  inputTagIsoVals.push_back(generalData_->inputCfg.edIsoVals.getParameter<edm::InputTag>("edSumNeutralHadronEt"));
922 
923  eventData_->edIsolationValues.resize(inputTagIsoVals.size());
924 
925  for (size_t j = 0; j<inputTagIsoVals.size(); ++j) {
926  event.getByLabel(inputTagIsoVals[j], eventData_->edIsolationValues[j]);
927  }
928  }
929  }
ElectronHcalHelper * hcalHelperPflow
T getParameter(std::string const &) const
edm::Handle< reco::ElectronSeedCollection > seeds
bool empty() const
Definition: ParameterSet.h:218
edm::Handle< edm::ValueMap< float > > pfMva
GeneralData * generalData_
EgammaTowerIsolation * hadDepth1Isolation04Bc
edm::EDGetTokenT< reco::GsfElectronCoreCollection > gsfElectronCores
void readEvent(const edm::Event &)
EgammaTowerIsolation * hadDepth1Isolation03Bc
edm::EDGetTokenT< reco::GsfElectronCollection > previousGsfElectrons
const IsolationConfiguration isoCfg
edm::EDGetTokenT< reco::VertexCollection > vtxCollectionTag
const EcalRecHitsConfiguration recHitsCfg
EventSetupData * eventSetupData_
edm::Handle< EcalRecHitCollection > endcapRecHits
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollection
const InputTagsConfiguration inputCfg
edm::ESHandle< EcalSeverityLevelAlgo > sevLevel
EgammaTowerIsolation * hadDepth1Isolation03
edm::EDGetTokenT< reco::GsfElectronCollection > pflowGsfElectronsTag
const StrategyConfiguration strategyCfg
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollection
void doFlagChecks(const std::vector< int > &v)
edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksTag
EgammaRecHitIsolation * ecalBarrelIsol04
EgammaTowerIsolation * hadDepth2Isolation03
EgammaTowerIsolation * hadDepth1Isolation04
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag
void setUseNumCrystals(bool b=true)
EgammaRecHitIsolation * ecalEndcapIsol03
EgammaTowerIsolation * hadDepth2Isolation03Bc
edm::Handle< EcalRecHitCollection > barrelRecHits
IsolationValueMaps pfIsolationValues
ElectronHcalHelper * hcalHelper
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsTag
const reco::BeamSpot * beamspot
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::EDGetTokenT< edm::ValueMap< float > > pfMVA
void doSeverityChecks(const EcalRecHitCollection *const recHits, const std::vector< int > &v)
edm::EDGetTokenT< CaloTowerCollection > hcalTowersTag
EgammaTowerIsolation * hadDepth2Isolation04Bc
edm::EDGetTokenT< reco::TrackCollection > ctfTracks
edm::Handle< reco::GsfElectronCollection > previousElectrons
edm::Handle< reco::VertexCollection > vertices
EgammaRecHitIsolation * ecalBarrelIsol03
edm::Handle< reco::GsfElectronCollection > pflowElectrons
T const * product() const
Definition: Handle.h:81
EgammaTowerIsolation * hadDepth2Isolation04
void setVetoClustered(bool b=true)
edm::Handle< reco::TrackCollection > currentCtfTracks
edm::ESHandle< CaloGeometry > caloGeom
EgammaRecHitIsolation * ecalEndcapIsol04
EventData * eventData_
IsolationValueMaps edIsolationValues
edm::Handle< reco::GsfElectronCoreCollection > coreElectrons
T const * product() const
Definition: ESHandle.h:86
edm::Handle< CaloTowerCollection > towers
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracks
void GsfElectronAlgo::calculateSaturationInfo ( const reco::SuperClusterRef theClus,
reco::GsfElectron::SaturationInfo si 
)
private

Definition at line 539 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::barrelRecHits, gamEcalExtractorBlocks_cff::detector, EcalBarrel, ecalRecalibRecHit_cfi::ecalRecHit, edm::SortedCollection< T, SORT >::end(), GsfElectronAlgo::EventData::endcapRecHits, eventData_, edm::SortedCollection< T, SORT >::find(), reco::GsfElectron::SaturationInfo::isSeedSaturated, reco::GsfElectron::SaturationInfo::nSaturatedXtals, nullptr, reco::CaloCluster::seed(), and DetId::subdetId().

Referenced by createElectron().

540  {
541 
542  const reco::CaloCluster & seedCluster = *(theClus->seed()) ;
543  DetId seedXtalId = seedCluster.seed();
544  int detector = seedXtalId.subdetId();
545  const EcalRecHitCollection* ecalRecHits = nullptr ;
546  if (detector==EcalBarrel)
547  ecalRecHits = eventData_->barrelRecHits.product() ;
548  else
549  ecalRecHits = eventData_->endcapRecHits.product() ;
550 
551  int nSaturatedXtals = 0;
552  bool isSeedSaturated = false;
553  const auto hitsAndFractions = theClus->hitsAndFractions();
554  for (auto&& hitFractionPair : hitsAndFractions) {
555  auto&& ecalRecHit = ecalRecHits->find(hitFractionPair.first);
556  if (ecalRecHit == ecalRecHits->end()) continue;
557  if (ecalRecHit->checkFlag(EcalRecHit::Flags::kSaturated)) {
558  nSaturatedXtals++;
559  if (seedXtalId == ecalRecHit->detid())
560  isSeedSaturated = true;
561  }
562  }
563  si.nSaturatedXtals = nSaturatedXtals;
564  si.isSeedSaturated = isSeedSaturated;
565 
566 }
edm::Handle< EcalRecHitCollection > endcapRecHits
#define nullptr
edm::Handle< EcalRecHitCollection > barrelRecHits
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
const_iterator end() const
Definition: DetId.h:18
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:207
iterator find(key_type k)
EventData * eventData_
void GsfElectronAlgo::calculateShowerShape ( const reco::SuperClusterRef theClus,
bool  pflow,
reco::GsfElectron::ShowerShape showerShape 
)
private

Definition at line 568 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::barrelRecHits, GsfElectronAlgo::EventSetupData::caloGeom, GsfElectronAlgo::EventSetupData::caloTopo, gamEcalExtractorBlocks_cff::detector, heepElectronID_HEEPV50_CSA14_25ns_cff::e1x5, reco::GsfElectron::ShowerShape::e1x5, reco::GsfElectron::ShowerShape::e2nd, reco::GsfElectron::ShowerShape::e2x5Bottom, reco::GsfElectron::ShowerShape::e2x5Left, reco::GsfElectron::ShowerShape::e2x5Max, reco::GsfElectron::ShowerShape::e2x5Right, reco::GsfElectron::ShowerShape::e2x5Top, heepElectronID_HEEPV50_CSA14_25ns_cff::e5x5, reco::GsfElectron::ShowerShape::e5x5, reco::GsfElectron::ShowerShape::eBottom, EcalBarrel, reco::GsfElectron::ShowerShape::eLeft, photonPostprocessing_cfi::eMax, reco::GsfElectron::ShowerShape::eMax, GsfElectronAlgo::EventData::endcapRecHits, reco::GsfElectron::ShowerShape::eRight, reco::GsfElectron::ShowerShape::eTop, eventData_, eventSetupData_, generalData_, ElectronHcalHelper::hasActiveHcal(), 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, ElectronHcalHelper::hcalTowersBehindClusters(), reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, reco::CaloCluster::hitsAndFractions(), reco::GsfElectron::ShowerShape::invalidHcal, edm::isNotFinite(), nullptr, edm::ESHandle< T >::product(), reco::GsfElectron::ShowerShape::r9, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedEndcaps, GsfElectronAlgo::GeneralData::recHitsCfg, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedEndcaps, reco::GsfElectron::ShowerShape::sigmaEtaEta, reco::GsfElectron::ShowerShape::sigmaIetaIeta, reco::GsfElectron::ShowerShape::sigmaIetaIphi, reco::GsfElectron::ShowerShape::sigmaIphiIphi, mathSSE::sqrt(), DetId::subdetId(), and ecaldqm::topology().

Referenced by createElectron().

570  {
571  const reco::CaloCluster & seedCluster = *(theClus->seed()) ;
572  // temporary, till CaloCluster->seed() is made available
573  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first ;
574  int detector = seedXtalId.subdetId() ;
575 
578  const EcalRecHitCollection * recHits = nullptr ;
579  std::vector<int> recHitFlagsToBeExcluded ;
580  std::vector<int> recHitSeverityToBeExcluded ;
581  if (detector==EcalBarrel)
582  {
583  recHits = eventData_->barrelRecHits.product() ;
584  recHitFlagsToBeExcluded = generalData_->recHitsCfg.recHitFlagsToBeExcludedBarrel ;
585  recHitSeverityToBeExcluded = generalData_->recHitsCfg.recHitSeverityToBeExcludedBarrel ;
586  }
587  else
588  {
589  recHits = eventData_->endcapRecHits.product() ;
590  recHitFlagsToBeExcluded = generalData_->recHitsCfg.recHitFlagsToBeExcludedEndcaps ;
591  recHitSeverityToBeExcluded = generalData_->recHitsCfg.recHitSeverityToBeExcludedEndcaps ;
592  }
593 
594  std::vector<float> covariances = EcalClusterTools::covariances(seedCluster,recHits,topology,geometry) ;
595  std::vector<float> localCovariances = EcalClusterTools::localCovariances(seedCluster,recHits,topology) ;
596  showerShape.sigmaEtaEta = sqrt(covariances[0]) ;
597  showerShape.sigmaIetaIeta = sqrt(localCovariances[0]) ;
598  if (!edm::isNotFinite(localCovariances[2])) showerShape.sigmaIphiIphi = sqrt(localCovariances[2]) ;
599  showerShape.e1x5 = EcalClusterTools::e1x5(seedCluster,recHits,topology) ;
600  showerShape.e2x5Max = EcalClusterTools::e2x5Max(seedCluster,recHits,topology) ;
601  showerShape.e5x5 = EcalClusterTools::e5x5(seedCluster,recHits,topology) ;
602  showerShape.r9 = EcalClusterTools::e3x3(seedCluster,recHits,topology)/theClus->rawEnergy() ;
603 
604  if (pflow)
605  {
606  showerShape.hcalDepth1OverEcal = generalData_->hcalHelperPflow->hcalESumDepth1(*theClus)/theClus->energy() ;
607  showerShape.hcalDepth2OverEcal = generalData_->hcalHelperPflow->hcalESumDepth2(*theClus)/theClus->energy() ;
611  showerShape.invalidHcal = (showerShape.hcalDepth1OverEcalBc == 0 &&
612  showerShape.hcalDepth2OverEcalBc == 0 &&
614  }
615  else
616  {
617  showerShape.hcalDepth1OverEcal = generalData_->hcalHelper->hcalESumDepth1(*theClus)/theClus->energy() ;
618  showerShape.hcalDepth2OverEcal = generalData_->hcalHelper->hcalESumDepth2(*theClus)/theClus->energy() ;
622  showerShape.invalidHcal = (showerShape.hcalDepth1OverEcalBc == 0 &&
623  showerShape.hcalDepth2OverEcalBc == 0 &&
624  !generalData_->hcalHelper->hasActiveHcal(*theClus));
625  }
626 
627  // extra shower shapes
628  const float see_by_spp = showerShape.sigmaIetaIeta*showerShape.sigmaIphiIphi;
629  if( see_by_spp > 0 ) {
630  showerShape.sigmaIetaIphi = localCovariances[1] / see_by_spp;
631  } else if ( localCovariances[1] > 0 ) {
632  showerShape.sigmaIetaIphi = 1.f;
633  } else {
634  showerShape.sigmaIetaIphi = -1.f;
635  }
636  showerShape.eMax = EcalClusterTools::eMax(seedCluster,recHits);
637  showerShape.e2nd = EcalClusterTools::e2nd(seedCluster,recHits);
638  showerShape.eTop = EcalClusterTools::eTop(seedCluster,recHits,topology);
639  showerShape.eLeft = EcalClusterTools::eLeft(seedCluster,recHits,topology);
640  showerShape.eRight = EcalClusterTools::eRight(seedCluster,recHits,topology);
641  showerShape.eBottom = EcalClusterTools::eBottom(seedCluster,recHits,topology);
642 
643  showerShape.e2x5Left = EcalClusterTools::e2x5Left(seedCluster,recHits,topology);
644  showerShape.e2x5Right = EcalClusterTools::e2x5Right(seedCluster,recHits,topology);
645  showerShape.e2x5Top = EcalClusterTools::e2x5Top(seedCluster,recHits,topology);
646  showerShape.e2x5Bottom = EcalClusterTools::e2x5Bottom(seedCluster,recHits,topology);
647  }
ElectronHcalHelper * hcalHelperPflow
GeneralData * generalData_
bool hasActiveHcal(const reco::SuperCluster &sc)
CaloTopology const * topology(0)
const EcalRecHitsConfiguration recHitsCfg
EventSetupData * eventSetupData_
edm::Handle< EcalRecHitCollection > endcapRecHits
double hcalESumDepth2BehindClusters(const std::vector< CaloTowerDetId > &towers)
std::vector< CaloTowerDetId > hcalTowersBehindClusters(const reco::SuperCluster &sc)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:197
double hcalESumDepth1BehindClusters(const std::vector< CaloTowerDetId > &towers)
#define nullptr
edm::ESHandle< CaloTopology > caloTopo
bool isNotFinite(T x)
Definition: isFinite.h:10
T sqrt(T t)
Definition: SSEVec.h:18
edm::Handle< EcalRecHitCollection > barrelRecHits
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:396
double hcalESumDepth2(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0)
ElectronHcalHelper * hcalHelper
Definition: DetId.h:18
edm::ESHandle< CaloGeometry > caloGeom
double hcalESumDepth1(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0)
EventData * eventData_
T const * product() const
Definition: ESHandle.h:86
void GsfElectronAlgo::calculateShowerShape_full5x5 ( const reco::SuperClusterRef theClus,
bool  pflow,
reco::GsfElectron::ShowerShape showerShape 
)
private

Definition at line 649 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::barrelRecHits, GsfElectronAlgo::EventSetupData::caloGeom, GsfElectronAlgo::EventSetupData::caloTopo, EcalClusterToolsT< noZS >::covariances(), gamEcalExtractorBlocks_cff::detector, EcalClusterToolsT< noZS >::e1x5(), reco::GsfElectron::ShowerShape::e1x5, EcalClusterToolsT< noZS >::e2nd(), reco::GsfElectron::ShowerShape::e2nd, EcalClusterToolsT< noZS >::e2x5Bottom(), reco::GsfElectron::ShowerShape::e2x5Bottom, EcalClusterToolsT< noZS >::e2x5Left(), reco::GsfElectron::ShowerShape::e2x5Left, EcalClusterToolsT< noZS >::e2x5Max(), reco::GsfElectron::ShowerShape::e2x5Max, EcalClusterToolsT< noZS >::e2x5Right(), reco::GsfElectron::ShowerShape::e2x5Right, EcalClusterToolsT< noZS >::e2x5Top(), reco::GsfElectron::ShowerShape::e2x5Top, EcalClusterToolsT< noZS >::e3x3(), EcalClusterToolsT< noZS >::e5x5(), reco::GsfElectron::ShowerShape::e5x5, EcalClusterToolsT< noZS >::eBottom(), reco::GsfElectron::ShowerShape::eBottom, EcalBarrel, EcalClusterToolsT< noZS >::eLeft(), reco::GsfElectron::ShowerShape::eLeft, EcalClusterToolsT< noZS >::eMax(), reco::GsfElectron::ShowerShape::eMax, GsfElectronAlgo::EventData::endcapRecHits, EcalClusterToolsT< noZS >::eRight(), reco::GsfElectron::ShowerShape::eRight, EcalClusterToolsT< noZS >::eTop(), reco::GsfElectron::ShowerShape::eTop, eventData_, eventSetupData_, generalData_, GsfElectronAlgo(), ElectronHcalHelper::hasActiveHcal(), 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, ElectronHcalHelper::hcalTowersBehindClusters(), reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, reco::CaloCluster::hitsAndFractions(), reco::GsfElectron::ShowerShape::invalidHcal, edm::isNotFinite(), EcalClusterToolsT< noZS >::localCovariances(), nullptr, edm::ESHandle< T >::product(), reco::GsfElectron::ShowerShape::r9, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedEndcaps, GsfElectronAlgo::GeneralData::recHitsCfg, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedEndcaps, reco::GsfElectron::ShowerShape::sigmaEtaEta, reco::GsfElectron::ShowerShape::sigmaIetaIeta, reco::GsfElectron::ShowerShape::sigmaIetaIphi, reco::GsfElectron::ShowerShape::sigmaIphiIphi, mathSSE::sqrt(), DetId::subdetId(), and ecaldqm::topology().

Referenced by createElectron().

651  {
652  const reco::CaloCluster & seedCluster = *(theClus->seed()) ;
653  // temporary, till CaloCluster->seed() is made available
654  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first ;
655  int detector = seedXtalId.subdetId() ;
656 
659  const EcalRecHitCollection * recHits = nullptr ;
660  std::vector<int> recHitFlagsToBeExcluded ;
661  std::vector<int> recHitSeverityToBeExcluded ;
662  if (detector==EcalBarrel)
663  {
664  recHits = eventData_->barrelRecHits.product() ;
665  recHitFlagsToBeExcluded = generalData_->recHitsCfg.recHitFlagsToBeExcludedBarrel ;
666  recHitSeverityToBeExcluded = generalData_->recHitsCfg.recHitSeverityToBeExcludedBarrel ;
667  }
668  else
669  {
670  recHits = eventData_->endcapRecHits.product() ;
671  recHitFlagsToBeExcluded = generalData_->recHitsCfg.recHitFlagsToBeExcludedEndcaps ;
672  recHitSeverityToBeExcluded = generalData_->recHitsCfg.recHitSeverityToBeExcludedEndcaps ;
673  }
674 
675  std::vector<float> covariances = noZS::EcalClusterTools::covariances(seedCluster,recHits,topology,geometry) ;
676  std::vector<float> localCovariances = noZS::EcalClusterTools::localCovariances(seedCluster,recHits,topology) ;
677  showerShape.sigmaEtaEta = sqrt(covariances[0]) ;
678  showerShape.sigmaIetaIeta = sqrt(localCovariances[0]) ;
679  if (!edm::isNotFinite(localCovariances[2])) showerShape.sigmaIphiIphi = sqrt(localCovariances[2]) ;
680  showerShape.e1x5 = noZS::EcalClusterTools::e1x5(seedCluster,recHits,topology) ;
681  showerShape.e2x5Max = noZS::EcalClusterTools::e2x5Max(seedCluster,recHits,topology) ;
682  showerShape.e5x5 = noZS::EcalClusterTools::e5x5(seedCluster,recHits,topology) ;
683  showerShape.r9 = noZS::EcalClusterTools::e3x3(seedCluster,recHits,topology)/theClus->rawEnergy() ;
684 
685  if (pflow)
686  {
687  showerShape.hcalDepth1OverEcal = generalData_->hcalHelperPflow->hcalESumDepth1(*theClus)/theClus->energy() ;
688  showerShape.hcalDepth2OverEcal = generalData_->hcalHelperPflow->hcalESumDepth2(*theClus)/theClus->energy() ;
692  showerShape.invalidHcal = (showerShape.hcalDepth1OverEcalBc == 0 &&
693  showerShape.hcalDepth2OverEcalBc == 0 &&
695  }
696  else
697  {
698  showerShape.hcalDepth1OverEcal = generalData_->hcalHelper->hcalESumDepth1(*theClus)/theClus->energy() ;
699  showerShape.hcalDepth2OverEcal = generalData_->hcalHelper->hcalESumDepth2(*theClus)/theClus->energy() ;
703  showerShape.invalidHcal = (showerShape.hcalDepth1OverEcalBc == 0 &&
704  showerShape.hcalDepth2OverEcalBc == 0 &&
705  !generalData_->hcalHelper->hasActiveHcal(*theClus));
706  }
707 
708  // extra shower shapes
709  const float see_by_spp = showerShape.sigmaIetaIeta*showerShape.sigmaIphiIphi;
710  if( see_by_spp > 0 ) {
711  showerShape.sigmaIetaIphi = localCovariances[1] / see_by_spp;
712  } else if ( localCovariances[1] > 0 ) {
713  showerShape.sigmaIetaIphi = 1.f;
714  } else {
715  showerShape.sigmaIetaIphi = -1.f;
716  }
717  showerShape.eMax = noZS::EcalClusterTools::eMax(seedCluster,recHits);
718  showerShape.e2nd = noZS::EcalClusterTools::e2nd(seedCluster,recHits);
719  showerShape.eTop = noZS::EcalClusterTools::eTop(seedCluster,recHits,topology);
720  showerShape.eLeft = noZS::EcalClusterTools::eLeft(seedCluster,recHits,topology);
721  showerShape.eRight = noZS::EcalClusterTools::eRight(seedCluster,recHits,topology);
722  showerShape.eBottom = noZS::EcalClusterTools::eBottom(seedCluster,recHits,topology);
723 
724  showerShape.e2x5Left = noZS::EcalClusterTools::e2x5Left(seedCluster,recHits,topology);
725  showerShape.e2x5Right = noZS::EcalClusterTools::e2x5Right(seedCluster,recHits,topology);
726  showerShape.e2x5Top = noZS::EcalClusterTools::e2x5Top(seedCluster,recHits,topology);
727  showerShape.e2x5Bottom = noZS::EcalClusterTools::e2x5Bottom(seedCluster,recHits,topology);
728 
729  }
ElectronHcalHelper * hcalHelperPflow
GeneralData * generalData_
static float e2x5Bottom(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static std::vector< float > covariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
bool hasActiveHcal(const reco::SuperCluster &sc)
CaloTopology const * topology(0)
static float eMax(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
const EcalRecHitsConfiguration recHitsCfg
EventSetupData * eventSetupData_
edm::Handle< EcalRecHitCollection > endcapRecHits
double hcalESumDepth2BehindClusters(const std::vector< CaloTowerDetId > &towers)
std::vector< CaloTowerDetId > hcalTowersBehindClusters(const reco::SuperCluster &sc)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:197
double hcalESumDepth1BehindClusters(const std::vector< CaloTowerDetId > &towers)
#define nullptr
edm::ESHandle< CaloTopology > caloTopo
static float e2x5Top(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
bool isNotFinite(T x)
Definition: isFinite.h:10
T sqrt(T t)
Definition: SSEVec.h:18
edm::Handle< EcalRecHitCollection > barrelRecHits
static float e2nd(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:396
static float e2x5Max(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double hcalESumDepth2(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0)
static float eBottom(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float e2x5Right(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
ElectronHcalHelper * hcalHelper
static float eTop(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Definition: DetId.h:18
static float e2x5Left(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
edm::ESHandle< CaloGeometry > caloGeom
double hcalESumDepth1(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0)
static float eRight(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
EventData * eventData_
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
T const * product() const
Definition: ESHandle.h:86
static float eLeft(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static std::vector< float > localCovariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
static float e1x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
void GsfElectronAlgo::checkSetup ( const edm::EventSetup es)

Definition at line 768 of file GsfElectronAlgo.cc.

References 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(), RegressionHelper::checkSetup(), GsfElectronAlgo::EventSetupData::constraintAtVtx, GsfElectronAlgo::GeneralData::crackCorrectionFunction, eventSetupData_, generalData_, edm::EventSetup::get(), GsfElectronAlgo::GeneralData::hcalHelper, GsfElectronAlgo::GeneralData::hcalHelperPflow, EcalClusterFunctionBaseClass::init(), GsfElectronAlgo::EventSetupData::magField, GsfElectronAlgo::EventSetupData::mtsTransform, edm::ESHandle< T >::product(), GsfElectronAlgo::GeneralData::regHelper, GsfElectronAlgo::EventSetupData::sevLevel, GsfElectronAlgo::GeneralData::strategyCfg, GsfElectronAlgo::GeneralData::superClusterErrorFunction, GsfElectronAlgo::EventSetupData::trackerHandle, GsfElectronAlgo::StrategyConfiguration::useCombinationRegression, and GsfElectronAlgo::StrategyConfiguration::useEcalRegression.

Referenced by GsfElectronBaseProducer::beginEvent().

769  {
770  // get EventSetupRecords if needed
771  bool updateField(false);
773  updateField = true;
776  }
777 
778  bool updateGeometry(false);
780  updateGeometry = true;
783  }
784 
785  if ( updateField || updateGeometry ) {
786  delete eventSetupData_->mtsTransform ;
790  }
791 
793  eventSetupData_->cacheIDGeom=es.get<CaloGeometryRecord>().cacheIdentifier();
795  }
796 
798  eventSetupData_->cacheIDTopo=es.get<CaloTopologyRecord>().cacheIdentifier();
800  }
801 
806 
807 
812 
813  //if(eventSetupData_->cacheChStatus!=es.get<EcalChannelStatusRcd>().cacheIdentifier()){
814  // eventSetupData_->cacheChStatus=es.get<EcalChannelStatusRcd>().cacheIdentifier();
815  // es.get<EcalChannelStatusRcd>().get(eventSetupData_->chStatus);
816  //}
817 
819  eventSetupData_->cacheSevLevel = es.get<EcalSeverityLevelAlgoRcd>().cacheIdentifier();
821  }
822  }
ElectronHcalHelper * hcalHelperPflow
unsigned long long cacheIdentifier() const
GeneralData * generalData_
EventSetupData * eventSetupData_
void checkSetup(const edm::EventSetup &)
edm::ESHandle< EcalSeverityLevelAlgo > sevLevel
const StrategyConfiguration strategyCfg
edm::ESHandle< CaloTopology > caloTopo
GsfConstraintAtVertex * constraintAtVtx
const MultiTrajectoryStateTransform * mtsTransform
ElectronHcalHelper * hcalHelper
edm::ESHandle< MagneticField > magField
EcalClusterFunctionBaseClass * superClusterErrorFunction
T get() const
Definition: EventSetup.h:63
edm::ESHandle< CaloGeometry > caloGeom
EcalClusterFunctionBaseClass * crackCorrectionFunction
RegressionHelper * regHelper
edm::ESHandle< TrackerGeometry > trackerHandle
virtual void init(const edm::EventSetup &es)=0
T const * product() const
Definition: ESHandle.h:86
void checkSetup(const edm::EventSetup &)
void GsfElectronAlgo::clonePreviousElectrons ( )

Definition at line 996 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::coreElectrons, GsfElectronAlgo::EventData::electrons, eventData_, GsfElectronAlgo::EventData::previousElectrons, and edm::Handle< T >::product().

Referenced by GsfElectronProducer::produce().

997  {
998  const GsfElectronCollection * oldElectrons = eventData_->previousElectrons.product() ;
1000  GsfElectronCollection::const_iterator oldElectron ;
1001  for
1002  ( oldElectron = oldElectrons->begin() ;
1003  oldElectron != oldElectrons->end() ;
1004  ++oldElectron )
1005  {
1006  const GsfElectronCoreRef oldCoreRef = oldElectron->core() ;
1007  const GsfTrackRef oldElectronGsfTrackRef = oldCoreRef->gsfTrack() ;
1008  unsigned int icore ;
1009  for ( icore=0 ; icore<newCores->size() ; ++icore )
1010  {
1011  if (oldElectronGsfTrackRef==(*newCores)[icore].gsfTrack())
1012  {
1014  eventData_->electrons->push_back(new GsfElectron(*oldElectron,coreRef)) ;
1015  break ;
1016  }
1017  }
1018  }
1019  }
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< GsfElectronCore > GsfElectronCoreCollection
GsfElectronPtrCollection * electrons
edm::Handle< reco::GsfElectronCollection > previousElectrons
T const * product() const
Definition: Handle.h:81
EventData * eventData_
edm::Handle< reco::GsfElectronCoreCollection > coreElectrons
void GsfElectronAlgo::completeElectrons ( const gsfAlgoHelpers::HeavyObjectCache hoc)

Definition at line 953 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, mps_fire::i, edm::Ref< C, T, F >::isNull(), GsfElectronAlgo::EventSetupData::mtsTransform, nullptr, edm::Handle< T >::product(), and funct::true.

Referenced by GsfElectronEcalDrivenProducer::produce(), GsfElectronProducer::produce(), and GEDGsfElectronProducer::produce().

954  {
955  if (electronData_!=nullptr)
956  { throw cms::Exception("GsfElectronAlgo|InternalError")<<"unexpected electron data" ; }
957 
958  const GsfElectronCoreCollection * coreCollection = eventData_->coreElectrons.product() ;
959  for ( unsigned int i=0 ; i<coreCollection->size() ; ++i )
960  {
961  // check there is no existing electron with this core
963  bool coreFound = false ;
964  GsfElectronPtrCollection::const_iterator itrEle ;
965  for
966  ( itrEle = eventData_->electrons->begin() ;
967  itrEle != eventData_->electrons->end() ;
968  itrEle++ )
969  {
970  if ((*itrEle)->core()==coreRef)
971  {
972  coreFound = true ;
973  break ;
974  }
975  }
976  if (coreFound) continue ;
977 
978  // check there is a super-cluster
979  if (coreRef->superCluster().isNull()) continue ;
980 
981  // prepare internal structure for electron specific data
982  delete electronData_ ;
983  electronData_ = new ElectronData(coreRef,*eventData_->beamspot) ;
984 
985  // calculate and check Trajectory StatesOnSurface....
987 
988  createElectron(hoc) ;
989 
990  } // loop over tracks
991 
992  delete electronData_ ;
994  }
EventSetupData * eventSetupData_
#define nullptr
void createElectron(const gsfAlgoHelpers::HeavyObjectCache *)
GsfConstraintAtVertex * constraintAtVtx
std::vector< GsfElectronCore > GsfElectronCoreCollection
const MultiTrajectoryStateTransform * mtsTransform
const reco::BeamSpot * beamspot
GsfElectronPtrCollection * electrons
bool isNull() const
Checks for null.
Definition: Ref.h:250
T const * product() const
Definition: Handle.h:81
bool calculateTSOS(const MultiTrajectoryStateTransform *, GsfConstraintAtVertex *)
EventData * eventData_
ElectronData * electronData_
edm::Handle< reco::GsfElectronCoreCollection > coreElectrons
void GsfElectronAlgo::copyElectrons ( reco::GsfElectronCollection outEle)

Definition at line 825 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::electrons, and eventData_.

Referenced by GsfElectronBaseProducer::fillEvent().

826  {
827  GsfElectronPtrCollection::const_iterator it ;
828  for
829  ( it = eventData_->electrons->begin() ;
830  it != eventData_->electrons->end() ;
831  it++ )
832  { outEle.push_back(**it) ; }
833  }
GsfElectronPtrCollection * electrons
EventData * eventData_
void GsfElectronAlgo::createElectron ( const gsfAlgoHelpers::HeavyObjectCache hoc)
private

Definition at line 1290 of file GsfElectronAlgo.cc.

References funct::abs(), RegressionHelper::applyCombinationRegression(), RegressionHelper::applyEcalRegression(), GsfElectronAlgo::EventData::barrelRecHits, GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::ElectronData::calculateMode(), GsfElectronAlgo::ElectronData::calculateMomentum(), calculateSaturationInfo(), calculateShowerShape(), calculateShowerShape_full5x5(), EleTkIsolFromCands::calIsolPt(), GsfElectronAlgo::ElectronData::checkCtfTrack(), GetRecoTauVFromDQM_MC_cff::cl, ElectronEnergyCorrector::classBasedParameterizationEnergy(), ElectronEnergyCorrector::classBasedParameterizationUncertainty(), ElectronClassification::classify(), GsfElectronAlgo::ElectronData::computeCharge(), ConversionInfo::conversionPartnerCtfTk(), ConversionInfo::conversionPartnerGsfTk(), reco::GsfElectron::core(), GsfElectronAlgo::ElectronData::coreRef, ElectronMomentumCorrector::correct(), GsfElectronAlgo::GeneralData::crackCorrectionFunction, reco::GsfElectron::ClosestCtfTrack::ctfTrack, GsfElectronAlgo::ElectronData::ctfTrackRef, gedGsfElectronCores_cfi::ctfTracks, 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, DetId::det(), gamEcalExtractorBlocks_cff::detector, ConversionInfo::dist(), reco::GsfElectron::ConversionRejection::dist, EcalBarrel, GsfElectronAlgo::EventData::ecalBarrelIsol03, GsfElectronAlgo::EventData::ecalBarrelIsol04, GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalEnergyFromClassBasedParameterization, GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalErrorFromClassBasedParameterization, EcalEndcap, GsfElectronAlgo::EventData::ecalEndcapIsol03, GsfElectronAlgo::EventData::ecalEndcapIsol04, reco::GsfElectron::IsolationVariables::ecalRecHitSumEt, reco::GsfElectron::TrackClusterMatching::eEleClusterOverPout, ele_convert(), reco::GsfElectron::TrackClusterMatching::electronCluster, reco::GsfElectron::electronCluster(), electronData_, GsfElectronAlgo::EventData::electrons, GsfElectronAlgo::ElectronData::eleMom, GsfElectronAlgo::ElectronData::elePos, GsfElectronAlgo::EventData::endcapRecHits, reco::CaloCluster::energy(), reco::GsfElectron::TrackClusterMatching::eSeedClusterOverP, reco::GsfElectron::TrackClusterMatching::eSeedClusterOverPout, reco::GsfElectron::TrackClusterMatching::eSuperClusterOverP, eventData_, eventSetupData_, Exception, ConversionInfo::flag(), reco::GsfElectron::ConversionRejection::flags, DetId::Forward, generalData_, GsfElectronAlgo::ElectronData::getEleBasicCluster(), EgammaRecHitIsolation::getEtSum(), EgammaTowerIsolation::getTowerEtSum(), EcalClusterFunctionBaseClass::getValue(), reco::GsfElectron::gsfTrack(), GsfElectronAlgo::EventData::hadDepth1Isolation03, GsfElectronAlgo::EventData::hadDepth1Isolation03Bc, GsfElectronAlgo::EventData::hadDepth1Isolation04, GsfElectronAlgo::EventData::hadDepth1Isolation04Bc, GsfElectronAlgo::EventData::hadDepth2Isolation03, GsfElectronAlgo::EventData::hadDepth2Isolation03Bc, GsfElectronAlgo::EventData::hadDepth2Isolation04, GsfElectronAlgo::EventData::hadDepth2Isolation04Bc, DetId::Hcal, 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, MagneticField::inTesla(), 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::Ref< C, T, F >::isNull(), 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, or, GsfElectronAlgo::EventData::originalCtfTracks, GsfElectronAlgo::EventData::originalGsfTracks, GsfElectronAlgo::ElectronData::outMom, reco::GsfElectron::p4(), reco::GsfElectron::ConversionRejection::partner, reco::BeamSpot::position(), reco::CaloCluster::position(), reco::GsfElectron::TrackExtrapolations::positionAtCalo, reco::GsfElectron::TrackExtrapolations::positionAtVtx, GsfElectronAlgo::StrategyConfiguration::PreSelectMVA, GsfElectronAlgo::StrategyConfiguration::pureTrackerDrivenEcalErrorFromSimpleParameterization, reco::GsfElectron::ConversionRejection::radius, ConversionInfo::radiusOfConversion(), ElectronClassification::refineWithPflow(), GsfElectronAlgo::GeneralData::regHelper, GsfElectronAlgo::EventData::retreiveOriginalTrackCollections(), SimDataFormats::CaloAnalysis::sc, GsfElectronAlgo::ElectronData::sclMom, GsfElectronAlgo::ElectronData::sclPos, GsfElectronAlgo::ElectronData::seedMom, GsfElectronAlgo::ElectronData::seedPos, gsfAlgoHelpers::HeavyObjectCache::sElectronMVAEstimator, reco::GsfElectron::setCorrectedEcalEnergyError(), setCutBasedPreselectionFlag(), reco::GsfElectron::setIsolation03(), reco::GsfElectron::setIsolation04(), reco::GsfElectron::setP4(), reco::GsfElectron::setPassMvaPreselection(), setPixelMatchInfomation(), reco::GsfElectron::setSuperClusterFbrem(), reco::GsfElectron::setTrackFbrem(), reco::GsfElectron::ClosestCtfTrack::shFracInnerHits, GsfElectronAlgo::ElectronData::shFracInnerHits, ElectronEnergyCorrector::simpleParameterizationUncertainty(), GsfElectronAlgo::GeneralData::strategyCfg, DetId::subdetId(), reco::GsfElectron::superCluster(), GsfElectronAlgo::GeneralData::superClusterErrorFunction, GsfElectronAlgo::ElectronData::superClusterRef, tkIsol03Calc_, tkIsol04Calc_, reco::GsfElectron::IsolationVariables::tkSumPt, funct::true, GsfElectronAlgo::StrategyConfiguration::useCombinationRegression, GsfElectronAlgo::StrategyConfiguration::useEcalRegression, GsfElectronAlgo::EventData::vertices, GsfElectronAlgo::ElectronData::vtxMom, GsfElectronAlgo::ElectronData::vtxMomWithConstraint, GsfElectronAlgo::ElectronData::vtxPos, GsfElectronAlgo::ElectronData::vtxTSOS, and PV3DBase< T, PVType, FrameType >::z().

Referenced by completeElectrons().

1291  {
1292  // eventually check ctf track
1295 
1296  // charge ID
1297  int eleCharge ;
1298  GsfElectron::ChargeInfo eleChargeInfo ;
1299  electronData_->computeCharge(eleCharge,eleChargeInfo) ;
1300 
1301  // electron basic cluster
1303 
1304  // Seed cluster
1305  const reco::CaloCluster & seedCluster = *(electronData_->superClusterRef->seed()) ;
1306 
1307  // seed Xtal
1308  // temporary, till CaloCluster->seed() is made available
1309  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first ;
1310 
1312 
1313 
1314  //====================================================
1315  // Candidate attributes
1316  //====================================================
1317 
1319 
1320 
1321  //====================================================
1322  // Track-Cluster Matching
1323  //====================================================
1324 
1326  tcMatching.electronCluster = elbcRef ;
1327  tcMatching.eSuperClusterOverP = (electronData_->vtxMom.mag()>0)?(electronData_->superClusterRef->energy()/electronData_->vtxMom.mag()):(-1.) ;
1328  tcMatching.eSeedClusterOverP = (electronData_->vtxMom.mag()>0.)?(seedCluster.energy()/electronData_->vtxMom.mag()):(-1) ;
1329  tcMatching.eSeedClusterOverPout = (electronData_->seedMom.mag()>0.)?(seedCluster.energy()/electronData_->seedMom.mag()):(-1.) ;
1330  tcMatching.eEleClusterOverPout = (electronData_->eleMom.mag()>0.)?(elbcRef->energy()/electronData_->eleMom.mag()):(-1.) ;
1331 
1333  tcMatching.deltaEtaSuperClusterAtVtx = scAtVtx.dEta() ;
1334  tcMatching.deltaPhiSuperClusterAtVtx = scAtVtx.dPhi() ;
1335 
1336  EleRelPointPair seedAtCalo(seedCluster.position(),electronData_->seedPos,eventData_->beamspot->position()) ;
1337  tcMatching.deltaEtaSeedClusterAtCalo = seedAtCalo.dEta() ;
1338  tcMatching.deltaPhiSeedClusterAtCalo = seedAtCalo.dPhi() ;
1339 
1341  tcMatching.deltaEtaEleClusterAtCalo = ecAtCalo.dEta() ;
1342  tcMatching.deltaPhiEleClusterAtCalo = ecAtCalo.dPhi() ;
1343 
1344 
1345  //=======================================================
1346  // Track extrapolations
1347  //=======================================================
1348 
1357 
1358 
1359  //=======================================================
1360  // Closest Ctf Track
1361  //=======================================================
1362 
1364  ctfInfo.ctfTrack = electronData_->ctfTrackRef ;
1366 
1367 
1368  //====================================================
1369  // FiducialFlags, using nextToBoundary definition of gaps
1370  //====================================================
1371 
1372  reco::GsfElectron::FiducialFlags fiducialFlags ;
1373  int region = seedXtalId.det();
1374  int detector = seedXtalId.subdetId() ;
1375  double feta=std::abs(electronData_->superClusterRef->position().eta()) ;
1376  if (detector==EcalBarrel)
1377  {
1378  fiducialFlags.isEB = true ;
1379  EBDetId ebdetid(seedXtalId);
1380  if (EBDetId::isNextToEtaBoundary(ebdetid))
1381  {
1382  if (ebdetid.ietaAbs()==85)
1383  { fiducialFlags.isEBEEGap = true ; }
1384  else
1385  { fiducialFlags.isEBEtaGap = true ; }
1386  }
1387  if (EBDetId::isNextToPhiBoundary(ebdetid))
1388  { fiducialFlags.isEBPhiGap = true ; }
1389  }
1390  else if (detector==EcalEndcap)
1391  {
1392  fiducialFlags.isEE = true ;
1393  EEDetId eedetid(seedXtalId);
1394  if (EEDetId::isNextToRingBoundary(eedetid))
1395  {
1396  if (std::abs(feta)<2.)
1397  { fiducialFlags.isEBEEGap = true ; }
1398  else
1399  { fiducialFlags.isEERingGap = true ; }
1400  }
1401  if (EEDetId::isNextToDBoundary(eedetid))
1402  { fiducialFlags.isEEDeeGap = true ; }
1403  }
1404  else if ( region==DetId::Forward || region == DetId::Hcal )
1405  {
1406  fiducialFlags.isEE = true ;
1407  //HGCalDetId eeDetid(seedXtalId);
1408  // fill in fiducial information when we know how to use it...
1409  }
1410  else
1411  { throw cms::Exception("GsfElectronAlgo|UnknownXtalRegion")<<"createElectron(): do not know if it is a barrel or endcap seed cluster !!!!" ; }
1412 
1413 
1414  //====================================================
1415  // SaturationInfo
1416  //====================================================
1417 
1418  reco::GsfElectron::SaturationInfo saturationInfo;
1420 
1421  //====================================================
1422  // ShowerShape
1423  //====================================================
1424 
1425  reco::GsfElectron::ShowerShape showerShape;
1426  reco::GsfElectron::ShowerShape full5x5_showerShape;
1427  if( !(region==DetId::Forward || region == DetId::Hcal) ) {
1428  calculateShowerShape(electronData_->superClusterRef,!(electronData_->coreRef->ecalDrivenSeed()),showerShape) ;
1429  calculateShowerShape_full5x5(electronData_->superClusterRef,!(electronData_->coreRef->ecalDrivenSeed()),full5x5_showerShape) ;
1430  }
1431 
1432  //====================================================
1433  // ConversionRejection
1434  //====================================================
1435 
1437 
1438  ConversionFinder conversionFinder ;
1439  double BInTesla = eventSetupData_->magField->inTesla(GlobalPoint(0.,0.,0.)).z() ;
1441  if (!ctfTracks.isValid()) { ctfTracks = eventData_->currentCtfTracks ; }
1442 
1443  // values of conversionInfo.flag()
1444  // -9999 : Partner track was not found
1445  // 0 : Partner track found in the CTF collection using
1446  // 1 : Partner track found in the CTF collection using
1447  // 2 : Partner track found in the GSF collection using
1448  // 3 : Partner track found in the GSF collection using the electron's GSF track
1449  ConversionInfo conversionInfo = conversionFinder.getConversionInfo
1450  (*electronData_->coreRef,ctfTracks,eventData_->originalGsfTracks,BInTesla) ;
1451 
1453  conversionVars.flags = conversionInfo.flag() ;
1454  conversionVars.dist = conversionInfo.dist() ;
1455  conversionVars.dcot = conversionInfo.dcot() ;
1456  conversionVars.radius = conversionInfo.radiusOfConversion() ;
1457  if ((conversionVars.flags==0)or(conversionVars.flags==1))
1458  conversionVars.partner = TrackBaseRef(conversionInfo.conversionPartnerCtfTk()) ;
1459  else if ((conversionVars.flags==2)or(conversionVars.flags==3))
1460  conversionVars.partner = TrackBaseRef(conversionInfo.conversionPartnerGsfTk()) ;
1461 
1462 
1463  //====================================================
1464  // Go !
1465  //====================================================
1466 
1467  GsfElectron * ele = new
1468  GsfElectron
1469  ( eleCharge,eleChargeInfo,electronData_->coreRef,
1470  tcMatching, tkExtra, ctfInfo,
1471  fiducialFlags,showerShape, full5x5_showerShape,
1472  conversionVars, saturationInfo ) ;
1473  // Will be overwritten later in the case of the regression
1475  ele->setP4(GsfElectron::P4_FROM_SUPER_CLUSTER,momentum,0,true) ;
1476 
1477  //====================================================
1478  // brems fractions
1479  //====================================================
1480 
1481  if (electronData_->innMom.mag()>0.)
1483 
1484  // the supercluster is the refined one The seed is not necessarily the first cluster
1485  // hence the use of the electronCluster
1486  SuperClusterRef sc = ele->superCluster() ;
1487  if (!(sc.isNull()))
1488  {
1489  CaloClusterPtr cl = ele->electronCluster() ;
1490  if (sc->clustersSize()>1)
1491  {
1492  float pf_fbrem =( sc->energy() - cl->energy() ) / sc->energy();
1493  ele->setSuperClusterFbrem( pf_fbrem ) ;
1494  }
1495  else
1496  {
1497  ele->setSuperClusterFbrem(0) ;
1498  }
1499  }
1500 
1501  //====================================================
1502  // classification and corrections
1503  //====================================================
1504  // classification
1505  ElectronClassification theClassifier ;
1506  theClassifier.classify(*ele) ;
1507  theClassifier.refineWithPflow(*ele) ;
1508  // ecal energy
1511  {
1516  }
1517  else // original implementation
1518  {
1519  if( region!=DetId::Forward && region != DetId::Hcal ) {
1520  if (ele->core()->ecalDrivenSeed())
1521  {
1523  { theEnCorrector.classBasedParameterizationEnergy(*ele,*eventData_->beamspot) ; }
1525  { theEnCorrector.classBasedParameterizationUncertainty(*ele) ; }
1526  }
1527  else
1528  {
1530  { theEnCorrector.simpleParameterizationUncertainty(*ele) ; }
1531  }
1532  }
1533  }
1534 
1535  // momentum
1536  // Keep the default correction running first. The track momentum error is computed in there
1537  if (ele->core()->ecalDrivenSeed())
1538  {
1539  ElectronMomentumCorrector theMomCorrector;
1540  theMomCorrector.correct(*ele,electronData_->vtxTSOS);
1541  }
1543  {
1545  }
1546 
1547  //====================================================
1548  // now isolation variables
1549  //====================================================
1550 
1554 
1555  if( !(region==DetId::Forward || region == DetId::Hcal) ) {
1568  }
1569  ele->setIsolation03(dr03);
1570  ele->setIsolation04(dr04);
1571 
1572 
1573  //====================================================
1574  // preselection flag
1575  //====================================================
1576 
1578  //setting mva flag, currently GedGsfElectron and GsfElectron pre-selection flags have desynced
1579  //this is for GedGsfElectrons, GsfElectrons (ie old pre 7X std reco) resets this later on
1580  //in the function "addPfInfo"
1581  //yes this is awful, we'll fix it once we work out how to...
1582  float mvaValue = hoc->sElectronMVAEstimator->mva( *(ele),*(eventData_->vertices));
1584 
1585  //====================================================
1586  // Pixel match variables
1587  //====================================================
1589 
1590  LogTrace("GsfElectronAlgo")<<"Constructed new electron with energy "<< ele->p4().e() ;
1591 
1592  eventData_->electrons->push_back(ele) ;
1593  }
CaloClusterPtr electronCluster() const
Definition: GsfElectron.h:244
void setPixelMatchInfomation(reco::GsfElectron *)
edm::Handle< reco::TrackCollection > originalCtfTracks
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:185
const MultiTrajectoryStateMode * mtsMode
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:131
void applyCombinationRegression(reco::GsfElectron &ele) const
void setTrackFbrem(float fbrem)
Definition: GsfElectron.h:764
std::unique_ptr< const SoftElectronMVAEstimator > sElectronMVAEstimator
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:199
GeneralData * generalData_
static bool isNextToEtaBoundary(EBDetId id)
Definition: EBDetId.cc:125
EgammaTowerIsolation * hadDepth1Isolation04Bc
reco::GsfTrackRef conversionPartnerGsfTk() const
EgammaTowerIsolation * hadDepth1Isolation03Bc
double radiusOfConversion() const
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:225
void retreiveOriginalTrackCollections(const reco::TrackRef &, const reco::GsfTrackRef &)
double getEtSum(const reco::Candidate *emObject) const
void calculateShowerShape(const reco::SuperClusterRef &, bool pflow, reco::GsfElectron::ShowerShape &)
EventSetupData * eventSetupData_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
edm::Handle< EcalRecHitCollection > endcapRecHits
double dist() const
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:197
void computeCharge(int &charge, reco::GsfElectron::ChargeInfo &info)
void checkCtfTrack(edm::Handle< reco::TrackCollection > currentCtfTracks)
EgammaTowerIsolation * hadDepth1Isolation03
const StrategyConfiguration strategyCfg
reco::TrackRef conversionPartnerCtfTk() const
void setSuperClusterFbrem(float fbrem)
Definition: GsfElectron.h:765
EgammaRecHitIsolation * ecalBarrelIsol04
EgammaTowerIsolation * hadDepth2Isolation03
EgammaTowerIsolation * hadDepth1Isolation04
virtual float getValue(const reco::BasicCluster &, const EcalRecHitCollection &) const =0
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:179
T mag() const
Definition: PV3DBase.h:67
void calculateShowerShape_full5x5(const reco::SuperClusterRef &, bool pflow, reco::GsfElectron::ShowerShape &)
void setCutBasedPreselectionFlag(reco::GsfElectron *ele, const reco::BeamSpot &)
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:32
EgammaRecHitIsolation * ecalEndcapIsol03
EgammaTowerIsolation * hadDepth2Isolation03Bc
static bool isNextToPhiBoundary(EBDetId id)
Definition: EBDetId.cc:130
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::Handle< EcalRecHitCollection > barrelRecHits
T z() const
Definition: PV3DBase.h:64
void correct(reco::GsfElectron &, TrajectoryStateOnSurface &)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
void setPassMvaPreselection(bool flag)
Definition: GsfElectron.h:724
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:396
const MultiTrajectoryStateTransform * mtsTransform
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:375
double energy() const
cluster energy
Definition: CaloCluster.h:126
double calIsolPt(Args &&...args) const
const reco::BeamSpot * beamspot
edm::ESHandle< MagneticField > magField
GsfElectronPtrCollection * electrons
CaloClusterPtr getEleBasicCluster(const MultiTrajectoryStateTransform *)
static bool isNextToDBoundary(EEDetId id)
Definition: EEDetId.cc:367
bool isValid() const
Definition: HandleBase.h:74
bool isNull() const
Checks for null.
Definition: Ref.h:250
void setIsolation04(const IsolationVariables &dr04)
Definition: GsfElectron.h:574
#define LogTrace(id)
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
void classify(reco::GsfElectron &)
EgammaTowerIsolation * hadDepth2Isolation04Bc
Definition: DetId.h:18
edm::Handle< reco::VertexCollection > vertices
EgammaRecHitIsolation * ecalBarrelIsol03
int flag() const
void calculateSaturationInfo(const reco::SuperClusterRef &, reco::GsfElectron::SaturationInfo &)
EcalClusterFunctionBaseClass * superClusterErrorFunction
void ele_convert(const Type1 &obj1, Type2 &obj2)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
math::XYZVectorF momentumAtVtxWithConstraint
Definition: GsfElectron.h:285
void refineWithPflow(reco::GsfElectron &)
void setIsolation03(const IsolationVariables &dr03)
Definition: GsfElectron.h:573
edm::Handle< reco::GsfTrackCollection > originalGsfTracks
void applyEcalRegression(reco::GsfElectron &electron, const edm::Handle< reco::VertexCollection > &vertices, const edm::Handle< EcalRecHitCollection > &rechitsEB, const edm::Handle< EcalRecHitCollection > &rechitsEE) const
EgammaTowerIsolation * hadDepth2Isolation04
const reco::GsfElectronCoreRef coreRef
edm::Handle< reco::TrackCollection > currentCtfTracks
EleTkIsolFromCands tkIsol04Calc_
double getTowerEtSum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
EcalClusterFunctionBaseClass * crackCorrectionFunction
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
EgammaRecHitIsolation * ecalEndcapIsol04
const reco::SuperClusterRef superClusterRef
const Point & position() const
position
Definition: BeamSpot.h:62
EventData * eventData_
double dcot() const
RegressionHelper * regHelper
ElectronData * electronData_
EleTkIsolFromCands tkIsol03Calc_
void calculateMode(const MultiTrajectoryStateMode *mtsMode)
TrajectoryStateOnSurface vtxTSOS
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
Candidate::LorentzVector calculateMomentum()
void GsfElectronAlgo::displayInternalElectrons ( const std::string &  title) const

Definition at line 939 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::electrons, GsfElectronAlgo::EventData::event, eventData_, edm::EventBase::id(), and LogTrace.

Referenced by GsfElectronBaseProducer::fillEvent().

940  {
941  LogTrace("GsfElectronAlgo") << "========== " << title << " ==========";
942  LogTrace("GsfElectronAlgo") << "Event: " << eventData_->event->id();
943  LogTrace("GsfElectronAlgo") << "Number of electrons: " << eventData_->electrons->size() ;
944  GsfElectronPtrCollection::const_iterator it ;
945  for ( it = eventData_->electrons->begin(); it != eventData_->electrons->end(); it++ )
946  {
947  LogTrace("GsfElectronAlgo") << "Electron with charge, pt, eta, phi: " << (*it)->charge() << " , "
948  << (*it)->pt() << " , " << (*it)->eta() << " , " << (*it)->phi();
949  }
950  LogTrace("GsfElectronAlgo") << "=================================================";
951  }
GsfElectronPtrCollection * electrons
#define LogTrace(id)
edm::EventID id() const
Definition: EventBase.h:60
EventData * eventData_
void GsfElectronAlgo::endEvent ( )

Definition at line 931 of file GsfElectronAlgo.cc.

References eventData_, Exception, and nullptr.

Referenced by GsfElectronBaseProducer::endEvent().

932  {
933  if (eventData_==nullptr)
934  { throw cms::Exception("GsfElectronAlgo|InternalError")<<"lacking event data" ; }
935  delete eventData_ ;
936  eventData_ = nullptr ;
937  }
#define nullptr
EventData * eventData_
const reco::SuperClusterRef GsfElectronAlgo::getTrSuperCluster ( const reco::GsfTrackRef trackRef)
private
bool GsfElectronAlgo::isPreselected ( reco::GsfElectron ele)
private

Definition at line 1112 of file GsfElectronAlgo.cc.

References reco::GsfElectron::ecalDrivenSeed(), GsfElectronAlgo::StrategyConfiguration::gedElectronMode, generalData_, GsfElectronAlgo::StrategyConfiguration::MaxElePtForOnlyMVA, reco::GsfElectron::passingCutBasedPreselection(), reco::GsfElectron::passingMvaPreselection(), reco::GsfElectron::passingPflowPreselection(), reco::LeafCandidate::pt(), and GsfElectronAlgo::GeneralData::strategyCfg.

Referenced by removeNotPreselectedElectrons(), and setAmbiguityData().

1113  {
1114  bool passCutBased=ele->passingCutBasedPreselection();
1115  bool passPF=ele->passingPflowPreselection(); //it is worth nothing for gedGsfElectrons, this does nothing as its not set till GedGsfElectron finaliser, this is always false
1117  bool passmva=ele->passingMvaPreselection();
1118  if(!ele->ecalDrivenSeed()){
1120  return passmva && passCutBased;
1121  else
1122  return passmva;
1123  }
1124  else{
1125  return passCutBased || passPF || passmva;
1126  }
1127  }
1128  else{
1129  return passCutBased || passPF;
1130  }
1131 
1132  return true;
1133  }
GeneralData * generalData_
double pt() const final
transverse momentum
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:709
bool passingMvaPreselection() const
Definition: GsfElectron.h:725
const StrategyConfiguration strategyCfg
bool ecalDrivenSeed() const
Definition: GsfElectron.h:188
bool passingPflowPreselection() const
Definition: GsfElectron.h:710
void GsfElectronAlgo::removeAmbiguousElectrons ( )

Definition at line 1725 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::electrons, eventData_, and LogTrace.

Referenced by GsfElectronBaseProducer::fillEvent().

1726  {
1727  GsfElectronPtrCollection::size_type ei = 1, emax = eventData_->electrons->size() ;
1728  GsfElectronPtrCollection::iterator eitr = eventData_->electrons->begin() ;
1729  while (eitr!=eventData_->electrons->end())
1730  {
1731  LogTrace("GsfElectronAlgo")<<"========== remove ambiguous "<<ei<<"/"<<emax<<"==========" ;
1732  if ((*eitr)->ambiguous())
1733  { delete (*eitr) ; eitr = eventData_->electrons->erase(eitr) ; ++ei ; }
1734  else
1735  { ++eitr ; ++ei ; }
1736  }
1737  }
uint16_t size_type
GsfElectronPtrCollection * electrons
#define LogTrace(id)
EventData * eventData_
void GsfElectronAlgo::removeNotPreselectedElectrons ( )

Definition at line 1135 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::electrons, eventData_, isPreselected(), and LogTrace.

Referenced by GsfElectronBaseProducer::fillEvent().

1136  {
1137  GsfElectronPtrCollection::size_type ei = 1, emax = eventData_->electrons->size() ;
1138  GsfElectronPtrCollection::iterator eitr = eventData_->electrons->begin() ;
1139  while (eitr!=eventData_->electrons->end())
1140  {
1141  LogTrace("GsfElectronAlgo")<<"========== removed not preselected "<<ei<<"/"<<emax<<"==========" ;
1142  if (isPreselected(*eitr))
1143  { ++eitr ; ++ei ; }
1144  else
1145  { delete (*eitr) ; eitr = eventData_->electrons->erase(eitr) ; ++ei ; }
1146  }
1147  }
bool isPreselected(reco::GsfElectron *ele)
uint16_t size_type
GsfElectronPtrCollection * electrons
#define LogTrace(id)
EventData * eventData_
void GsfElectronAlgo::setAmbiguityData ( bool  ignoreNotPreselected = true)

Definition at line 1603 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::StrategyConfiguration::ambClustersOverlapStrategy, GsfElectronAlgo::StrategyConfiguration::ambSortingStrategy, GsfElectronAlgo::EventData::barrelRecHits, GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::EventData::electrons, photonPostprocessing_cfi::eMin, GsfElectronAlgo::EventData::endcapRecHits, PVValHelper::eta, eventData_, eventSetupData_, Exception, funct::false, runEdmFileComparison::found, generalData_, edm::Ref< C, T, F >::get(), GsfElectronAlgo::EventData::gsfPfRecTracks, EgAmbiguityTools::isBetter(), isPreselected(), LogDebug, reco::BeamSpot::position(), edm::Handle< T >::product(), EgAmbiguityTools::sharedEnergy(), GsfElectronAlgo::GeneralData::strategyCfg, electronIdCutBased_cfi::threshold, GsfElectronAlgo::EventSetupData::trackerHandle, funct::true, and GsfElectronAlgo::StrategyConfiguration::useGsfPfRecTracks.

Referenced by GsfElectronBaseProducer::fillEvent().

1604  {
1605  GsfElectronPtrCollection::iterator e1, e2 ;
1610  else
1611  { throw cms::Exception("GsfElectronAlgo|UnknownAmbiguitySortingStrategy")<<"value of generalData_->strategyCfg.ambSortingStrategy is : "<<generalData_->strategyCfg.ambSortingStrategy ; }
1612 
1613  // init
1614  for
1615  ( e1 = eventData_->electrons->begin() ;
1616  e1 != eventData_->electrons->end() ;
1617  ++e1 )
1618  {
1619  (*e1)->clearAmbiguousGsfTracks() ;
1620  (*e1)->setAmbiguous(false) ;
1621  }
1622 
1623  // get ambiguous from GsfPfRecTracks
1625  {
1626  for
1627  ( e1 = eventData_->electrons->begin() ;
1628  e1 != eventData_->electrons->end() ;
1629  ++e1 )
1630  {
1631  bool found = false ;
1632  const GsfPFRecTrackCollection * gsfPfRecTrackCollection = eventData_->gsfPfRecTracks.product() ;
1633  GsfPFRecTrackCollection::const_iterator gsfPfRecTrack ;
1634  for ( gsfPfRecTrack=gsfPfRecTrackCollection->begin() ;
1635  gsfPfRecTrack!=gsfPfRecTrackCollection->end() ;
1636  ++gsfPfRecTrack )
1637  {
1638  if (gsfPfRecTrack->gsfTrackRef()==(*e1)->gsfTrack())
1639  {
1640  if (found)
1641  {
1642  edm::LogWarning("GsfElectronAlgo")<<"associated gsfPfRecTrack already found" ;
1643  }
1644  else
1645  {
1646  found = true ;
1647  const std::vector<reco::GsfPFRecTrackRef> & duplicates(gsfPfRecTrack->convBremGsfPFRecTrackRef()) ;
1648  std::vector<reco::GsfPFRecTrackRef>::const_iterator duplicate ;
1649  for ( duplicate = duplicates.begin() ; duplicate != duplicates.end() ; duplicate ++ )
1650  { (*e1)->addAmbiguousGsfTrack((*duplicate)->gsfTrackRef()) ; }
1651  }
1652  }
1653  }
1654  }
1655  }
1656  // or search overlapping clusters
1657  else
1658  {
1659  for
1660  ( e1 = eventData_->electrons->begin() ;
1661  e1 != eventData_->electrons->end() ;
1662  ++e1 )
1663  {
1664  if ((*e1)->ambiguous()) continue ;
1665  if ( ignoreNotPreselected && !isPreselected(*e1) ) continue ;
1666 
1667  SuperClusterRef scRef1 = (*e1)->superCluster();
1668  CaloClusterPtr eleClu1 = (*e1)->electronCluster();
1669  LogDebug("GsfElectronAlgo")
1670  << "Blessing electron with E/P " << (*e1)->eSuperClusterOverP()
1671  << ", cluster " << scRef1.get()
1672  << " & track " << (*e1)->gsfTrack().get() ;
1673 
1674  for
1675  ( e2 = e1, ++e2 ;
1676  e2 != eventData_->electrons->end() ;
1677  ++e2 )
1678  {
1679  if ((*e2)->ambiguous()) continue ;
1680  if ( ignoreNotPreselected && !isPreselected(*e2) ) continue ;
1681 
1682  SuperClusterRef scRef2 = (*e2)->superCluster();
1683  CaloClusterPtr eleClu2 = (*e2)->electronCluster();
1684 
1685  // search if same cluster
1686  bool sameCluster = false ;
1688  { sameCluster = (scRef1==scRef2) ; }
1690  {
1691  float eMin = 1. ;
1692  float threshold = eMin*cosh(EleRelPoint(scRef1->position(),eventData_->beamspot->position()).eta()) ;
1693  sameCluster =
1695  (EgAmbiguityTools::sharedEnergy(&(*scRef1->seed()),&(*eleClu2),eventData_->barrelRecHits,eventData_->endcapRecHits)>=threshold) ||
1697  (EgAmbiguityTools::sharedEnergy(&(*scRef1->seed()),&(*scRef2->seed()),eventData_->barrelRecHits,eventData_->endcapRecHits)>=threshold) ) ;
1698  }
1699  else
1700  { throw cms::Exception("GsfElectronAlgo|UnknownAmbiguityClustersOverlapStrategy")<<"value of generalData_->strategyCfg.ambClustersOverlapStrategy is : "<<generalData_->strategyCfg.ambClustersOverlapStrategy ; }
1701 
1702  // main instructions
1703  if (sameCluster)
1704  {
1705  LogDebug("GsfElectronAlgo")
1706  << "Discarding electron with E/P " << (*e2)->eSuperClusterOverP()
1707  << ", cluster " << scRef2.get()
1708  << " and track " << (*e2)->gsfTrack().get() ;
1709  (*e1)->addAmbiguousGsfTrack((*e2)->gsfTrack()) ;
1710  (*e2)->setAmbiguous(true) ;
1711  }
1712  else if ((*e1)->gsfTrack()==(*e2)->gsfTrack())
1713  {
1714  edm::LogWarning("GsfElectronAlgo")
1715  << "Forgetting electron with E/P " << (*e2)->eSuperClusterOverP()
1716  << ", cluster " << scRef2.get()
1717  << " and track " << (*e2)->gsfTrack().get() ;
1718  (*e2)->setAmbiguous(true) ;
1719  }
1720  }
1721  }
1722  }
1723  }
#define LogDebug(id)
bool isPreselected(reco::GsfElectron *ele)
GeneralData * generalData_
bool isBetter(const reco::GsfElectron *, const reco::GsfElectron *)
EventSetupData * eventSetupData_
edm::Handle< EcalRecHitCollection > endcapRecHits
const StrategyConfiguration strategyCfg
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
float sharedEnergy(const reco::CaloCluster *, const reco::CaloCluster *, edm::Handle< EcalRecHitCollection > &barrelRecHits, edm::Handle< EcalRecHitCollection > &endcapRecHits)
edm::Handle< EcalRecHitCollection > barrelRecHits
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:245
const reco::BeamSpot * beamspot
GsfElectronPtrCollection * electrons
T const * product() const
Definition: Handle.h:81
const Point & position() const
position
Definition: BeamSpot.h:62
EventData * eventData_
edm::ESHandle< TrackerGeometry > trackerHandle
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracks
void GsfElectronAlgo::setCutBasedPreselectionFlag ( reco::GsfElectron ele,
const reco::BeamSpot bs 
)
private

Definition at line 1150 of file GsfElectronAlgo.cc.

References funct::abs(), edm::RefToBase< T >::castTo(), looper::cfg, reco::GsfElectron::core(), GsfElectronAlgo::GeneralData::cutsCfg, GsfElectronAlgo::GeneralData::cutsCfgPflow, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), gamEcalExtractorBlocks_cff::detector, EcalBarrel, EcalEndcap, reco::GsfElectron::eSuperClusterOverP(), PVValHelper::eta, Exception, funct::false, GsfElectronAlgo::StrategyConfiguration::gedElectronMode, 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, ecalDrivenElectronSeedsParameters_cff::maxHBarrel, ecalDrivenElectronSeedsParameters_cff::maxHEndcaps, 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, packedPFCandidateRefMixer_cfi::pf, reco::BeamSpot::position(), mathSSE::return(), SurveyInfoScenario_cff::seed, GsfElectronAlgo::CutsConfiguration::seedFromTEC, reco::GsfElectron::setPassCutBasedPreselection(), reco::GsfElectron::sigmaIetaIeta(), GsfElectronAlgo::GeneralData::strategyCfg, and reco::GsfElectron::superCluster().

Referenced by createElectron().

1151  {
1152  // default value
1153  ele->setPassCutBasedPreselection(false) ;
1154 
1155  // kind of seeding
1156  bool eg = ele->core()->ecalDrivenSeed() ;
1157  bool pf = ele->core()->trackerDrivenSeed() && !ele->core()->ecalDrivenSeed() ;
1158  bool gedMode = generalData_->strategyCfg.gedElectronMode;
1159  if (eg&&pf) { throw cms::Exception("GsfElectronAlgo|BothEcalAndPureTrackerDriven")<<"An electron cannot be both egamma and purely pflow" ; }
1160  if ((!eg)&&(!pf)) { throw cms::Exception("GsfElectronAlgo|NeitherEcalNorPureTrackerDriven")<<"An electron cannot be neither egamma nor purely pflow" ; }
1161 
1162  const CutsConfiguration * cfg = ((eg||gedMode)?&generalData_->cutsCfg:&generalData_->cutsCfgPflow);
1163 
1164  // Et cut
1165  double etaValue = EleRelPoint(ele->superCluster()->position(),bs.position()).eta() ;
1166  double etValue = ele->superCluster()->energy()/cosh(etaValue) ;
1167  LogTrace("GsfElectronAlgo") << "Et : " << etValue ;
1168  if (ele->isEB() && (etValue < cfg->minSCEtBarrel)) return ;
1169  if (ele->isEE() && (etValue < cfg->minSCEtEndcaps)) return ;
1170  LogTrace("GsfElectronAlgo") << "Et criteria are satisfied";
1171 
1172  // E/p cut
1173  double eopValue = ele->eSuperClusterOverP() ;
1174  LogTrace("GsfElectronAlgo") << "E/p : " << eopValue ;
1175  if (ele->isEB() && (eopValue > cfg->maxEOverPBarrel)) return ;
1176  if (ele->isEE() && (eopValue > cfg->maxEOverPEndcaps)) return ;
1177  if (ele->isEB() && (eopValue < cfg->minEOverPBarrel)) return ;
1178  if (ele->isEE() && (eopValue < cfg->minEOverPEndcaps)) return ;
1179  LogTrace("GsfElectronAlgo") << "E/p criteria are satisfied";
1180 
1181  // HoE cuts
1182  LogTrace("GsfElectronAlgo") << "HoE1 : " << ele->hcalDepth1OverEcal() << ", HoE2 : " << ele->hcalDepth2OverEcal();
1183  double had = ele->hcalOverEcal()*ele->superCluster()->energy() ;
1184  const reco::CaloCluster & seedCluster = *(ele->superCluster()->seed()) ;
1185  int detector = seedCluster.hitsAndFractions()[0].first.subdetId() ;
1186  bool HoEveto = false ;
1187  if (detector==EcalBarrel && (had<cfg->maxHBarrel || (had/ele->superCluster()->energy())<cfg->maxHOverEBarrel)) HoEveto=true;
1188  else if (detector==EcalEndcap && (had<cfg->maxHEndcaps || (had/ele->superCluster()->energy())<cfg->maxHOverEEndcaps)) HoEveto=true;
1189  if ( !HoEveto ) return ;
1190  LogTrace("GsfElectronAlgo") << "H/E criteria are satisfied";
1191 
1192  // delta eta criteria
1193  double deta = ele->deltaEtaSuperClusterTrackAtVtx() ;
1194  LogTrace("GsfElectronAlgo") << "delta eta : " << deta ;
1195  if (ele->isEB() && (std::abs(deta) > cfg->maxDeltaEtaBarrel)) return ;
1196  if (ele->isEE() && (std::abs(deta) > cfg->maxDeltaEtaEndcaps)) return ;
1197  LogTrace("GsfElectronAlgo") << "Delta eta criteria are satisfied";
1198 
1199  // delta phi criteria
1200  double dphi = ele->deltaPhiSuperClusterTrackAtVtx();
1201  LogTrace("GsfElectronAlgo") << "delta phi : " << dphi;
1202  if (ele->isEB() && (std::abs(dphi) > cfg->maxDeltaPhiBarrel)) return ;
1203  if (ele->isEE() && (std::abs(dphi) > cfg->maxDeltaPhiEndcaps)) return ;
1204  LogTrace("GsfElectronAlgo") << "Delta phi criteria are satisfied";
1205 
1206  // sigma ieta ieta
1207  LogTrace("GsfElectronAlgo") << "sigma ieta ieta : " << ele->sigmaIetaIeta();
1208  if (ele->isEB() && (ele->sigmaIetaIeta() > cfg->maxSigmaIetaIetaBarrel)) return ;
1209  if (ele->isEE() && (ele->sigmaIetaIeta() > cfg->maxSigmaIetaIetaEndcaps)) return ;
1210  LogTrace("GsfElectronAlgo") << "Sigma ieta ieta criteria are satisfied";
1211 
1212  // fiducial
1213  if (!ele->isEB() && cfg->isBarrel) return ;
1214  if (!ele->isEE() && cfg->isEndcaps) return ;
1215  if (cfg->isFiducial && (ele->isEBEEGap()||ele->isEBEtaGap()||ele->isEBPhiGap()||ele->isEERingGap()||ele->isEEDeeGap())) return ;
1216  LogTrace("GsfElectronAlgo") << "Fiducial flags criteria are satisfied";
1217 
1218  // seed in TEC
1219  edm::RefToBase<TrajectorySeed> seed = ele->gsfTrack()->extra()->seedRef() ;
1220  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>() ;
1221  if (eg && !generalData_->cutsCfg.seedFromTEC)
1222  {
1223  if (elseed.isNull())
1224  { throw cms::Exception("GsfElectronAlgo|NotElectronSeed")<<"The GsfTrack seed is not an ElectronSeed ?!" ; }
1225  else
1226  { if (elseed->subDet2()==6) return ; }
1227  }
1228 
1229  // transverse impact parameter
1230  if (std::abs(ele->gsfTrack()->dxy(bs.position()))>cfg->maxTIP) return ;
1231  LogTrace("GsfElectronAlgo") << "TIP criterion is satisfied" ;
1232 
1233  LogTrace("GsfElectronAlgo") << "All cut based criteria are satisfied" ;
1234  ele->setPassCutBasedPreselection(true) ;
1235  }
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:185
GeneralData * generalData_
const CutsConfiguration cutsCfgPflow
void setPassCutBasedPreselection(bool flag)
Definition: GsfElectron.h:717
bool isEBEtaGap() const
Definition: GsfElectron.h:357
float eSuperClusterOverP() const
Definition: GsfElectron.h:245
bool isEBEEGap() const
Definition: GsfElectron.h:355
float hcalDepth2OverEcal() const
Definition: GsfElectron.h:443
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:197
bool isEERingGap() const
Definition: GsfElectron.h:361
bool isEEDeeGap() const
Definition: GsfElectron.h:360
const StrategyConfiguration strategyCfg
bool isEE() const
Definition: GsfElectron.h:353
bool isEB() const
Definition: GsfElectron.h:352
return((rh^lh)&mask)
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:249
float sigmaIetaIeta() const
Definition: GsfElectron.h:436
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:252
float hcalOverEcal() const
Definition: GsfElectron.h:444
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const CutsConfiguration cutsCfg
bool isNull() const
Checks for null.
Definition: Ref.h:250
#define LogTrace(id)
float hcalDepth1OverEcal() const
Definition: GsfElectron.h:442
REF castTo() const
Definition: RefToBase.h:286
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
bool isEBPhiGap() const
Definition: GsfElectron.h:358
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
const Point & position() const
position
Definition: BeamSpot.h:62
void GsfElectronAlgo::setMVAepiBasedPreselectionFlag ( reco::GsfElectron ele)
private
void GsfElectronAlgo::setMVAInputs ( const std::map< reco::GsfTrackRef, reco::GsfElectron::MvaInput > &  mvaInputs)

Definition at line 1253 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::electrons, and eventData_.

Referenced by GEDGsfElectronProducer::produce().

1254 {
1255  GsfElectronPtrCollection::iterator el ;
1256  for
1257  ( el = eventData_->electrons->begin() ;
1258  el != eventData_->electrons->end() ;
1259  el++ )
1260  {
1261  std::map<reco::GsfTrackRef,reco::GsfElectron::MvaInput>::const_iterator itcheck=mvaInputs.find((*el)->gsfTrack());
1262  (*el)->setMvaInput(itcheck->second);
1263  }
1264 }
GsfElectronPtrCollection * electrons
EventData * eventData_
void GsfElectronAlgo::setMVAOutputs ( const gsfAlgoHelpers::HeavyObjectCache hoc,
const std::map< reco::GsfTrackRef, reco::GsfElectron::MvaOutput > &  mvaOutputs 
)

Definition at line 1266 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::electrons, eventData_, GsfElectronAlgo::StrategyConfiguration::gedElectronMode, generalData_, gsfAlgoHelpers::HeavyObjectCache::iElectronMVAEstimator, reco::GsfElectron::MvaOutput::mva_e_pi, reco::GsfElectron::MvaOutput::mva_Isolated, gsfAlgoHelpers::HeavyObjectCache::sElectronMVAEstimator, GsfElectronAlgo::GeneralData::strategyCfg, and GsfElectronAlgo::EventData::vertices.

Referenced by GEDGsfElectronProducer::produce().

1268 {
1269  GsfElectronPtrCollection::iterator el ;
1270  for
1271  ( el = eventData_->electrons->begin() ;
1272  el != eventData_->electrons->end() ;
1273  el++ )
1274  {
1276  float mva_NIso_Value= hoc->sElectronMVAEstimator->mva( *(*el), *(eventData_->vertices));
1277  float mva_Iso_Value = hoc->iElectronMVAEstimator->mva( *(*el), eventData_->vertices->size() );
1278  GsfElectron::MvaOutput mvaOutput ;
1279  mvaOutput.mva_e_pi = mva_NIso_Value ;
1280  mvaOutput.mva_Isolated = mva_Iso_Value ;
1281  (*el)->setMvaOutput(mvaOutput);
1282  }
1283  else{
1284  std::map<reco::GsfTrackRef,reco::GsfElectron::MvaOutput>::const_iterator itcheck=mvaOutputs.find((*el)->gsfTrack());
1285  (*el)->setMvaOutput(itcheck->second);
1286  }
1287  }
1288 }
std::unique_ptr< const SoftElectronMVAEstimator > sElectronMVAEstimator
GeneralData * generalData_
const StrategyConfiguration strategyCfg
GsfElectronPtrCollection * electrons
edm::Handle< reco::VertexCollection > vertices
EventData * eventData_
std::unique_ptr< const ElectronMVAEstimator > iElectronMVAEstimator
void GsfElectronAlgo::setPflowPreselectionFlag ( reco::GsfElectron ele)
private

Definition at line 1237 of file GsfElectronAlgo.cc.

References reco::GsfElectron::core(), GsfElectronAlgo::GeneralData::cutsCfg, GsfElectronAlgo::GeneralData::cutsCfgPflow, generalData_, LogTrace, GsfElectronAlgo::CutsConfiguration::minMVA, reco::GsfElectron::MvaOutput::mva_e_pi, reco::GsfElectron::mvaOutput(), reco::GsfElectron::passingMvaPreselection(), reco::GsfElectron::setPassMvaPreselection(), and reco::GsfElectron::setPassPflowPreselection().

Referenced by addPflowInfo().

1238  {
1239  ele->setPassMvaPreselection(false) ;
1240 
1241  if (ele->core()->ecalDrivenSeed())
1242  { if (ele->mvaOutput().mva_e_pi>=generalData_->cutsCfg.minMVA) ele->setPassMvaPreselection(true) ; }
1243  else
1245 
1246  if (ele->passingMvaPreselection())
1247  { LogTrace("GsfElectronAlgo") << "Main mva criterion is satisfied" ; }
1248 
1250 
1251  }
GeneralData * generalData_
const CutsConfiguration cutsCfgPflow
bool passingMvaPreselection() const
Definition: GsfElectron.h:725
void setPassMvaPreselection(bool flag)
Definition: GsfElectron.h:724
const CutsConfiguration cutsCfg
#define LogTrace(id)
const MvaOutput & mvaOutput() const
Definition: GsfElectron.h:683
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
void setPassPflowPreselection(bool flag)
Definition: GsfElectron.h:718
void GsfElectronAlgo::setPixelMatchInfomation ( reco::GsfElectron ele)
private

Definition at line 1741 of file GsfElectronAlgo.cc.

References edm::RefToBase< T >::castTo(), reco::LeafCandidate::charge(), reco::GsfElectron::gsfTrack(), edm::RefToBase< T >::isNull(), edm::Ref< C, T, F >::isNull(), SurveyInfoScenario_cff::seed, reco::GsfElectron::setPixelMatchDPhi1(), reco::GsfElectron::setPixelMatchDPhi2(), reco::GsfElectron::setPixelMatchDRz1(), reco::GsfElectron::setPixelMatchDRz2(), and reco::GsfElectron::setPixelMatchSubdetectors().

Referenced by createElectron().

1741  {
1742  int sd1 = 0 ;
1743  int sd2 = 0 ;
1744  float dPhi1 = 0 ;
1745  float dPhi2 = 0 ;
1746  float dRz1 = 0 ;
1747  float dRz2 = 0 ;
1748  edm::RefToBase<TrajectorySeed> seed = ele->gsfTrack()->extra()->seedRef();
1749  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>();
1750  if(seed.isNull()){}
1751  else{
1752  if(elseed.isNull()){}
1753  else{
1754  sd1 = elseed->subDet1() ;
1755  sd2 = elseed->subDet2() ;
1756  dPhi1 = (ele->charge()>0) ? elseed->dPhi1Pos() : elseed->dPhi1() ;
1757  dPhi2 = (ele->charge()>0) ? elseed->dPhi2Pos() : elseed->dPhi2() ;
1758  dRz1 = (ele->charge()>0) ? elseed->dRz1Pos () : elseed->dRz1 () ;
1759  dRz2 = (ele->charge()>0) ? elseed->dRz2Pos () : elseed->dRz2 () ;
1760  }
1761  }
1762  ele->setPixelMatchSubdetectors(sd1,sd2) ;
1763  ele->setPixelMatchDPhi1(dPhi1) ;
1764  ele->setPixelMatchDPhi2(dPhi2) ;
1765  ele->setPixelMatchDRz1 (dRz1 ) ;
1766  ele->setPixelMatchDRz2 (dRz2 ) ;
1767 }
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:185
void setPixelMatchDRz2(float dRz2)
Definition: GsfElectron.h:892
void setPixelMatchDPhi1(float dPhi1)
Definition: GsfElectron.h:889
int charge() const final
electric charge
Definition: LeafCandidate.h:91
void setPixelMatchSubdetectors(int sd1, int sd2)
Definition: GsfElectron.h:888
bool isNull() const
Checks for null.
Definition: Ref.h:250
void setPixelMatchDPhi2(float dPhi2)
Definition: GsfElectron.h:890
REF castTo() const
Definition: RefToBase.h:286
bool isNull() const
Checks for null.
Definition: RefToBase.h:328
void setPixelMatchDRz1(float dRz1)
Definition: GsfElectron.h:891

Member Data Documentation

ElectronData* GsfElectronAlgo::electronData_
private

Definition at line 240 of file GsfElectronAlgo.h.

Referenced by completeElectrons(), createElectron(), and ~GsfElectronAlgo().

EventData* GsfElectronAlgo::eventData_
private
EventSetupData* GsfElectronAlgo::eventSetupData_
private
GeneralData* GsfElectronAlgo::generalData_
private
EleTkIsolFromCands GsfElectronAlgo::tkIsol03Calc_
private

Definition at line 242 of file GsfElectronAlgo.h.

Referenced by createElectron().

EleTkIsolFromCands GsfElectronAlgo::tkIsol04Calc_
private

Definition at line 243 of file GsfElectronAlgo.h.

Referenced by createElectron().