CMS 3D CMS Logo

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 { return i1 < cut_ && i2 < cut_; }
10  double cut() const { return cut_; }
11 
12 private:
13  double cut_;
14 };
15 
18  bool operator()(double i1, double i2) const { return !isolated_(i1, i2); }
19  double cut() const { return isolated_.cut(); }
20 
21 private:
23 };
24 
27  bool operator()(double i1, double i2) const { return (i1 < cut_ && i2 >= cut_) || (i1 >= cut_ && i2 < cut_); }
28  double cut() const { return cut_; }
29 
30 private:
31  double cut_;
32 };
33 
36  bool operator()(double i1, double i2) const { return i1 >= cut_ && i2 >= cut_; }
37  double cut() const { return cut_; }
38 
39 private:
40  double cut_;
41 };
42 
53 
54 using namespace reco;
55 using namespace isodeposit;
56 
57 template <typename Isolator>
59 public:
61  : isolator_(cfg.template getParameter<double>("isoCut")),
62  ptThreshold(cfg.getUntrackedParameter<double>("ptThreshold")),
63  etEcalThreshold(cfg.getUntrackedParameter<double>("etEcalThreshold")),
64  etHcalThreshold(cfg.getUntrackedParameter<double>("etHcalThreshold")),
65  dRVetoTrk(cfg.getUntrackedParameter<double>("deltaRVetoTrk")),
66  dRTrk(cfg.getUntrackedParameter<double>("deltaRTrk")),
67  dREcal(cfg.getUntrackedParameter<double>("deltaREcal")),
68  dRHcal(cfg.getUntrackedParameter<double>("deltaRHcal")),
69  alpha(cfg.getUntrackedParameter<double>("alpha")),
70  beta(cfg.getUntrackedParameter<double>("beta")),
71  relativeIsolation(cfg.template getParameter<bool>("relativeIsolation")) {}
72 
73  template <typename T>
74  double isolation(const T* t) const {
75  const pat::IsoDeposit* trkIso = t->isoDeposit(pat::TrackIso);
76  const pat::IsoDeposit* ecalIso = t->isoDeposit(pat::EcalIso);
77  const pat::IsoDeposit* hcalIso = t->isoDeposit(pat::HcalIso);
78 
79  Direction dir = Direction(t->eta(), t->phi());
80 
81  IsoDeposit::AbsVetos vetosTrk;
82  vetosTrk.push_back(new ConeVeto(dir, dRVetoTrk));
83  vetosTrk.push_back(new ThresholdVeto(ptThreshold));
84 
85  IsoDeposit::AbsVetos vetosEcal;
86  vetosEcal.push_back(new ConeVeto(dir, 0.));
87  vetosEcal.push_back(new ThresholdVeto(etEcalThreshold));
88 
89  IsoDeposit::AbsVetos vetosHcal;
90  vetosHcal.push_back(new ConeVeto(dir, 0.));
91  vetosHcal.push_back(new ThresholdVeto(etHcalThreshold));
92 
93  double isovalueTrk = (trkIso->sumWithin(dRTrk, vetosTrk));
94  double isovalueEcal = (ecalIso->sumWithin(dREcal, vetosEcal));
95  double isovalueHcal = (hcalIso->sumWithin(dRHcal, vetosHcal));
96 
97  double iso =
98  alpha * (((1 + beta) / 2 * isovalueEcal) + ((1 - beta) / 2 * isovalueHcal)) + ((1 - alpha) * isovalueTrk);
100  iso /= t->pt();
101  return iso;
102  }
103 
104  double candIsolation(const reco::Candidate* c) const {
105  const pat::Muon* mu = dynamic_cast<const pat::Muon*>(c);
106  if (mu != nullptr)
107  return isolation(mu);
108  const pat::GenericParticle* trk = dynamic_cast<const pat::GenericParticle*>(c);
109  if (trk != nullptr)
110  return isolation(trk);
112  << "Candidate daughter #0 is neither pat::Muons nor pat::GenericParticle\n";
113  return -1;
114  }
115  bool operator()(const reco::Candidate& z) const {
116  if (z.numberOfDaughters() != 2)
118  << "Candidate has " << z.numberOfDaughters() << " daughters, 2 expected\n";
119  const reco::Candidate* dau0 = z.daughter(0);
120  const reco::Candidate* dau1 = z.daughter(1);
121  if (!(dau0->hasMasterClone() && dau1->hasMasterClone()))
122  throw edm::Exception(edm::errors::InvalidReference) << "Candidate daughters have no master clone\n";
123  const reco::Candidate *m0 = &*dau0->masterClone(), *m1 = &*dau1->masterClone();
124  return isolator_(candIsolation(m0), candIsolation(m1));
125  }
126 
127 private:
128  Isolator isolator_;
131 };
132 
136 
137 typedef SingleObjectSelector<
141 
142 typedef SingleObjectSelector<
146 
147 typedef SingleObjectSelector<
151 
152 typedef SingleObjectSelector<
156 
158 
ZToMuMuIsoDepositSelector::candIsolation
double candIsolation(const reco::Candidate *c) const
Definition: ZToMuMuIsoDepositSelector.cc:104
ewkMuLumiMonitorDQM_cfi.ptThreshold
ptThreshold
Definition: ewkMuLumiMonitorDQM_cfi.py:13
OneNonIsolatedSelector
Definition: ZToMuMuIsoDepositSelector.cc:25
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
reco::CandidateView
edm::View< Candidate > CandidateView
view of a collection containing candidates
Definition: CandidateFwd.h:23
OneNonIsolatedSelector::operator()
bool operator()(double i1, double i2) const
Definition: ZToMuMuIsoDepositSelector.cc:27
zMuMuMuonUserData.dRHcal
dRHcal
Definition: zMuMuMuonUserData.py:19
electrons_cff.bool
bool
Definition: electrons_cff.py:372
pat::EcalIso
Definition: Isolation.h:11
IsoDepositVetos.h
edm::errors::InvalidReference
Definition: EDMException.h:39
StringCutObjectSelector.h
AndSelector
Definition: AndSelector.h:26
ZToMuMuIsoDepositSelector::isolation
double isolation(const T *t) const
Definition: ZToMuMuIsoDepositSelector.cc:74
NonIsolatedSelector
Definition: ZToMuMuIsoDepositSelector.cc:16
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
zMuMuMuonUserData.beta
beta
Definition: zMuMuMuonUserData.py:10
ZMuMuCategoriesSequences_cff.trkIso
trkIso
Definition: ZMuMuCategoriesSequences_cff.py:140
Muon.h
ZToMuMuIsolatedIDSelector
SingleObjectSelector< reco::CandidateView, AndSelector< ZToMuMuIsoDepositSelector< IsolatedSelector >, StringCutObjectSelector< reco::Candidate > > > ZToMuMuIsolatedIDSelector
Definition: ZToMuMuIsoDepositSelector.cc:140
GenericParticle.h
SingleObjectSelector.h
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
IsolatedSelector::cut_
double cut_
Definition: ZToMuMuIsoDepositSelector.cc:13
NonIsolatedSelector::cut
double cut() const
Definition: ZToMuMuIsoDepositSelector.cc:19
ZToMuMuIsoDepositSelector
Definition: ZToMuMuIsoDepositSelector.cc:58
NonIsolatedSelector::isolated_
IsolatedSelector isolated_
Definition: ZToMuMuIsoDepositSelector.cc:22
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
pat::Muon
Analysis-level muon class.
Definition: Muon.h:51
ZToMuMuOneNonIsolatedIDSelector
SingleObjectSelector< reco::CandidateView, AndSelector< ZToMuMuIsoDepositSelector< OneNonIsolatedSelector >, StringCutObjectSelector< reco::Candidate > > > ZToMuMuOneNonIsolatedIDSelector
Definition: ZToMuMuIsoDepositSelector.cc:150
ZToMuMuNonIsolatedIDSelector
SingleObjectSelector< reco::CandidateView, AndSelector< ZToMuMuIsoDepositSelector< NonIsolatedSelector >, StringCutObjectSelector< reco::Candidate > > > ZToMuMuNonIsolatedIDSelector
Definition: ZToMuMuIsoDepositSelector.cc:145
IsoDepositDirection.h
IsolatedSelector::cut
double cut() const
Definition: ZToMuMuIsoDepositSelector.cc:10
edm::Exception
Definition: EDMException.h:77
EDMException.h
TwoNonIsolatedSelector::TwoNonIsolatedSelector
TwoNonIsolatedSelector(double cut)
Definition: ZToMuMuIsoDepositSelector.cc:35
reco::isodeposit::ConeVeto
Definition: IsoDepositVetos.h:9
candIsolation
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)
Definition: ZToLLEdmNtupleDumper.cc:105
NonIsolatedSelector::NonIsolatedSelector
NonIsolatedSelector(double cut)
Definition: ZToMuMuIsoDepositSelector.cc:17
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
zMuMuMuonUserData.dREcal
dREcal
Definition: zMuMuMuonUserData.py:18
ZToMuMuIsoDepositSelector::relativeIsolation
bool relativeIsolation
Definition: ZToMuMuIsoDepositSelector.cc:130
zMuMuMuonUserData.dRTrk
dRTrk
Definition: zMuMuMuonUserData.py:17
reco::IsoDeposit::AbsVetos
isodeposit::AbsVetos AbsVetos
Definition: IsoDeposit.h:53
ZToMuMuIsoDepositSelector::operator()
bool operator()(const reco::Candidate &z) const
Definition: ZToMuMuIsoDepositSelector.cc:115
TwoNonIsolatedSelector::cut_
double cut_
Definition: ZToMuMuIsoDepositSelector.cc:40
reco::Candidate::hasMasterClone
virtual bool hasMasterClone() const =0
Isolation.h
OrderedSet.t
t
Definition: OrderedSet.py:90
IsoDeposit.h
TwoNonIsolatedSelector::cut
double cut() const
Definition: ZToMuMuIsoDepositSelector.cc:37
pat::GenericParticle
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed)
Definition: GenericParticle.h:38
edm::ParameterSet
Definition: ParameterSet.h:36
ZMuMuCategoriesNtuples_cff.relativeIsolation
relativeIsolation
Definition: ZMuMuCategoriesNtuples_cff.py:27
zMuMuMuonUserData.dRVetoTrk
dRVetoTrk
Definition: zMuMuMuonUserData.py:16
pat::TrackIso
Definition: Isolation.h:10
reco::IsoDeposit::sumWithin
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Definition: IsoDeposit.cc:137
OneNonIsolatedSelector::cut
double cut() const
Definition: ZToMuMuIsoDepositSelector.cc:28
pat::HcalIso
Definition: Isolation.h:12
zMuMuMuonUserData.etEcalThreshold
etEcalThreshold
Definition: zMuMuMuonUserData.py:14
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
OneNonIsolatedSelector::OneNonIsolatedSelector
OneNonIsolatedSelector(double cut)
Definition: ZToMuMuIsoDepositSelector.cc:26
SingleObjectSelectorBase
Definition: SingleObjectSelector.h:26
reco::isodeposit::ThresholdVeto
Definition: IsoDepositVetos.h:21
ZToMuMuIsoDepositSelector::ZToMuMuIsoDepositSelector
ZToMuMuIsoDepositSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
Definition: ZToMuMuIsoDepositSelector.cc:60
looper.cfg
cfg
Definition: looper.py:297
reco::Candidate
Definition: Candidate.h:27
ZToMuMuIsoDepositSelector::ptThreshold
double ptThreshold
Definition: ZToMuMuIsoDepositSelector.cc:129
TwoNonIsolatedSelector::operator()
bool operator()(double i1, double i2) const
Definition: ZToMuMuIsoDepositSelector.cc:36
AndSelector.h
NonIsolatedSelector::operator()
bool operator()(double i1, double i2) const
Definition: ZToMuMuIsoDepositSelector.cc:18
IsolatedSelector::operator()
bool operator()(double i1, double i2) const
Definition: ZToMuMuIsoDepositSelector.cc:9
T
long double T
Definition: Basic3DVectorLD.h:48
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
StringCutObjectSelector< reco::Candidate >
Exception
Definition: hltDiff.cc:246
ZToMuMuIsoDepositSelector::isolator_
Isolator isolator_
Definition: ZToMuMuIsoDepositSelector.cc:128
OneNonIsolatedSelector::cut_
double cut_
Definition: ZToMuMuIsoDepositSelector.cc:31
reco::IsoDeposit
Definition: IsoDeposit.h:49
reco::Candidate::masterClone
virtual const CandidateBaseRef & masterClone() const =0
IsolatedSelector
Definition: ZToMuMuIsoDepositSelector.cc:7
TwoNonIsolatedSelector
Definition: ZToMuMuIsoDepositSelector.cc:34
ConsumesCollector.h
IsoDepositFwd.h
ParameterSet.h
ZToMuMuTwoNonIsolatedIDSelector
SingleObjectSelector< reco::CandidateView, AndSelector< ZToMuMuIsoDepositSelector< TwoNonIsolatedSelector >, StringCutObjectSelector< reco::Candidate > > > ZToMuMuTwoNonIsolatedIDSelector
Definition: ZToMuMuIsoDepositSelector.cc:155
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
zMuMuMuonUserData.etHcalThreshold
etHcalThreshold
Definition: zMuMuMuonUserData.py:15
isolation
double isolation
Definition: AssociatedVariableMaxCutCandRefSelector.cc:25
IsolatedSelector::IsolatedSelector
IsolatedSelector(double cut)
Definition: ZToMuMuIsoDepositSelector.cc:8
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23