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
 
 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
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

const edm::InputTag labelBS_
 
const edm::InputTag labelEB_
 
const edm::InputTag labelEE_
 
const edm::InputTag labelHBHE_
 
const edm::InputTag labelMuon_
 
const edm::InputTag labelVtx_
 
unsigned int nAll_
 
unsigned int nGood_
 
unsigned int nRun_
 
const 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 > >
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

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 81 of file AlCaHBHEMuonProducer.cc.

References 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_.

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

◆ ~AlCaHBHEMuonProducer()

AlCaHBHEMuonProducer::~AlCaHBHEMuonProducer ( )
override

Definition at line 114 of file AlCaHBHEMuonProducer.cc.

114 {}

Member Function Documentation

◆ beginRun()

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

Definition at line 237 of file AlCaHBHEMuonProducer.cc.

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

237  {
238  edm::LogVerbatim("HcalHBHEMuon") << "Run[" << nRun_ << "] " << iRun.run();
239 }
Log< level::Info, true > LogVerbatim

◆ endRun()

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

Definition at line 241 of file AlCaHBHEMuonProducer.cc.

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

241  {
242  ++nRun_;
243  edm::LogVerbatim("HcalHBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run();
244 }
Log< level::Info, true > LogVerbatim

◆ endStream()

void AlCaHBHEMuonProducer::endStream ( )
override

Definition at line 214 of file AlCaHBHEMuonProducer.cc.

References nAll_, and nGood_.

214  {
215  globalCache()->nAll_ += nAll_;
216  globalCache()->nGood_ += nGood_;
217 }

◆ fillDescriptions()

void AlCaHBHEMuonProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 223 of file AlCaHBHEMuonProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_2022v12_cff::InputTag.

223  {
224  //The following says we do not know what parameters are allowed so do no validation
225  // Please change this to state exactly what you do use, even if it is no parameters
227  desc.add<edm::InputTag>("BeamSpotLabel", edm::InputTag("offlineBeamSpot"));
228  desc.add<edm::InputTag>("VertexLabel", edm::InputTag("offlinePrimaryVertices"));
229  desc.add<edm::InputTag>("EBRecHitLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
230  desc.add<edm::InputTag>("EERecHitLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
231  desc.add<edm::InputTag>("HBHERecHitLabel", edm::InputTag("hbhereco"));
232  desc.add<edm::InputTag>("MuonLabel", edm::InputTag("muons"));
233  desc.add<double>("MinimumMuonP", 10.0);
234  descriptions.add("alcaHBHEMuonProducer", desc);
235 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ globalEndJob()

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

Definition at line 219 of file AlCaHBHEMuonProducer.cc.

References submitPVResolutionJobs::count.

219  {
220  edm::LogVerbatim("HcalHBHEMuon") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events";
221 }
Log< level::Info, true > LogVerbatim

◆ 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 116 of file AlCaHBHEMuonProducer.cc.

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

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

◆ select()

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

Definition at line 246 of file AlCaHBHEMuonProducer.cc.

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

Referenced by produce().

246  {
247  bool ok(false);
248  for (unsigned int k = 0; k < muons.size(); ++k) {
249  if (muons[k].p() > pMuonMin_) {
250  ok = true;
251  break;
252  }
253  }
254  return ok;
255 }

Member Data Documentation

◆ labelBS_

const edm::InputTag AlCaHBHEMuonProducer::labelBS_
private

Definition at line 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelEB_

const edm::InputTag AlCaHBHEMuonProducer::labelEB_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelEE_

const edm::InputTag AlCaHBHEMuonProducer::labelEE_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelHBHE_

const edm::InputTag AlCaHBHEMuonProducer::labelHBHE_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelMuon_

const edm::InputTag AlCaHBHEMuonProducer::labelMuon_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelVtx_

const edm::InputTag AlCaHBHEMuonProducer::labelVtx_
private

Definition at line 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ nAll_

unsigned int AlCaHBHEMuonProducer::nAll_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

◆ nGood_

unsigned int AlCaHBHEMuonProducer::nGood_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

◆ nRun_

unsigned int AlCaHBHEMuonProducer::nRun_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by beginRun(), and endRun().

◆ pMuonMin_

const double AlCaHBHEMuonProducer::pMuonMin_
private

Definition at line 71 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and select().

◆ tok_BS_

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

Definition at line 73 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_EB_

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

Definition at line 75 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_EE_

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

Definition at line 76 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_HBHE_

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

Definition at line 77 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_Muon_

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

Definition at line 78 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_Vtx_

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

Definition at line 74 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().