CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
AlCaHBHEMuonProducer Class Reference
Inheritance diagram for AlCaHBHEMuonProducer:
edm::stream::EDProducer< edm::GlobalCache< AlCaHBHEMuons::Counters > >

Public Member Functions

 AlCaHBHEMuonProducer (edm::ParameterSet const &, const AlCaHBHEMuons::Counters *count)
 
void endStream () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~AlCaHBHEMuonProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< AlCaHBHEMuons::Counters > >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void globalEndJob (const AlCaHBHEMuons::Counters *counters)
 
static std::unique_ptr< AlCaHBHEMuons::CountersinitializeGlobalCache (edm::ParameterSet const &)
 

Private Member Functions

void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
bool select (const reco::MuonCollection &)
 

Private Attributes

edm::InputTag labelBS_
 
edm::InputTag labelEB_
 
edm::InputTag labelEE_
 
edm::InputTag labelHBHE_
 
edm::InputTag labelMuon_
 
edm::InputTag labelVtx_
 
unsigned int nAll_
 
unsigned int nGood_
 
unsigned int nRun_
 
double pMuonMin_
 
edm::EDGetTokenT< reco::BeamSpottok_BS_
 
edm::EDGetTokenT< EcalRecHitCollectiontok_EB_
 
edm::EDGetTokenT< EcalRecHitCollectiontok_EE_
 
edm::EDGetTokenT< HBHERecHitCollectiontok_HBHE_
 
edm::EDGetTokenT< reco::MuonCollectiontok_Muon_
 
edm::EDGetTokenT< reco::VertexCollectiontok_Vtx_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< AlCaHBHEMuons::Counters > >
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

Definition at line 48 of file AlCaHBHEMuonProducer.cc.

Constructor & Destructor Documentation

◆ AlCaHBHEMuonProducer()

AlCaHBHEMuonProducer::AlCaHBHEMuonProducer ( edm::ParameterSet const &  iConfig,
const AlCaHBHEMuons::Counters count 
)
explicit

Definition at line 80 of file AlCaHBHEMuonProducer.cc.

81  : nRun_(0), nAll_(0), nGood_(0) {
82  //Get the run parameters
83  labelBS_ = iConfig.getParameter<edm::InputTag>("BeamSpotLabel");
84  labelVtx_ = iConfig.getParameter<edm::InputTag>("VertexLabel");
85  labelEB_ = iConfig.getParameter<edm::InputTag>("EBRecHitLabel");
86  labelEE_ = iConfig.getParameter<edm::InputTag>("EERecHitLabel");
87  labelHBHE_ = iConfig.getParameter<edm::InputTag>("HBHERecHitLabel");
88  labelMuon_ = iConfig.getParameter<edm::InputTag>("MuonLabel");
89  pMuonMin_ = iConfig.getParameter<double>("MinimumMuonP");
90 
91  // define tokens for access
92  tok_Vtx_ = consumes<reco::VertexCollection>(labelVtx_);
93  tok_BS_ = consumes<reco::BeamSpot>(labelBS_);
94  tok_EB_ = consumes<EcalRecHitCollection>(labelEB_);
95  tok_EE_ = consumes<EcalRecHitCollection>(labelEE_);
96  tok_HBHE_ = consumes<HBHERecHitCollection>(labelHBHE_);
97  tok_Muon_ = consumes<reco::MuonCollection>(labelMuon_);
98 
99  edm::LogVerbatim("HcalHBHEMuon") << "Parameters read from config file \n"
100  << "\t minP of muon " << pMuonMin_ << "\t input labels " << labelBS_ << " "
101  << labelVtx_ << " " << labelEB_ << " " << labelEE_ << " " << labelHBHE_ << " "
102  << labelMuon_;
103 
104  //saves the following collections
105  produces<reco::BeamSpot>(labelBS_.label());
106  produces<reco::VertexCollection>(labelVtx_.label());
107  produces<EcalRecHitCollection>(labelEB_.instance());
108  produces<EcalRecHitCollection>(labelEE_.instance());
109  produces<HBHERecHitCollection>(labelHBHE_.label());
110  produces<reco::MuonCollection>(labelMuon_.label());
111 }

References edm::ParameterSet::getParameter(), edm::InputTag::instance(), edm::InputTag::label(), labelBS_, labelEB_, labelEE_, labelHBHE_, labelMuon_, labelVtx_, pMuonMin_, tok_BS_, tok_EB_, tok_EE_, tok_HBHE_, tok_Muon_, and tok_Vtx_.

◆ ~AlCaHBHEMuonProducer()

AlCaHBHEMuonProducer::~AlCaHBHEMuonProducer ( )
override

Definition at line 113 of file AlCaHBHEMuonProducer.cc.

113 {}

Member Function Documentation

◆ beginRun()

void AlCaHBHEMuonProducer::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 228 of file AlCaHBHEMuonProducer.cc.

228  {
229  edm::LogVerbatim("HcalHBHEMuon") << "Run[" << nRun_ << "] " << iRun.run();
230 }

References nRun_, and edm::RunBase::run().

◆ endRun()

void AlCaHBHEMuonProducer::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivate

Definition at line 232 of file AlCaHBHEMuonProducer.cc.

232  {
233  ++nRun_;
234  edm::LogVerbatim("HcalHBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run();
235 }

References nRun_, and edm::RunBase::run().

◆ endStream()

void AlCaHBHEMuonProducer::endStream ( )
override

Definition at line 219 of file AlCaHBHEMuonProducer.cc.

219  {
220  globalCache()->nAll_ += nAll_;
221  globalCache()->nGood_ += nGood_;
222 }

References nAll_, and nGood_.

◆ globalEndJob()

void AlCaHBHEMuonProducer::globalEndJob ( const AlCaHBHEMuons::Counters counters)
static

Definition at line 224 of file AlCaHBHEMuonProducer.cc.

224  {
225  edm::LogVerbatim("HcalHBHEMuon") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events";
226 }

References submitPVResolutionJobs::count.

◆ initializeGlobalCache()

static std::unique_ptr<AlCaHBHEMuons::Counters> AlCaHBHEMuonProducer::initializeGlobalCache ( edm::ParameterSet const &  )
inlinestatic

Definition at line 53 of file AlCaHBHEMuonProducer.cc.

53  {
54  return std::make_unique<AlCaHBHEMuons::Counters>();
55  }

◆ produce()

void AlCaHBHEMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 115 of file AlCaHBHEMuonProducer.cc.

115  {
116  ++nAll_;
117  bool valid(true);
118 #ifdef EDM_ML_DEBUG
119  edm::LogVerbatim("HcalHBHEMuon") << "AlCaHBHEMuonProducer::Run " << iEvent.id().run() << " Event "
120  << iEvent.id().event() << " Luminosity " << iEvent.luminosityBlock() << " Bunch "
121  << iEvent.bunchCrossing();
122 #endif
123 
124  //Step1: Get all the relevant containers
126  iEvent.getByToken(tok_BS_, bmspot);
127  if (!bmspot.isValid()) {
128  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelBS_;
129  valid = false;
130  }
131 
133  iEvent.getByToken(tok_Vtx_, vt);
134  if (!vt.isValid()) {
135  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelVtx_;
136  valid = false;
137  }
138 
139  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
140  iEvent.getByToken(tok_EB_, barrelRecHitsHandle);
141  if (!barrelRecHitsHandle.isValid()) {
142  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelEB_;
143  valid = false;
144  }
145 
146  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
147  iEvent.getByToken(tok_EE_, endcapRecHitsHandle);
148  if (!endcapRecHitsHandle.isValid()) {
149  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelEE_;
150  valid = false;
151  }
152 
154  iEvent.getByToken(tok_HBHE_, hbhe);
155  if (!hbhe.isValid()) {
156  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelHBHE_;
157  valid = false;
158  }
159 
161  iEvent.getByToken(tok_Muon_, muonhandle);
162  if (!muonhandle.isValid()) {
163  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelMuon_;
164  valid = false;
165  }
166 
167 #ifdef EDM_ML_DEBUG
168  edm::LogVerbatim("HcalHBHEMuon") << "AlCaHBHEMuonProducer::obtained the collections with validity flag " << valid;
169 #endif
170 
171  //For accepted events
172  auto outputBeamSpot = std::make_unique<reco::BeamSpot>();
173  auto outputVColl = std::make_unique<reco::VertexCollection>();
174  auto outputEBColl = std::make_unique<EBRecHitCollection>();
175  auto outputEEColl = std::make_unique<EERecHitCollection>();
176  auto outputHBHEColl = std::make_unique<HBHERecHitCollection>();
177  auto outputMColl = std::make_unique<reco::MuonCollection>();
178 
179  if (valid) {
180  const reco::BeamSpot beam = *(bmspot.product());
181  outputBeamSpot = std::make_unique<reco::BeamSpot>(
182  beam.position(), beam.sigmaZ(), beam.dxdz(), beam.dydz(), beam.BeamWidthX(), beam.covariance(), beam.type());
183  const reco::VertexCollection vtx = *(vt.product());
184  const EcalRecHitCollection ebcoll = *(barrelRecHitsHandle.product());
185  const EcalRecHitCollection eecoll = *(endcapRecHitsHandle.product());
186  const HBHERecHitCollection hbhecoll = *(hbhe.product());
187  const reco::MuonCollection muons = *(muonhandle.product());
188 
189  bool accept = select(muons);
190 
191  if (accept) {
192  ++nGood_;
193 
194  for (reco::VertexCollection::const_iterator vtr = vtx.begin(); vtr != vtx.end(); ++vtr)
195  outputVColl->push_back(*vtr);
196 
197  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit = ebcoll.begin(); ehit != ebcoll.end(); ++ehit)
198  outputEBColl->push_back(*ehit);
199 
200  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit = eecoll.begin(); ehit != eecoll.end(); ++ehit)
201  outputEEColl->push_back(*ehit);
202 
203  for (std::vector<HBHERecHit>::const_iterator hhit = hbhecoll.begin(); hhit != hbhecoll.end(); ++hhit)
204  outputHBHEColl->push_back(*hhit);
205 
206  for (reco::MuonCollection::const_iterator muon = muons.begin(); muon != muons.end(); ++muon)
207  outputMColl->push_back(*muon);
208  }
209  }
210 
211  iEvent.put(std::move(outputBeamSpot), labelBS_.label());
212  iEvent.put(std::move(outputVColl), labelVtx_.label());
213  iEvent.put(std::move(outputEBColl), labelEB_.instance());
214  iEvent.put(std::move(outputEEColl), labelEE_.instance());
215  iEvent.put(std::move(outputHBHEColl), labelHBHE_.label());
216  iEvent.put(std::move(outputMColl), labelMuon_.label());
217 }

References accept(), EcalCondDBWriter_cfi::beam, edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), photonIsolationHIProducer_cfi::hbhe, iEvent, edm::InputTag::instance(), edm::HandleBase::isValid(), edm::InputTag::label(), labelBS_, labelEB_, labelEE_, labelHBHE_, labelMuon_, labelVtx_, eostools::move(), HLT_FULL_cff::muon, PDWG_BPHSkim_cff::muons, nAll_, nGood_, edm::Handle< T >::product(), select(), tok_BS_, tok_EB_, tok_EE_, tok_HBHE_, tok_Muon_, tok_Vtx_, RunInfoPI::valid, and extraflags_cff::vtx.

◆ select()

bool AlCaHBHEMuonProducer::select ( const reco::MuonCollection muons)
private

Definition at line 237 of file AlCaHBHEMuonProducer.cc.

237  {
238  bool ok(false);
239  for (unsigned int k = 0; k < muons.size(); ++k) {
240  if (muons[k].p() > pMuonMin_) {
241  ok = true;
242  break;
243  }
244  }
245  return ok;
246 }

References dqmdumpme::k, PDWG_BPHSkim_cff::muons, convertSQLiteXML::ok, AlCaHLTBitMon_ParallelJobs::p, and pMuonMin_.

Referenced by produce().

Member Data Documentation

◆ labelBS_

edm::InputTag AlCaHBHEMuonProducer::labelBS_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelEB_

edm::InputTag AlCaHBHEMuonProducer::labelEB_
private

Definition at line 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelEE_

edm::InputTag AlCaHBHEMuonProducer::labelEE_
private

Definition at line 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelHBHE_

edm::InputTag AlCaHBHEMuonProducer::labelHBHE_
private

Definition at line 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelMuon_

edm::InputTag AlCaHBHEMuonProducer::labelMuon_
private

Definition at line 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelVtx_

edm::InputTag AlCaHBHEMuonProducer::labelVtx_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ nAll_

unsigned int AlCaHBHEMuonProducer::nAll_
private

Definition at line 67 of file AlCaHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

◆ nGood_

unsigned int AlCaHBHEMuonProducer::nGood_
private

Definition at line 67 of file AlCaHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

◆ nRun_

unsigned int AlCaHBHEMuonProducer::nRun_
private

Definition at line 67 of file AlCaHBHEMuonProducer.cc.

Referenced by beginRun(), and endRun().

◆ pMuonMin_

double AlCaHBHEMuonProducer::pMuonMin_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and select().

◆ tok_BS_

edm::EDGetTokenT<reco::BeamSpot> AlCaHBHEMuonProducer::tok_BS_
private

Definition at line 72 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_EB_

edm::EDGetTokenT<EcalRecHitCollection> AlCaHBHEMuonProducer::tok_EB_
private

Definition at line 74 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_EE_

edm::EDGetTokenT<EcalRecHitCollection> AlCaHBHEMuonProducer::tok_EE_
private

Definition at line 75 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_HBHE_

edm::EDGetTokenT<HBHERecHitCollection> AlCaHBHEMuonProducer::tok_HBHE_
private

Definition at line 76 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_Muon_

edm::EDGetTokenT<reco::MuonCollection> AlCaHBHEMuonProducer::tok_Muon_
private

Definition at line 77 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_Vtx_

edm::EDGetTokenT<reco::VertexCollection> AlCaHBHEMuonProducer::tok_Vtx_
private

Definition at line 73 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
edm::Handle::product
T const * product() const
Definition: Handle.h:70
AlCaHBHEMuonProducer::labelBS_
edm::InputTag labelBS_
Definition: AlCaHBHEMuonProducer.cc:68
edm::InputTag::instance
std::string const & instance() const
Definition: InputTag.h:37
muon
Definition: MuonCocktails.h:17
AlCaHBHEMuonProducer::labelHBHE_
edm::InputTag labelHBHE_
Definition: AlCaHBHEMuonProducer.cc:69
AlCaHBHEMuonProducer::tok_Vtx_
edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
Definition: AlCaHBHEMuonProducer.cc:73
AlCaHBHEMuonProducer::select
bool select(const reco::MuonCollection &)
Definition: AlCaHBHEMuonProducer.cc:237
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
AlCaHBHEMuonProducer::labelVtx_
edm::InputTag labelVtx_
Definition: AlCaHBHEMuonProducer.cc:68
AlCaHBHEMuonProducer::tok_BS_
edm::EDGetTokenT< reco::BeamSpot > tok_BS_
Definition: AlCaHBHEMuonProducer.cc:72
edm::SortedCollection< EcalRecHit >
AlCaHBHEMuonProducer::tok_Muon_
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
Definition: AlCaHBHEMuonProducer.cc:77
AlCaHBHEMuonProducer::tok_EE_
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
Definition: AlCaHBHEMuonProducer.cc:75
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
edm::Handle< reco::BeamSpot >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
AlCaHBHEMuonProducer::nGood_
unsigned int nGood_
Definition: AlCaHBHEMuonProducer.cc:67
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11776
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
reco::MuonCollection
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
AlCaHBHEMuonProducer::labelMuon_
edm::InputTag labelMuon_
Definition: AlCaHBHEMuonProducer.cc:69
reco::BeamSpot
Definition: BeamSpot.h:21
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
EcalCondDBWriter_cfi.beam
beam
Definition: EcalCondDBWriter_cfi.py:45
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHBHEMuonProducer::labelEE_
edm::InputTag labelEE_
Definition: AlCaHBHEMuonProducer.cc:69
AlCaHBHEMuonProducer::nRun_
unsigned int nRun_
Definition: AlCaHBHEMuonProducer.cc:67
AlCaHBHEMuonProducer::pMuonMin_
double pMuonMin_
Definition: AlCaHBHEMuonProducer.cc:70
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
iEvent
int iEvent
Definition: GenABIO.cc:224
photonIsolationHIProducer_cfi.hbhe
hbhe
Definition: photonIsolationHIProducer_cfi.py:8
eostools.move
def move(src, dest)
Definition: eostools.py:511
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
AlCaHBHEMuonProducer::labelEB_
edm::InputTag labelEB_
Definition: AlCaHBHEMuonProducer.cc:69
AlCaHBHEMuonProducer::nAll_
unsigned int nAll_
Definition: AlCaHBHEMuonProducer.cc:67
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
AlCaHBHEMuonProducer::tok_HBHE_
edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
Definition: AlCaHBHEMuonProducer.cc:76
AlCaHBHEMuonProducer::tok_EB_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
Definition: AlCaHBHEMuonProducer.cc:74
edm::InputTag
Definition: InputTag.h:15