src
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 "
FWCore/MessageLogger/interface/MessageLogger.h
"
4
#include "
DataFormats/MuonReco/interface/Muon.h
"
5
#include "
DataFormats/MuonReco/interface/MuonSelectors.h
"
6
7
class
MuonDzCut
:
public
CutApplicatorWithEventContentBase
{
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
,
MuonDzCut
,
"MuonDzCut"
);
24
25
// Define constructors and initialization routines
26
MuonDzCut::MuonDzCut
(
const
edm::ParameterSet
&
c
)
27
:
CutApplicatorWithEventContentBase
(
c
), maxDz_(
c
.getParameter<double>(
"maxDz"
)) {
28
const
std::string
trackTypeName =
c
.getParameter<
std::string
>(
"trackType"
);
29
trackType_
=
NONE
;
30
if
(trackTypeName ==
"muonBestTrack"
)
31
trackType_
=
MUONBESTTRACK
;
32
else
if
(trackTypeName ==
"innerTrack"
)
33
trackType_
=
INNERTRACK
;
34
else
{
35
edm::LogError
(
"MuonDzCut"
) <<
"Wrong cut id name, "
<< trackTypeName
36
<<
"Choose among \"muonBestTrack\", \"innerTrack\""
;
37
trackType_
=
NONE
;
38
}
39
40
contentTags_
.emplace(
"vertices"
,
c
.getParameter<
edm::InputTag
>(
"vertexSrc"
));
41
contentTags_
.emplace(
"verticesMiniAOD"
,
c
.getParameter<
edm::InputTag
>(
"vertexSrcMiniAOD"
));
42
}
43
44
void
MuonDzCut::setConsumes
(
edm::ConsumesCollector
&
cc
) {
45
contentTokens_
.emplace(
"vertices"
,
cc
.consumes<
reco::VertexCollection
>(
contentTags_
[
"vertices"
]));
46
contentTokens_
.emplace(
"verticesMiniAOD"
,
cc
.consumes<
reco::VertexCollection
>(
contentTags_
[
"verticesMiniAOD"
]));
47
}
48
49
void
MuonDzCut::getEventContent
(
const
edm::EventBase
&
ev
) {
50
ev
.getByLabel(
contentTags_
[
"vertices"
],
vtxs_
);
51
if
(!
vtxs_
.
isValid
())
52
ev
.getByLabel(
contentTags_
[
"verticesMiniAOD"
],
vtxs_
);
53
}
54
55
// Functors for evaluation
56
CutApplicatorBase::result_type
MuonDzCut::operator()
(
const
reco::MuonPtr
&
cand
)
const
{
57
const
auto
& vtxPos =
vtxs_
->at(0).position();
58
59
reco::TrackRef
trackRef;
60
if
(
trackType_
==
INNERTRACK
)
61
trackRef =
cand
->innerTrack();
62
else
if
(
trackType_
==
MUONBESTTRACK
)
63
trackRef =
cand
->muonBestTrack();
64
65
return
trackRef.
isNonnull
() and
std::abs
(trackRef->dz(vtxPos)) <=
maxDz_
;
66
}
67
68
double
MuonDzCut::value
(
const
reco::CandidatePtr
&
cand
)
const
{
69
const
reco::MuonPtr
muon
(
cand
);
70
reco::TrackRef
trackRef;
71
if
(
trackType_
==
INNERTRACK
)
72
trackRef =
muon
->innerTrack();
73
else
if
(
trackType_
==
MUONBESTTRACK
)
74
trackRef =
muon
->muonBestTrack();
75
if
(trackRef.
isNull
())
76
return
-1;
77
78
const
auto
& vtxPos =
vtxs_
->at(0).position();
79
return
std::abs
(trackRef->dz(vtxPos));
80
}
makeMEIFBenchmarkPlots.ev
ev
Definition:
makeMEIFBenchmarkPlots.py:55
CutApplicatorWithEventContentBase
Definition:
CutApplicatorWithEventContentBase.h:19
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition:
CutApplicatorWithEventContentBase.h:35
MessageLogger.h
runTheMatrix.const
const
Definition:
runTheMatrix.py:374
MuonDzCut::trackType_
enum MuonDzCut::BestTrackType trackType_
edm::Ref< TrackCollection >
gpuPixelDoublets::cc
uint32_t cc[maxCellsPerHit]
Definition:
gpuFishbone.h:49
MuonDzCut::vtxs_
edm::Handle< reco::VertexCollection > vtxs_
Definition:
MuonDzCut.cc:19
edm::Handle< reco::VertexCollection >
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition:
Ref.h:238
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition:
VertexFwd.h:9
MuonDzCut::value
double value(const reco::CandidatePtr &) const final
Definition:
MuonDzCut.cc:68
muon
Definition:
MuonCocktails.h:17
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:129
HltBtagPostValidation_cff.c
c
Definition:
HltBtagPostValidation_cff.py:35
MuonDzCut::MuonDzCut
MuonDzCut(const edm::ParameterSet &c)
Definition:
MuonDzCut.cc:26
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edmplugin::PluginFactory
Definition:
PluginFactory.h:35
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:7
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition:
Ref.h:235
edm::EventBase
Definition:
EventBase.h:47
MuonDzCut::setConsumes
void setConsumes(edm::ConsumesCollector &) final
Definition:
MuonDzCut.cc:44
CutApplicatorWithEventContentBase::contentTokens_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition:
CutApplicatorWithEventContentBase.h:40
MuonSelectors.h
MuonDzCut::NONE
Definition:
MuonDzCut.cc:21
MuonDzCut::getEventContent
void getEventContent(const edm::EventBase &) final
Definition:
MuonDzCut.cc:49
edm::HandleBase::isValid
bool isValid() const
Definition:
HandleBase.h:70
MuonDzCut::BestTrackType
BestTrackType
Definition:
MuonDzCut.cc:21
CutApplicatorBase::MUON
Definition:
CutApplicatorBase.h:47
edm::InputTag
Definition:
InputTag.h:15
MuonDzCut::INNERTRACK
Definition:
MuonDzCut.cc:21
MuonDzCut::candidateType
CandidateType candidateType() const final
Definition:
MuonDzCut.cc:12
CutApplicatorBase::CandidateType
CandidateType
Definition:
CutApplicatorBase.h:47
MuonDzCut::operator()
result_type operator()(const reco::MuonPtr &) const final
Definition:
MuonDzCut.cc:56
edm::ParameterSet
Definition:
ParameterSet.h:48
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:123
cand
Definition:
decayParser.h:32
MuonDzCut::maxDz_
const double maxDz_
Definition:
MuonDzCut.cc:20
MuonDzCut::MUONBESTTRACK
Definition:
MuonDzCut.cc:21
CutApplicatorBase.h
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
HLT_2024v10_cff.muon
muon
Definition:
HLT_2024v10_cff.py:9663
Generated for CMSSW Reference Manual by
1.8.14