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_ |
Definition at line 53 of file ZToMuMuIsolationSelector.cc.
typedef float(pat::GenericParticle::* ZToMuMuIsolationSelector< Isolator >::TrackIsolationType)() const [private] |
Definition at line 118 of file ZToMuMuIsolationSelector.cc.
ZToMuMuIsolationSelector< Isolator >::ZToMuMuIsolationSelector | ( | const edm::ParameterSet & | cfg | ) | [inline] |
Definition at line 55 of file ZToMuMuIsolationSelector.cc.
References pat::GenericParticle::caloIso(), edm::errors::Configuration, pat::GenericParticle::ecalIso(), Exception, pat::GenericParticle::hcalIso(), ExpressReco_HICollisions_FallBack::iso, ZToMuMuIsolationSelector< Isolator >::leptonIsolation_, pat::GenericParticle::trackIso(), and ZToMuMuIsolationSelector< Isolator >::trackIsolation_.
: isolator_(cfg.template getParameter<double>("isoCut")) { std::string iso = cfg.template getParameter<std::string>("isolationType"); if(iso == "track") { leptonIsolation_ = & pat::Lepton<reco::Muon>::trackIso; trackIsolation_ = & pat::GenericParticle::trackIso; } else if(iso == "ecal") { leptonIsolation_ = & pat::Lepton<reco::Muon>::ecalIso; trackIsolation_ = & pat::GenericParticle::ecalIso; } else if(iso == "hcal") { leptonIsolation_ = & pat::Lepton<reco::Muon>::hcalIso; trackIsolation_ = & pat::GenericParticle::hcalIso; } else if(iso == "calo") { leptonIsolation_ = & pat::Lepton<reco::Muon>::caloIso; trackIsolation_ = & pat::GenericParticle::caloIso; } else throw edm::Exception(edm::errors::Configuration) << "Invalid isolation type: " << iso << ". Valid types are:" << "'track', 'ecal', 'hcal', 'calo'\n"; }
typedef ZToMuMuIsolationSelector< Isolator >::float | ( | pat::Lepton< reco::Muon >::* | LeptonIsolationType | ) | const [private] |
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; }
Isolator ZToMuMuIsolationSelector< Isolator >::isolator_ [private] |
Definition at line 121 of file ZToMuMuIsolationSelector.cc.
Referenced by ZToMuMuIsolationSelector< Isolator >::operator()().
LeptonIsolationType ZToMuMuIsolationSelector< Isolator >::leptonIsolation_ [private] |
Definition at line 119 of file ZToMuMuIsolationSelector.cc.
Referenced by ZToMuMuIsolationSelector< Isolator >::operator()(), and ZToMuMuIsolationSelector< Isolator >::ZToMuMuIsolationSelector().
TrackIsolationType ZToMuMuIsolationSelector< Isolator >::trackIsolation_ [private] |
Definition at line 120 of file ZToMuMuIsolationSelector.cc.
Referenced by ZToMuMuIsolationSelector< Isolator >::operator()(), and ZToMuMuIsolationSelector< Isolator >::ZToMuMuIsolationSelector().