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

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

Definition at line 110 of file ZToMuMuIsolationSelector.cc.

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

Definition at line 111 of file ZToMuMuIsolationSelector.cc.

Constructor & Destructor Documentation

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

Definition at line 52 of file ZToMuMuIsolationSelector.cc.

References pat::GenericParticle::caloIso(), edm::errors::Configuration, pat::GenericParticle::ecalIso(), Exception, pat::GenericParticle::hcalIso(), AlCaHLTBitMon_QueryRunRegistry::string, and pat::GenericParticle::trackIso().

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  }
float trackIso() const
float hcalIso() const
Analysis-level lepton class.
Definition: Lepton.h:29
float caloIso() const
float ecalIso() const

Member Function Documentation

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

Definition at line 71 of file ZToMuMuIsolationSelector.cc.

References reco::Candidate::daughter(), Exception, reco::Candidate::hasMasterClone(), edm::errors::InvalidReference, reco::Candidate::masterClone(), and reco::Candidate::numberOfDaughters().

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  }
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed) ...
virtual const CandidateBaseRef & masterClone() const =0
virtual size_type numberOfDaughters() const =0
number of daughters
Analysis-level muon class.
Definition: Muon.h:51
virtual bool hasMasterClone() const =0

Member Data Documentation

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

Definition at line 114 of file ZToMuMuIsolationSelector.cc.

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

Definition at line 112 of file ZToMuMuIsolationSelector.cc.

template<typename Isolator >
TrackIsolationType ZToMuMuIsolationSelector< Isolator >::trackIsolation_
private

Definition at line 113 of file ZToMuMuIsolationSelector.cc.