CMS 3D CMS Logo

pat::Lepton< LeptonType > Class Template Reference

Analysis-level lepton class. More...

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

Inheritance diagram for pat::Lepton< LeptonType >:

pat::PATObject< LeptonType > LeptonType pat::Electron pat::Muon pat::Tau

List of all members.

Public Member Functions

float caloIso () const
 Return the sum of ecal and hcal isolation variable that were stored in this object when produced, or -1.0 if at least one is missing.
float chargedParticleIso () const
 Return the isolation calculated with only the charged PFCandidates.
virtual Lepton< LeptonType > * clone () const
float ecalIso () const
 Return the ecal isolation variable that was stored in this object when produced, or -1.0 if there is none.
void ecalIsoDeposit (const IsoDeposit &dep)
const IsoDepositecalIsoDeposit () const
float gammaParticleIso () const
 Return the isolation calculated with only the gamma PFCandidates.
const reco::GenParticlegenLepton () const
float hcalIso () const
 Return the hcal isolation variable that was stored in this object when produced, or -1.0 if there is none.
void hcalIsoDeposit (const IsoDeposit &dep)
const IsoDeposithcalIsoDeposit () const
const IsoDepositisoDeposit (IsolationKeys key) const
 Returns the IsoDeposit associated with some key, or a null pointer if it is not available.
float isolation (IsolationKeys key) const
 Returns the isolation variable for a specifc key (or pseudo-key like CaloIso), or -1.0 if not available.
 Lepton (const edm::Ptr< LeptonType > &aLeptonRef)
 constructor from ref to LeptonType
 Lepton (const edm::RefToBase< LeptonType > &aLeptonRef)
 constructor from ref to LeptonType
 Lepton (const LeptonType &aLepton)
 constructor from LeptonType
 Lepton ()
 default constructor
float neutralParticleIso () const
 Return the isolation calculated with only the neutral hadrons PFCandidates.
float particleIso () const
 PARTICLE FLOW ISOLATION Return the isolation calculated with all the PFCandidates.
void setECalIso (float caloIso)
 Sets ecal isolation variable.
void setGenLepton (const reco::GenParticleRef &gl, bool embed=false)
void setHCalIso (float caloIso)
 Sets hcal isolation variable.
void setIsoDeposit (IsolationKeys key, const IsoDeposit &dep)
 Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
void setIsolation (IsolationKeys key, float value)
 Sets the isolation variable for a specifc key.
void setTrackIso (float trackIso)
 Sets tracker isolation variable.
void setUserIso (float value, uint8_t index=0)
 Sets user isolation variable index.
void trackerIsoDeposit (const IsoDeposit &dep)
const IsoDeposittrackerIsoDeposit () const
float trackIso () const
 Return the tracker isolation variable that was stored in this object when produced, or -1.0 if there is none.
float userIso (uint8_t index=0) const
 Return the user defined isolation variable index that was stored in this object when produced, or -1.0 if there is none.
void userIsoDeposit (const IsoDeposit &dep, uint8_t index=0)
const IsoDeposituserIsoDeposit (uint8_t index=0) const
virtual ~Lepton ()
 destructor

Protected Types

typedef std::vector< std::pair
< IsolationKeys,
pat::IsoDeposit > > 
IsoDepositPairs

Protected Attributes

IsoDepositPairs isoDeposits_
std::vector< float > isolations_


Detailed Description

template<class LeptonType>
class pat::Lepton< LeptonType >

Analysis-level lepton class.

Lepton implements the analysis-level charged lepton class within the 'pat' namespace. It currently provides the link to the generated lepton and the isolation information.

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
Lepton.h,v 1.14.2.2 2009/02/08 19:36:30 pioppi Exp

Definition at line 32 of file Lepton.h.


Member Typedef Documentation

template<class LeptonType>
typedef std::vector<std::pair<IsolationKeys, pat::IsoDeposit> > pat::Lepton< LeptonType >::IsoDepositPairs [protected]

Definition at line 150 of file Lepton.h.


Constructor & Destructor Documentation

template<class LeptonType>
pat::Lepton< LeptonType >::Lepton (  )  [inline]

default constructor

Definition at line 158 of file Lepton.h.

00158                              :
00159     PATObject<LeptonType>(LeptonType()) {
00160     // no common constructor, so initialize the candidate manually
00161     this->setCharge(0);
00162     this->setP4(reco::Particle::LorentzVector(0, 0, 0, 0));
00163     this->setVertex(reco::Particle::Point(0, 0, 0));
00164   }

template<class LeptonType>
pat::Lepton< LeptonType >::Lepton ( const LeptonType aLepton  )  [inline]

constructor from LeptonType

Definition at line 169 of file Lepton.h.

00169                                                        :
00170     PATObject<LeptonType>(aLepton) {
00171   }

template<class LeptonType>
pat::Lepton< LeptonType >::Lepton ( const edm::RefToBase< LeptonType > &  aLeptonRef  )  [inline]

constructor from ref to LeptonType

Definition at line 176 of file Lepton.h.

00176                                                                         :
00177     PATObject<LeptonType>(aLeptonRef) {
00178   }

template<class LeptonType>
pat::Lepton< LeptonType >::Lepton ( const edm::Ptr< LeptonType > &  aLeptonRef  )  [inline]

constructor from ref to LeptonType

Definition at line 183 of file Lepton.h.

00183                                                                   :
00184     PATObject<LeptonType>(aLeptonRef) {
00185   }

template<class LeptonType>
pat::Lepton< LeptonType >::~Lepton (  )  [inline, virtual]

destructor

Definition at line 190 of file Lepton.h.

00190                               {
00191   }


Member Function Documentation

template<class LeptonType>
float pat::Lepton< LeptonType >::caloIso (  )  const [inline]

Return the sum of ecal and hcal isolation variable that were stored in this object when produced, or -1.0 if at least one is missing.

Definition at line 85 of file Lepton.h.

Referenced by pat::HistoMuon::fill(), and pat::HistoElectron::fill().

00085 { return isolation(CaloIso); }

template<class LeptonType>
float pat::Lepton< LeptonType >::chargedParticleIso (  )  const [inline]

Return the isolation calculated with only the charged PFCandidates.

Definition at line 95 of file Lepton.h.

00095 { return isolation(ChargedParticleIso); }

template<class LeptonType>
virtual Lepton<LeptonType>* pat::Lepton< LeptonType >::clone ( void   )  const [inline, virtual]

Reimplemented in pat::Electron, pat::Muon, and pat::Tau.

Definition at line 42 of file Lepton.h.

00042 { return new Lepton<LeptonType>(*this); }

template<class LeptonType>
float pat::Lepton< LeptonType >::ecalIso (  )  const [inline]

Return the ecal isolation variable that was stored in this object when produced, or -1.0 if there is none.

Definition at line 87 of file Lepton.h.

00087 { return isolation(ECalIso); }

template<class LeptonType>
void pat::Lepton< LeptonType >::ecalIsoDeposit ( const IsoDeposit dep  )  [inline]

Definition at line 143 of file Lepton.h.

00143 { setIsoDeposit(ECalIso, dep); }

template<class LeptonType>
const IsoDeposit* pat::Lepton< LeptonType >::ecalIsoDeposit (  )  const [inline]

Definition at line 137 of file Lepton.h.

00137 { return isoDeposit(ECalIso); }

template<class LeptonType>
float pat::Lepton< LeptonType >::gammaParticleIso (  )  const [inline]

Return the isolation calculated with only the gamma PFCandidates.

Definition at line 99 of file Lepton.h.

00099 { return isolation(GammaParticleIso); } 

template<class LeptonType>
const reco::GenParticle* pat::Lepton< LeptonType >::genLepton (  )  const [inline]

Definition at line 44 of file Lepton.h.

template<class LeptonType>
float pat::Lepton< LeptonType >::hcalIso (  )  const [inline]

Return the hcal isolation variable that was stored in this object when produced, or -1.0 if there is none.

Definition at line 89 of file Lepton.h.

00089 { return isolation(HCalIso); }

template<class LeptonType>
void pat::Lepton< LeptonType >::hcalIsoDeposit ( const IsoDeposit dep  )  [inline]

Definition at line 144 of file Lepton.h.

00144 { setIsoDeposit(HCalIso, dep); }

template<class LeptonType>
const IsoDeposit* pat::Lepton< LeptonType >::hcalIsoDeposit (  )  const [inline]

Definition at line 138 of file Lepton.h.

00138 { return isoDeposit(HCalIso); }

template<class LeptonType>
const IsoDeposit* pat::Lepton< LeptonType >::isoDeposit ( IsolationKeys  key  )  const [inline]

Returns the IsoDeposit associated with some key, or a null pointer if it is not available.

Definition at line 117 of file Lepton.h.

Referenced by pat::Lepton< reco::Muon >::ecalIsoDeposit(), pat::Lepton< reco::Muon >::hcalIsoDeposit(), pat::Lepton< reco::Muon >::trackerIsoDeposit(), and pat::Lepton< reco::Muon >::userIsoDeposit().

00117                                                              {
00118           for (IsoDepositPairs::const_iterator it = isoDeposits_.begin(), ed = isoDeposits_.end(); 
00119                   it != ed; ++it) 
00120           {
00121               if (it->first == key) return & it->second;
00122           }
00123           return 0;
00124       } 

template<class LeptonType>
float pat::Lepton< LeptonType >::isolation ( IsolationKeys  key  )  const [inline]

Returns the isolation variable for a specifc key (or pseudo-key like CaloIso), or -1.0 if not available.

Definition at line 50 of file Lepton.h.

Referenced by pat::Lepton< reco::Muon >::caloIso(), pat::Lepton< reco::Muon >::chargedParticleIso(), pat::Lepton< reco::Muon >::ecalIso(), pat::Lepton< reco::Muon >::gammaParticleIso(), pat::Lepton< reco::Muon >::hcalIso(), pat::Lepton< reco::Muon >::neutralParticleIso(), pat::Lepton< reco::Muon >::particleIso(), pat::Lepton< reco::Muon >::trackIso(), and pat::Lepton< reco::Muon >::userIso().

00050                                                { 
00051           if (key >= 0) {
00052               //if (key >= isolations_.size()) throw cms::Excepton("Missing Data") << "Isolation corresponding to key " << key << " was not stored for this particle.";
00053               if (size_t(key) >= isolations_.size()) return -1.0;
00054               return isolations_[key];
00055           } else switch (key) {
00056               case CaloIso:  
00057                   //if (isolations_.size() <= HCalIso) throw cms::Excepton("Missing Data") << "CalIsoo Isolation was not stored for this particle.";
00058                   if (isolations_.size() <= HCalIso) return -1.0; 
00059                   return isolations_[ECalIso] + isolations_[HCalIso];
00060               default:
00061                   return -1.0;
00062                   //throw cms::Excepton("Missing Data") << "Isolation corresponding to key " << key << " was not stored for this particle.";
00063           }
00064       }

template<class LeptonType>
float pat::Lepton< LeptonType >::neutralParticleIso (  )  const [inline]

Return the isolation calculated with only the neutral hadrons PFCandidates.

Definition at line 97 of file Lepton.h.

00097 { return isolation(NeutralParticleIso); }       

template<class LeptonType>
float pat::Lepton< LeptonType >::particleIso (  )  const [inline]

PARTICLE FLOW ISOLATION Return the isolation calculated with all the PFCandidates.

Definition at line 93 of file Lepton.h.

00093 { return isolation(ParticleIso); }

template<class LeptonType>
void pat::Lepton< LeptonType >::setECalIso ( float  caloIso  )  [inline]

Sets ecal isolation variable.

Definition at line 108 of file Lepton.h.

template<class LeptonType>
void pat::Lepton< LeptonType >::setGenLepton ( const reco::GenParticleRef gl,
bool  embed = false 
) [inline]

Definition at line 46 of file Lepton.h.

template<class LeptonType>
void pat::Lepton< LeptonType >::setHCalIso ( float  caloIso  )  [inline]

Sets hcal isolation variable.

Definition at line 110 of file Lepton.h.

template<class LeptonType>
void pat::Lepton< LeptonType >::setIsoDeposit ( IsolationKeys  key,
const IsoDeposit dep 
) [inline]

Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.

Definition at line 127 of file Lepton.h.

Referenced by pat::Lepton< reco::Muon >::ecalIsoDeposit(), pat::Lepton< reco::Muon >::hcalIsoDeposit(), pat::PATElectronProducer::produce(), pat::PATMuonProducer::produce(), pat::PATTauProducer::produce(), pat::Lepton< reco::Muon >::trackerIsoDeposit(), and pat::Lepton< reco::Muon >::userIsoDeposit().

00127                                                                    {
00128           IsoDepositPairs::iterator it = isoDeposits_.begin(), ed = isoDeposits_.end();
00129           for (; it != ed; ++it) {
00130               if (it->first == key) { it->second = dep; return; }
00131           }
00132           isoDeposits_.push_back(std::make_pair(key,dep));
00133       } 

template<class LeptonType>
void pat::Lepton< LeptonType >::setIsolation ( IsolationKeys  key,
float  value 
) [inline]

Sets the isolation variable for a specifc key.

Note that you can't set isolation for a pseudo-key like CaloIso

Definition at line 68 of file Lepton.h.

Referenced by pat::PATElectronProducer::produce(), pat::PATMuonProducer::produce(), pat::PATTauProducer::produce(), pat::Lepton< reco::Muon >::setECalIso(), pat::Lepton< reco::Muon >::setHCalIso(), pat::Lepton< reco::Muon >::setTrackIso(), and pat::Lepton< reco::Muon >::setUserIso().

00068                                                         {
00069           if (key >= 0) {
00070               if (size_t(key) >= isolations_.size()) isolations_.resize(key+1, -1.0);
00071               isolations_[key] = value;
00072           } else {
00073               throw cms::Exception("Illegal Argument") << 
00074                   "The key for which you're setting isolation does not correspond " <<
00075                   "to an individual isolation but to the sum of more independent isolations " <<
00076                   "(e.g. Calo = ECal + HCal), so you can't SET the value, just GET it.\n" <<
00077                   "Please set up each component independly.\n";
00078           }
00079       }

template<class LeptonType>
void pat::Lepton< LeptonType >::setTrackIso ( float  trackIso  )  [inline]

Sets tracker isolation variable.

Definition at line 106 of file Lepton.h.

template<class LeptonType>
void pat::Lepton< LeptonType >::setUserIso ( float  value,
uint8_t  index = 0 
) [inline]

Sets user isolation variable index.

Definition at line 112 of file Lepton.h.

template<class LeptonType>
void pat::Lepton< LeptonType >::trackerIsoDeposit ( const IsoDeposit dep  )  [inline]

Definition at line 142 of file Lepton.h.

00142 { setIsoDeposit(TrackerIso, dep); }

template<class LeptonType>
const IsoDeposit* pat::Lepton< LeptonType >::trackerIsoDeposit (  )  const [inline]

Definition at line 136 of file Lepton.h.

00136 { return isoDeposit(TrackerIso); }

template<class LeptonType>
float pat::Lepton< LeptonType >::trackIso (  )  const [inline]

Return the tracker isolation variable that was stored in this object when produced, or -1.0 if there is none.

Definition at line 83 of file Lepton.h.

Referenced by pat::HistoMuon::fill(), and pat::HistoElectron::fill().

00083 { return isolation(TrackerIso); }

template<class LeptonType>
float pat::Lepton< LeptonType >::userIso ( uint8_t  index = 0  )  const [inline]

Return the user defined isolation variable index that was stored in this object when produced, or -1.0 if there is none.

Definition at line 102 of file Lepton.h.

00102 { return isolation(IsolationKeys(UserBaseIso + index)); }

template<class LeptonType>
void pat::Lepton< LeptonType >::userIsoDeposit ( const IsoDeposit dep,
uint8_t  index = 0 
) [inline]

Definition at line 145 of file Lepton.h.

template<class LeptonType>
const IsoDeposit* pat::Lepton< LeptonType >::userIsoDeposit ( uint8_t  index = 0  )  const [inline]

Definition at line 139 of file Lepton.h.

00139 { return isoDeposit(IsolationKeys(UserBaseIso + index)); }


Member Data Documentation

template<class LeptonType>
IsoDepositPairs pat::Lepton< LeptonType >::isoDeposits_ [protected]

Definition at line 151 of file Lepton.h.

Referenced by pat::Lepton< reco::Muon >::isoDeposit(), and pat::Lepton< reco::Muon >::setIsoDeposit().

template<class LeptonType>
std::vector<float> pat::Lepton< LeptonType >::isolations_ [protected]

Definition at line 152 of file Lepton.h.

Referenced by pat::Lepton< reco::Muon >::isolation(), and pat::Lepton< reco::Muon >::setIsolation().


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