CMS 3D CMS Logo

Public Member Functions | Protected Types | Protected Attributes

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

List of all members.

Public Member Functions

float caloIso () const
float chargedHadronIso () const
virtual Lepton< LeptonType > * clone () const
float ecalIso () const
void ecalIsoDeposit (const IsoDeposit &dep)
const IsoDepositecalIsoDeposit () const
const reco::GenParticlegenLepton () const
float hcalIso () const
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.
 Lepton (const edm::Ptr< LeptonType > &aLeptonRef)
 constructor from ref to LeptonType
 Lepton (const LeptonType &aLepton)
 constructor from LeptonType
 Lepton (const edm::RefToBase< LeptonType > &aLeptonRef)
 constructor from ref to LeptonType
 Lepton ()
 default constructor
float neutralHadronIso () const
float particleIso () const
float photonIso () const
float puChargedHadronIso () const
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)
void setTrackIso (float trackIso)
 Sets tracker isolation variable.
void setUserIso (float value, uint8_t index=0)
 Sets user isolation variable #index.
float trackIso () const
const IsoDeposittrackIsoDeposit () const
void trackIsoDeposit (const IsoDeposit &dep)
float userIso (uint8_t index=0) const
void userIsoDeposit (const IsoDeposit &dep, uint8_t index=0)
const IsoDeposituserIsoDeposit (uint8_t index=0) const
float userIsolation (IsolationKeys key) const
float userIsolation (const std::string &key) 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: https://hypernews.cern.ch/HyperNews/CMS/get/physTools.html

Author:
Steven Lowette, Giovanni Petrucciani, Frederic Ronga
Version:
Id:
Lepton.h,v 1.24 2011/09/29 05:19:08 cbern 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 200 of file Lepton.h.


Constructor & Destructor Documentation

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

default constructor

Definition at line 208 of file Lepton.h.

                             :
    PATObject<LeptonType>(LeptonType()) {
    // no common constructor, so initialize the candidate manually
    this->setCharge(0);
    this->setP4(reco::Particle::LorentzVector(0, 0, 0, 0));
    this->setVertex(reco::Particle::Point(0, 0, 0));
  }
template<class LeptonType>
pat::Lepton< LeptonType >::Lepton ( const LeptonType aLepton)

constructor from LeptonType

Definition at line 219 of file Lepton.h.

                                                       :
    PATObject<LeptonType>(aLepton) {
  }
template<class LeptonType>
pat::Lepton< LeptonType >::Lepton ( const edm::RefToBase< LeptonType > &  aLeptonRef)

constructor from ref to LeptonType

Definition at line 226 of file Lepton.h.

                                                                        :
    PATObject<LeptonType>(aLeptonRef) {
  }
template<class LeptonType>
pat::Lepton< LeptonType >::Lepton ( const edm::Ptr< LeptonType > &  aLeptonRef)

constructor from ref to LeptonType

Definition at line 233 of file Lepton.h.

                                                                  :
    PATObject<LeptonType>(aLeptonRef) {
  }
template<class LeptonType >
pat::Lepton< LeptonType >::~Lepton ( ) [virtual]

destructor

Definition at line 240 of file Lepton.h.

                              {
  }

Member Function Documentation

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

Returns 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 (overloaded if specific isolation functions are available from the derived objects)

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

Definition at line 123 of file Lepton.h.

Referenced by dummy::Isolationdummy().

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

Returns the isolation calculated with only the charged hadron PFCandidates

Definition at line 140 of file Lepton.h.

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.

{ return new Lepton<LeptonType>(*this); }
template<class LeptonType>
float pat::Lepton< LeptonType >::ecalIso ( ) const [inline]

Returns the ecal isolation variable that was stored in this object when produced, or -1.0 if there is none (overloaded if specific isolation functions are available from the derived objects)

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

Definition at line 128 of file Lepton.h.

Referenced by dummy::Isolationdummy().

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

Definition at line 187 of file Lepton.h.

{ return isoDeposit(pat::EcalIso ); }
template<class LeptonType>
void pat::Lepton< LeptonType >::ecalIsoDeposit ( const IsoDeposit dep) [inline]

Definition at line 193 of file Lepton.h.

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

Returns the hcal isolation variable that was stored in this object when produced, or -1.0 if there is none (overloaded if specific isolation functions are available from the derived objects)

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

Definition at line 133 of file Lepton.h.

Referenced by dummy::Isolationdummy().

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

Definition at line 188 of file Lepton.h.

{ return isoDeposit(pat::HcalIso ); }
template<class LeptonType>
void pat::Lepton< LeptonType >::hcalIsoDeposit ( const IsoDeposit dep) [inline]

Definition at line 194 of file Lepton.h.

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 167 of file Lepton.h.

Referenced by ZMuMuIsolationAnalyzer::analyze(), ZMuMu_Radiative_analyzer::analyze(), pat::Lepton< reco::Muon >::ecalIsoDeposit(), ZGlobalVsSAIsolationAnalyzer::evaluate(), pat::Lepton< reco::Muon >::hcalIsoDeposit(), pat::Lepton< reco::Muon >::trackIsoDeposit(), and pat::Lepton< reco::Muon >::userIsoDeposit().

                                                             {
          for (IsoDepositPairs::const_iterator it = isoDeposits_.begin(), ed = isoDeposits_.end(); 
                  it != ed; ++it) 
          {
              if (it->first == key) return & it->second;
          }
          return 0;
      } 
template<class LeptonType>
float pat::Lepton< LeptonType >::neutralHadronIso ( ) const [inline]

Returns the isolation calculated with only the neutral hadron PFCandidates

Definition at line 143 of file Lepton.h.

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

PARTICLE FLOW ISOLATION Returns the isolation calculated with all the PFCandidates

Definition at line 137 of file Lepton.h.

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

Returns the isolation calculated with only the gamma PFCandidates

Definition at line 146 of file Lepton.h.

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

Returns the isolation calculated with only the pile-up charged hadron PFCandidates

Definition at line 149 of file Lepton.h.

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

Sets ecal isolation variable.

Definition at line 158 of file Lepton.h.

Referenced by aod2patFilterZee::filter().

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 160 of file Lepton.h.

Referenced by aod2patFilterZee::filter().

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 177 of file Lepton.h.

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

                                                                   {
          IsoDepositPairs::iterator it = isoDeposits_.begin(), ed = isoDeposits_.end();
          for (; it != ed; ++it) {
              if (it->first == key) { it->second = dep; return; }
          }
          isoDeposits_.push_back(std::make_pair(key,dep));
      } 
template<class LeptonType>
void pat::Lepton< LeptonType >::setIsolation ( IsolationKeys  key,
float  value 
) [inline]

Sets the userIsolation variable for a specific key. Note that you can't set isolation for a pseudo-key like CaloIso

Definition at line 100 of file Lepton.h.

Referenced by pat::PATElectronProducer::fillElectron(), pat::PATElectronProducer::fillElectron2(), pat::PATMuonProducer::fillMuon(), pat::PATElectronProducer::produce(), pat::PATMuonProducer::produce(), ZMuMuMuonUserData::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().

                                                        {
          if (key >= 0) {
              if (size_t(key) >= isolations_.size()) isolations_.resize(key+1, -1.0);
              isolations_[key] = value;
          } else {
              throw cms::Exception("Illegal Argument") << 
                  "The key for which you're setting isolation does not correspond " <<
                  "to an individual isolation but to the sum of more independent isolations " <<
                  "(e.g. Calo = Ecal + Hcal), so you can't SET the value, just GET it.\n" <<
                  "Please set up each component independly.\n";
          }
      }
template<class LeptonType>
void pat::Lepton< LeptonType >::setTrackIso ( float  trackIso) [inline]

Sets tracker isolation variable.

Definition at line 156 of file Lepton.h.

Referenced by aod2patFilterZee::filter().

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

Sets user isolation variable #index.

Definition at line 162 of file Lepton.h.

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

Returns the tracker isolation variable that was stored in this object when produced, or -1.0 if there is none (overloaded if specific isolation functions are available from the derived objects)

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

Definition at line 118 of file Lepton.h.

Referenced by dummy::Isolationdummy().

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

Definition at line 186 of file Lepton.h.

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

Definition at line 192 of file Lepton.h.

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

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

Definition at line 152 of file Lepton.h.

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

Definition at line 195 of file Lepton.h.

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

Definition at line 189 of file Lepton.h.

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

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

Definition at line 51 of file Lepton.h.

Referenced by pat::Lepton< reco::Muon >::caloIso(), pat::Lepton< reco::Muon >::chargedHadronIso(), pat::Lepton< reco::Muon >::ecalIso(), pat::Lepton< reco::Muon >::hcalIso(), pat::Lepton< reco::Muon >::neutralHadronIso(), pat::Lepton< reco::Muon >::particleIso(), pat::Lepton< reco::Muon >::photonIso(), pat::Lepton< reco::Muon >::puChargedHadronIso(), ZeePlots::ReturnCandVar(), PFMuonSelector::spring11Cuts(), PFElectronSelector::spring11Cuts(), pat::Lepton< reco::Muon >::trackIso(), pat::Lepton< reco::Muon >::userIso(), and pat::Lepton< reco::Muon >::userIsolation().

                                                   { 
          if (key >= 0) {
            //if (key >= isolations_.size()) throw cms::Excepton("Missing Data") 
            //<< "Isolation corresponding to key " 
            //<< key << " was not stored for this particle.";
              if (size_t(key) >= isolations_.size()) return -1.0;
              return isolations_[key];
          } else switch (key) {
          case pat::CaloIso:  
            //if (isolations_.size() <= pat::HcalIso) throw cms::Excepton("Missing Data") 
            //<< "CaloIso Isolation was not stored for this particle.";
            if (isolations_.size() <= pat::HcalIso) return -1.0; 
            return isolations_[pat::EcalIso] + isolations_[pat::HcalIso];
          default:
            return -1.0;
            //throw cms::Excepton("Missing Data") << "Isolation corresponding to key " 
            //<< key << " was not stored for this particle.";
          }
      }
template<class LeptonType>
float pat::Lepton< LeptonType >::userIsolation ( const std::string &  key) const [inline]

Returns the isolation variable for string type function arguments (to be used with the cut-string parser); the possible values of the strings are the enums defined in DataFormats/PatCandidates/interface/Isolation.h

Definition at line 74 of file Lepton.h.

                                                      {
        // remove leading namespace specifier
        std::string prunedKey = ( key.find("pat::") == 0 ) ? std::string(key, 5) : key;
        if ( prunedKey == "TrackIso" ) return userIsolation(pat::TrackIso);
        if ( prunedKey == "EcalIso" ) return userIsolation(pat::EcalIso);
        if ( prunedKey == "HcalIso" ) return userIsolation(pat::HcalIso);
        if ( prunedKey == "PfAllParticleIso" ) return userIsolation(pat::PfAllParticleIso);
        if ( prunedKey == "PfChargedHadronIso" ) return userIsolation(pat::PfChargedHadronIso);
        if ( prunedKey == "PfNeutralHadronIso" ) return userIsolation(pat::PfNeutralHadronIso);
        if ( prunedKey == "PfGammaIso" ) return userIsolation(pat::PfGammaIso);
        if ( prunedKey == "User1Iso" ) return userIsolation(pat::User1Iso);
        if ( prunedKey == "User2Iso" ) return userIsolation(pat::User2Iso);
        if ( prunedKey == "User3Iso" ) return userIsolation(pat::User3Iso);
        if ( prunedKey == "User4Iso" ) return userIsolation(pat::User4Iso);
        if ( prunedKey == "User5Iso" ) return userIsolation(pat::User5Iso);
        if ( prunedKey == "UserBaseIso" ) return userIsolation(pat::UserBaseIso);
        if ( prunedKey == "CaloIso" ) return userIsolation(pat::CaloIso);
        if ( prunedKey == "PfPUChargedHadronIso" ) return userIsolation(pat::PfPUChargedHadronIso);
        //throw cms::Excepton("Missing Data")
        //<< "Isolation corresponding to key " 
        //<< key << " was not stored for this particle.";
        return -1.0;
      }

Member Data Documentation

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