CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

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

Private Attributes

edm::InputTag m_muonCollection
 
edm::EDGetTokenT
< reco::MuonCollection
muonToken_
 
MuonTimingFillertheTimingFiller_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 }
MuonTimingFiller * theTimingFiller_
edm::InputTag m_muonCollection
edm::EDGetTokenT< reco::MuonCollection > muonToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 MuonTimingFiller::fillTiming(), edm::Event::getByToken(), mps_fire::i, eostools::move(), patZpeak::muons, muonToken_, edm::Event::put(), and theTimingFiller_.

63  {
64  auto muonTimeMap = std::make_unique<reco::MuonTimeExtraMap>();
65  reco::MuonTimeExtraMap::Filler filler(*muonTimeMap);
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:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
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_
def move
Definition: eostools.py:511
edm::EDGetTokenT< reco::MuonCollection > muonToken_
tuple muons
Definition: patZpeak.py:39

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().