CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 

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

Member Typedef Documentation

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

Definition at line 117 of file ZToMuMuIsolationSelector.cc.

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

Definition at line 55 of file ZToMuMuIsolationSelector.cc.

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

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

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

78  {
79  if(z.numberOfDaughters()!=2)
81  << "Candidate has " << z.numberOfDaughters() << " daughters, 2 expected\n";
82  const reco::Candidate * dau0 = z.daughter(0);
83  const reco::Candidate * dau1 = z.daughter(1);
84  if(!(dau0->hasMasterClone()&&dau1->hasMasterClone()))
86  << "Candidate daughters have no master clone\n";
87  const reco::Candidate * m0 = &*dau0->masterClone(), * m1 = &*dau1->masterClone();
88  double iso0 = -1, iso1 = -1;
89  const pat::Muon * mu0 = dynamic_cast<const pat::Muon *>(m0);
90  if(mu0 != 0) {
91  iso0 = ((*mu0).*(leptonIsolation_))();
92  } else {
93  const pat::GenericParticle * trk0 = dynamic_cast<const pat::GenericParticle*>(m0);
94  if(trk0 != 0) {
95  iso0 = ((*trk0).*(trackIsolation_))();
96  } else {
98  << "Candidate daughter #0 is neither pat::Muons nor pat::GenericParticle\n";
99  }
100  }
101  const pat::Muon * mu1 = dynamic_cast<const pat::Muon *>(m1);
102  if(mu1 != 0) {
103  iso1 = ((*mu1).*(leptonIsolation_))();
104  } else {
105  const pat::GenericParticle * trk1 = dynamic_cast<const pat::GenericParticle*>(m1);
106  if(trk1 != 0) {
107  iso1 = ((*trk1).*(trackIsolation_))();
108  } else {
110  << "Candidate daughter #1 is neither pat::Muons nor pat::GenericParticle\n";
111  }
112  }
113  bool pass = isolator_(iso0, iso1);
114  return pass;
115  }
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 size_type numberOfDaughters() const =0
number of daughters
virtual bool hasMasterClone() const =0
Analysis-level muon class.
Definition: Muon.h:51
virtual const CandidateBaseRef & masterClone() const =0

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