RecoMuon
MuonIdentification
plugins
MuonShowerInformationProducer.cc
Go to the documentation of this file.
1
#include <string>
2
#include <vector>
3
4
#include "
DataFormats/Common/interface/ValueMap.h
"
5
#include "
DataFormats/MuonReco/interface/MuonFwd.h
"
6
#include "
DataFormats/MuonReco/interface/Muon.h
"
7
#include "
DataFormats/TrackReco/interface/Track.h
"
8
#include "
DataFormats/TrackReco/interface/TrackFwd.h
"
9
10
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
11
#include "
FWCore/Framework/interface/Event.h
"
12
#include "
FWCore/Framework/interface/EventSetup.h
"
13
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
14
#include "
FWCore/Framework/interface/MakerMacros.h
"
15
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
16
17
#include "
RecoMuon/MuonIdentification/interface/MuonShowerInformationFiller.h
"
18
19
class
MuonShowerInformationProducer
:
public
edm::stream::EDProducer
<> {
20
public
:
21
MuonShowerInformationProducer
(
const
edm::ParameterSet
& iConfig)
22
:
inputMuonCollection_
(iConfig.getParameter<
edm
::
InputTag
>(
"muonCollection"
)),
23
inputTrackCollection_
(iConfig.getParameter<
edm
::
InputTag
>(
"trackCollection"
)) {
24
edm::ConsumesCollector
iC = consumesCollector();
25
showerFiller_
=
new
MuonShowerInformationFiller
(
26
iConfig.
getParameter
<
edm::ParameterSet
>(
"ShowerInformationFillerParameters"
), iC);
27
28
muonToken_
= consumes<reco::MuonCollection>(
inputMuonCollection_
);
29
30
produces<edm::ValueMap<reco::MuonShower>>().setBranchAlias(
"muonShowerInformation"
);
31
}
32
~MuonShowerInformationProducer
()
override
{
33
if
(
showerFiller_
)
34
delete
showerFiller_
;
35
}
36
37
private
:
38
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
39
edm::InputTag
inputMuonCollection_
;
40
edm::InputTag
inputTrackCollection_
;
41
edm::EDGetTokenT<reco::MuonCollection>
muonToken_
;
42
43
MuonShowerInformationFiller
*
showerFiller_
;
44
};
45
46
void
MuonShowerInformationProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
47
edm::Handle<reco::MuonCollection>
muons
;
48
iEvent
.getByToken(
muonToken_
,
muons
);
49
50
// reserve some space for output
51
std::vector<reco::MuonShower> showerInfoValues;
52
showerInfoValues.reserve(
muons
->size());
53
54
for
(reco::MuonCollection::const_iterator
muon
=
muons
->begin();
muon
!=
muons
->end(); ++
muon
) {
55
// if (!muon->isGlobalMuon() && !muon->isStandAloneMuon()) continue;
56
showerInfoValues.push_back(
showerFiller_
->
fillShowerInformation
(*
muon
,
iEvent
, iSetup));
57
}
58
59
// create and fill value map
60
auto
outC = std::make_unique<edm::ValueMap<reco::MuonShower>>();
61
edm::ValueMap<reco::MuonShower>::Filler
fillerC(*outC);
62
fillerC.insert(
muons
, showerInfoValues.begin(), showerInfoValues.end());
63
fillerC.fill();
64
65
// put value map into event
66
iEvent
.put(
std::move
(outC));
67
}
68
DEFINE_FWK_MODULE
(
MuonShowerInformationProducer
);
MuonShowerInformationFiller.h
PDWG_BPHSkim_cff.muons
muons
Definition:
PDWG_BPHSkim_cff.py:47
MuonShowerInformationProducer::MuonShowerInformationProducer
MuonShowerInformationProducer(const edm::ParameterSet &iConfig)
Definition:
MuonShowerInformationProducer.cc:21
MuonShowerInformationProducer::showerFiller_
MuonShowerInformationFiller * showerFiller_
Definition:
MuonShowerInformationProducer.cc:43
Muon.h
muon
Definition:
MuonCocktails.h:17
edm::EDGetTokenT< reco::MuonCollection >
edm
HLT enums.
Definition:
AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89281
EDProducer.h
MuonShowerInformationProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
MuonShowerInformationProducer.cc:46
edm::Handle< reco::MuonCollection >
MuonShowerInformationFiller
Definition:
MuonShowerInformationFiller.h:63
MakerMacros.h
Track.h
MuonShowerInformationProducer::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition:
MuonShowerInformationProducer.cc:41
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
MuonShowerInformationProducer
Definition:
MuonShowerInformationProducer.cc:19
HLT_FULL_cff.muon
muon
Definition:
HLT_FULL_cff.py:11710
MuonFwd.h
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
MuonShowerInformationProducer::~MuonShowerInformationProducer
~MuonShowerInformationProducer() override
Definition:
MuonShowerInformationProducer.cc:32
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::stream::EDProducer
Definition:
EDProducer.h:38
edm::EventSetup
Definition:
EventSetup.h:58
MuonShowerInformationProducer::inputTrackCollection_
edm::InputTag inputTrackCollection_
Definition:
MuonShowerInformationProducer.cc:40
ValueMap.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Frameworkfwd.h
MuonShowerInformationProducer::inputMuonCollection_
edm::InputTag inputMuonCollection_
Definition:
MuonShowerInformationProducer.cc:39
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
MuonShowerInformationFiller::fillShowerInformation
reco::MuonShower fillShowerInformation(const reco::Muon &muon, const edm::Event &, const edm::EventSetup &)
fill muon shower variables
Definition:
MuonShowerInformationFiller.cc:109
edm::helper::Filler
Definition:
ValueMap.h:22
ParameterSet.h
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
Generated for CMSSW Reference Manual by
1.8.16