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< alCaHBHEMuonProducer::Counters > >

Public Member Functions

 AlCaHBHEMuonProducer (edm::ParameterSet const &, const alCaHBHEMuonProducer::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< alCaHBHEMuonProducer::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 alCaHBHEMuonProducer::Counters *counters)
 
static std::unique_ptr< alCaHBHEMuonProducer::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< alCaHBHEMuonProducer::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 alCaHBHEMuonProducer::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_.

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

115 {}

Member Function Documentation

◆ beginRun()

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

Definition at line 238 of file AlCaHBHEMuonProducer.cc.

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

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

◆ endRun()

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

Definition at line 242 of file AlCaHBHEMuonProducer.cc.

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

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

◆ endStream()

void AlCaHBHEMuonProducer::endStream ( )
override

Definition at line 215 of file AlCaHBHEMuonProducer.cc.

References nAll_, and nGood_.

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

◆ fillDescriptions()

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

Definition at line 224 of file AlCaHBHEMuonProducer.cc.

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

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

◆ globalEndJob()

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

Definition at line 220 of file AlCaHBHEMuonProducer.cc.

References submitPVResolutionJobs::count.

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

◆ initializeGlobalCache()

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

Definition at line 53 of file AlCaHBHEMuonProducer.cc.

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

◆ produce()

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

Definition at line 117 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_2023v12_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 L1BJetProducer_cff::vtx.

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

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

Referenced by produce().

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

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