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

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

81  : nAll_(0),
82  nGood_(0),
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  // define tokens for access
91  tok_Vtx_ = consumes<reco::VertexCollection>(labelVtx_);
92  tok_BS_ = consumes<reco::BeamSpot>(labelBS_);
93  tok_EB_ = consumes<EcalRecHitCollection>(labelEB_);
94  tok_EE_ = consumes<EcalRecHitCollection>(labelEE_);
95  tok_HBHE_ = consumes<HBHERecHitCollection>(labelHBHE_);
96  tok_Muon_ = consumes<reco::MuonCollection>(labelMuon_);
97 
98  edm::LogVerbatim("HcalHBHEMuon") << "Parameters read from config file \n"
99  << "\t minP of muon " << pMuonMin_ << "\t input labels " << labelBS_ << " "
100  << labelVtx_ << " " << labelEB_ << " " << labelEE_ << " " << labelHBHE_ << " "
101  << labelMuon_;
102 
103  //saves the following collections
104  produces<reco::BeamSpot>(labelBS_.label());
105  produces<reco::VertexCollection>(labelVtx_.label());
106  produces<EcalRecHitCollection>(labelEB_.instance());
107  produces<EcalRecHitCollection>(labelEE_.instance());
108  produces<HBHERecHitCollection>(labelHBHE_.label());
109  produces<reco::MuonCollection>(labelMuon_.label());
110 }
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 112 of file AlCaHBHEMuonProducer.cc.

112 {}

Member Function Documentation

◆ endStream()

void AlCaHBHEMuonProducer::endStream ( )
override

Definition at line 212 of file AlCaHBHEMuonProducer.cc.

References nAll_, and nGood_.

212  {
213  globalCache()->nAll_ += nAll_;
214  globalCache()->nGood_ += nGood_;
215 }

◆ fillDescriptions()

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

Definition at line 221 of file AlCaHBHEMuonProducer.cc.

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

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

◆ globalEndJob()

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

Definition at line 217 of file AlCaHBHEMuonProducer.cc.

References submitPVResolutionJobs::count.

217  {
218  edm::LogVerbatim("HcalHBHEMuon") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events";
219 }
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 114 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, DiMuonV_cfg::muons, nAll_, nGood_, select(), tok_BS_, tok_EB_, tok_EE_, tok_HBHE_, tok_Muon_, tok_Vtx_, validateGeometry_cfg::valid, and L1BJetProducer_cff::vtx.

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

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

Referenced by produce().

235  {
236  bool ok(false);
237  for (unsigned int k = 0; k < muons.size(); ++k) {
238  if (muons[k].p() > pMuonMin_) {
239  ok = true;
240  break;
241  }
242  }
243  return ok;
244 }
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:212

Member Data Documentation

◆ labelBS_

const edm::InputTag AlCaHBHEMuonProducer::labelBS_
private

Definition at line 67 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelEB_

const edm::InputTag AlCaHBHEMuonProducer::labelEB_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelEE_

const edm::InputTag AlCaHBHEMuonProducer::labelEE_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelHBHE_

const edm::InputTag AlCaHBHEMuonProducer::labelHBHE_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelMuon_

const edm::InputTag AlCaHBHEMuonProducer::labelMuon_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ labelVtx_

const edm::InputTag AlCaHBHEMuonProducer::labelVtx_
private

Definition at line 67 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ nAll_

unsigned int AlCaHBHEMuonProducer::nAll_
private

Definition at line 66 of file AlCaHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

◆ nGood_

unsigned int AlCaHBHEMuonProducer::nGood_
private

Definition at line 66 of file AlCaHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

◆ pMuonMin_

const double AlCaHBHEMuonProducer::pMuonMin_
private

Definition at line 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and select().

◆ tok_BS_

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

Definition at line 71 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_EB_

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

Definition at line 73 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_EE_

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

Definition at line 74 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_HBHE_

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

Definition at line 75 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_Muon_

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

Definition at line 76 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

◆ tok_Vtx_

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

Definition at line 72 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().