CMS 3D CMS Logo

MuonPOGStandardCut.cc
Go to the documentation of this file.
5 
7 public:
9 
10  result_type operator()(const reco::MuonPtr&) const final;
11  CandidateType candidateType() const final { return MUON; }
12 
14  void getEventContent(const edm::EventBase&) final;
15 
16  double value(const reco::CandidatePtr& cand) const final;
17 
18 private:
21 };
23 
24 // Define constructors and initialization routines
26  const auto cutTypeName = c.getParameter<std::string>("idName");
27  if (cutTypeName == "loose")
28  cutType_ = LOOSE;
29  else if (cutTypeName == "tight")
30  cutType_ = TIGHT;
31  else if (cutTypeName == "medium")
32  cutType_ = MEDIUM;
33  else if (cutTypeName == "soft")
34  cutType_ = SOFT;
35  else if (cutTypeName == "highpt")
36  cutType_ = HIGHPT;
37  else {
38  edm::LogError("MuonPOGStandardCut") << "Wrong cut id name, " << cutTypeName;
39  cutType_ = NONE;
40  }
41 
42  contentTags_.emplace("vertices", c.getParameter<edm::InputTag>("vertexSrc"));
43 }
44 
46  auto vtcs = cc.consumes<reco::VertexCollection>(contentTags_["vertices"]);
47  contentTokens_.emplace("vertices", vtcs);
48 }
49 
50 void MuonPOGStandardCut::getEventContent(const edm::EventBase& ev) { ev.getByLabel(contentTags_["vertices"], vtxs_); }
51 
52 // Functors for evaluation
54  switch (cutType_) {
55  case LOOSE:
56  return muon::isLooseMuon(*cand);
57  break;
58  case TIGHT:
59  return muon::isTightMuon(*cand, vtxs_->at(0));
60  break;
61  case MEDIUM:
62  return muon::isMediumMuon(*cand);
63  break;
64  case SOFT:
65  return muon::isSoftMuon(*cand, vtxs_->at(0));
66  break;
67  case HIGHPT:
68  return muon::isHighPtMuon(*cand, vtxs_->at(0));
69  break;
70  case NONE:
71  return false;
72  break;
73  }
74 
75  return true;
76 }
77 
80  switch (cutType_) {
81  case LOOSE:
82  return muon::isLooseMuon(*mu);
83  break;
84  case TIGHT:
85  return muon::isTightMuon(*mu, vtxs_->at(0));
86  break;
87  case MEDIUM:
88  return muon::isMediumMuon(*mu);
89  break;
90  case SOFT:
91  return muon::isSoftMuon(*mu, vtxs_->at(0));
92  break;
93  case HIGHPT:
94  return muon::isHighPtMuon(*mu, vtxs_->at(0));
95  break;
96  case NONE:
97  return 0.0;
98  break;
99  }
100  return 1.0;
101 }
Muon.h
muon::isSoftMuon
bool isSoftMuon(const reco::Muon &, const reco::Vertex &, bool run2016_hip_mitigation=false)
Definition: MuonSelectors.cc:931
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
MuonPOGStandardCut::MEDIUM
Definition: MuonPOGStandardCut.cc:19
watchdog.const
const
Definition: watchdog.py:83
edm::Handle< reco::VertexCollection >
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition: CutApplicatorWithEventContentBase.h:35
candidate_functions::CandidateCut::result_type
bool result_type
Definition: CandidateCut.h:11
MuonPOGStandardCut::TIGHT
Definition: MuonPOGStandardCut.cc:19
muon::isLooseMuon
bool isLooseMuon(const reco::Muon &)
Definition: MuonSelectors.cc:910
MuonSelectors.h
CutApplicatorWithEventContentBase.h
MuonPOGStandardCut
Definition: MuonPOGStandardCut.cc:6
MuonPOGStandardCut::candidateType
CandidateType candidateType() const final
Definition: MuonPOGStandardCut.cc:11
MuonPOGStandardCut::setConsumes
void setConsumes(edm::ConsumesCollector &) final
Definition: MuonPOGStandardCut.cc:45
MuonPOGStandardCut::SOFT
Definition: MuonPOGStandardCut.cc:19
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
CutApplicatorBase::MUON
Definition: CutApplicatorBase.h:47
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
muon::isHighPtMuon
bool isHighPtMuon(const reco::Muon &, const reco::Vertex &)
Definition: MuonSelectors.cc:947
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
MuonPOGStandardCut::value
double value(const reco::CandidatePtr &cand) const final
Definition: MuonPOGStandardCut.cc:78
CutApplicatorBase::CandidateType
CandidateType
Definition: CutApplicatorBase.h:47
muon::isTightMuon
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
Definition: MuonSelectors.cc:895
edmplugin::PluginFactory
Definition: PluginFactory.h:34
cand
Definition: decayParser.h:34
MuonPOGStandardCut::operator()
result_type operator()(const reco::MuonPtr &) const final
Definition: MuonPOGStandardCut.cc:53
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
muon::isMediumMuon
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
Definition: MuonSelectors.cc:914
cc
MuonPOGStandardCut::LOOSE
Definition: MuonPOGStandardCut.cc:19
MuonPOGStandardCut::CutType
CutType
Definition: MuonPOGStandardCut.cc:19
edm::Ptr< reco::Muon >
MuonPOGStandardCut::getEventContent
void getEventContent(const edm::EventBase &) final
Definition: MuonPOGStandardCut.cc:50
MuonPOGStandardCut::cutType_
enum MuonPOGStandardCut::CutType cutType_
MuonPOGStandardCut::HIGHPT
Definition: MuonPOGStandardCut.cc:19
MuonPOGStandardCut::NONE
Definition: MuonPOGStandardCut.cc:19
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
CutApplicatorWithEventContentBase::contentTokens_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition: CutApplicatorWithEventContentBase.h:40
edm::EventBase
Definition: EventBase.h:46
MuonPOGStandardCut::vtxs_
edm::Handle< reco::VertexCollection > vtxs_
Definition: MuonPOGStandardCut.cc:20
CutApplicatorBase.h
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
CutApplicatorWithEventContentBase
Definition: CutApplicatorWithEventContentBase.h:19
MuonPOGStandardCut::MuonPOGStandardCut
MuonPOGStandardCut(const edm::ParameterSet &c)
Definition: MuonPOGStandardCut.cc:25