CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
ZToMuMuIsolationSelector< Isolator > Class Template Reference

Public Member Functions

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

Private Types

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

Private Attributes

Isolator isolator_
 
LeptonIsolationType leptonIsolation_
 
TrackIsolationType trackIsolation_
 

Detailed Description

template<typename Isolator>
class ZToMuMuIsolationSelector< Isolator >

Definition at line 50 of file ZToMuMuIsolationSelector.cc.

Member Typedef Documentation

◆ LeptonIsolationType

template<typename Isolator >
typedef float(pat::Lepton<reco::Muon>::* ZToMuMuIsolationSelector< Isolator >::LeptonIsolationType) () const
private

Definition at line 110 of file ZToMuMuIsolationSelector.cc.

◆ TrackIsolationType

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

Definition at line 111 of file ZToMuMuIsolationSelector.cc.

Constructor & Destructor Documentation

◆ ZToMuMuIsolationSelector()

template<typename Isolator >
ZToMuMuIsolationSelector< Isolator >::ZToMuMuIsolationSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector iC 
)
inline

Definition at line 52 of file ZToMuMuIsolationSelector.cc.

53  : isolator_(cfg.template getParameter<double>("isoCut")) {
54  std::string iso = cfg.template getParameter<std::string>("isolationType");
55  if (iso == "track") {
58  } else if (iso == "ecal") {
61  } else if (iso == "hcal") {
64  } else if (iso == "calo") {
67  } else
68  throw edm::Exception(edm::errors::Configuration) << "Invalid isolation type: " << iso << ". Valid types are:"
69  << "'track', 'ecal', 'hcal', 'calo'\n";
70  }

References pat::GenericParticle::caloIso(), looper::cfg, edm::errors::Configuration, pat::GenericParticle::ecalIso(), Exception, pat::GenericParticle::hcalIso(), ZToMuMuIsolationSelector< Isolator >::leptonIsolation_, AlCaHLTBitMon_QueryRunRegistry::string, pat::GenericParticle::trackIso(), and ZToMuMuIsolationSelector< Isolator >::trackIsolation_.

Member Function Documentation

◆ operator()()

template<typename Isolator >
bool ZToMuMuIsolationSelector< Isolator >::operator() ( const reco::Candidate z) const
inline

Definition at line 71 of file ZToMuMuIsolationSelector.cc.

71  {
72  if (z.numberOfDaughters() != 2)
74  << "Candidate has " << z.numberOfDaughters() << " daughters, 2 expected\n";
75  const reco::Candidate *dau0 = z.daughter(0);
76  const reco::Candidate *dau1 = z.daughter(1);
77  if (!(dau0->hasMasterClone() && dau1->hasMasterClone()))
78  throw edm::Exception(edm::errors::InvalidReference) << "Candidate daughters have no master clone\n";
79  const reco::Candidate *m0 = &*dau0->masterClone(), *m1 = &*dau1->masterClone();
80  double iso0 = -1, iso1 = -1;
81  const pat::Muon *mu0 = dynamic_cast<const pat::Muon *>(m0);
82  if (mu0 != nullptr) {
83  iso0 = ((*mu0).*(leptonIsolation_))();
84  } else {
85  const pat::GenericParticle *trk0 = dynamic_cast<const pat::GenericParticle *>(m0);
86  if (trk0 != nullptr) {
87  iso0 = ((*trk0).*(trackIsolation_))();
88  } else {
90  << "Candidate daughter #0 is neither pat::Muons nor pat::GenericParticle\n";
91  }
92  }
93  const pat::Muon *mu1 = dynamic_cast<const pat::Muon *>(m1);
94  if (mu1 != nullptr) {
95  iso1 = ((*mu1).*(leptonIsolation_))();
96  } else {
97  const pat::GenericParticle *trk1 = dynamic_cast<const pat::GenericParticle *>(m1);
98  if (trk1 != nullptr) {
99  iso1 = ((*trk1).*(trackIsolation_))();
100  } else {
102  << "Candidate daughter #1 is neither pat::Muons nor pat::GenericParticle\n";
103  }
104  }
105  bool pass = isolator_(iso0, iso1);
106  return pass;
107  }

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

Member Data Documentation

◆ isolator_

template<typename Isolator >
Isolator ZToMuMuIsolationSelector< Isolator >::isolator_
private

◆ leptonIsolation_

template<typename Isolator >
LeptonIsolationType ZToMuMuIsolationSelector< Isolator >::leptonIsolation_
private

◆ trackIsolation_

template<typename Isolator >
TrackIsolationType ZToMuMuIsolationSelector< Isolator >::trackIsolation_
private
edm::errors::InvalidReference
Definition: EDMException.h:39
pat::GenericParticle::caloIso
float caloIso() const
Definition: GenericParticle.h:222
pat::Lepton
Analysis-level lepton class.
Definition: Lepton.h:29
pat::GenericParticle::trackIso
float trackIso() const
Definition: GenericParticle.h:218
pat::GenericParticle::ecalIso
float ecalIso() const
Definition: GenericParticle.h:225
pat::Muon
Analysis-level muon class.
Definition: Muon.h:51
ZToMuMuIsolationSelector::trackIsolation_
TrackIsolationType trackIsolation_
Definition: ZToMuMuIsolationSelector.cc:113
edm::Exception
Definition: EDMException.h:77
DDAxes::z
pat::GenericParticle::hcalIso
float hcalIso() const
Definition: GenericParticle.h:228
reco::Candidate::hasMasterClone
virtual bool hasMasterClone() const =0
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pat::GenericParticle
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed)
Definition: GenericParticle.h:38
ZToMuMuIsolationSelector::isolator_
Isolator isolator_
Definition: ZToMuMuIsolationSelector.cc:114
looper.cfg
cfg
Definition: looper.py:297
reco::Candidate
Definition: Candidate.h:27
Exception
Definition: hltDiff.cc:246
reco::Candidate::masterClone
virtual const CandidateBaseRef & masterClone() const =0
ZToMuMuIsolationSelector::leptonIsolation_
LeptonIsolationType leptonIsolation_
Definition: ZToMuMuIsolationSelector.cc:112
edm::errors::Configuration
Definition: EDMException.h:36