CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonTimingProducer Class Reference

#include <RecoMuon/MuonIdentification/interface/MuonTimingProducer.h>

Inheritance diagram for MuonTimingProducer:
edm::stream::EDProducer<>

Public Member Functions

 MuonTimingProducer (const edm::ParameterSet &)
 
 ~MuonTimingProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::InputTag m_muonCollection
 
edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 
MuonTimingFillertheTimingFiller_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 41 of file MuonTimingProducer.h.

Constructor & Destructor Documentation

MuonTimingProducer::MuonTimingProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 41 of file MuonTimingProducer.cc.

References edm::ParameterSet::getParameter(), m_muonCollection, muonToken_, and theTimingFiller_.

41  {
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 }
T getParameter(std::string const &) const
MuonTimingFiller * theTimingFiller_
edm::InputTag m_muonCollection
edm::EDGetTokenT< reco::MuonCollection > muonToken_
MuonTimingProducer::~MuonTimingProducer ( )
override

Definition at line 53 of file MuonTimingProducer.cc.

References theTimingFiller_.

53  {
54  if (theTimingFiller_)
55  delete theTimingFiller_;
56 }
MuonTimingFiller * theTimingFiller_

Member Function Documentation

void MuonTimingProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 63 of file MuonTimingProducer.cc.

References trigObjTnPSource_cfi::filler, MuonTimingFiller::fillTiming(), edm::Event::getByToken(), mps_fire::i, eostools::move(), PDWG_BPHSkim_cff::muons, muonToken_, jets_cff::nMuons, edm::Event::put(), and theTimingFiller_.

63  {
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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
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)
MuonTimingFiller * theTimingFiller_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::InputTag MuonTimingProducer::m_muonCollection
private

Definition at line 50 of file MuonTimingProducer.h.

Referenced by MuonTimingProducer().

edm::EDGetTokenT<reco::MuonCollection> MuonTimingProducer::muonToken_
private

Definition at line 51 of file MuonTimingProducer.h.

Referenced by MuonTimingProducer(), and produce().

MuonTimingFiller* MuonTimingProducer::theTimingFiller_
private

Definition at line 53 of file MuonTimingProducer.h.

Referenced by MuonTimingProducer(), produce(), and ~MuonTimingProducer().