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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 43 of file MuonTimingProducer.h.

Constructor & Destructor Documentation

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

Definition at line 43 of file MuonTimingProducer.cc.

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

44 {
45  produces<reco::MuonTimeExtraMap>("combined");
46  produces<reco::MuonTimeExtraMap>("dt");
47  produces<reco::MuonTimeExtraMap>("csc");
48 
49  m_muonCollection = iConfig.getParameter<edm::InputTag>("MuonCollection");
50  muonToken_ = consumes<reco::MuonCollection>(m_muonCollection);
51  // Load parameters for the TimingFiller
52  edm::ParameterSet fillerParameters = iConfig.getParameter<edm::ParameterSet>("TimingFillerParameters");
53  theTimingFiller_ = new MuonTimingFiller(fillerParameters,consumesCollector());
54 }
T getParameter(std::string const &) const
MuonTimingFiller * theTimingFiller_
edm::InputTag m_muonCollection
edm::EDGetTokenT< reco::MuonCollection > muonToken_
MuonTimingProducer::~MuonTimingProducer ( )
override

Definition at line 57 of file MuonTimingProducer.cc.

References theTimingFiller_.

58 {
60 }
MuonTimingFiller * theTimingFiller_

Member Function Documentation

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

Definition at line 69 of file MuonTimingProducer.cc.

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

69  {
70 
71  auto muonTimeMap = std::make_unique<reco::MuonTimeExtraMap>();
73  auto muonTimeMapDT = std::make_unique<reco::MuonTimeExtraMap>();
74  reco::MuonTimeExtraMap::Filler fillerDT(*muonTimeMapDT);
75  auto muonTimeMapCSC = std::make_unique<reco::MuonTimeExtraMap>();
76  reco::MuonTimeExtraMap::Filler fillerCSC(*muonTimeMapCSC);
77 
79  iEvent.getByToken(muonToken_, muons);
80 
81  unsigned int nMuons = muons->size();
82 
83  std::vector<reco::MuonTimeExtra> dtTimeColl(nMuons);
84  std::vector<reco::MuonTimeExtra> cscTimeColl(nMuons);
85  std::vector<reco::MuonTimeExtra> combinedTimeColl(nMuons);
86 
87  for ( unsigned int i=0; i<nMuons; ++i ) {
88 
89  reco::MuonTimeExtra dtTime;
90  reco::MuonTimeExtra cscTime;
91  reco::MuonTime rpcTime;
92  reco::MuonTimeExtra combinedTime;
93 
94  reco::MuonRef muonr(muons,i);
95 
96  theTimingFiller_->fillTiming(*muonr, dtTime, cscTime, rpcTime, combinedTime, iEvent, iSetup);
97 
98  dtTimeColl[i] = dtTime;
99  cscTimeColl[i] = cscTime;
100  combinedTimeColl[i] = combinedTime;
101 
102  }
103 
104  filler.insert(muons, combinedTimeColl.begin(), combinedTimeColl.end());
105  filler.fill();
106  fillerDT.insert(muons, dtTimeColl.begin(), dtTimeColl.end());
107  fillerDT.fill();
108  fillerCSC.insert(muons, cscTimeColl.begin(), cscTimeColl.end());
109  fillerCSC.fill();
110 
111  iEvent.put(std::move(muonTimeMap),"combined");
112  iEvent.put(std::move(muonTimeMapDT),"dt");
113  iEvent.put(std::move(muonTimeMapCSC),"csc");
114 
115 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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 52 of file MuonTimingProducer.h.

Referenced by MuonTimingProducer().

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

Definition at line 53 of file MuonTimingProducer.h.

Referenced by MuonTimingProducer(), and produce().

MuonTimingFiller* MuonTimingProducer::theTimingFiller_
private

Definition at line 55 of file MuonTimingProducer.h.

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