RecoMuon
MuonIdentification
plugins
cuts
MuonPOGStandardCut.cc
Go to the documentation of this file.
1
#include "
PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h
"
2
#include "
PhysicsTools/SelectorUtils/interface/CutApplicatorWithEventContentBase.h
"
3
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
4
#include "
DataFormats/MuonReco/interface/Muon.h
"
5
#include "
DataFormats/MuonReco/interface/MuonSelectors.h
"
6
7
class
MuonPOGStandardCut
:
public
CutApplicatorWithEventContentBase
{
8
public
:
9
MuonPOGStandardCut
(
const
edm::ParameterSet
&
c
);
10
11
result_type
operator()
(
const
reco::MuonPtr
&)
const
final
;
12
CandidateType
candidateType
()
const
final {
return
MUON
; }
13
14
void
setConsumes
(
edm::ConsumesCollector
&)
final
;
15
void
getEventContent
(
const
edm::EventBase
&)
final
;
16
17
double
value
(
const
reco::CandidatePtr
&
cand
)
const
final
;
18
19
private
:
20
enum
CutType
{
LOOSE
,
MEDIUM
,
TIGHT
,
SOFT
,
HIGHPT
,
NONE
}
cutType_
;
21
edm::Handle<reco::VertexCollection>
vtxs_
;
22
};
23
DEFINE_EDM_PLUGIN
(
CutApplicatorFactory
,
MuonPOGStandardCut
,
"MuonPOGStandardCut"
);
24
25
// Define constructors and initialization routines
26
MuonPOGStandardCut::MuonPOGStandardCut
(
const
edm::ParameterSet
&
c
) :
CutApplicatorWithEventContentBase
(
c
) {
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
46
void
MuonPOGStandardCut::setConsumes
(
edm::ConsumesCollector
&
cc
) {
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
54
CutApplicatorBase::result_type
MuonPOGStandardCut::operator()
(
const
reco::MuonPtr
&
cand
)
const
{
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
79
double
MuonPOGStandardCut::value
(
const
reco::CandidatePtr
&
cand
)
const
{
80
edm::Ptr<reco::Muon>
mu
(
cand
);
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
}
Muon.h
MessageLogger.h
muon::isSoftMuon
bool isSoftMuon(const reco::Muon &, const reco::Vertex &, bool run2016_hip_mitigation=false)
Definition:
MuonSelectors.cc:916
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:20
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:20
muon::isLooseMuon
bool isLooseMuon(const reco::Muon &)
Definition:
MuonSelectors.cc:895
MuonSelectors.h
CutApplicatorWithEventContentBase.h
MuonPOGStandardCut
Definition:
MuonPOGStandardCut.cc:7
MuonPOGStandardCut::candidateType
CandidateType candidateType() const final
Definition:
MuonPOGStandardCut.cc:12
MuonPOGStandardCut::setConsumes
void setConsumes(edm::ConsumesCollector &) final
Definition:
MuonPOGStandardCut.cc:46
MuonPOGStandardCut::SOFT
Definition:
MuonPOGStandardCut.cc:20
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:124
CutApplicatorBase::MUON
Definition:
CutApplicatorBase.h:47
muon::isHighPtMuon
bool isHighPtMuon(const reco::Muon &, const reco::Vertex &)
Definition:
MuonSelectors.cc:933
edm::ParameterSet
Definition:
ParameterSet.h:47
MuonPOGStandardCut::value
double value(const reco::CandidatePtr &cand) const final
Definition:
MuonPOGStandardCut.cc:79
CutApplicatorBase::CandidateType
CandidateType
Definition:
CutApplicatorBase.h:47
muon::isTightMuon
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
Definition:
MuonSelectors.cc:880
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
cand
Definition:
decayParser.h:32
MuonPOGStandardCut::operator()
result_type operator()(const reco::MuonPtr &) const final
Definition:
MuonPOGStandardCut.cc:54
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:123
muon::isMediumMuon
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
Definition:
MuonSelectors.cc:899
cc
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
MuonPOGStandardCut::LOOSE
Definition:
MuonPOGStandardCut.cc:20
MuonPOGStandardCut::CutType
CutType
Definition:
MuonPOGStandardCut.cc:20
edm::Ptr< reco::Muon >
MuonPOGStandardCut::getEventContent
void getEventContent(const edm::EventBase &) final
Definition:
MuonPOGStandardCut.cc:51
MuonPOGStandardCut::cutType_
enum MuonPOGStandardCut::CutType cutType_
MuonPOGStandardCut::HIGHPT
Definition:
MuonPOGStandardCut.cc:20
MuonPOGStandardCut::NONE
Definition:
MuonPOGStandardCut.cc:20
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:97
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:21
CutApplicatorBase.h
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:56
edm::InputTag
Definition:
InputTag.h:15
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
CutApplicatorWithEventContentBase
Definition:
CutApplicatorWithEventContentBase.h:19
MuonPOGStandardCut::MuonPOGStandardCut
MuonPOGStandardCut(const edm::ParameterSet &c)
Definition:
MuonPOGStandardCut.cc:26
Generated for CMSSW Reference Manual by
1.8.16