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 54 of file ZToMuMuIsolationSelector.cc.

Member Typedef Documentation

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

Definition at line 118 of file ZToMuMuIsolationSelector.cc.

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

Definition at line 119 of file ZToMuMuIsolationSelector.cc.

Constructor & Destructor Documentation

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

Definition at line 56 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().

56  :
57  isolator_(cfg.template getParameter<double>("isoCut")) {
58  std::string iso = cfg.template getParameter<std::string>("isolationType");
59  if(iso == "track") {
62  }
63  else if(iso == "ecal") {
66  }
67  else if(iso == "hcal") {
70  }
71  else if(iso == "calo") {
74  }
76  << "Invalid isolation type: " << iso << ". Valid types are:"
77  << "'track', 'ecal', 'hcal', 'calo'\n";
78  }
float trackIso() const
float hcalIso() const
Analysis-level lepton class.
Definition: Lepton.h:31
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 79 of file ZToMuMuIsolationSelector.cc.

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

79  {
80  if(z.numberOfDaughters()!=2)
82  << "Candidate has " << z.numberOfDaughters() << " daughters, 2 expected\n";
83  const reco::Candidate * dau0 = z.daughter(0);
84  const reco::Candidate * dau1 = z.daughter(1);
85  if(!(dau0->hasMasterClone()&&dau1->hasMasterClone()))
87  << "Candidate daughters have no master clone\n";
88  const reco::Candidate * m0 = &*dau0->masterClone(), * m1 = &*dau1->masterClone();
89  double iso0 = -1, iso1 = -1;
90  const pat::Muon * mu0 = dynamic_cast<const pat::Muon *>(m0);
91  if(mu0 != nullptr) {
92  iso0 = ((*mu0).*(leptonIsolation_))();
93  } else {
94  const pat::GenericParticle * trk0 = dynamic_cast<const pat::GenericParticle*>(m0);
95  if(trk0 != nullptr) {
96  iso0 = ((*trk0).*(trackIsolation_))();
97  } else {
99  << "Candidate daughter #0 is neither pat::Muons nor pat::GenericParticle\n";
100  }
101  }
102  const pat::Muon * mu1 = dynamic_cast<const pat::Muon *>(m1);
103  if(mu1 != nullptr) {
104  iso1 = ((*mu1).*(leptonIsolation_))();
105  } else {
106  const pat::GenericParticle * trk1 = dynamic_cast<const pat::GenericParticle*>(m1);
107  if(trk1 != nullptr) {
108  iso1 = ((*trk1).*(trackIsolation_))();
109  } else {
111  << "Candidate daughter #1 is neither pat::Muons nor pat::GenericParticle\n";
112  }
113  }
114  bool pass = isolator_(iso0, iso1);
115  return pass;
116  }
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 122 of file ZToMuMuIsolationSelector.cc.

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

Definition at line 120 of file ZToMuMuIsolationSelector.cc.

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

Definition at line 121 of file ZToMuMuIsolationSelector.cc.