CMS 3D CMS Logo

pat::Electron Class Reference

Analysis-level electron class. More...

#include <DataFormats/PatCandidates/interface/Electron.h>

Inheritance diagram for pat::Electron:

pat::Lepton< LeptonType > pat::PATObject< LeptonType > LeptonType

List of all members.

Public Types

typedef std::pair< std::string,
float > 
IdPair

Public Member Functions

virtual Electronclone () const
 required reimplementation of the Candidate's clone method
 Electron (const edm::Ptr< ElectronType > &anElectronRef)
 constructor from a Ptr to a reco electron
 Electron (const edm::RefToBase< ElectronType > &anElectronRef)
 constructor from a RefToBase to a reco electron (to be superseded by Ptr counterpart)
 Electron (const ElectronType &anElectron)
 constructor from a reco electron
 Electron ()
 default constructor
float 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 is 1.0 for good, 0.0 for bad.
const std::vector< IdPair > & electronIDs () const
 Returns all the electron IDs in the form of <name,value> pairs The 'default' ID is the first in the list.
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 ElectronType::gsfTrack method, to access the internal storage of the supercluster
bool isElectronIDAvailable (const std::string &name) const
 Returns true if a specific ID is available in this pat::Electron.
bool isLeptonIDAvailable (const std::string &name) const
 deprecated !!!
float leptonID (const std::string &name) const
 deprecated !!!
const std::vector< IdPair > & leptonIDs () const
 deprecated !!!
reco::PFCandidateRef pfCandidateRef () const
 reference to the source PFCandidates null if this has been built from a standard electron
const float scE1x5 () const
const float scE2x5Max () const
const float scE5x5 () const
const float scSigmaEtaEta () const
const float scSigmaIEtaIEta () const
void setClusterShapes (const float &, const float &, const float &, const float &, const float &)
 Store the cluster shape variables associated to the electron.
void setElectronIDs (const std::vector< IdPair > &ids)
 Store multiple electron ID values, discarding existing ones The first one in the list becomes the 'default' electron id.
void setLeptonIDs (const std::vector< IdPair > &ids)
 deprecated !!!
void setPFCandidateRef (const reco::PFCandidateRef &ref)
 add a reference to the source IsolatedPFCandidate
reco::SuperClusterRef superCluster () const
 override the ElectronType::superCluster method, to access the internal storage of the supercluster
reco::TrackRef track () const
 override the ElectronType::track method, to access the internal storage of the track
virtual ~Electron ()
 destructor

Protected Attributes

std::vector< IdPairelectronIDs_
bool embeddedGsfTrack_
bool embeddedPFCandidate_
 true if the IsolatedPFCandidate is embedded
bool embeddedSuperCluster_
bool embeddedTrack_
std::vector< reco::GsfTrackgsfTrack_
reco::PFCandidateCollection pfCandidate_
 if embeddedPFCandidate_, a copy of the source IsolatedPFCandidate is stored in this vector
reco::PFCandidateRef pfCandidateRef_
 reference to the IsolatedPFCandidate this has been built from null if this has been built from a standard electron
float scE1x5_
float scE2x5Max_
float scE5x5_
float scSigmaEtaEta_
float scSigmaIEtaIEta_
std::vector< reco::SuperClustersuperCluster_
std::vector< reco::Tracktrack_


Detailed Description

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: httpss://hypernews.cern.ch/HyperNews/CMS/get/physTools.html

Author:
Steven Lowette, Giovanni Petrucciani, Frederic Ronga
Version:
Id
Electron.h,v 1.18.2.3 2009/02/06 15:31:48 pioppi Exp

Definition at line 46 of file Electron.h.


Member Typedef Documentation

typedef std::pair<std::string,float> pat::Electron::IdPair

Definition at line 50 of file Electron.h.


Constructor & Destructor Documentation

Electron::Electron (  ) 

default constructor

Definition at line 12 of file Electron.cc.

Referenced by clone().

00012                    :
00013     Lepton<ElectronType>(),
00014     embeddedGsfTrack_(false),
00015     embeddedSuperCluster_(false),
00016     embeddedTrack_(false),
00017     scSigmaEtaEta_(0),
00018     scSigmaIEtaIEta_(0), 
00019     scE1x5_(0),
00020     scE2x5Max_(0), 
00021     scE5x5_(0) 
00022 {
00023 }

Electron::Electron ( const ElectronType anElectron  ) 

constructor from a reco electron

constructor from ElectronType

Definition at line 27 of file Electron.cc.

00027                                                   :
00028     Lepton<ElectronType>(anElectron),
00029     embeddedGsfTrack_(false),
00030     embeddedSuperCluster_(false),
00031     embeddedTrack_(false),
00032     scSigmaEtaEta_(0),
00033     scSigmaIEtaIEta_(0), 
00034     scE1x5_(0),
00035     scE2x5Max_(0), 
00036     scE5x5_(0) 
00037 {
00038 }

Electron::Electron ( const edm::RefToBase< ElectronType > &  anElectronRef  ) 

constructor from a RefToBase to a reco electron (to be superseded by Ptr counterpart)

constructor from ref to ElectronType

Definition at line 42 of file Electron.cc.

00042                                                                    :
00043     Lepton<ElectronType>(anElectronRef),
00044     embeddedGsfTrack_(false),
00045     embeddedSuperCluster_(false),
00046     embeddedTrack_(false),
00047     scSigmaEtaEta_(0),
00048     scSigmaIEtaIEta_(0), 
00049     scE1x5_(0),
00050     scE2x5Max_(0), 
00051     scE5x5_(0) 
00052 {
00053 }

Electron::Electron ( const edm::Ptr< ElectronType > &  anElectronRef  ) 

constructor from a Ptr to a reco electron

constructor from ref to ElectronType

Definition at line 56 of file Electron.cc.

00056                                                              :
00057     Lepton<ElectronType>(anElectronRef),
00058     embeddedGsfTrack_(false),
00059     embeddedSuperCluster_(false),
00060     embeddedTrack_(false),
00061     scSigmaEtaEta_(0),
00062     scSigmaIEtaIEta_(0), 
00063     scE1x5_(0),
00064     scE2x5Max_(0), 
00065     scE5x5_(0) 
00066 {
00067 }

Electron::~Electron (  )  [virtual]

destructor

Definition at line 71 of file Electron.cc.

00071                     {
00072 }


Member Function Documentation

virtual Electron* pat::Electron::clone ( void   )  const [inline, virtual]

required reimplementation of the Candidate's clone method

Reimplemented from pat::Lepton< LeptonType >.

Definition at line 64 of file Electron.h.

References Electron().

00064 { return new Electron(*this); }

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 is 1.0 for good, 0.0 for bad.

Note: an exception is thrown if the specified ID is not available

Definition at line 134 of file Electron.cc.

References electronIDs_, and it.

Referenced by leptonID().

00134                                                        {
00135     for (std::vector<IdPair>::const_iterator it = electronIDs_.begin(), ed = electronIDs_.end(); it != ed; ++it) {
00136         if (it->first == name) return it->second;
00137     }
00138     cms::Exception ex("Key not found");
00139     ex << "pat::Electron: the ID " << name << " can't be found in this pat::Electron.\n";
00140     ex << "The available IDs are: ";
00141     for (std::vector<IdPair>::const_iterator it = electronIDs_.begin(), ed = electronIDs_.end(); it != ed; ++it) {
00142         ex << "'" << it->first << "' ";
00143     }
00144     ex << ".\n";
00145     throw ex;
00146 }

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 101 of file Electron.h.

References electronIDs_.

Referenced by leptonIDs().

00101 { return electronIDs_; }

void Electron::embedGsfTrack (  ) 

method to store the electron's GsfTrack internally

method to store the electron's gsfTrack internally

Definition at line 105 of file Electron.cc.

References embeddedGsfTrack_, reco::GsfElectron::gsfTrack(), and gsfTrack_.

Referenced by pat::PATElectronProducer::FillElectron().

00105                              {
00106   gsfTrack_.clear();
00107   if (ElectronType::gsfTrack().isNonnull()) {
00108       gsfTrack_.push_back(*ElectronType::gsfTrack());
00109       embeddedGsfTrack_ = true;
00110   }
00111 }

void Electron::embedPFCandidate (  ) 

embed the PFCandidate pointed to by pfCandidateRef_

embed the IsolatedPFCandidate pointed to by pfCandidateRef_

Definition at line 175 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().

00175                                 {
00176   pfCandidate_.clear();
00177   if ( pfCandidateRef_.isAvailable() && pfCandidateRef_.isNonnull()) {
00178     pfCandidate_.push_back( *pfCandidateRef_ );
00179     embeddedPFCandidate_ = true;
00180   }
00181 }

void Electron::embedSuperCluster (  ) 

method to store the electron's SuperCluster internally

method to store the electron's supercluster internally

Definition at line 115 of file Electron.cc.

References embeddedSuperCluster_, reco::GsfElectron::superCluster(), and superCluster_.

Referenced by pat::PATElectronProducer::FillElectron().

00115                                  {
00116   superCluster_.clear();
00117   if (ElectronType::superCluster().isNonnull()) {
00118       superCluster_.push_back(*ElectronType::superCluster());
00119       embeddedSuperCluster_ = true;
00120   }
00121 }

void Electron::embedTrack (  ) 

method to store the electron's Track internally

method to store the electron's track internally

Definition at line 125 of file Electron.cc.

References embeddedTrack_, reco::GsfElectron::track(), and track_.

Referenced by pat::PATElectronProducer::FillElectron().

00125                           {
00126   track_.clear();
00127   if (ElectronType::track().isNonnull()) {
00128       track_.push_back(*ElectronType::track());
00129       embeddedTrack_ = true;
00130   }
00131 }

reco::GsfTrackRef Electron::gsfTrack (  )  const

override the ElectronType::gsfTrack method, to access the internal storage of the supercluster

Definition at line 76 of file Electron.cc.

References embeddedGsfTrack_, reco::GsfElectron::gsfTrack(), and gsfTrack_.

Referenced by pat::CaloIsolationEnergy::calculate(), pat::LeptonVertexSignificance::calculate(), pat::TrackerIsolationPt::calculate(), and pat::HistoElectron::fill().

00076                                          {
00077   if (embeddedGsfTrack_) {
00078     return reco::GsfTrackRef(&gsfTrack_, 0);
00079   } else {
00080     return ElectronType::gsfTrack();
00081   }
00082 }

bool Electron::isElectronIDAvailable ( const std::string &  name  )  const

Returns true if a specific ID is available in this pat::Electron.

Definition at line 148 of file Electron.cc.

References electronIDs_, and it.

Referenced by isLeptonIDAvailable().

00148                                                                  {
00149     for (std::vector<IdPair>::const_iterator it = electronIDs_.begin(), ed = electronIDs_.end(); it != ed; ++it) {
00150         if (it->first == name) return true;
00151     }
00152     return false;
00153 }

bool pat::Electron::isLeptonIDAvailable ( const std::string &  name  )  const [inline]

deprecated !!!

Definition at line 94 of file Electron.h.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and isElectronIDAvailable().

00094                                                              {
00095         // avoid messagelogger in dataformats
00096         std::cout << "The pat::Electron::isLeptonIDAvailable() method is deprecated. Please use the isElectronIDAvailable() one instead" << std::endl;
00097         return isElectronIDAvailable(name);
00098       }

float pat::Electron::leptonID ( const std::string &  name  )  const [inline]

deprecated !!!

Definition at line 86 of file Electron.h.

References GenMuonPlsPt100GeV_cfg::cout, electronID(), and lat::endl().

00086                                                    {
00087         // avoid messagelogger in dataformats
00088         std::cout << "The pat::Electron::leptonID() method is deprecated. Please use the electronID() one instead" << std::endl;
00089         return electronID(name);
00090       }

const std::vector<IdPair>& pat::Electron::leptonIDs (  )  const [inline]

deprecated !!!

Definition at line 103 of file Electron.h.

References GenMuonPlsPt100GeV_cfg::cout, electronIDs(), and lat::endl().

00103                                                    {
00104         // avoid messagelogger in dataformats
00105         std::cout << "The pat::Electron::leptonIDs() method is deprecated. Please use the electronIDs() one instead" << std::endl;
00106         return electronIDs();
00107       }

reco::PFCandidateRef Electron::pfCandidateRef (  )  const

reference to the source PFCandidates null if this has been built from a standard electron

reference to the source PFCandidates

Definition at line 167 of file Electron.cc.

References embeddedPFCandidate_, pfCandidate_, and pfCandidateRef_.

00167                                                   {
00168   if (embeddedPFCandidate_) {
00169     return reco::PFCandidateRef(&pfCandidate_, 0);
00170   } else {
00171     return pfCandidateRef_;
00172   }
00173 }

const float pat::Electron::scE1x5 (  )  const [inline]

Definition at line 121 of file Electron.h.

References scE1x5_.

00121 { return  scE1x5_ ; }

const float pat::Electron::scE2x5Max (  )  const [inline]

Definition at line 122 of file Electron.h.

References scE2x5Max_.

00122 { return  scE2x5Max_ ; }        

const float pat::Electron::scE5x5 (  )  const [inline]

Definition at line 123 of file Electron.h.

References scE5x5_.

00123 { return  scE5x5_ ; }             

const float pat::Electron::scSigmaEtaEta (  )  const [inline]

Definition at line 119 of file Electron.h.

References scSigmaEtaEta_.

00119 { return  scSigmaEtaEta_ ; }

const float pat::Electron::scSigmaIEtaIEta (  )  const [inline]

Definition at line 120 of file Electron.h.

References scSigmaIEtaIEta_.

00120 { return  scSigmaIEtaIEta_ ; }  

void Electron::setClusterShapes ( const float &  scSigmaEtaEta,
const float &  scSigmaIEtaIEta,
const float &  scE1x5,
const float &  scE2x5Max,
const float &  scE5x5 
)

Store the cluster shape variables associated to the electron.

method to store the electron's cluster shape

Definition at line 155 of file Electron.cc.

References scE1x5_, scE2x5Max_, scE5x5_, scSigmaEtaEta_, and scSigmaIEtaIEta_.

Referenced by pat::PATElectronProducer::FillElectron().

00157   { 
00158     scSigmaEtaEta_ = scSigmaEtaEta ; 
00159     scSigmaIEtaIEta_ = scSigmaIEtaIEta ;
00160     scE1x5_ = scE1x5 ;
00161     scE2x5Max_ = scE2x5Max ;
00162     scE5x5_ = scE5x5 ;
00163   }

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 110 of file Electron.h.

References electronIDs_.

Referenced by pat::PATElectronProducer::produce(), and setLeptonIDs().

00110 { electronIDs_ = ids; }

void pat::Electron::setLeptonIDs ( const std::vector< IdPair > &  ids  )  [inline]

deprecated !!!

Definition at line 112 of file Electron.h.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and setElectronIDs().

00112                                                        {
00113         // avoid messagelogger in dataformats
00114         std::cout << "The pat::Electron::setLeptonIDs() method is deprecated. Please use the setElectronIDs() one instead" << std::endl;
00115         setElectronIDs(ids);
00116       }

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().

00131                                                             {
00132         pfCandidateRef_ = ref;
00133       } 

reco::SuperClusterRef Electron::superCluster (  )  const

override the ElectronType::superCluster method, to access the internal storage of the supercluster

Definition at line 86 of file Electron.cc.

References embeddedSuperCluster_, reco::GsfElectron::superCluster(), and superCluster_.

00086                                                  {
00087   if (embeddedSuperCluster_) {
00088     return reco::SuperClusterRef(&superCluster_, 0);
00089   } else {
00090     return ElectronType::superCluster();
00091   }
00092 }

reco::TrackRef Electron::track ( void   )  const

override the ElectronType::track method, to access the internal storage of the track

Definition at line 96 of file Electron.cc.

References embeddedTrack_, track, and track_.

00096                                    {
00097   if (embeddedTrack_) {
00098     return reco::TrackRef(&track_, 0);
00099   } else {
00100     return ElectronType::track();
00101   }
00102 }


Member Data Documentation

std::vector<IdPair> pat::Electron::electronIDs_ [protected]

Definition at line 148 of file Electron.h.

Referenced by electronID(), electronIDs(), isElectronIDAvailable(), and setElectronIDs().

bool pat::Electron::embeddedGsfTrack_ [protected]

Definition at line 141 of file Electron.h.

Referenced by embedGsfTrack(), and gsfTrack().

bool pat::Electron::embeddedPFCandidate_ [protected]

true if the IsolatedPFCandidate is embedded

Definition at line 159 of file Electron.h.

Referenced by embedPFCandidate(), and pfCandidateRef().

bool pat::Electron::embeddedSuperCluster_ [protected]

Definition at line 143 of file Electron.h.

Referenced by embedSuperCluster(), and superCluster().

bool pat::Electron::embeddedTrack_ [protected]

Definition at line 145 of file Electron.h.

Referenced by embedTrack(), and track().

std::vector<reco::GsfTrack> pat::Electron::gsfTrack_ [protected]

Definition at line 142 of file Electron.h.

Referenced by embedGsfTrack(), and gsfTrack().

reco::PFCandidateCollection pat::Electron::pfCandidate_ [protected]

if embeddedPFCandidate_, a copy of the source IsolatedPFCandidate is stored in this vector

Definition at line 162 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 165 of file Electron.h.

Referenced by embedPFCandidate(), pfCandidateRef(), and setPFCandidateRef().

float pat::Electron::scE1x5_ [protected]

Definition at line 152 of file Electron.h.

Referenced by scE1x5(), and setClusterShapes().

float pat::Electron::scE2x5Max_ [protected]

Definition at line 153 of file Electron.h.

Referenced by scE2x5Max(), and setClusterShapes().

float pat::Electron::scE5x5_ [protected]

Definition at line 154 of file Electron.h.

Referenced by scE5x5(), and setClusterShapes().

float pat::Electron::scSigmaEtaEta_ [protected]

Definition at line 150 of file Electron.h.

Referenced by scSigmaEtaEta(), and setClusterShapes().

float pat::Electron::scSigmaIEtaIEta_ [protected]

Definition at line 151 of file Electron.h.

Referenced by scSigmaIEtaIEta(), and setClusterShapes().

std::vector<reco::SuperCluster> pat::Electron::superCluster_ [protected]

Definition at line 144 of file Electron.h.

Referenced by embedSuperCluster(), and superCluster().

std::vector<reco::Track> pat::Electron::track_ [protected]

Definition at line 146 of file Electron.h.

Referenced by embedTrack(), and track().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:49:32 2009 for CMSSW by  doxygen 1.5.4