Main Page
Namespaces
Classes
Package Documentation
RecoMuon
MuonIdentification
plugins
cuts
MuonDzCut.cc
Go to the documentation of this file.
1
#include "
PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h
"
2
#include "
PhysicsTools/SelectorUtils/interface/CutApplicatorWithEventContentBase.h
"
3
#include "
DataFormats/MuonReco/interface/Muon.h
"
4
#include "
DataFormats/MuonReco/interface/MuonSelectors.h
"
5
6
class
MuonDzCut
:
public
CutApplicatorWithEventContentBase
7
{
8
public
:
9
MuonDzCut
(
const
edm::ParameterSet
&
c
);
10
11
result_type
operator()
(
const
reco::MuonPtr
&)
const
final
;
12
CandidateType
candidateType
() const final {
return
MUON
; }
13
double
value
(
const
reco::CandidatePtr
&)
const
final
;
14
15
void
setConsumes
(
edm::ConsumesCollector
&)
final
;
16
void
getEventContent
(
const
edm::EventBase
&)
final
;
17
18
private
:
19
edm::Handle<reco::VertexCollection>
vtxs_
;
20
const
double
maxDz_
;
21
enum
BestTrackType
{
INNERTRACK
,
MUONBESTTRACK
,
NONE
}
trackType_
;
22
};
23
DEFINE_EDM_PLUGIN
(
CutApplicatorFactory
,
24
MuonDzCut
,
"MuonDzCut"
);
25
26
// Define constructors and initialization routines
27
MuonDzCut::MuonDzCut
(
const
edm::ParameterSet
&
c
):
28
CutApplicatorWithEventContentBase
(c),
29
maxDz_
(c.getParameter<double>(
"maxDz"
))
30
{
31
const
std::string
trackTypeName = c.
getParameter
<
std::string
>(
"trackType"
);
32
trackType_
=
NONE
;
33
if
( trackTypeName ==
"muonBestTrack"
) trackType_ =
MUONBESTTRACK
;
34
else
if
( trackTypeName ==
"innerTrack"
) trackType_ =
INNERTRACK
;
35
else
36
{
37
edm::LogError
(
"MuonDzCut"
) <<
"Wrong cut id name, "
<< trackTypeName
38
<<
"Choose among \"muonBestTrack\", \"innerTrack\""
;
39
trackType_ =
NONE
;
40
}
41
42
contentTags_
.emplace(
"vertices"
, c.
getParameter
<
edm::InputTag
>(
"vertexSrc"
));
43
contentTags_
.emplace(
"verticesMiniAOD"
, c.
getParameter
<
edm::InputTag
>(
"vertexSrcMiniAOD"
));
44
}
45
46
void
MuonDzCut::setConsumes
(
edm::ConsumesCollector
& cc)
47
{
48
contentTokens_
.emplace(
"vertices"
, cc.
consumes
<
reco::VertexCollection
>(
contentTags_
[
"vertices"
]));
49
contentTokens_
.emplace(
"verticesMiniAOD"
, cc.
consumes
<
reco::VertexCollection
>(
contentTags_
[
"verticesMiniAOD"
]));
50
}
51
52
void
MuonDzCut::getEventContent
(
const
edm::EventBase
&
ev
)
53
{
54
ev.
getByLabel
(
contentTags_
[
"vertices"
],
vtxs_
);
55
if
( !
vtxs_
.
isValid
() ) ev.
getByLabel
(
contentTags_
[
"verticesMiniAOD"
],
vtxs_
);
56
}
57
58
// Functors for evaluation
59
CutApplicatorBase::result_type
MuonDzCut::operator()
(
const
reco::MuonPtr
&
cand
)
const
60
{
61
const
auto
& vtxPos =
vtxs_
->at(0).position();
62
63
reco::TrackRef
trackRef;
64
if
(
trackType_
==
INNERTRACK
) trackRef = cand->
innerTrack
();
65
else
if
(
trackType_
==
MUONBESTTRACK
) trackRef = cand->
muonBestTrack
();
66
67
return
trackRef.
isNonnull
() and
std::abs
(trackRef->dz(vtxPos)) <=
maxDz_
;
68
}
69
70
double
MuonDzCut::value
(
const
reco::CandidatePtr
&
cand
)
const
71
{
72
const
reco::MuonPtr
muon
(cand);
73
reco::TrackRef
trackRef;
74
if
(
trackType_
==
INNERTRACK
) trackRef = muon->
innerTrack
();
75
else
if
(
trackType_
==
MUONBESTTRACK
) trackRef = muon->
muonBestTrack
();
76
if
( trackRef.
isNull
() )
return
-1;
77
78
const
auto
& vtxPos =
vtxs_
->at(0).position();
79
return
std::abs
(trackRef->dz(vtxPos));
80
}
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition:
ConsumesCollector.h:52
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CutApplicatorWithEventContentBase
Definition:
CutApplicatorWithEventContentBase.h:19
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition:
Ref.h:251
MuonDzCut::value
double value(const reco::CandidatePtr &) const final
Definition:
MuonDzCut.cc:70
reco::Muon::innerTrack
virtual TrackRef innerTrack() const
Definition:
Muon.h:48
MuonDzCut::trackType_
enum MuonDzCut::BestTrackType trackType_
edm::Ref< TrackCollection >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
MuonDzCut::vtxs_
edm::Handle< reco::VertexCollection > vtxs_
Definition:
MuonDzCut.cc:19
CutApplicatorWithEventContentBase::contentTokens_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition:
CutApplicatorWithEventContentBase.h:44
EnergyCorrector.c
c
Definition:
EnergyCorrector.py:44
edm::Handle< reco::VertexCollection >
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition:
VertexFwd.h:9
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:95
MuonDzCut::MuonDzCut
MuonDzCut(const edm::ParameterSet &c)
Definition:
MuonDzCut.cc:27
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition:
CutApplicatorWithEventContentBase.h:39
edm::LogError
Definition:
MessageLogger.h:174
MuonDzCut::candidateType
CandidateType candidateType() const final
Definition:
MuonDzCut.cc:12
reco::Muon::muonBestTrack
virtual TrackRef muonBestTrack() const
Definition:
Muon.h:63
edmplugin::PluginFactory
Definition:
PluginFactory.h:32
MuonDzCut::operator()
result_type operator()(const reco::MuonPtr &) const final
Definition:
MuonDzCut.cc:59
candidate_functions::CandidateCut::result_type
bool result_type
Definition:
CandidateCut.h:11
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
CutApplicatorWithEventContentBase.h
edm::Ptr< reco::Muon >
Muon.h
MuonDzCut
Definition:
MuonDzCut.cc:6
edm::HandleBase::isValid
bool isValid() const
Definition:
HandleBase.h:74
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition:
Ref.h:248
edm::EventBase
Definition:
EventBase.h:46
MuonDzCut::setConsumes
void setConsumes(edm::ConsumesCollector &) final
Definition:
MuonDzCut.cc:46
metsig::muon
Definition:
SignAlgoResolutions.h:40
MuonSelectors.h
MuonDzCut::NONE
Definition:
MuonDzCut.cc:21
MuonDzCut::getEventContent
void getEventContent(const edm::EventBase &) final
Definition:
MuonDzCut.cc:52
MuonDzCut::BestTrackType
BestTrackType
Definition:
MuonDzCut.cc:21
CutApplicatorBase::MUON
Definition:
CutApplicatorBase.h:48
edm::EventBase::getByLabel
bool getByLabel(InputTag const &, Handle< T > &) const
Definition:
EventBase.h:94
edm::InputTag
Definition:
InputTag.h:15
MuonDzCut::INNERTRACK
Definition:
MuonDzCut.cc:21
CutApplicatorBase::CandidateType
CandidateType
Definition:
CutApplicatorBase.h:47
edm::ParameterSet
Definition:
ParameterSet.h:36
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:109
cand
Definition:
decayParser.h:34
MuonDzCut::maxDz_
const double maxDz_
Definition:
MuonDzCut.cc:20
MuonDzCut::MUONBESTTRACK
Definition:
MuonDzCut.cc:21
CutApplicatorBase.h
edm::ConsumesCollector
Definition:
ConsumesCollector.h:39
Generated for CMSSW Reference Manual by
1.8.11