CMS 3D CMS Logo

MuonTimingProducer.cc
Go to the documentation of this file.
1 //
2 // Package: MuonTimingProducer
3 // Class: MuonTimingProducer
4 //
12 //
13 // Original Author: Piotr Traczyk, CERN
14 // Created: Mon Mar 16 12:27:22 CET 2009
15 //
16 //
17 
18 // system include files
19 #include <memory>
20 
21 // user include files
23 //#include "FWCore/Framework/interface/EDProducer.h"
24 
27 
29 
34 
37 
38 //
39 // constructors and destructor
40 //
42  produces<reco::MuonTimeExtraMap>("combined");
43  produces<reco::MuonTimeExtraMap>("dt");
44  produces<reco::MuonTimeExtraMap>("csc");
45 
46  m_muonCollection = iConfig.getParameter<edm::InputTag>("MuonCollection");
47  muonToken_ = consumes<reco::MuonCollection>(m_muonCollection);
48  // Load parameters for the TimingFiller
49  edm::ParameterSet fillerParameters = iConfig.getParameter<edm::ParameterSet>("TimingFillerParameters");
50  theTimingFiller_ = new MuonTimingFiller(fillerParameters, consumesCollector());
51 }
52 
54  if (theTimingFiller_)
55  delete theTimingFiller_;
56 }
57 
58 //
59 // member functions
60 //
61 
62 // ------------ method called to produce the data ------------
64  auto muonTimeMap = std::make_unique<reco::MuonTimeExtraMap>();
66  auto muonTimeMapDT = std::make_unique<reco::MuonTimeExtraMap>();
67  reco::MuonTimeExtraMap::Filler fillerDT(*muonTimeMapDT);
68  auto muonTimeMapCSC = std::make_unique<reco::MuonTimeExtraMap>();
69  reco::MuonTimeExtraMap::Filler fillerCSC(*muonTimeMapCSC);
70 
72  iEvent.getByToken(muonToken_, muons);
73 
74  unsigned int nMuons = muons->size();
75 
76  std::vector<reco::MuonTimeExtra> dtTimeColl(nMuons);
77  std::vector<reco::MuonTimeExtra> cscTimeColl(nMuons);
78  std::vector<reco::MuonTimeExtra> combinedTimeColl(nMuons);
79 
80  for (unsigned int i = 0; i < nMuons; ++i) {
81  reco::MuonTimeExtra dtTime;
82  reco::MuonTimeExtra cscTime;
83  reco::MuonTime rpcTime;
84  reco::MuonTimeExtra combinedTime;
85 
86  reco::MuonRef muonr(muons, i);
87 
88  theTimingFiller_->fillTiming(*muonr, dtTime, cscTime, rpcTime, combinedTime, iEvent, iSetup);
89 
90  dtTimeColl[i] = dtTime;
91  cscTimeColl[i] = cscTime;
92  combinedTimeColl[i] = combinedTime;
93  }
94 
95  filler.insert(muons, combinedTimeColl.begin(), combinedTimeColl.end());
96  filler.fill();
97  fillerDT.insert(muons, dtTimeColl.begin(), dtTimeColl.end());
98  fillerDT.fill();
99  fillerCSC.insert(muons, cscTimeColl.begin(), cscTimeColl.end());
100  fillerCSC.fill();
101 
102  iEvent.put(std::move(muonTimeMap), "combined");
103  iEvent.put(std::move(muonTimeMapDT), "dt");
104  iEvent.put(std::move(muonTimeMapCSC), "csc");
105 }
106 
107 //define this as a plug-in
108 //DEFINE_FWK_MODULE(MuonTimingProducer);
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
edm::helper::Filler::insert
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
mps_fire.i
i
Definition: mps_fire.py:428
Muon.h
MuonTimingProducer::theTimingFiller_
MuonTimingFiller * theTimingFiller_
Definition: MuonTimingProducer.h:53
MuonTimingProducer::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition: MuonTimingProducer.h:51
custom_jme_cff.nMuons
nMuons
Definition: custom_jme_cff.py:148
MuonTimingFiller::fillTiming
void fillTiming(const reco::Muon &muon, reco::MuonTimeExtra &dtTime, reco::MuonTimeExtra &cscTime, reco::MuonTime &rpcTime, reco::MuonTimeExtra &combinedTime, edm::Event &iEvent, const edm::EventSetup &iSetup)
Definition: MuonTimingFiller.cc:76
edm::helper::Filler::fill
void fill()
Definition: ValueMap.h:65
edm::Handle< reco::MuonCollection >
edm::Ref< MuonCollection >
reco::MuonTime
Definition: MuonTime.h:5
MakerMacros.h
MuonTimeExtraMap.h
MuonTimingProducer::~MuonTimingProducer
~MuonTimingProducer() override
Definition: MuonTimingProducer.cc:53
reco::MuonTimeExtra
Definition: MuonTimeExtra.h:15
MuonFwd.h
MuonTimeExtra.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
MuonTimingProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: MuonTimingProducer.cc:63
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
MuonTimingProducer.h
MuonTimingFiller
Definition: MuonTimingFiller.h:42
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TimeMeasurementSequence.h
edm::helper::Filler
Definition: ValueMap.h:22
MuonTimingProducer::MuonTimingProducer
MuonTimingProducer(const edm::ParameterSet &)
Definition: MuonTimingProducer.cc:41
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
MuonTimingProducer::m_muonCollection
edm::InputTag m_muonCollection
Definition: MuonTimingProducer.h:50