Analysis-level electron class. More...
#include <DataFormats/PatCandidates/interface/Electron.h>
Public Types | |
typedef std::pair< std::string, float > | IdPair |
Public Member Functions | |
float | caloIso () const |
virtual Electron * | clone () const |
required reimplementation of the Candidate's clone method | |
virtual reco::GsfElectronCoreRef | core () const |
override the virtual reco::GsfElectron::core method, so that the embedded core can be used by GsfElectron client methods | |
double | dB () const |
const LorentzVector & | ecalDrivenMomentum () const |
float | ecalIso () const |
double | edB () const |
Electron (const edm::Ptr< reco::GsfElectron > &anElectronRef) | |
constructor from a Ptr to a reco electron | |
Electron (const reco::GsfElectron &anElectron) | |
constructor from a reco electron | |
Electron (const edm::RefToBase< reco::GsfElectron > &anElectronRef) | |
constructor from a RefToBase to a reco electron (to be superseded by Ptr counterpart) | |
Electron () | |
default constructor | |
float | electronID (const std::string &name) const |
const std::vector< IdPair > & | electronIDs () const |
void | embedGsfElectronCore () |
method to store the electron's core internally | |
void | embedGsfTrack () |
method to store the electron's GsfTrack internally | |
void | embedPFCandidate () |
embed the PFCandidate pointed to by pfCandidateRef_ | |
void | embedSuperCluster () |
method to store the electron's SuperCluster internally | |
void | embedTrack () |
method to store the electron's Track internally | |
reco::GsfTrackRef | gsfTrack () const |
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster | |
float | hcalIso () const |
bool | isElectronIDAvailable (const std::string &name) const |
Returns true if a specific ID is available in this pat::Electron. | |
size_t | numberOfSourceCandidatePtrs () const |
reco::PFCandidateRef | pfCandidateRef () const |
reference to the source PFCandidates | |
void | setDB (double dB, double edB) |
void | setEcalDrivenMomentum (const Candidate::LorentzVector &mom) |
void | setElectronIDs (const std::vector< IdPair > &ids) |
void | setPFCandidateRef (const reco::PFCandidateRef &ref) |
add a reference to the source IsolatedPFCandidate | |
reco::CandidatePtr | sourceCandidatePtr (size_type i) const |
get the candidate pointer with index i | |
reco::SuperClusterRef | superCluster () const |
override the reco::GsfElectron::superCluster method, to access the internal storage of the supercluster | |
reco::TrackRef | track () const |
override the reco::GsfElectron::track method, to access the internal storage of the track | |
float | trackIso () const |
virtual | ~Electron () |
destructor | |
Protected Attributes | |
bool | cachedDB_ |
double | dB_ |
LorentzVector | ecalDrivenMomentum_ |
ECAL-driven momentum. | |
double | edB_ |
std::vector< IdPair > | electronIDs_ |
bool | embeddedGsfElectronCore_ |
bool | embeddedGsfTrack_ |
bool | embeddedPFCandidate_ |
true if the IsolatedPFCandidate is embedded | |
bool | embeddedSuperCluster_ |
bool | embeddedTrack_ |
std::vector < reco::GsfElectronCore > | gsfElectronCore_ |
std::vector< reco::GsfTrack > | gsfTrack_ |
reco::PFCandidateCollection | pfCandidate_ |
reco::PFCandidateRef | pfCandidateRef_ |
std::vector< reco::SuperCluster > | superCluster_ |
std::vector< reco::Track > | track_ |
Analysis-level electron class.
pat::Electron implements the analysis-level electron class within the 'pat' namespace.
Please post comments and questions to the Physics Tools hypernews: https://hypernews.cern.ch/HyperNews/CMS/get/physTools.html
Definition at line 46 of file Electron.h.
typedef std::pair<std::string,float> pat::Electron::IdPair |
Definition at line 50 of file Electron.h.
Electron::Electron | ( | ) |
default constructor
Definition at line 13 of file Electron.cc.
Referenced by clone().
: Lepton<reco::GsfElectron>(), embeddedGsfElectronCore_(false), embeddedGsfTrack_(false), embeddedSuperCluster_(false), embeddedTrack_(false), embeddedPFCandidate_(false), ecalDrivenMomentum_(Candidate::LorentzVector(0.,0.,0.,0.)), cachedDB_(false), dB_(0.0), edB_(0.0) { }
Electron::Electron | ( | const reco::GsfElectron & | anElectron | ) |
constructor from a reco electron
constructor from reco::GsfElectron
Definition at line 30 of file Electron.cc.
: Lepton<reco::GsfElectron>(anElectron), embeddedGsfElectronCore_(false), embeddedGsfTrack_(false), embeddedSuperCluster_(false), embeddedTrack_(false), embeddedPFCandidate_(false), ecalDrivenMomentum_(anElectron.p4()), cachedDB_(false), dB_(0.0), edB_(0.0) { }
Electron::Electron | ( | const edm::RefToBase< reco::GsfElectron > & | anElectronRef | ) |
constructor from a RefToBase to a reco electron (to be superseded by Ptr counterpart)
constructor from ref to reco::GsfElectron
Definition at line 46 of file Electron.cc.
: Lepton<reco::GsfElectron>(anElectronRef), embeddedGsfElectronCore_(false), embeddedGsfTrack_(false), embeddedSuperCluster_(false), embeddedTrack_(false), embeddedPFCandidate_(false), ecalDrivenMomentum_(anElectronRef->p4()), cachedDB_(false), dB_(0.0), edB_(0.0) { }
Electron::Electron | ( | const edm::Ptr< reco::GsfElectron > & | anElectronRef | ) |
constructor from a Ptr to a reco electron
constructor from Ptr to reco::GsfElectron
Definition at line 61 of file Electron.cc.
: Lepton<reco::GsfElectron>(anElectronRef), embeddedGsfElectronCore_(false), embeddedGsfTrack_(false), embeddedSuperCluster_(false), embeddedTrack_(false), embeddedPFCandidate_(false), ecalDrivenMomentum_(anElectronRef->p4()), cachedDB_(false), dB_(0.0), edB_(0.0) { }
Electron::~Electron | ( | ) | [virtual] |
float pat::Electron::caloIso | ( | ) | const [inline] |
Overload of pat::Lepton::trackIso(); returns the sum of ecalIso() and hcalIso
Reimplemented from pat::Lepton< reco::GsfElectron >.
Definition at line 124 of file Electron.h.
virtual Electron* pat::Electron::clone | ( | void | ) | const [inline, virtual] |
required reimplementation of the Candidate's clone method
Reimplemented from pat::Lepton< reco::GsfElectron >.
Definition at line 64 of file Electron.h.
References Electron().
{ return new Electron(*this); }
reco::GsfElectronCoreRef Electron::core | ( | ) | const [virtual] |
override the virtual reco::GsfElectron::core method, so that the embedded core can be used by GsfElectron client methods
Reimplemented from reco::GsfElectron.
Definition at line 91 of file Electron.cc.
References embeddedGsfElectronCore_, and gsfElectronCore_.
{ if (embeddedGsfElectronCore_) { return reco::GsfElectronCoreRef(&gsfElectronCore_, 0); } else { return reco::GsfElectron::core(); } }
double Electron::dB | ( | ) | const |
dB gives the impact parameter wrt the beamline. If this is not cached it is not meaningful, since it relies on the distance to the beamline.
Definition at line 211 of file Electron.cc.
References cachedDB_, dB_, and max().
Referenced by ElectronVPlusJetsIDSelectionFunctor::firstDataCuts(), and setDB().
{ if ( cachedDB_ ) { return dB_; } else { return std::numeric_limits<double>::max(); } }
const LorentzVector& pat::Electron::ecalDrivenMomentum | ( | ) | const [inline] |
Definition at line 151 of file Electron.h.
References ecalDrivenMomentum_.
{return ecalDrivenMomentum_;}
float pat::Electron::ecalIso | ( | ) | const [inline] |
Overload of pat::Lepton::trackIso(); returns the value of the summed Et of all recHits in the ecal in a cone of deltaR<0.4
Reimplemented from pat::Lepton< reco::GsfElectron >.
Definition at line 117 of file Electron.h.
References reco::GsfElectron::dr04EcalRecHitSumEt().
Referenced by caloIso().
{ return dr04EcalRecHitSumEt(); }
double Electron::edB | ( | ) | const |
edB gives the uncertainty on the impact parameter wrt the beamline. If this is not cached it is not meaningful, since it relies on the distance to the beamline.
Definition at line 222 of file Electron.cc.
References cachedDB_, edB_, and max().
Referenced by ElectronVPlusJetsIDSelectionFunctor::firstDataCuts(), and setDB().
{ if ( cachedDB_ ) { return edB_; } else { return std::numeric_limits<double>::max(); } }
float Electron::electronID | ( | const std::string & | name | ) | const |
Returns a specific electron ID associated to the pat::Electron given its name For cut-based IDs, the value map has the following meaning: 0: fails 1: passes electron ID only 2: passes electron Isolation only 3: passes electron ID and Isolation only 4: passes conversion rejection 5: passes conversion rejection and ID 6: passes conversion rejection and Isolation 7: passes the whole selection For more details have a look at: https://twiki.cern.ch/twiki/bin/view/CMS/SimpleCutBasedEleID https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCategoryBasedElectronID Note: an exception is thrown if the specified ID is not available
Definition at line 158 of file Electron.cc.
References electronIDs_.
{ for (std::vector<IdPair>::const_iterator it = electronIDs_.begin(), ed = electronIDs_.end(); it != ed; ++it) { if (it->first == name) return it->second; } cms::Exception ex("Key not found"); ex << "pat::Electron: the ID " << name << " can't be found in this pat::Electron.\n"; ex << "The available IDs are: "; for (std::vector<IdPair>::const_iterator it = electronIDs_.begin(), ed = electronIDs_.end(); it != ed; ++it) { ex << "'" << it->first << "' "; } ex << ".\n"; throw ex; }
const std::vector<IdPair>& pat::Electron::electronIDs | ( | ) | const [inline] |
Returns all the electron IDs in the form of <name,value> pairs The 'default' ID is the first in the list
Definition at line 105 of file Electron.h.
References electronIDs_.
{ return electronIDs_; }
void Electron::embedGsfElectronCore | ( | ) |
method to store the electron's core internally
method to store the electron's gsfElectronCore internally
Definition at line 120 of file Electron.cc.
References reco::GsfElectron::core(), embeddedGsfElectronCore_, and gsfElectronCore_.
Referenced by pat::PATElectronProducer::fillElectron(), and pat::PATElectronProducer::fillElectron2().
{ gsfElectronCore_.clear(); if (reco::GsfElectron::core().isNonnull()) { gsfElectronCore_.push_back(*reco::GsfElectron::core()); embeddedGsfElectronCore_ = true; } }
void Electron::embedGsfTrack | ( | ) |
method to store the electron's GsfTrack internally
method to store the electron's gsfTrack internally
Definition at line 129 of file Electron.cc.
References embeddedGsfTrack_, reco::GsfElectron::gsfTrack(), and gsfTrack_.
Referenced by pat::PATElectronProducer::fillElectron(), and pat::PATElectronProducer::fillElectron2().
{ gsfTrack_.clear(); if (reco::GsfElectron::gsfTrack().isNonnull()) { gsfTrack_.push_back(*reco::GsfElectron::gsfTrack()); embeddedGsfTrack_ = true; } }
void Electron::embedPFCandidate | ( | ) |
embed the PFCandidate pointed to by pfCandidateRef_
embed the IsolatedPFCandidate pointed to by pfCandidateRef_
Definition at line 189 of file Electron.cc.
References embeddedPFCandidate_, edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), pfCandidate_, and pfCandidateRef_.
Referenced by pat::PATElectronProducer::produce().
{ pfCandidate_.clear(); if ( pfCandidateRef_.isAvailable() && pfCandidateRef_.isNonnull()) { pfCandidate_.push_back( *pfCandidateRef_ ); embeddedPFCandidate_ = true; } }
void Electron::embedSuperCluster | ( | ) |
method to store the electron's SuperCluster internally
method to store the electron's supercluster internally
Definition at line 139 of file Electron.cc.
References embeddedSuperCluster_, reco::GsfElectron::superCluster(), and superCluster_.
Referenced by pat::PATElectronProducer::fillElectron(), and pat::PATElectronProducer::fillElectron2().
{ superCluster_.clear(); if (reco::GsfElectron::superCluster().isNonnull()) { superCluster_.push_back(*reco::GsfElectron::superCluster()); embeddedSuperCluster_ = true; } }
void Electron::embedTrack | ( | ) |
method to store the electron's Track internally
method to store the electron's track internally
Definition at line 149 of file Electron.cc.
References embeddedTrack_, reco::RecoCandidate::track(), and track_.
Referenced by pat::PATElectronProducer::fillElectron(), and pat::PATElectronProducer::fillElectron2().
{ track_.clear(); if (reco::GsfElectron::track().isNonnull()) { track_.push_back(*reco::GsfElectron::track()); embeddedTrack_ = true; } }
reco::GsfTrackRef Electron::gsfTrack | ( | ) | const [virtual] |
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster
Reimplemented from reco::GsfElectron.
Definition at line 82 of file Electron.cc.
References embeddedGsfTrack_, and gsfTrack_.
Referenced by pat::CaloIsolationEnergy::calculate(), pat::LeptonVertexSignificance::calculate(), pat::TrackerIsolationPt::calculate(), and SimpleCutBasedElectronIDSelectionFunctor::spring10Variables().
{ if (embeddedGsfTrack_) { return reco::GsfTrackRef(&gsfTrack_, 0); } else { return reco::GsfElectron::gsfTrack(); } }
float pat::Electron::hcalIso | ( | ) | const [inline] |
Overload of pat::Lepton::trackIso(); returns the value of the summed Et of all caloTowers in the hcal in a cone of deltaR<0.4
Reimplemented from pat::Lepton< reco::GsfElectron >.
Definition at line 121 of file Electron.h.
References reco::GsfElectron::dr04HcalTowerSumEt().
Referenced by caloIso().
{ return dr04HcalTowerSumEt(); }
bool Electron::isElectronIDAvailable | ( | const std::string & | name | ) | const |
Returns true if a specific ID is available in this pat::Electron.
Definition at line 172 of file Electron.cc.
References electronIDs_.
{ for (std::vector<IdPair>::const_iterator it = electronIDs_.begin(), ed = electronIDs_.end(); it != ed; ++it) { if (it->first == name) return true; } return false; }
size_t pat::Electron::numberOfSourceCandidatePtrs | ( | ) | const [inline, virtual] |
return the number of source Candidates ( the candidates used to construct this Candidate)
Reimplemented from reco::LeafCandidate.
Definition at line 137 of file Electron.h.
References edm::Ref< C, T, F >::isNonnull(), and pfCandidateRef_.
{ return pfCandidateRef_.isNonnull() ? 1 : 0; }
reco::PFCandidateRef Electron::pfCandidateRef | ( | ) | const |
reference to the source PFCandidates
reference to the source PFCandidates null if this has been built from a standard electron
Definition at line 181 of file Electron.cc.
References embeddedPFCandidate_, pfCandidate_, and pfCandidateRef_.
Referenced by pat::PATElectronProducer::fillElectron(), and pat::PATElectronProducer::fillElectron2().
{ if (embeddedPFCandidate_) { return reco::PFCandidateRef(&pfCandidate_, 0); } else { return pfCandidateRef_; } }
void pat::Electron::setDB | ( | double | dB, |
double | edB | ||
) | [inline] |
void pat::Electron::setEcalDrivenMomentum | ( | const Candidate::LorentzVector & | mom | ) | [inline] |
Definition at line 152 of file Electron.h.
References ecalDrivenMomentum_.
Referenced by pat::PATElectronProducer::fillElectron2().
{ecalDrivenMomentum_=mom;}
void pat::Electron::setElectronIDs | ( | const std::vector< IdPair > & | ids | ) | [inline] |
Store multiple electron ID values, discarding existing ones The first one in the list becomes the 'default' electron id
Definition at line 108 of file Electron.h.
References electronIDs_.
Referenced by pat::PATElectronProducer::produce().
{ electronIDs_ = ids; }
void pat::Electron::setPFCandidateRef | ( | const reco::PFCandidateRef & | ref | ) | [inline] |
add a reference to the source IsolatedPFCandidate
Definition at line 131 of file Electron.h.
References pfCandidateRef_.
Referenced by pat::PATElectronProducer::produce().
{ pfCandidateRef_ = ref; }
reco::CandidatePtr Electron::sourceCandidatePtr | ( | size_type | i | ) | const [virtual] |
get the candidate pointer with index i
reference to the parent PF candidate for use in TopProjector
Reimplemented from reco::LeafCandidate.
Definition at line 198 of file Electron.cc.
References embeddedPFCandidate_, edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), and pfCandidateRef_.
{ if (embeddedPFCandidate_) { return reco::CandidatePtr( pfCandidateRef_.id(), pfCandidateRef_.get(), pfCandidateRef_.key() ); } else { return reco::CandidatePtr(); } }
reco::SuperClusterRef Electron::superCluster | ( | ) | const [virtual] |
override the reco::GsfElectron::superCluster method, to access the internal storage of the supercluster
Reimplemented from reco::GsfElectron.
Definition at line 101 of file Electron.cc.
References embeddedSuperCluster_, and superCluster_.
Referenced by ZeePlots::CheckCut(), WenuPlots::CheckCut(), ZeePlots::CheckCut2(), ZeePlots::CheckCut2Inv(), ZeePlots::CheckCutInv(), and WenuPlots::CheckCutInv().
{ if (embeddedSuperCluster_) { return reco::SuperClusterRef(&superCluster_, 0); } else { return reco::GsfElectron::superCluster(); } }
reco::TrackRef Electron::track | ( | void | ) | const [virtual] |
override the reco::GsfElectron::track method, to access the internal storage of the track
Reimplemented from reco::RecoCandidate.
Definition at line 111 of file Electron.cc.
References embeddedTrack_, and track_.
{ if (embeddedTrack_) { return reco::TrackRef(&track_, 0); } else { return reco::GsfElectron::track(); } }
float pat::Electron::trackIso | ( | ) | const [inline] |
Overload of pat::Lepton::trackIso(); returns the value of the summed track pt in a cone of deltaR<0.4
Reimplemented from pat::Lepton< reco::GsfElectron >.
Definition at line 113 of file Electron.h.
References reco::GsfElectron::dr04TkSumPt().
{ return dr04TkSumPt(); }
bool pat::Electron::cachedDB_ [protected] |
Definition at line 184 of file Electron.h.
double pat::Electron::dB_ [protected] |
Definition at line 185 of file Electron.h.
LorentzVector pat::Electron::ecalDrivenMomentum_ [protected] |
ECAL-driven momentum.
Definition at line 181 of file Electron.h.
Referenced by ecalDrivenMomentum(), and setEcalDrivenMomentum().
double pat::Electron::edB_ [protected] |
Definition at line 186 of file Electron.h.
std::vector<IdPair> pat::Electron::electronIDs_ [protected] |
Definition at line 167 of file Electron.h.
Referenced by electronID(), electronIDs(), isElectronIDAvailable(), and setElectronIDs().
bool pat::Electron::embeddedGsfElectronCore_ [protected] |
Definition at line 157 of file Electron.h.
Referenced by core(), and embedGsfElectronCore().
bool pat::Electron::embeddedGsfTrack_ [protected] |
Definition at line 159 of file Electron.h.
Referenced by embedGsfTrack(), and gsfTrack().
bool pat::Electron::embeddedPFCandidate_ [protected] |
true if the IsolatedPFCandidate is embedded
Definition at line 171 of file Electron.h.
Referenced by embedPFCandidate(), pfCandidateRef(), and sourceCandidatePtr().
bool pat::Electron::embeddedSuperCluster_ [protected] |
Definition at line 161 of file Electron.h.
Referenced by embedSuperCluster(), and superCluster().
bool pat::Electron::embeddedTrack_ [protected] |
Definition at line 163 of file Electron.h.
Referenced by embedTrack(), and track().
std::vector<reco::GsfElectronCore> pat::Electron::gsfElectronCore_ [protected] |
Definition at line 158 of file Electron.h.
Referenced by core(), and embedGsfElectronCore().
std::vector<reco::GsfTrack> pat::Electron::gsfTrack_ [protected] |
Definition at line 160 of file Electron.h.
Referenced by embedGsfTrack(), and gsfTrack().
if embeddedPFCandidate_, a copy of the source IsolatedPFCandidate is stored in this vector
Definition at line 174 of file Electron.h.
Referenced by embedPFCandidate(), and pfCandidateRef().
reco::PFCandidateRef pat::Electron::pfCandidateRef_ [protected] |
reference to the IsolatedPFCandidate this has been built from null if this has been built from a standard electron
Definition at line 177 of file Electron.h.
Referenced by embedPFCandidate(), numberOfSourceCandidatePtrs(), pfCandidateRef(), setPFCandidateRef(), and sourceCandidatePtr().
std::vector<reco::SuperCluster> pat::Electron::superCluster_ [protected] |
Definition at line 162 of file Electron.h.
Referenced by embedSuperCluster(), and superCluster().
std::vector<reco::Track> pat::Electron::track_ [protected] |
Definition at line 164 of file Electron.h.
Referenced by embedTrack(), and track().