CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

ZToMuMuIsolationSelector< Isolator > Class Template Reference

List of all members.

Public Member Functions

bool operator() (const reco::Candidate &z) const
 ZToMuMuIsolationSelector (const edm::ParameterSet &cfg)

Private Types

typedef float(pat::GenericParticle::* TrackIsolationType )() const

Private Member Functions

typedef float (pat::Lepton< reco::Muon >::*LeptonIsolationType)() const

Private Attributes

Isolator isolator_
LeptonIsolationType leptonIsolation_
TrackIsolationType trackIsolation_

Detailed Description

template<typename Isolator>
class ZToMuMuIsolationSelector< Isolator >

Definition at line 53 of file ZToMuMuIsolationSelector.cc.


Member Typedef Documentation

template<typename Isolator >
typedef float(pat::GenericParticle::* ZToMuMuIsolationSelector< Isolator >::TrackIsolationType)() const [private]

Definition at line 118 of file ZToMuMuIsolationSelector.cc.


Constructor & Destructor Documentation

template<typename Isolator >
ZToMuMuIsolationSelector< Isolator >::ZToMuMuIsolationSelector ( const edm::ParameterSet cfg) [inline]

Member Function Documentation

template<typename Isolator >
typedef ZToMuMuIsolationSelector< Isolator >::float ( pat::Lepton< reco::Muon >::*  LeptonIsolationType) const [private]
template<typename Isolator >
bool ZToMuMuIsolationSelector< Isolator >::operator() ( const reco::Candidate z) const [inline]

Definition at line 78 of file ZToMuMuIsolationSelector.cc.

References reco::Candidate::daughter(), Exception, reco::Candidate::hasMasterClone(), edm::errors::InvalidReference, ZToMuMuIsolationSelector< Isolator >::isolator_, ZToMuMuIsolationSelector< Isolator >::leptonIsolation_, reco::Candidate::masterClone(), reco::Candidate::numberOfDaughters(), and ZToMuMuIsolationSelector< Isolator >::trackIsolation_.

                                                 {
    if(z.numberOfDaughters()!=2) 
      throw edm::Exception(edm::errors::InvalidReference) 
        << "Candidate has " << z.numberOfDaughters() << " daughters, 2 expected\n";
    const reco::Candidate * dau0 = z.daughter(0);
    const reco::Candidate * dau1 = z.daughter(1);
    if(!(dau0->hasMasterClone()&&dau1->hasMasterClone()))
      throw edm::Exception(edm::errors::InvalidReference) 
        << "Candidate daughters have no master clone\n"; 
    const reco::Candidate * m0 = &*dau0->masterClone(), * m1 = &*dau1->masterClone();
    double iso0 = -1, iso1 = -1;
    const pat::Muon * mu0 = dynamic_cast<const pat::Muon *>(m0);
    if(mu0 != 0) {
      iso0 = ((*mu0).*(leptonIsolation_))(); 
    } else {
      const pat::GenericParticle * trk0 = dynamic_cast<const pat::GenericParticle*>(m0);
      if(trk0 != 0) {
        iso0 = ((*trk0).*(trackIsolation_))(); 
      } else {
        throw edm::Exception(edm::errors::InvalidReference) 
          << "Candidate daughter #0 is neither pat::Muons nor pat::GenericParticle\n";      
      }
    }
    const pat::Muon * mu1 = dynamic_cast<const pat::Muon *>(m1);
    if(mu1 != 0) {
      iso1 = ((*mu1).*(leptonIsolation_))(); 
    } else {
      const pat::GenericParticle * trk1 = dynamic_cast<const pat::GenericParticle*>(m1);
      if(trk1 != 0) {
        iso1 = ((*trk1).*(trackIsolation_))(); 
      } else {
        throw edm::Exception(edm::errors::InvalidReference) 
          << "Candidate daughter #1 is neither pat::Muons nor pat::GenericParticle\n";      
      }
    } 
    bool pass = isolator_(iso0, iso1);
    return pass;
  }

Member Data Documentation

template<typename Isolator >
Isolator ZToMuMuIsolationSelector< Isolator >::isolator_ [private]
template<typename Isolator >
LeptonIsolationType ZToMuMuIsolationSelector< Isolator >::leptonIsolation_ [private]
template<typename Isolator >
TrackIsolationType ZToMuMuIsolationSelector< Isolator >::trackIsolation_ [private]