CMS 3D CMS Logo

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