RecoMuon
MuonIdentification
plugins
MuonRefProducer.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: MuonIdentification
4
// Class: MuonRefProducer
5
//
6
//
7
// Original Author: Dmytro Kovalskyi
8
//
9
//
10
11
// user include files
12
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
13
//#include "FWCore/Framework/interface/EDProducer.h"
14
15
#include "
FWCore/Framework/interface/Event.h
"
16
#include "
FWCore/Framework/interface/EventSetup.h
"
17
18
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
19
20
#include "
DataFormats/Common/interface/Handle.h
"
21
#include "
DataFormats/MuonReco/interface/Muon.h
"
22
23
#include "
RecoMuon/MuonIdentification/plugins/MuonRefProducer.h
"
24
#include "
DataFormats/Common/interface/Ref.h
"
25
#include "
DataFormats/Common/interface/RefVector.h
"
26
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
27
#include "
DataFormats/MuonReco/interface/MuonSelectors.h
"
28
29
MuonRefProducer::MuonRefProducer
(
const
edm::ParameterSet
& iConfig) {
30
theReferenceCollection_
= iConfig.
getParameter
<
edm::InputTag
>(
"ReferenceCollection"
);
31
muonToken_
= consumes<reco::MuonCollection>(
theReferenceCollection_
);
32
33
type_
=
muon::TMLastStation
;
// default type
34
std::string
type
= iConfig.
getParameter
<
std::string
>(
"algorithmType"
);
35
if
(
type
!=
"TMLastStation"
)
36
edm::LogWarning
(
"MuonIdentification"
)
37
<<
"Unknown algorithm type is requested: "
<<
type
<<
"\nUsing the default one."
;
38
39
minNumberOfMatches_
= iConfig.
getParameter
<
int
>(
"minNumberOfMatchedStations"
);
40
maxAbsDx_
= iConfig.
getParameter
<
double
>(
"maxAbsDx"
);
41
maxAbsPullX_
= iConfig.
getParameter
<
double
>(
"maxAbsPullX"
);
42
maxAbsDy_
= iConfig.
getParameter
<
double
>(
"maxAbsDy"
);
43
maxAbsPullY_
= iConfig.
getParameter
<
double
>(
"maxAbsPullY"
);
44
maxChamberDist_
= iConfig.
getParameter
<
double
>(
"maxChamberDistance"
);
45
maxChamberDistPull_
= iConfig.
getParameter
<
double
>(
"maxChamberDistancePull"
);
46
47
std::string
arbitrationType = iConfig.
getParameter
<
std::string
>(
"arbitrationType"
);
48
if
(arbitrationType ==
"NoArbitration"
)
49
arbitrationType_
=
reco::Muon::NoArbitration
;
50
else
if
(arbitrationType ==
"SegmentArbitration"
)
51
arbitrationType_
=
reco::Muon::SegmentArbitration
;
52
else
if
(arbitrationType ==
"SegmentAndTrackArbitration"
)
53
arbitrationType_
=
reco::Muon::SegmentAndTrackArbitration
;
54
else
{
55
edm::LogWarning
(
"MuonIdentification"
)
56
<<
"Unknown arbitration type is requested: "
<< arbitrationType <<
"\nUsing the default one"
;
57
arbitrationType_
=
reco::Muon::SegmentAndTrackArbitration
;
58
}
59
produces<edm::RefVector<std::vector<reco::Muon>>>();
60
}
61
62
MuonRefProducer::~MuonRefProducer
() {}
63
64
void
MuonRefProducer::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const
{
65
auto
outputCollection = std::make_unique<edm::RefVector<std::vector<reco::Muon>>>();
66
67
edm::Handle<reco::MuonCollection>
muons
;
68
iEvent
.getByToken(
muonToken_
,
muons
);
69
70
// loop over input collection
71
for
(
unsigned
int
i
= 0;
i
<
muons
->size(); ++
i
)
72
if
(
muon::isGoodMuon
((*
muons
)[
i
],
73
type_
,
74
minNumberOfMatches_
,
75
maxAbsDx_
,
76
maxAbsPullX_
,
77
maxAbsDy_
,
78
maxAbsPullY_
,
79
maxChamberDist_
,
80
maxChamberDistPull_
,
81
arbitrationType_
))
82
outputCollection->push_back(
edm::RefVector
<std::vector<reco::Muon>>::
value_type
(
muons
,
i
));
83
iEvent
.put(
std::move
(outputCollection));
84
}
edm::StreamID
Definition:
StreamID.h:30
PDWG_BPHSkim_cff.muons
muons
Definition:
PDWG_BPHSkim_cff.py:47
Handle.h
mps_fire.i
i
Definition:
mps_fire.py:428
Muon.h
MessageLogger.h
reco::Muon::SegmentAndTrackArbitration
Definition:
Muon.h:190
reco::Muon::SegmentArbitration
Definition:
Muon.h:189
muon::TMLastStation
Definition:
MuonSelectors.h:154
MuonRefProducer::~MuonRefProducer
~MuonRefProducer() override
Definition:
MuonRefProducer.cc:62
edm::RefVector
Definition:
EDProductfwd.h:27
edm::Handle< reco::MuonCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
MuonRefProducer::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition:
MuonRefProducer.h:34
MuonRefProducer::type_
muon::AlgorithmType type_
Definition:
MuonRefProducer.h:36
MuonRefProducer::maxChamberDist_
double maxChamberDist_
Definition:
MuonRefProducer.h:42
muon::isGoodMuon
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
Definition:
MuonSelectors.cc:649
MuonSelectors.h
MuonRefProducer.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
MuonRefProducer::maxAbsDy_
double maxAbsDy_
Definition:
MuonRefProducer.h:40
reco::Muon::NoArbitration
Definition:
Muon.h:188
edm::ParameterSet
Definition:
ParameterSet.h:47
MuonRefProducer::MuonRefProducer
MuonRefProducer(const edm::ParameterSet &)
Definition:
MuonRefProducer.cc:29
RefVector.h
Event.h
MuonRefProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition:
MuonRefProducer.cc:64
type
type
Definition:
SiPixelVCal_PayloadInspector.cc:37
MuonRefProducer::maxChamberDistPull_
double maxChamberDistPull_
Definition:
MuonRefProducer.h:43
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:57
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
MuonRefProducer::maxAbsPullY_
double maxAbsPullY_
Definition:
MuonRefProducer.h:41
MuonRefProducer::maxAbsPullX_
double maxAbsPullX_
Definition:
MuonRefProducer.h:39
MuonRefProducer::maxAbsDx_
double maxAbsDx_
Definition:
MuonRefProducer.h:38
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Ref.h
Frameworkfwd.h
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
MuonRefProducer::arbitrationType_
reco::Muon::ArbitrationType arbitrationType_
Definition:
MuonRefProducer.h:44
ParameterSet.h
MuonRefProducer::theReferenceCollection_
edm::InputTag theReferenceCollection_
Definition:
MuonRefProducer.h:33
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
MuonRefProducer::minNumberOfMatches_
int minNumberOfMatches_
Definition:
MuonRefProducer.h:37
Generated for CMSSW Reference Manual by
1.8.16