CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
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)
 
void removeAmbiguousElectrons ()
 
void removeNotPreselectedElectrons ()
 
void setAmbiguityData (bool ignoreNotPreselected=true)
 
 ~GsfElectronAlgo ()
 

Private Member Functions

void calculateShowerShape (const reco::SuperClusterRef &, bool pflow, reco::GsfElectron::ShowerShape &)
 
void createElectron ()
 
const reco::SuperClusterRef getTrSuperCluster (const reco::GsfTrackRef &trackRef)
 
bool isPreselected (reco::GsfElectron *ele)
 
void setCutBasedPreselectionFlag (reco::GsfElectron *ele, const reco::BeamSpot &)
 
void setPflowPreselectionFlag (reco::GsfElectron *ele)
 

Private Attributes

ElectronDataelectronData_
 
EventDataeventData_
 
EventSetupDataeventSetupData_
 
GeneralDatageneralData_
 

Detailed Description

Definition at line 49 of file GsfElectronAlgo.h.

Member Typedef Documentation

Definition at line 197 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 
)

Definition at line 580 of file GsfElectronAlgo.cc.

591  : generalData_(new GeneralData(inputCfg,strategyCfg,cutsCfg,cutsCfgPflow,hcalCfg,hcalCfgPflow,isoCfg,recHitsCfg,superClusterErrorFunction,crackCorrectionFunction)),
592  eventSetupData_(new EventSetupData),
594  {}
GeneralData * generalData_
EventSetupData * eventSetupData_
EventData * eventData_
ElectronData * electronData_
GsfElectronAlgo::~GsfElectronAlgo ( )

Definition at line 596 of file GsfElectronAlgo.cc.

References electronData_, eventData_, eventSetupData_, and generalData_.

597  {
598  delete generalData_ ;
599  delete eventSetupData_ ;
600  delete eventData_ ;
601  delete electronData_ ;
602  }
GeneralData * generalData_
EventSetupData * eventSetupData_
EventData * eventData_
ElectronData * electronData_

Member Function Documentation

void GsfElectronAlgo::addPflowInfo ( )

Definition at line 860 of file GsfElectronAlgo.cc.

References calculateShowerShape(), reco::GsfElectron::PflowIsolationVariables::chargedHadronIso, GsfElectronAlgo::EventData::edIsolationValues, GsfElectronAlgo::EventData::electrons, eventData_, edm::hlt::Exception, funct::false, first, newFWLiteAna::found, edm::Ref< C, T, F >::isNull(), reco::GsfElectron::PflowIsolationVariables::neutralHadronIso, pfElectrons_cff::pfElectrons, GsfElectronAlgo::EventData::pfIsolationValues, GsfElectronAlgo::EventData::pflowElectrons, reco::GsfElectron::PflowIsolationVariables::photonIso, GsfElectronAlgo::EventData::previousElectrons, edm::Handle< T >::product(), ElectronClassification::refineWithPflow(), setPflowPreselectionFlag(), and funct::true.

Referenced by GsfElectronProducer::produce().

861  {
862  bool found ;
863  const GsfElectronCollection * edElectrons = eventData_->previousElectrons.product() ;
865  GsfElectronCollection::const_iterator pfElectron, edElectron ;
866  unsigned int edIndex, pfIndex ;
867 
868  GsfElectronPtrCollection::iterator el ;
869  for
870  ( el = eventData_->electrons->begin() ;
871  el != eventData_->electrons->end() ;
872  el++ )
873  {
874 // // MVA
875 // // we check that the value is never inferior to the no-cut value
876 // // we generally use in the configuration file for minMVA.
877 // GsfTrackRef gsfTrackRef = (*el)->gsfTrack() ;
878 // float mva = (*eventData_->pfMva.product())[gsfTrackRef] ;
879 // if (mva<noCutMin) { throw cms::Exception("GsfElectronAlgo|UnexpectedMvaValue")<<"unexpected MVA value: "<<mva ; }
880 //
881 // // Mva Output
882 // GsfElectron::MvaOutput mvaOutput ;
883 // mvaOutput.mva = mva ;
884 // (*el)->setMvaOutput(mvaOutput) ;
885 
886  // Retreive info from pflow electrons
887  found = false ;
888  for
889  ( pfIndex = 0, pfElectron = pfElectrons->begin() ; pfElectron != pfElectrons->end() ; pfIndex++, pfElectron++ )
890  {
891  if (pfElectron->gsfTrack()==(*el)->gsfTrack())
892  {
893  if (found)
894  {
895  edm::LogWarning("GsfElectronProducer")<<"associated pfGsfElectron already found" ;
896  }
897  else
898  {
899  found = true ;
900 
901  // Isolation Values
902  if( (eventData_->pfIsolationValues).size() != 0 )
903  {
905  pfElectronRef(eventData_->pflowElectrons, pfIndex);
907  isoVariables.chargedHadronIso=(*(eventData_->pfIsolationValues)[0])[pfElectronRef];
908  isoVariables.photonIso =(*(eventData_->pfIsolationValues)[1])[pfElectronRef];
909  isoVariables.neutralHadronIso=(*(eventData_->pfIsolationValues)[2])[pfElectronRef];
910  (*el)->setPfIsolationVariables(isoVariables);
911  }
912 
913 // (*el)->setPfIsolationVariables(pfElectron->pfIsolationVariables()) ;
914  (*el)->setMvaInput(pfElectron->mvaInput()) ;
915  (*el)->setMvaOutput(pfElectron->mvaOutput()) ;
916  if ((*el)->ecalDrivenSeed())
917  { (*el)->setP4(GsfElectron::P4_PFLOW_COMBINATION,pfElectron->p4(GsfElectron::P4_PFLOW_COMBINATION),pfElectron->p4Error(GsfElectron::P4_PFLOW_COMBINATION),false) ; }
918  else
919  { (*el)->setP4(GsfElectron::P4_PFLOW_COMBINATION,pfElectron->p4(GsfElectron::P4_PFLOW_COMBINATION),pfElectron->p4Error(GsfElectron::P4_PFLOW_COMBINATION),true) ; }
920  double noCutMin = -999999999. ;
921  if ((*el)->mva()<noCutMin) { throw cms::Exception("GsfElectronAlgo|UnexpectedMvaValue")<<"unexpected MVA value: "<<(*el)->mva() ; }
922  }
923  }
924  }
925 
926  // Isolation Values
927  // Retreive not found info from ed electrons
928  if( (eventData_->edIsolationValues).size() != 0 )
929  {
930  edIndex = 0, edElectron = edElectrons->begin() ;
931  while ((found == false)&&(edElectron != edElectrons->end()))
932  {
933  if (edElectron->gsfTrack()==(*el)->gsfTrack())
934  {
935  found = true ;
936 
937  // CONSTRUCTION D UNE REF dans le handle eventData_->previousElectrons avec l'indice edIndex,
938  // puis recuperation dans la ValueMap ED
939 
941  edElectronRef(eventData_->previousElectrons, edIndex);
943  isoVariables.chargedHadronIso=(*(eventData_->edIsolationValues)[0])[edElectronRef];
944  isoVariables.photonIso =(*(eventData_->edIsolationValues)[1])[edElectronRef];
945  isoVariables.neutralHadronIso=(*(eventData_->edIsolationValues)[2])[edElectronRef];
946  (*el)->setPfIsolationVariables(isoVariables);
947  }
948 
949  edIndex++ ;
950  edElectron++ ;
951  }
952  }
953 
954  // Preselection
956 
957  // Shower Shape of pflow cluster
958  if (!((*el)->pflowSuperCluster().isNull()))
959  {
960  reco::GsfElectron::ShowerShape pflowShowerShape ;
961  calculateShowerShape((*el)->pflowSuperCluster(),true,pflowShowerShape) ;
962  (*el)->setPfShowerShape(pflowShowerShape) ;
963  }
964  else if ((*el)->passingPflowPreselection())
965  { edm::LogError("GsfElectronCoreProducer")<<"Preselected tracker driven GsfTrack with no associated pflow SuperCluster." ; }
966 
967  // PfBrem
968  SuperClusterRef sc = (*el)->pflowSuperCluster() ;
969  if (!(sc.isNull()))
970  {
971 
972  if (sc->clustersSize()>1)
973  {
974  CaloCluster_iterator first = sc->clustersBegin() ;
975  (*el)->setPfSuperClusterFbrem((sc->energy()-(*first)->energy())/sc->energy()) ;
976  }
977  else
978  { (*el)->setPfSuperClusterFbrem(0.) ; }
979  ElectronClassification theClassifier ;
980  theClassifier.refineWithPflow(**el) ;
981  }
982  }
983  }
void calculateShowerShape(const reco::SuperClusterRef &, bool pflow, reco::GsfElectron::ShowerShape &)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
bool isNull() const
Checks for null.
Definition: Ref.h:247
IsolationValueMaps pfIsolationValues
GsfElectronPtrCollection * electrons
bool first
Definition: L1TdeRCT.cc:94
edm::Handle< reco::GsfElectronCollection > previousElectrons
edm::Handle< reco::GsfElectronCollection > pflowElectrons
void setPflowPreselectionFlag(reco::GsfElectron *ele)
T const * product() const
Definition: Handle.h:74
void refineWithPflow(reco::GsfElectron &)
EventData * eventData_
IsolationValueMaps edIsolationValues
void GsfElectronAlgo::beginEvent ( edm::Event event)

Definition at line 667 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::ecalBarrelHitsMeta, GsfElectronAlgo::EventData::ecalBarrelIsol03, GsfElectronAlgo::EventData::ecalBarrelIsol04, GsfElectronAlgo::EventData::ecalEndcapHitsMeta, 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, event(), GsfElectronAlgo::EventData::event, eventData_, eventSetupData_, edm::hlt::Exception, generalData_, 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::intRadiusBarrelTk, GsfElectronAlgo::IsolationConfiguration::intRadiusEcalBarrel, GsfElectronAlgo::IsolationConfiguration::intRadiusEcalEndcaps, GsfElectronAlgo::IsolationConfiguration::intRadiusEndcapTk, GsfElectronAlgo::IsolationConfiguration::intRadiusHcal, GsfElectronAlgo::GeneralData::isoCfg, j, GsfElectronAlgo::IsolationConfiguration::jurassicWidth, GsfElectronAlgo::IsolationConfiguration::maxDrbTk, GsfElectronAlgo::IsolationConfiguration::maxVtxDistTk, GsfElectronAlgo::EventData::pfIsolationValues, GsfElectronAlgo::InputTagsConfiguration::pfIsoVals, GsfElectronAlgo::EventData::pflowElectrons, GsfElectronAlgo::InputTagsConfiguration::pflowGsfElectronsTag, GsfElectronAlgo::InputTagsConfiguration::pfMVA, GsfElectronAlgo::EventData::pfMva, reco::BeamSpot::position(), GsfElectronAlgo::EventData::previousElectrons, GsfElectronAlgo::InputTagsConfiguration::previousGsfElectrons, edm::Handle< T >::product(), edm::ESHandle< class >::product(), PtMinSelector_cfg::ptMin, GsfElectronAlgo::IsolationConfiguration::ptMinTk, 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::IsolationConfiguration::stripBarrelTk, GsfElectronAlgo::IsolationConfiguration::stripEndcapTk, GsfElectronAlgo::EventData::tkIsolation03, GsfElectronAlgo::EventData::tkIsolation04, GsfElectronAlgo::EventData::towers, GsfElectronAlgo::StrategyConfiguration::useGsfPfRecTracks, GsfElectronAlgo::IsolationConfiguration::useNumCrystals, and GsfElectronAlgo::IsolationConfiguration::vetoClustered.

Referenced by GsfElectronBaseProducer::beginEvent().

668  {
669  if (eventData_!=0)
670  { throw cms::Exception("GsfElectronAlgo|InternalError")<<"unexpected event data" ; }
671  eventData_ = new EventData ;
672 
673  // init the handles linked to the current event
674  eventData_->event = &event ;
681  event.getByLabel(generalData_->inputCfg.hcalTowersTag,eventData_->towers) ;
682  event.getByLabel(generalData_->inputCfg.pfMVA,eventData_->pfMva) ;
683  event.getByLabel(generalData_->inputCfg.seedsTag,eventData_->seeds) ;
686 
687  // get the beamspot from the Event:
688  edm::Handle<reco::BeamSpot> recoBeamSpotHandle ;
689  event.getByLabel(generalData_->inputCfg.beamSpotTag,recoBeamSpotHandle) ;
690  eventData_->beamspot = recoBeamSpotHandle.product() ;
691 
692  // prepare access to hcal data
695 
696  // Isolation algos
697  float extRadiusSmall=0.3, extRadiusLarge=0.4 ;
698  float intRadiusBarrel=generalData_->isoCfg.intRadiusBarrelTk, intRadiusEndcap=generalData_->isoCfg.intRadiusEndcapTk, stripBarrel=generalData_->isoCfg.stripBarrelTk, stripEndcap=generalData_->isoCfg.stripEndcapTk ;
700  eventData_->tkIsolation03 = new ElectronTkIsolation(extRadiusSmall,intRadiusBarrel,intRadiusEndcap,stripBarrel,stripEndcap,ptMin,maxVtxDist,drb,eventData_->currentCtfTracks.product(),eventData_->beamspot->position()) ;
701  eventData_->tkIsolation04 = new ElectronTkIsolation(extRadiusLarge,intRadiusBarrel,intRadiusEndcap,stripBarrel,stripEndcap,ptMin,maxVtxDist,drb,eventData_->currentCtfTracks.product(),eventData_->beamspot->position()) ;
702 
703  float egHcalIsoConeSizeOutSmall=0.3, egHcalIsoConeSizeOutLarge=0.4;
704  float egHcalIsoConeSizeIn=generalData_->isoCfg.intRadiusHcal,egHcalIsoPtMin=generalData_->isoCfg.etMinHcal;
705  int egHcalDepth1=1, egHcalDepth2=2;
706  eventData_->hadDepth1Isolation03 = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
707  eventData_->hadDepth2Isolation03 = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
708  eventData_->hadDepth1Isolation04 = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
709  eventData_->hadDepth2Isolation04 = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
710  eventData_->hadDepth1Isolation03Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,0.,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
711  eventData_->hadDepth2Isolation03Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,0.,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
712  eventData_->hadDepth1Isolation04Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,0.,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
713  eventData_->hadDepth2Isolation04Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,0.,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
714 
715  float egIsoConeSizeOutSmall=0.3, egIsoConeSizeOutLarge=0.4, egIsoJurassicWidth=generalData_->isoCfg.jurassicWidth;
716  float egIsoPtMinBarrel=generalData_->isoCfg.etMinBarrel,egIsoEMinBarrel=generalData_->isoCfg.eMinBarrel, egIsoConeSizeInBarrel=generalData_->isoCfg.intRadiusEcalBarrel;
717  float egIsoPtMinEndcap=generalData_->isoCfg.etMinEndcaps,egIsoEMinEndcap=generalData_->isoCfg.eMinEndcaps, egIsoConeSizeInEndcap=generalData_->isoCfg.intRadiusEcalEndcaps;
720  eventData_->ecalBarrelIsol03 = new EgammaRecHitIsolation(egIsoConeSizeOutSmall,egIsoConeSizeInBarrel,egIsoJurassicWidth,egIsoPtMinBarrel,egIsoEMinBarrel,eventSetupData_->caloGeom,eventData_->ecalBarrelHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal);
721  eventData_->ecalBarrelIsol04 = new EgammaRecHitIsolation(egIsoConeSizeOutLarge,egIsoConeSizeInBarrel,egIsoJurassicWidth,egIsoPtMinBarrel,egIsoEMinBarrel,eventSetupData_->caloGeom,eventData_->ecalBarrelHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal);
722  eventData_->ecalEndcapIsol03 = new EgammaRecHitIsolation(egIsoConeSizeOutSmall,egIsoConeSizeInEndcap,egIsoJurassicWidth,egIsoPtMinEndcap,egIsoEMinEndcap,eventSetupData_->caloGeom,eventData_->ecalEndcapHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal);
723  eventData_->ecalEndcapIsol04 = new EgammaRecHitIsolation(egIsoConeSizeOutLarge,egIsoConeSizeInEndcap,egIsoJurassicWidth,egIsoPtMinEndcap,egIsoEMinEndcap,eventSetupData_->caloGeom,eventData_->ecalEndcapHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal);
740 
741  //Fill in the Isolation Value Maps for PF and EcalDriven electrons
742  std::vector<edm::InputTag> inputTagIsoVals;
744  inputTagIsoVals.push_back(generalData_->inputCfg.pfIsoVals.getParameter<edm::InputTag>("pfChargedHadrons"));
745  inputTagIsoVals.push_back(generalData_->inputCfg.pfIsoVals.getParameter<edm::InputTag>("pfPhotons"));
746  inputTagIsoVals.push_back(generalData_->inputCfg.pfIsoVals.getParameter<edm::InputTag>("pfNeutralHadrons"));
747 
748  eventData_->pfIsolationValues.resize(inputTagIsoVals.size());
749 
750  for (size_t j = 0; j<inputTagIsoVals.size(); ++j) {
751  event.getByLabel(inputTagIsoVals[j], eventData_->pfIsolationValues[j]);
752  }
753 
754  }
755 
757  inputTagIsoVals.clear();
758  inputTagIsoVals.push_back(generalData_->inputCfg.edIsoVals.getParameter<edm::InputTag>("edChargedHadrons"));
759  inputTagIsoVals.push_back(generalData_->inputCfg.edIsoVals.getParameter<edm::InputTag>("edPhotons"));
760  inputTagIsoVals.push_back(generalData_->inputCfg.edIsoVals.getParameter<edm::InputTag>("edNeutralHadrons"));
761 
762  eventData_->edIsolationValues.resize(inputTagIsoVals.size());
763 
764  for (size_t j = 0; j<inputTagIsoVals.size(); ++j) {
765  event.getByLabel(inputTagIsoVals[j], eventData_->edIsolationValues[j]);
766  }
767  }
768  }
ElectronHcalHelper * hcalHelperPflow
T getParameter(std::string const &) const
edm::Handle< reco::ElectronSeedCollection > seeds
bool empty() const
Definition: ParameterSet.h:219
edm::Handle< edm::ValueMap< float > > pfMva
GeneralData * generalData_
EgammaTowerIsolation * hadDepth1Isolation04Bc
void readEvent(const edm::Event &)
EgammaTowerIsolation * hadDepth1Isolation03Bc
const IsolationConfiguration isoCfg
const EcalRecHitsConfiguration recHitsCfg
EventSetupData * eventSetupData_
edm::Handle< EcalRecHitCollection > endcapRecHits
const InputTagsConfiguration inputCfg
edm::ESHandle< EcalSeverityLevelAlgo > sevLevel
EgammaTowerIsolation * hadDepth1Isolation03
const StrategyConfiguration strategyCfg
void doFlagChecks(const std::vector< int > &v)
EgammaRecHitIsolation * ecalBarrelIsol04
EgammaTowerIsolation * hadDepth2Isolation03
EgammaTowerIsolation * hadDepth1Isolation04
ElectronTkIsolation * tkIsolation03
void setUseNumCrystals(bool b=true)
EgammaRecHitIsolation * ecalEndcapIsol03
EgammaTowerIsolation * hadDepth2Isolation03Bc
edm::Handle< EcalRecHitCollection > barrelRecHits
IsolationValueMaps pfIsolationValues
int j
Definition: DBlmapReader.cc:9
ElectronHcalHelper * hcalHelper
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
void doSeverityChecks(const EcalRecHitCollection *const recHits, const std::vector< int > &v)
EgammaTowerIsolation * hadDepth2Isolation04Bc
edm::Handle< reco::GsfElectronCollection > previousElectrons
EgammaRecHitIsolation * ecalBarrelIsol03
edm::Handle< reco::GsfElectronCollection > pflowElectrons
EcalRecHitMetaCollection * ecalBarrelHitsMeta
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
EgammaTowerIsolation * hadDepth2Isolation04
void setVetoClustered(bool b=true)
SimpleCaloRecHitMetaCollection< EcalRecHitCollection > EcalRecHitMetaCollection
edm::Handle< reco::TrackCollection > currentCtfTracks
edm::ESHandle< CaloGeometry > caloGeom
EgammaRecHitIsolation * ecalEndcapIsol04
const Point & position() const
position
Definition: BeamSpot.h:63
EventData * eventData_
ElectronTkIsolation * tkIsolation04
IsolationValueMaps edIsolationValues
edm::Handle< reco::GsfElectronCoreCollection > coreElectrons
edm::Handle< CaloTowerCollection > towers
EcalRecHitMetaCollection * ecalEndcapHitsMeta
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracks
void GsfElectronAlgo::calculateShowerShape ( const reco::SuperClusterRef theClus,
bool  pflow,
reco::GsfElectron::ShowerShape showerShape 
)
private

Definition at line 520 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::barrelRecHits, GsfElectronAlgo::EventSetupData::caloGeom, GsfElectronAlgo::EventSetupData::caloTopo, EcalClusterTools::covariances(), EcalClusterTools::e1x5(), reco::GsfElectron::ShowerShape::e1x5, EcalClusterTools::e2x5Max(), reco::GsfElectron::ShowerShape::e2x5Max, EcalClusterTools::e3x3(), EcalClusterTools::e5x5(), reco::GsfElectron::ShowerShape::e5x5, EcalBarrel, GsfElectronAlgo::EventData::endcapRecHits, eventData_, eventSetupData_, generalData_, geometry, reco::GsfElectron::ShowerShape::hcalDepth1OverEcal, reco::GsfElectron::ShowerShape::hcalDepth1OverEcalBc, reco::GsfElectron::ShowerShape::hcalDepth2OverEcal, reco::GsfElectron::ShowerShape::hcalDepth2OverEcalBc, ElectronHcalHelper::hcalESumDepth1(), ElectronHcalHelper::hcalESumDepth1BehindClusters(), ElectronHcalHelper::hcalESumDepth2(), ElectronHcalHelper::hcalESumDepth2BehindClusters(), GsfElectronAlgo::GeneralData::hcalHelper, GsfElectronAlgo::GeneralData::hcalHelperPflow, ElectronHcalHelper::hcalTowersBehindClusters(), reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, reco::CaloCluster::hitsAndFractions(), edm::isNotFinite(), EcalClusterTools::localCovariances(), edm::ESHandle< class >::product(), reco::GsfElectron::ShowerShape::r9, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedEndcaps, GsfElectronAlgo::GeneralData::recHitsCfg, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedEndcaps, GsfElectronAlgo::EventSetupData::sevLevel, reco::GsfElectron::ShowerShape::sigmaEtaEta, reco::GsfElectron::ShowerShape::sigmaIetaIeta, reco::GsfElectron::ShowerShape::sigmaIphiIphi, mathSSE::sqrt(), and DetId::subdetId().

Referenced by addPflowInfo(), and createElectron().

521  {
522  const reco::CaloCluster & seedCluster = *(theClus->seed()) ;
523  // temporary, till CaloCluster->seed() is made available
524  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first ;
525  int detector = seedXtalId.subdetId() ;
526 
527  const CaloTopology * topology = eventSetupData_->caloTopo.product() ;
529  const EcalRecHitCollection * recHits = 0 ;
530  std::vector<int> recHitFlagsToBeExcluded ;
531  std::vector<int> recHitSeverityToBeExcluded ;
532  const EcalSeverityLevelAlgo * severityLevelAlgo = eventSetupData_->sevLevel.product() ;
533  if (detector==EcalBarrel)
534  {
535  recHits = eventData_->barrelRecHits.product() ;
536  recHitFlagsToBeExcluded = generalData_->recHitsCfg.recHitFlagsToBeExcludedBarrel ;
537  recHitSeverityToBeExcluded = generalData_->recHitsCfg.recHitSeverityToBeExcludedBarrel ;
538  }
539  else
540  {
541  recHits = eventData_->endcapRecHits.product() ;
542  recHitFlagsToBeExcluded = generalData_->recHitsCfg.recHitFlagsToBeExcludedEndcaps ;
543  recHitSeverityToBeExcluded = generalData_->recHitsCfg.recHitSeverityToBeExcludedEndcaps ;
544  }
545 
546  std::vector<float> covariances = EcalClusterTools::covariances(seedCluster,recHits,topology,geometry,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo) ;
547  std::vector<float> localCovariances = EcalClusterTools::localCovariances(seedCluster,recHits,topology,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo) ;
548  showerShape.sigmaEtaEta = sqrt(covariances[0]) ;
549  showerShape.sigmaIetaIeta = sqrt(localCovariances[0]) ;
550  if (!edm::isNotFinite(localCovariances[2])) showerShape.sigmaIphiIphi = sqrt(localCovariances[2]) ;
551  showerShape.e1x5 = EcalClusterTools::e1x5(seedCluster,recHits,topology,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo) ;
552  showerShape.e2x5Max = EcalClusterTools::e2x5Max(seedCluster,recHits,topology,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo) ;
553  showerShape.e5x5 = EcalClusterTools::e5x5(seedCluster,recHits,topology,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo) ;
554  showerShape.r9 = EcalClusterTools::e3x3(seedCluster,recHits,topology,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo)/theClus->rawEnergy() ;
555 
556  if (pflow)
557  {
558  showerShape.hcalDepth1OverEcal = generalData_->hcalHelperPflow->hcalESumDepth1(*theClus)/theClus->energy() ;
559  showerShape.hcalDepth2OverEcal = generalData_->hcalHelperPflow->hcalESumDepth2(*theClus)/theClus->energy() ;
563  }
564  else
565  {
566  showerShape.hcalDepth1OverEcal = generalData_->hcalHelper->hcalESumDepth1(*theClus)/theClus->energy() ;
567  showerShape.hcalDepth2OverEcal = generalData_->hcalHelper->hcalESumDepth2(*theClus)/theClus->energy() ;
571  }
572  }
ElectronHcalHelper * hcalHelperPflow
GeneralData * generalData_
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:189
double hcalESumDepth1BehindClusters(const std::vector< CaloTowerDetId > &towers)
edm::ESHandle< EcalSeverityLevelAlgo > sevLevel
edm::ESHandle< CaloTopology > caloTopo
static std::vector< float > covariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
bool isNotFinite(T x)
Definition: isFinite.h:10
static std::vector< float > localCovariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
T sqrt(T t)
Definition: SSEVec.h:48
edm::Handle< EcalRecHitCollection > barrelRecHits
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:366
double hcalESumDepth2(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0)
ElectronHcalHelper * hcalHelper
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
T const * product() const
Definition: ESHandle.h:62
ESHandle< TrackerGeometry > geometry
static float e2x5Max(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
edm::ESHandle< CaloGeometry > caloGeom
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double hcalESumDepth1(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0)
static float e1x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
EventData * eventData_
void GsfElectronAlgo::checkSetup ( const edm::EventSetup es)

Definition at line 604 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(), 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< class >::product(), GsfElectronAlgo::EventSetupData::sevLevel, GsfElectronAlgo::GeneralData::superClusterErrorFunction, and GsfElectronAlgo::EventSetupData::trackerHandle.

Referenced by GsfElectronBaseProducer::beginEvent().

605  {
606  // get EventSetupRecords if needed
607  bool updateField(false);
609  updateField = true;
612  }
613 
614  bool updateGeometry(false);
616  updateGeometry = true;
619  }
620 
621  if ( updateField || updateGeometry ) {
622  delete eventSetupData_->mtsTransform ;
626  }
627 
629  eventSetupData_->cacheIDGeom=es.get<CaloGeometryRecord>().cacheIdentifier();
631  }
632 
634  eventSetupData_->cacheIDTopo=es.get<CaloTopologyRecord>().cacheIdentifier();
636  }
637 
640 
645 
646  //if(eventSetupData_->cacheChStatus!=es.get<EcalChannelStatusRcd>().cacheIdentifier()){
647  // eventSetupData_->cacheChStatus=es.get<EcalChannelStatusRcd>().cacheIdentifier();
648  // es.get<EcalChannelStatusRcd>().get(eventSetupData_->chStatus);
649  //}
650 
652  eventSetupData_->cacheSevLevel = es.get<EcalSeverityLevelAlgoRcd>().cacheIdentifier();
654  }
655  }
ElectronHcalHelper * hcalHelperPflow
unsigned long long cacheIdentifier() const
GeneralData * generalData_
EventSetupData * eventSetupData_
void checkSetup(const edm::EventSetup &)
edm::ESHandle< EcalSeverityLevelAlgo > sevLevel
edm::ESHandle< CaloTopology > caloTopo
GsfConstraintAtVertex * constraintAtVtx
const MultiTrajectoryStateTransform * mtsTransform
ElectronHcalHelper * hcalHelper
edm::ESHandle< MagneticField > magField
EcalClusterFunctionBaseClass * superClusterErrorFunction
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
edm::ESHandle< CaloGeometry > caloGeom
EcalClusterFunctionBaseClass * crackCorrectionFunction
edm::ESHandle< TrackerGeometry > trackerHandle
virtual void init(const edm::EventSetup &es)=0
void GsfElectronAlgo::clonePreviousElectrons ( )

Definition at line 835 of file GsfElectronAlgo.cc.

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

Referenced by GsfElectronProducer::produce().

836  {
837  const GsfElectronCollection * oldElectrons = eventData_->previousElectrons.product() ;
839  GsfElectronCollection::const_iterator oldElectron ;
840  for
841  ( oldElectron = oldElectrons->begin() ;
842  oldElectron != oldElectrons->end() ;
843  ++oldElectron )
844  {
845  const GsfElectronCoreRef oldCoreRef = oldElectron->core() ;
846  const GsfTrackRef oldElectronGsfTrackRef = oldCoreRef->gsfTrack() ;
847  unsigned int icore ;
848  for ( icore=0 ; icore<newCores->size() ; ++icore )
849  {
850  if (oldElectronGsfTrackRef==(*newCores)[icore].gsfTrack())
851  {
853  eventData_->electrons->push_back(new GsfElectron(*oldElectron,coreRef)) ;
854  break ;
855  }
856  }
857  }
858  }
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:74
EventData * eventData_
edm::Handle< reco::GsfElectronCoreCollection > coreElectrons
void GsfElectronAlgo::completeElectrons ( )

Definition at line 792 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::ElectronData::calculateTSOS(), GsfElectronAlgo::EventSetupData::constraintAtVtx, GsfElectronAlgo::EventData::coreElectrons, createElectron(), electronData_, GsfElectronAlgo::EventData::electrons, eventData_, eventSetupData_, edm::hlt::Exception, funct::false, i, edm::Ref< C, T, F >::isNull(), GsfElectronAlgo::EventSetupData::mtsTransform, edm::Handle< T >::product(), and funct::true.

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

793  {
794  if (electronData_!=0)
795  { throw cms::Exception("GsfElectronAlgo|InternalError")<<"unexpected electron data" ; }
796 
797  const GsfElectronCoreCollection * coreCollection = eventData_->coreElectrons.product() ;
798  for ( unsigned int i=0 ; i<coreCollection->size() ; ++i )
799  {
800  // check there is no existing electron with this core
802  bool coreFound = false ;
803  GsfElectronPtrCollection::const_iterator itrEle ;
804  for
805  ( itrEle = eventData_->electrons->begin() ;
806  itrEle != eventData_->electrons->end() ;
807  itrEle++ )
808  {
809  if ((*itrEle)->core()==coreRef)
810  {
811  coreFound = true ;
812  break ;
813  }
814  }
815  if (coreFound) continue ;
816 
817  // check there is a super-cluster
818  if (coreRef->superCluster().isNull()) continue ;
819 
820  // prepare internal structure for electron specific data
821  delete electronData_ ;
822  electronData_ = new ElectronData(coreRef,*eventData_->beamspot) ;
823 
824  // calculate and check Trajectory StatesOnSurface....
826 
827  createElectron() ;
828 
829  } // loop over tracks
830 
831  delete electronData_ ;
832  electronData_ = 0 ;
833  }
int i
Definition: DBlmapReader.cc:9
EventSetupData * eventSetupData_
bool isNull() const
Checks for null.
Definition: Ref.h:247
GsfConstraintAtVertex * constraintAtVtx
std::vector< GsfElectronCore > GsfElectronCoreCollection
const MultiTrajectoryStateTransform * mtsTransform
const reco::BeamSpot * beamspot
GsfElectronPtrCollection * electrons
T const * product() const
Definition: Handle.h:74
bool calculateTSOS(const MultiTrajectoryStateTransform *, GsfConstraintAtVertex *)
EventData * eventData_
ElectronData * electronData_
edm::Handle< reco::GsfElectronCoreCollection > coreElectrons
void GsfElectronAlgo::copyElectrons ( reco::GsfElectronCollection outEle)

Definition at line 657 of file GsfElectronAlgo.cc.

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

Referenced by GsfElectronBaseProducer::fillEvent().

658  {
659  GsfElectronPtrCollection::const_iterator it ;
660  for
661  ( it = eventData_->electrons->begin() ;
662  it != eventData_->electrons->end() ;
663  it++ )
664  { outEle.push_back(**it) ; }
665  }
GsfElectronPtrCollection * electrons
EventData * eventData_
void GsfElectronAlgo::createElectron ( )
private

Definition at line 1118 of file GsfElectronAlgo.cc.

References abs, GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::ElectronData::calculateMode(), GsfElectronAlgo::ElectronData::calculateMomentum(), calculateShowerShape(), GsfElectronAlgo::ElectronData::checkCtfTrack(), 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, GsfElectronAlgo::StrategyConfiguration::ctfTracksCheck, GsfElectronAlgo::EventData::currentCtfTracks, ConversionInfo::dcot(), reco::GsfElectron::ConversionRejection::dcot, reco::GsfElectron::TrackClusterMatching::deltaEtaEleClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaEtaSeedClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaEtaSuperClusterAtVtx, reco::GsfElectron::TrackClusterMatching::deltaPhiEleClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaPhiSeedClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaPhiSuperClusterAtVtx, ConversionInfo::dist(), reco::GsfElectron::ConversionRejection::dist, EcalBarrel, GsfElectronAlgo::EventData::ecalBarrelIsol03, GsfElectronAlgo::EventData::ecalBarrelIsol04, 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, reco::CaloCluster::energy(), reco::GsfElectron::TrackClusterMatching::eSeedClusterOverP, reco::GsfElectron::TrackClusterMatching::eSeedClusterOverPout, reco::GsfElectron::TrackClusterMatching::eSuperClusterOverP, eventData_, eventSetupData_, edm::hlt::Exception, ConversionInfo::flag(), reco::GsfElectron::ConversionRejection::flags, generalData_, GsfElectronAlgo::ElectronData::getEleBasicCluster(), EgammaRecHitIsolation::getEtSum(), ElectronTkIsolation::getPtTracks(), EgammaTowerIsolation::getTowerEtSum(), EcalClusterFunctionBaseClass::getValue(), GsfElectronAlgo::EventData::hadDepth1Isolation03, GsfElectronAlgo::EventData::hadDepth1Isolation03Bc, GsfElectronAlgo::EventData::hadDepth1Isolation04, GsfElectronAlgo::EventData::hadDepth1Isolation04Bc, GsfElectronAlgo::EventData::hadDepth2Isolation03, GsfElectronAlgo::EventData::hadDepth2Isolation03Bc, GsfElectronAlgo::EventData::hadDepth2Isolation04, GsfElectronAlgo::EventData::hadDepth2Isolation04Bc, reco::GsfElectron::IsolationVariables::hcalDepth1TowerSumEt, reco::GsfElectron::IsolationVariables::hcalDepth1TowerSumEtBc, reco::GsfElectron::IsolationVariables::hcalDepth2TowerSumEt, reco::GsfElectron::IsolationVariables::hcalDepth2TowerSumEtBc, reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, reco::CaloCluster::hitsAndFractions(), EBDetId::ietaAbs(), GsfElectronAlgo::ElectronData::innMom, reco::GsfElectron::FiducialFlags::isEB, reco::GsfElectron::FiducialFlags::isEBEEGap, reco::GsfElectron::FiducialFlags::isEBEtaGap, reco::GsfElectron::FiducialFlags::isEBPhiGap, reco::GsfElectron::FiducialFlags::isEE, reco::GsfElectron::FiducialFlags::isEEDeeGap, reco::GsfElectron::FiducialFlags::isEERingGap, EEDetId::isNextToDBoundary(), EBDetId::isNextToEtaBoundary(), EBDetId::isNextToPhiBoundary(), EEDetId::isNextToRingBoundary(), edm::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::pureTrackerDrivenEcalErrorFromSimpleParameterization, reco::GsfElectron::ConversionRejection::radius, ConversionInfo::radiusOfConversion(), GsfElectronAlgo::EventData::retreiveOriginalTrackCollections(), GsfElectronAlgo::ElectronData::sclMom, GsfElectronAlgo::ElectronData::sclPos, GsfElectronAlgo::ElectronData::seedMom, GsfElectronAlgo::ElectronData::seedPos, reco::GsfElectron::setCorrectedEcalEnergyError(), setCutBasedPreselectionFlag(), reco::GsfElectron::setIsolation03(), reco::GsfElectron::setIsolation04(), reco::GsfElectron::setP4(), 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, GsfElectronAlgo::EventData::tkIsolation03, GsfElectronAlgo::EventData::tkIsolation04, reco::GsfElectron::IsolationVariables::tkSumPt, funct::true, GsfElectronAlgo::ElectronData::vtxMom, GsfElectronAlgo::ElectronData::vtxMomWithConstraint, GsfElectronAlgo::ElectronData::vtxPos, and GsfElectronAlgo::ElectronData::vtxTSOS.

Referenced by completeElectrons().

1119  {
1120  // eventually check ctf track
1123 
1124  // charge ID
1125  int eleCharge ;
1126  GsfElectron::ChargeInfo eleChargeInfo ;
1127  electronData_->computeCharge(eleCharge,eleChargeInfo) ;
1128 
1129  // electron basic cluster
1131 
1132  // Seed cluster
1133  const reco::CaloCluster & seedCluster = *(electronData_->superClusterRef->seed()) ;
1134 
1135  // seed Xtal
1136  // temporary, till CaloCluster->seed() is made available
1137  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first ;
1138 
1140 
1141 
1142  //====================================================
1143  // Candidate attributes
1144  //====================================================
1145 
1147 
1148 
1149  //====================================================
1150  // Track-Cluster Matching
1151  //====================================================
1152 
1154  tcMatching.electronCluster = elbcRef ;
1155  tcMatching.eSuperClusterOverP = (electronData_->vtxMom.mag()>0)?(electronData_->superClusterRef->energy()/electronData_->vtxMom.mag()):(-1.) ;
1156  tcMatching.eSeedClusterOverP = (electronData_->vtxMom.mag()>0.)?(seedCluster.energy()/electronData_->vtxMom.mag()):(-1) ;
1157  tcMatching.eSeedClusterOverPout = (electronData_->seedMom.mag()>0.)?(seedCluster.energy()/electronData_->seedMom.mag()):(-1.) ;
1158  tcMatching.eEleClusterOverPout = (electronData_->eleMom.mag()>0.)?(elbcRef->energy()/electronData_->eleMom.mag()):(-1.) ;
1159 
1161  tcMatching.deltaEtaSuperClusterAtVtx = scAtVtx.dEta() ;
1162  tcMatching.deltaPhiSuperClusterAtVtx = scAtVtx.dPhi() ;
1163 
1164  EleRelPointPair seedAtCalo(seedCluster.position(),electronData_->seedPos,eventData_->beamspot->position()) ;
1165  tcMatching.deltaEtaSeedClusterAtCalo = seedAtCalo.dEta() ;
1166  tcMatching.deltaPhiSeedClusterAtCalo = seedAtCalo.dPhi() ;
1167 
1168  EleRelPointPair ecAtCalo(elbcRef->position(),electronData_->elePos,eventData_->beamspot->position()) ;
1169  tcMatching.deltaEtaEleClusterAtCalo = ecAtCalo.dEta() ;
1170  tcMatching.deltaPhiEleClusterAtCalo = ecAtCalo.dPhi() ;
1171 
1172 
1173  //=======================================================
1174  // Track extrapolations
1175  //=======================================================
1176 
1185 
1186 
1187  //=======================================================
1188  // Closest Ctf Track
1189  //=======================================================
1190 
1192  ctfInfo.ctfTrack = electronData_->ctfTrackRef ;
1194 
1195 
1196  //====================================================
1197  // FiducialFlags, using nextToBoundary definition of gaps
1198  //====================================================
1199 
1200  reco::GsfElectron::FiducialFlags fiducialFlags ;
1201  int detector = seedXtalId.subdetId() ;
1202  double feta=std::abs(electronData_->superClusterRef->position().eta()) ;
1203  if (detector==EcalBarrel)
1204  {
1205  fiducialFlags.isEB = true ;
1206  EBDetId ebdetid(seedXtalId);
1207  if (EBDetId::isNextToEtaBoundary(ebdetid))
1208  {
1209  if (ebdetid.ietaAbs()==85)
1210  { fiducialFlags.isEBEEGap = true ; }
1211  else
1212  { fiducialFlags.isEBEtaGap = true ; }
1213  }
1214  if (EBDetId::isNextToPhiBoundary(ebdetid))
1215  { fiducialFlags.isEBPhiGap = true ; }
1216  }
1217  else if (detector==EcalEndcap)
1218  {
1219  fiducialFlags.isEE = true ;
1220  EEDetId eedetid(seedXtalId);
1221  if (EEDetId::isNextToRingBoundary(eedetid))
1222  {
1223  if (std::abs(feta)<2.)
1224  { fiducialFlags.isEBEEGap = true ; }
1225  else
1226  { fiducialFlags.isEERingGap = true ; }
1227  }
1228  if (EEDetId::isNextToDBoundary(eedetid))
1229  { fiducialFlags.isEEDeeGap = true ; }
1230  }
1231  else
1232  { throw cms::Exception("GsfElectronAlgo|UnknownXtalRegion")<<"createElectron(): do not know if it is a barrel or endcap seed cluster !!!!" ; }
1233 
1234 
1235  //====================================================
1236  // ShowerShape
1237  //====================================================
1238 
1239  reco::GsfElectron::ShowerShape showerShape ;
1240  calculateShowerShape(electronData_->superClusterRef,!(electronData_->coreRef->ecalDrivenSeed()),showerShape) ;
1241 
1242 
1243  //====================================================
1244  // ConversionRejection
1245  //====================================================
1246 
1248 
1249  ConversionFinder conversionFinder ;
1250  double BInTesla = eventSetupData_->magField->inTesla(GlobalPoint(0.,0.,0.)).z() ;
1252  if (!ctfTracks.isValid()) { ctfTracks = eventData_->currentCtfTracks ; }
1253 
1254  // values of conversionInfo.flag()
1255  // -9999 : Partner track was not found
1256  // 0 : Partner track found in the CTF collection using
1257  // 1 : Partner track found in the CTF collection using
1258  // 2 : Partner track found in the GSF collection using
1259  // 3 : Partner track found in the GSF collection using the electron's GSF track
1260  ConversionInfo conversionInfo = conversionFinder.getConversionInfo
1261  (*electronData_->coreRef,ctfTracks,eventData_->originalGsfTracks,BInTesla) ;
1262 
1264  conversionVars.flags = conversionInfo.flag() ;
1265  conversionVars.dist = conversionInfo.dist() ;
1266  conversionVars.dcot = conversionInfo.dcot() ;
1267  conversionVars.radius = conversionInfo.radiusOfConversion() ;
1268  if ((conversionVars.flags==0)or(conversionVars.flags==1))
1269  conversionVars.partner = TrackBaseRef(conversionInfo.conversionPartnerCtfTk()) ;
1270  else if ((conversionVars.flags==2)or(conversionVars.flags==3))
1271  conversionVars.partner = TrackBaseRef(conversionInfo.conversionPartnerGsfTk()) ;
1272 
1273 
1274  //====================================================
1275  // Go !
1276  //====================================================
1277 
1278  GsfElectron * ele = new
1279  GsfElectron
1280  ( eleCharge,eleChargeInfo,electronData_->coreRef,
1281  tcMatching, tkExtra, ctfInfo,
1282  fiducialFlags,showerShape,
1283  conversionVars ) ;
1285  ele->setP4(GsfElectron::P4_FROM_SUPER_CLUSTER,momentum,0,true) ;
1286 
1287 
1288  //====================================================
1289  // brems fractions
1290  //====================================================
1291 
1292  if (electronData_->innMom.mag()>0.)
1294 
1295  SuperClusterRef sc = ele->superCluster() ;
1296  if (!(sc.isNull()))
1297  {
1298  CaloClusterPtr cl = ele->electronCluster() ;
1299  if (sc->clustersSize()>1)
1300  { ele->setSuperClusterFbrem( ( sc->energy() - cl->energy() ) / sc->energy() ) ; }
1301  else
1302  { ele->setSuperClusterFbrem(0) ; }
1303  }
1304 
1305 
1306  //====================================================
1307  // classification and corrections
1308  //====================================================
1309 
1310  // classification
1311  ElectronClassification theClassifier ;
1312  theClassifier.classify(*ele) ;
1313 
1314  // ecal energy
1316  if (ele->core()->ecalDrivenSeed())
1317  {
1319  { theEnCorrector.classBasedParameterizationEnergy(*ele,*eventData_->beamspot) ; }
1321  { theEnCorrector.classBasedParameterizationUncertainty(*ele) ; }
1322  }
1323  else
1324  {
1326  { theEnCorrector.simpleParameterizationUncertainty(*ele) ; }
1327  }
1328 
1329  // momentum
1330  if (ele->core()->ecalDrivenSeed())
1331  {
1332  ElectronMomentumCorrector theMomCorrector;
1333  theMomCorrector.correct(*ele,electronData_->vtxTSOS);
1334  }
1335 
1336 
1337  //====================================================
1338  // now isolation variables
1339  //====================================================
1340 
1354  ele->setIsolation03(dr03);
1355  ele->setIsolation04(dr04);
1356 
1357 
1358  //====================================================
1359  // preselection flag
1360  //====================================================
1361 
1363 
1364  LogTrace("GsfElectronAlgo")<<"Constructed new electron with energy "<< ele->p4().e() ;
1365 
1366  eventData_->electrons->push_back(ele) ;
1367  }
CaloClusterPtr electronCluster() const
Definition: GsfElectron.h:228
edm::Handle< reco::TrackCollection > originalCtfTracks
const MultiTrajectoryStateMode * mtsMode
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
void setTrackFbrem(float fbrem)
Definition: GsfElectron.h:642
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:178
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:204
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
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
double dist() const
#define abs(x)
Definition: mlp_lapack.h:159
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
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:643
EgammaRecHitIsolation * ecalBarrelIsol04
virtual float getValue(const reco::BasicCluster &, const EcalRecHitCollection &) const =0
EgammaTowerIsolation * hadDepth2Isolation03
EgammaTowerIsolation * hadDepth1Isolation04
ElectronTkIsolation * tkIsolation03
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:158
bool isNull() const
Checks for null.
Definition: Ref.h:247
T mag() const
Definition: PV3DBase.h:67
void setCutBasedPreselectionFlag(reco::GsfElectron *ele, const reco::BeamSpot &)
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:22
EgammaRecHitIsolation * ecalEndcapIsol03
EgammaTowerIsolation * hadDepth2Isolation03Bc
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
static bool isNextToPhiBoundary(EBDetId id)
Definition: EBDetId.cc:130
void correct(reco::GsfElectron &, TrajectoryStateOnSurface &)
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:366
const MultiTrajectoryStateTransform * mtsTransform
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:375
double energy() const
cluster energy
Definition: CaloCluster.h:120
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:76
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
void setIsolation04(const IsolationVariables &dr04)
Definition: GsfElectron.h:463
#define LogTrace(id)
void classify(reco::GsfElectron &)
EgammaTowerIsolation * hadDepth2Isolation04Bc
Definition: DetId.h:20
EgammaRecHitIsolation * ecalBarrelIsol03
int flag() const
EcalClusterFunctionBaseClass * superClusterErrorFunction
void ele_convert(const Type1 &obj1, Type2 &obj2)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
math::XYZVectorF momentumAtVtxWithConstraint
Definition: GsfElectron.h:266
double getPtTracks(const reco::GsfElectron *) const
void setIsolation03(const IsolationVariables &dr03)
Definition: GsfElectron.h:462
edm::Handle< reco::GsfTrackCollection > originalGsfTracks
EgammaTowerIsolation * hadDepth2Isolation04
const reco::GsfElectronCoreRef coreRef
edm::Handle< reco::TrackCollection > currentCtfTracks
double getTowerEtSum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
EcalClusterFunctionBaseClass * crackCorrectionFunction
EgammaRecHitIsolation * ecalEndcapIsol04
const reco::SuperClusterRef superClusterRef
const Point & position() const
position
Definition: BeamSpot.h:63
EventData * eventData_
double dcot() const
ElectronTkIsolation * tkIsolation04
ElectronData * electronData_
void calculateMode(const MultiTrajectoryStateMode *mtsMode)
TrajectoryStateOnSurface vtxTSOS
Candidate::LorentzVector calculateMomentum()
void GsfElectronAlgo::displayInternalElectrons ( const std::string &  title) const

Definition at line 778 of file GsfElectronAlgo.cc.

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

Referenced by GsfElectronBaseProducer::fillEvent().

779  {
780  LogTrace("GsfElectronAlgo") << "========== " << title << " ==========";
781  LogTrace("GsfElectronAlgo") << "Event: " << eventData_->event->id();
782  LogTrace("GsfElectronAlgo") << "Number of electrons: " << eventData_->electrons->size() ;
783  GsfElectronPtrCollection::const_iterator it ;
784  for ( it = eventData_->electrons->begin(); it != eventData_->electrons->end(); it++ )
785  {
786  LogTrace("GsfElectronAlgo") << "Electron with charge, pt, eta, phi: " << (*it)->charge() << " , "
787  << (*it)->pt() << " , " << (*it)->eta() << " , " << (*it)->phi();
788  }
789  LogTrace("GsfElectronAlgo") << "=================================================";
790  }
GsfElectronPtrCollection * electrons
#define LogTrace(id)
edm::EventID id() const
Definition: EventBase.h:56
EventData * eventData_
void GsfElectronAlgo::endEvent ( )

Definition at line 770 of file GsfElectronAlgo.cc.

References eventData_, and edm::hlt::Exception.

Referenced by GsfElectronBaseProducer::endEvent().

771  {
772  if (eventData_==0)
773  { throw cms::Exception("GsfElectronAlgo|InternalError")<<"lacking event data" ; }
774  delete eventData_ ;
775  eventData_ = 0 ;
776  }
EventData * eventData_
const reco::SuperClusterRef GsfElectronAlgo::getTrSuperCluster ( const reco::GsfTrackRef trackRef)
private
bool GsfElectronAlgo::isPreselected ( reco::GsfElectron ele)
private
void GsfElectronAlgo::removeAmbiguousElectrons ( )

Definition at line 1499 of file GsfElectronAlgo.cc.

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

Referenced by GsfElectronBaseProducer::fillEvent().

1500  {
1501  GsfElectronPtrCollection::size_type ei = 1, emax = eventData_->electrons->size() ;
1502  GsfElectronPtrCollection::iterator eitr = eventData_->electrons->begin() ;
1503  while (eitr!=eventData_->electrons->end())
1504  {
1505  LogTrace("GsfElectronAlgo")<<"========== remove ambiguous "<<ei<<"/"<<emax<<"==========" ;
1506  if ((*eitr)->ambiguous())
1507  { delete (*eitr) ; eitr = eventData_->electrons->erase(eitr) ; ++ei ; }
1508  else
1509  { ++eitr ; ++ei ; }
1510  }
1511  }
uint16_t size_type
GsfElectronPtrCollection * electrons
#define LogTrace(id)
EventData * eventData_
void GsfElectronAlgo::removeNotPreselectedElectrons ( )

Definition at line 988 of file GsfElectronAlgo.cc.

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

Referenced by GsfElectronBaseProducer::fillEvent().

989  {
991  GsfElectronPtrCollection::iterator eitr = eventData_->electrons->begin() ;
992  while (eitr!=eventData_->electrons->end())
993  {
994  LogTrace("GsfElectronAlgo")<<"========== removed not preselected "<<ei<<"/"<<emax<<"==========" ;
995  if (isPreselected(*eitr))
996  { ++eitr ; ++ei ; }
997  else
998  { delete (*eitr) ; eitr = eventData_->electrons->erase(eitr) ; ++ei ; }
999  }
1000  }
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 1377 of file GsfElectronAlgo.cc.

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

Referenced by GsfElectronBaseProducer::fillEvent().

1378  {
1379  GsfElectronPtrCollection::iterator e1, e2 ;
1384  else
1385  { throw cms::Exception("GsfElectronAlgo|UnknownAmbiguitySortingStrategy")<<"value of generalData_->strategyCfg.ambSortingStrategy is : "<<generalData_->strategyCfg.ambSortingStrategy ; }
1386 
1387  // init
1388  for
1389  ( e1 = eventData_->electrons->begin() ;
1390  e1 != eventData_->electrons->end() ;
1391  ++e1 )
1392  {
1393  (*e1)->clearAmbiguousGsfTracks() ;
1394  (*e1)->setAmbiguous(false) ;
1395  }
1396 
1397  // get ambiguous from GsfPfRecTracks
1399  {
1400  for
1401  ( e1 = eventData_->electrons->begin() ;
1402  e1 != eventData_->electrons->end() ;
1403  ++e1 )
1404  {
1405  bool found = false ;
1406  const GsfPFRecTrackCollection * gsfPfRecTrackCollection = eventData_->gsfPfRecTracks.product() ;
1407  GsfPFRecTrackCollection::const_iterator gsfPfRecTrack ;
1408  for ( gsfPfRecTrack=gsfPfRecTrackCollection->begin() ;
1409  gsfPfRecTrack!=gsfPfRecTrackCollection->end() ;
1410  ++gsfPfRecTrack )
1411  {
1412  if (gsfPfRecTrack->gsfTrackRef()==(*e1)->gsfTrack())
1413  {
1414  if (found)
1415  {
1416  edm::LogWarning("GsfElectronAlgo")<<"associated gsfPfRecTrack already found" ;
1417  }
1418  else
1419  {
1420  found = true ;
1421  const std::vector<reco::GsfPFRecTrackRef> & duplicates(gsfPfRecTrack->convBremGsfPFRecTrackRef()) ;
1422  std::vector<reco::GsfPFRecTrackRef>::const_iterator duplicate ;
1423  for ( duplicate = duplicates.begin() ; duplicate != duplicates.end() ; duplicate ++ )
1424  { (*e1)->addAmbiguousGsfTrack((*duplicate)->gsfTrackRef()) ; }
1425  }
1426  }
1427  }
1428  }
1429  }
1430  // or search overlapping clusters
1431  else
1432  {
1433  for
1434  ( e1 = eventData_->electrons->begin() ;
1435  e1 != eventData_->electrons->end() ;
1436  ++e1 )
1437  {
1438  if ((*e1)->ambiguous()) continue ;
1439  if ( ignoreNotPreselected && !isPreselected(*e1) ) continue ;
1440 
1441  SuperClusterRef scRef1 = (*e1)->superCluster();
1442  CaloClusterPtr eleClu1 = (*e1)->electronCluster();
1443  LogDebug("GsfElectronAlgo")
1444  << "Blessing electron with E/P " << (*e1)->eSuperClusterOverP()
1445  << ", cluster " << scRef1.get()
1446  << " & track " << (*e1)->gsfTrack().get() ;
1447 
1448  for
1449  ( e2 = e1, ++e2 ;
1450  e2 != eventData_->electrons->end() ;
1451  ++e2 )
1452  {
1453  if ((*e2)->ambiguous()) continue ;
1454  if ( ignoreNotPreselected && !isPreselected(*e2) ) continue ;
1455 
1456  SuperClusterRef scRef2 = (*e2)->superCluster();
1457  CaloClusterPtr eleClu2 = (*e2)->electronCluster();
1458 
1459  // search if same cluster
1460  bool sameCluster = false ;
1462  { sameCluster = (scRef1==scRef2) ; }
1464  {
1465  float eMin = 1. ;
1466  float threshold = eMin*cosh(EleRelPoint(scRef1->position(),eventData_->beamspot->position()).eta()) ;
1467  sameCluster =
1469  (EgAmbiguityTools::sharedEnergy(&(*scRef1->seed()),&(*eleClu2),eventData_->barrelRecHits,eventData_->endcapRecHits)>=threshold) ||
1471  (EgAmbiguityTools::sharedEnergy(&(*scRef1->seed()),&(*scRef2->seed()),eventData_->barrelRecHits,eventData_->endcapRecHits)>=threshold) ) ;
1472  }
1473  else
1474  { throw cms::Exception("GsfElectronAlgo|UnknownAmbiguityClustersOverlapStrategy")<<"value of generalData_->strategyCfg.ambClustersOverlapStrategy is : "<<generalData_->strategyCfg.ambClustersOverlapStrategy ; }
1475 
1476  // main instructions
1477  if (sameCluster)
1478  {
1479  LogDebug("GsfElectronAlgo")
1480  << "Discarding electron with E/P " << (*e2)->eSuperClusterOverP()
1481  << ", cluster " << scRef2.get()
1482  << " and track " << (*e2)->gsfTrack().get() ;
1483  (*e1)->addAmbiguousGsfTrack((*e2)->gsfTrack()) ;
1484  (*e2)->setAmbiguous(true) ;
1485  }
1486  else if ((*e1)->gsfTrack()==(*e2)->gsfTrack())
1487  {
1488  edm::LogWarning("GsfElectronAlgo")
1489  << "Forgetting electron with E/P " << (*e2)->eSuperClusterOverP()
1490  << ", cluster " << scRef2.get()
1491  << " and track " << (*e2)->gsfTrack().get() ;
1492  (*e2)->setAmbiguous(true) ;
1493  }
1494  }
1495  }
1496  }
1497  }
#define LogDebug(id)
bool isPreselected(reco::GsfElectron *ele)
GeneralData * generalData_
bool isBetter(const reco::GsfElectron *, const reco::GsfElectron *)
EventSetupData * eventSetupData_
edm::Handle< EcalRecHitCollection > endcapRecHits
T eta() const
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
const reco::BeamSpot * beamspot
GsfElectronPtrCollection * electrons
Float e1
Definition: deltaR.h:22
T const * product() const
Definition: Handle.h:74
Float e2
Definition: deltaR.h:23
const Point & position() const
position
Definition: BeamSpot.h:63
EventData * eventData_
edm::ESHandle< TrackerGeometry > trackerHandle
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracks
void GsfElectronAlgo::setCutBasedPreselectionFlag ( reco::GsfElectron ele,
const reco::BeamSpot bs 
)
private

Definition at line 1002 of file GsfElectronAlgo.cc.

References abs, edm::RefToBase< T >::castTo(), reco::GsfElectron::core(), GsfElectronAlgo::GeneralData::cutsCfg, GsfElectronAlgo::GeneralData::cutsCfgPflow, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), EcalBarrel, EcalEndcap, reco::GsfElectron::eSuperClusterOverP(), eta(), edm::hlt::Exception, funct::false, generalData_, reco::GsfElectron::gsfTrack(), reco::GsfElectron::hcalDepth1OverEcal(), reco::GsfElectron::hcalDepth2OverEcal(), reco::GsfElectron::hcalOverEcal(), reco::CaloCluster::hitsAndFractions(), GsfElectronAlgo::CutsConfiguration::isBarrel, reco::GsfElectron::isEB(), reco::GsfElectron::isEBEEGap(), reco::GsfElectron::isEBEtaGap(), reco::GsfElectron::isEBPhiGap(), reco::GsfElectron::isEE(), reco::GsfElectron::isEEDeeGap(), reco::GsfElectron::isEERingGap(), GsfElectronAlgo::CutsConfiguration::isEndcaps, GsfElectronAlgo::CutsConfiguration::isFiducial, edm::Ref< C, T, F >::isNull(), LogTrace, GsfElectronAlgo::CutsConfiguration::maxDeltaEtaBarrel, GsfElectronAlgo::CutsConfiguration::maxDeltaEtaEndcaps, GsfElectronAlgo::CutsConfiguration::maxDeltaPhiBarrel, GsfElectronAlgo::CutsConfiguration::maxDeltaPhiEndcaps, GsfElectronAlgo::CutsConfiguration::maxEOverPBarrel, GsfElectronAlgo::CutsConfiguration::maxEOverPEndcaps, GsfElectronAlgo::CutsConfiguration::maxHOverEBarrel, GsfElectronAlgo::CutsConfiguration::maxHOverEEndcaps, GsfElectronAlgo::CutsConfiguration::maxSigmaIetaIetaBarrel, GsfElectronAlgo::CutsConfiguration::maxSigmaIetaIetaEndcaps, GsfElectronAlgo::CutsConfiguration::maxTIP, GsfElectronAlgo::CutsConfiguration::minEOverPBarrel, GsfElectronAlgo::CutsConfiguration::minEOverPEndcaps, GsfElectronAlgo::CutsConfiguration::minSCEtBarrel, GsfElectronAlgo::CutsConfiguration::minSCEtEndcaps, reco::BeamSpot::position(), hitfit::return, GsfElectronAlgo::CutsConfiguration::seedFromTEC, reco::GsfElectron::setPassCutBasedPreselection(), reco::GsfElectron::sigmaIetaIeta(), and reco::GsfElectron::superCluster().

Referenced by createElectron().

1003  {
1004  // default value
1005  ele->setPassCutBasedPreselection(false) ;
1006 
1007  // kind of seeding
1008  bool eg = ele->core()->ecalDrivenSeed() ;
1009  bool pf = ele->core()->trackerDrivenSeed() && !ele->core()->ecalDrivenSeed() ;
1010  if (eg&&pf) { throw cms::Exception("GsfElectronAlgo|BothEcalAndPureTrackerDriven")<<"An electron cannot be both egamma and purely pflow" ; }
1011  if ((!eg)&&(!pf)) { throw cms::Exception("GsfElectronAlgo|NeitherEcalNorPureTrackerDriven")<<"An electron cannot be neither egamma nor purely pflow" ; }
1012  const CutsConfiguration * cfg = (eg?&generalData_->cutsCfg:&generalData_->cutsCfgPflow) ;
1013 
1014  // Et cut
1015  double etaValue = EleRelPoint(ele->superCluster()->position(),bs.position()).eta() ;
1016  double etValue = ele->superCluster()->energy()/cosh(etaValue) ;
1017  LogTrace("GsfElectronAlgo") << "Et : " << etValue ;
1018  if (ele->isEB() && (etValue < cfg->minSCEtBarrel)) return ;
1019  if (ele->isEE() && (etValue < cfg->minSCEtEndcaps)) return ;
1020  LogTrace("GsfElectronAlgo") << "Et criteria are satisfied";
1021 
1022  // E/p cut
1023  double eopValue = ele->eSuperClusterOverP() ;
1024  LogTrace("GsfElectronAlgo") << "E/p : " << eopValue ;
1025  if (ele->isEB() && (eopValue > cfg->maxEOverPBarrel)) return ;
1026  if (ele->isEE() && (eopValue > cfg->maxEOverPEndcaps)) return ;
1027  if (ele->isEB() && (eopValue < cfg->minEOverPBarrel)) return ;
1028  if (ele->isEE() && (eopValue < cfg->minEOverPEndcaps)) return ;
1029  LogTrace("GsfElectronAlgo") << "E/p criteria are satisfied";
1030 
1031  // HoE cuts
1032  LogTrace("GsfElectronAlgo") << "HoE1 : " << ele->hcalDepth1OverEcal() << ", HoE2 : " << ele->hcalDepth2OverEcal();
1033  double had = ele->hcalOverEcal()*ele->superCluster()->energy() ;
1034  const reco::CaloCluster & seedCluster = *(ele->superCluster()->seed()) ;
1035  int detector = seedCluster.hitsAndFractions()[0].first.subdetId() ;
1036  bool HoEveto = false ;
1037  if (detector==EcalBarrel && (had<cfg->maxHBarrel || (had/ele->superCluster()->energy())<cfg->maxHOverEBarrel)) HoEveto=true;
1038  else if (detector==EcalEndcap && (had<cfg->maxHEndcaps || (had/ele->superCluster()->energy())<cfg->maxHOverEEndcaps)) HoEveto=true;
1039  if ( !HoEveto ) return ;
1040  LogTrace("GsfElectronAlgo") << "H/E criteria are satisfied";
1041 
1042  // delta eta criteria
1043  double deta = ele->deltaEtaSuperClusterTrackAtVtx() ;
1044  LogTrace("GsfElectronAlgo") << "delta eta : " << deta ;
1045  if (ele->isEB() && (std::abs(deta) > cfg->maxDeltaEtaBarrel)) return ;
1046  if (ele->isEE() && (std::abs(deta) > cfg->maxDeltaEtaEndcaps)) return ;
1047  LogTrace("GsfElectronAlgo") << "Delta eta criteria are satisfied";
1048 
1049  // delta phi criteria
1050  double dphi = ele->deltaPhiSuperClusterTrackAtVtx();
1051  LogTrace("GsfElectronAlgo") << "delta phi : " << dphi;
1052  if (ele->isEB() && (std::abs(dphi) > cfg->maxDeltaPhiBarrel)) return ;
1053  if (ele->isEE() && (std::abs(dphi) > cfg->maxDeltaPhiEndcaps)) return ;
1054  LogTrace("GsfElectronAlgo") << "Delta phi criteria are satisfied";
1055 
1056  // sigma ieta ieta
1057  LogTrace("GsfElectronAlgo") << "sigma ieta ieta : " << ele->sigmaIetaIeta();
1058  if (ele->isEB() && (ele->sigmaIetaIeta() > cfg->maxSigmaIetaIetaBarrel)) return ;
1059  if (ele->isEE() && (ele->sigmaIetaIeta() > cfg->maxSigmaIetaIetaEndcaps)) return ;
1060  LogTrace("GsfElectronAlgo") << "Sigma ieta ieta criteria are satisfied";
1061 
1062  // fiducial
1063  if (!ele->isEB() && cfg->isBarrel) return ;
1064  if (!ele->isEE() && cfg->isEndcaps) return ;
1065  if (cfg->isFiducial && (ele->isEBEEGap()||ele->isEBEtaGap()||ele->isEBPhiGap()||ele->isEERingGap()||ele->isEEDeeGap())) return ;
1066  LogTrace("GsfElectronAlgo") << "Fiducial flags criteria are satisfied";
1067 
1068  // seed in TEC
1069  edm::RefToBase<TrajectorySeed> seed = ele->gsfTrack()->extra()->seedRef() ;
1070  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>() ;
1071  if (eg && !generalData_->cutsCfg.seedFromTEC)
1072  {
1073  if (elseed.isNull())
1074  { throw cms::Exception("GsfElectronAlgo|NotElectronSeed")<<"The GsfTrack seed is not an ElectronSeed ?!" ; }
1075  else
1076  { if (elseed->subDet2()==6) return ; }
1077  }
1078 
1079  // transverse impact parameter
1080  if (std::abs(ele->gsfTrack()->dxy(bs.position()))>cfg->maxTIP) return ;
1081  LogTrace("GsfElectronAlgo") << "TIP criterion is satisfied" ;
1082 
1083  LogTrace("GsfElectronAlgo") << "All cut based criteria are satisfied" ;
1084  ele->setPassCutBasedPreselection(true) ;
1085  }
GeneralData * generalData_
const CutsConfiguration cutsCfgPflow
void setPassCutBasedPreselection(bool flag)
Definition: GsfElectron.h:593
bool isEBEtaGap() const
Definition: GsfElectron.h:335
float eSuperClusterOverP() const
Definition: GsfElectron.h:229
bool isEBEEGap() const
Definition: GsfElectron.h:333
float hcalDepth2OverEcal() const
Definition: GsfElectron.h:389
#define abs(x)
Definition: mlp_lapack.h:159
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
bool isEERingGap() const
Definition: GsfElectron.h:339
T eta() const
bool isEEDeeGap() const
Definition: GsfElectron.h:338
bool isEE() const
Definition: GsfElectron.h:331
bool isEB() const
Definition: GsfElectron.h:330
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:233
bool isNull() const
Checks for null.
Definition: Ref.h:247
float sigmaIetaIeta() const
Definition: GsfElectron.h:382
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:236
float hcalOverEcal() const
Definition: GsfElectron.h:390
const CutsConfiguration cutsCfg
#define LogTrace(id)
float hcalDepth1OverEcal() const
Definition: GsfElectron.h:388
REF castTo() const
cast to a concrete type
Definition: RefToBase.h:241
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
bool isEBPhiGap() const
Definition: GsfElectron.h:336
const Point & position() const
position
Definition: BeamSpot.h:63
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
void GsfElectronAlgo::setPflowPreselectionFlag ( reco::GsfElectron ele)
private

Definition at line 1087 of file GsfElectronAlgo.cc.

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

Referenced by addPflowInfo().

1088  {
1089  ele->setPassMvaPreselection(false) ;
1090 
1091  if (ele->core()->ecalDrivenSeed())
1092  { if (ele->mvaOutput().mva>=generalData_->cutsCfg.minMVA) ele->setPassMvaPreselection(true) ; }
1093  else
1094  { if (ele->mvaOutput().mva>=generalData_->cutsCfgPflow.minMVA) ele->setPassMvaPreselection(true) ; }
1095 
1096  if (ele->passingMvaPreselection())
1097  { LogTrace("GsfElectronAlgo") << "Main mva criterion is satisfied" ; }
1098 
1100 
1101 // ele->setPassPflowPreselection(false) ;
1102 // if (ele->core()->ecalDrivenSeed())
1103 // {
1104 // if ((ele->mvaOutput().mva>=generalData_->cutsCfg.minMVA) ||
1105 // (ele->mvaOutput().mvaByPassForIsolated>=generalData_->cutsCfg.minMvaByPassForIsolated))
1106 // ele->setPassPflowPreselection(true) ;
1107 // }
1108 // else
1109 // {
1110 // if ((ele->mvaOutput().mva>=generalData_->cutsCfgPflow.minMVA) ||
1111 // (ele->mvaOutput().mvaByPassForIsolated>=generalData_->cutsCfgPflow.minMvaByPassForIsolated))
1112 // ele->setPassPflowPreselection(true) ;
1113 // }
1114 // if (ele->passingPflowPreselection())
1115 // { LogTrace("GsfElectronAlgo") << "Mva criteria are satisfied" ; }
1116  }
GeneralData * generalData_
const CutsConfiguration cutsCfgPflow
bool passingMvaPreselection() const
Definition: GsfElectron.h:601
void setPassMvaPreselection(bool flag)
Definition: GsfElectron.h:600
const CutsConfiguration cutsCfg
#define LogTrace(id)
const MvaOutput & mvaOutput() const
Definition: GsfElectron.h:558
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
void setPassPflowPreselection(bool flag)
Definition: GsfElectron.h:594

Member Data Documentation

ElectronData* GsfElectronAlgo::electronData_
private

Definition at line 223 of file GsfElectronAlgo.h.

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

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