Main Page
Namespaces
Classes
Package Documentation
src
RecoMuon
MuonIdentification
plugins
cuts
MuonDxyCut.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
MuonDxyCut
:
public
CutApplicatorWithEventContentBase
7
{
8
public
:
9
MuonDxyCut
(
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
maxDxy_
;
21
enum
BestTrackType
{
INNERTRACK
,
MUONBESTTRACK
,
NONE
}
trackType_
;
22
};
23
DEFINE_EDM_PLUGIN
(
CutApplicatorFactory
,
24
MuonDxyCut
,
"MuonDxyCut"
);
25
26
// Define constructors and initialization routines
27
MuonDxyCut::MuonDxyCut
(
const
edm::ParameterSet
&
c
):
28
CutApplicatorWithEventContentBase
(c),
29
maxDxy_
(c.getParameter<double>(
"maxDxy"
))
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
(
"MuonDxyCut"
) <<
"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
MuonDxyCut::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
MuonDxyCut::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
MuonDxyCut::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->dxy(vtxPos)) <=
maxDxy_
;
68
}
69
70
double
MuonDxyCut::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->dxy(vtxPos));
80
}
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition:
ConsumesCollector.h:49
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
MuonDxyCut::INNERTRACK
Definition:
MuonDxyCut.cc:21
reco::Muon::innerTrack
virtual TrackRef innerTrack() const
Definition:
Muon.h:48
edm::Ref< TrackCollection >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
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
MuonDxyCut::MuonDxyCut
MuonDxyCut(const edm::ParameterSet &c)
Definition:
MuonDxyCut.cc:27
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition:
CutApplicatorWithEventContentBase.h:39
MuonDxyCut::operator()
result_type operator()(const reco::MuonPtr &) const final
Definition:
MuonDxyCut.cc:59
MuonDxyCut::trackType_
enum MuonDxyCut::BestTrackType trackType_
MuonDxyCut::getEventContent
void getEventContent(const edm::EventBase &) final
Definition:
MuonDxyCut.cc:52
MuonDxyCut::vtxs_
edm::Handle< reco::VertexCollection > vtxs_
Definition:
MuonDxyCut.cc:19
edm::LogError
Definition:
MessageLogger.h:183
reco::Muon::muonBestTrack
virtual TrackRef muonBestTrack() const
Definition:
Muon.h:63
edmplugin::PluginFactory
Definition:
PluginFactory.h:33
MuonDxyCut::MUONBESTTRACK
Definition:
MuonDxyCut.cc:21
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 >
MuonDxyCut::BestTrackType
BestTrackType
Definition:
MuonDxyCut.cc:21
Muon.h
edm::HandleBase::isValid
bool isValid() const
Definition:
HandleBase.h:74
MuonDxyCut::NONE
Definition:
MuonDxyCut.cc:21
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition:
Ref.h:248
edm::EventBase
Definition:
EventBase.h:46
metsig::muon
Definition:
SignAlgoResolutions.h:40
MuonSelectors.h
MuonDxyCut::maxDxy_
const double maxDxy_
Definition:
MuonDxyCut.cc:20
CutApplicatorBase::MUON
Definition:
CutApplicatorBase.h:48
edm::EventBase::getByLabel
bool getByLabel(InputTag const &, Handle< T > &) const
Definition:
EventBase.h:92
edm::InputTag
Definition:
InputTag.h:15
MuonDxyCut::value
double value(const reco::CandidatePtr &) const final
Definition:
MuonDxyCut.cc:70
CutApplicatorBase::CandidateType
CandidateType
Definition:
CutApplicatorBase.h:47
MuonDxyCut::candidateType
CandidateType candidateType() const final
Definition:
MuonDxyCut.cc:12
edm::ParameterSet
Definition:
ParameterSet.h:36
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:121
cand
Definition:
decayParser.h:34
CutApplicatorBase.h
MuonDxyCut::setConsumes
void setConsumes(edm::ConsumesCollector &) final
Definition:
MuonDxyCut.cc:46
MuonDxyCut
Definition:
MuonDxyCut.cc:6
edm::ConsumesCollector
Definition:
ConsumesCollector.h:39
Generated for CMSSW Reference Manual by
1.8.11