CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ZToMuMuIsoDepositSelector.cc
Go to the documentation of this file.
1 /* \class ZToMuMuIsolationSelector
2  *
3  * \author Luca Lista, INFN
4  *
5  */
6 
8  IsolatedSelector(double cut) : cut_(cut) { }
9  bool operator()(double i1, double i2) const {
10  return i1 < cut_ && i2 < cut_;
11  }
12  double cut() const { return cut_; }
13 private:
14  double cut_;
15 };
16 
18  NonIsolatedSelector(double cut) : isolated_(cut) { }
19  bool operator()(double i1, double i2) const {
20  return !isolated_(i1, i2);
21  }
22  double cut() const { return isolated_.cut(); }
23 private:
25 };
26 
28  OneNonIsolatedSelector(double cut) : cut_(cut) { }
29  bool operator()(double i1, double i2) const {
30  return (i1 < cut_ && i2 >= cut_) || (i1 >= cut_ && i2 < cut_);
31  }
32  double cut() const { return cut_; }
33 private:
34  double cut_;
35 };
36 
38  TwoNonIsolatedSelector(double cut) : cut_(cut) { }
39  bool operator()(double i1, double i2) const {
40  return i1 >= cut_ && i2 >= cut_;
41  }
42  double cut() const { return cut_; }
43 private:
44  double cut_;
45 };
46 
56 
57 using namespace reco;
58 using namespace isodeposit;
59 
60 template<typename Isolator>
62 public:
64  isolator_(cfg.template getParameter<double>("isoCut")),
65  ptThreshold(cfg.getUntrackedParameter<double>("ptThreshold")),
66  etEcalThreshold(cfg.getUntrackedParameter<double>("etEcalThreshold")),
67  etHcalThreshold(cfg.getUntrackedParameter<double>("etHcalThreshold")),
68  dRVetoTrk(cfg.getUntrackedParameter<double>("deltaRVetoTrk")),
69  dRTrk(cfg.getUntrackedParameter<double>("deltaRTrk")),
70  dREcal(cfg.getUntrackedParameter<double>("deltaREcal")),
71  dRHcal(cfg.getUntrackedParameter<double>("deltaRHcal")),
72  alpha(cfg.getUntrackedParameter<double>("alpha")),
73  beta(cfg.getUntrackedParameter<double>("beta")),
74  relativeIsolation(cfg.template getParameter<bool>("relativeIsolation")) {
75  }
76 
77  template<typename T>
78  double isolation(const T * t) const {
79  const pat::IsoDeposit * trkIso = t->isoDeposit(pat::TrackIso);
80  const pat::IsoDeposit * ecalIso = t->isoDeposit(pat::EcalIso);
81  const pat::IsoDeposit * hcalIso = t->isoDeposit(pat::HcalIso);
82 
83  Direction dir = Direction(t->eta(), t->phi());
84 
85  IsoDeposit::AbsVetos vetosTrk;
86  vetosTrk.push_back(new ConeVeto( dir, dRVetoTrk ));
87  vetosTrk.push_back(new ThresholdVeto( ptThreshold ));
88 
89  IsoDeposit::AbsVetos vetosEcal;
90  vetosEcal.push_back(new ConeVeto( dir, 0.));
91  vetosEcal.push_back(new ThresholdVeto( etEcalThreshold ));
92 
93  IsoDeposit::AbsVetos vetosHcal;
94  vetosHcal.push_back(new ConeVeto( dir, 0. ));
95  vetosHcal.push_back(new ThresholdVeto( etHcalThreshold ));
96 
97  double isovalueTrk = (trkIso->sumWithin(dRTrk,vetosTrk));
98  double isovalueEcal = (ecalIso->sumWithin(dREcal,vetosEcal));
99  double isovalueHcal = (hcalIso->sumWithin(dRHcal,vetosHcal));
100 
101 
102  double iso = alpha*( ((1+beta)/2*isovalueEcal) + ((1-beta)/2*isovalueHcal) ) + ((1-alpha)*isovalueTrk) ;
103  if(relativeIsolation) iso /= t->pt();
104  return iso;
105  }
106 
107  double candIsolation(const reco::Candidate* c) const {
108  const pat::Muon * mu = dynamic_cast<const pat::Muon *>(c);
109  if(mu != 0) return isolation(mu);
110  const pat::GenericParticle * trk = dynamic_cast<const pat::GenericParticle*>(c);
111  if(trk != 0) return isolation(trk);
113  << "Candidate daughter #0 is neither pat::Muons nor pat::GenericParticle\n";
114  return -1;
115  }
116  bool operator()(const reco::Candidate & z) const {
117  if(z.numberOfDaughters()!=2)
119  << "Candidate has " << z.numberOfDaughters() << " daughters, 2 expected\n";
120  const reco::Candidate * dau0 = z.daughter(0);
121  const reco::Candidate * dau1 = z.daughter(1);
122  if(!(dau0->hasMasterClone()&&dau1->hasMasterClone()))
124  << "Candidate daughters have no master clone\n";
125  const reco::Candidate * m0 = &*dau0->masterClone(), * m1 = &*dau1->masterClone();
126  return isolator_(candIsolation(m0), candIsolation(m1));
127  }
128 private:
129  Isolator isolator_;
130  double ptThreshold,etEcalThreshold,etHcalThreshold, dRVetoTrk, dRTrk, dREcal, dRHcal, alpha, beta;
132 
133 };
134 
138 
142  >
144 
148  >
150 
151 
155  >
157 
161  >
163 
164 
166 
const double beta
float alpha
Definition: AMPTWrapper.h:95
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
SingleObjectSelector< reco::CandidateView, AndSelector< ZToMuMuIsoDepositSelector< TwoNonIsolatedSelector >, StringCutObjectSelector< reco::Candidate > > > ZToMuMuTwoNonIsolatedIDSelector
double candIsolation(const reco::Candidate *c) const
bool operator()(double i1, double i2) const
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Definition: IsoDeposit.cc:138
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
Definition: DDAxes.h:10
SingleObjectSelector< reco::CandidateView, AndSelector< ZToMuMuIsoDepositSelector< NonIsolatedSelector >, StringCutObjectSelector< reco::Candidate > > > ZToMuMuNonIsolatedIDSelector
bool operator()(const reco::Candidate &z) const
bool operator()(double i1, double i2) const
SingleObjectSelector< reco::CandidateView, AndSelector< ZToMuMuIsoDepositSelector< IsolatedSelector >, StringCutObjectSelector< reco::Candidate > > > ZToMuMuIsolatedIDSelector
double candIsolation(const reco::Candidate *c, double ptThreshold, double etEcalThreshold, double etHcalThreshold, double dRVetoTrk, double dRTrk, double dREcal, double dRHcal, double alpha, double beta, bool relativeIsolation)
bool operator()(double i1, double i2) const
DEFINE_FWK_MODULE(CosmicTrackingParticleSelector)
ZToMuMuIsoDepositSelector(const edm::ParameterSet &cfg)
double isolation(const T *t) const
SingleObjectSelector< reco::CandidateView, AndSelector< ZToMuMuIsoDepositSelector< OneNonIsolatedSelector >, StringCutObjectSelector< reco::Candidate > > > ZToMuMuOneNonIsolatedIDSelector
dbl *** dir
Definition: mlp_gen.cc:35
isodeposit::AbsVetos AbsVetos
Definition: IsoDeposit.h:50
Analysis-level muon class.
Definition: Muon.h:47
edm::View< Candidate > CandidateView
view of a collection containing candidates
Definition: CandidateFwd.h:23
def template
Definition: svgfig.py:520
bool operator()(double i1, double i2) const
virtual const CandidateBaseRef & masterClone() const =0