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 | 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::Counters
initializeGlobalCache (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
< EcalRecHitCollection
tok_EB_
 
edm::EDGetTokenT
< EcalRecHitCollection
tok_EE_
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_HBHE_
 
edm::EDGetTokenT
< reco::MuonCollection
tok_Muon_
 
edm::EDGetTokenT
< reco::VertexCollection
tok_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 ( edm::ParameterSet const &  iConfig,
const AlCaHBHEMuons::Counters count 
)
explicit

Definition at line 81 of file AlCaHBHEMuonProducer.cc.

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

82  : nRun_(0), nAll_(0), nGood_(0) {
83  //Get the run parameters
84  labelBS_ = iConfig.getParameter<edm::InputTag>("BeamSpotLabel");
85  labelVtx_ = iConfig.getParameter<edm::InputTag>("VertexLabel");
86  labelEB_ = iConfig.getParameter<edm::InputTag>("EBRecHitLabel");
87  labelEE_ = iConfig.getParameter<edm::InputTag>("EERecHitLabel");
88  labelHBHE_ = iConfig.getParameter<edm::InputTag>("HBHERecHitLabel");
89  labelMuon_ = iConfig.getParameter<edm::InputTag>("MuonLabel");
90  pMuonMin_ = iConfig.getParameter<double>("MinimumMuonP");
91 
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
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< reco::BeamSpot > tok_BS_
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
std::string const & instance() const
Definition: InputTag.h:37
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
AlCaHBHEMuonProducer::~AlCaHBHEMuonProducer ( )
override

Definition at line 114 of file AlCaHBHEMuonProducer.cc.

114 {}

Member Function Documentation

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

Definition at line 223 of file AlCaHBHEMuonProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, and HLT_FULL_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 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void AlCaHBHEMuonProducer::globalEndJob ( const AlCaHBHEMuons::Counters counters)
static

Definition at line 219 of file AlCaHBHEMuonProducer.cc.

References AlCaHBHEMuons::Counters::nAll_, and AlCaHBHEMuons::Counters::nGood_.

219  {
220  edm::LogVerbatim("HcalHBHEMuon") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events";
221 }
Log< level::Info, true > LogVerbatim
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  }
void AlCaHBHEMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 116 of file AlCaHBHEMuonProducer.cc.

References accept(), EcalCondDBWriter_cfi::beam, reco::BeamSpot::BeamWidthX(), edm::SortedCollection< T, SORT >::begin(), edm::EventBase::bunchCrossing(), reco::BeamSpot::covariance(), reco::BeamSpot::dxdz(), reco::BeamSpot::dydz(), edm::SortedCollection< T, SORT >::end(), edm::EventID::event(), edm::Event::getHandle(), edm::EventBase::id(), edm::InputTag::instance(), edm::InputTag::label(), labelBS_, labelEB_, labelEE_, labelHBHE_, labelMuon_, labelVtx_, edm::EventBase::luminosityBlock(), eostools::move(), HLT_FULL_cff::muon, patZpeak::muons, nAll_, nGood_, reco::BeamSpot::position(), edm::Event::put(), edm::EventID::run(), select(), reco::BeamSpot::sigmaZ(), tok_BS_, tok_EB_, tok_EE_, tok_HBHE_, tok_Muon_, tok_Vtx_, and reco::BeamSpot::type().

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 }
RunNumber_t run() const
Definition: EventID.h:38
Log< level::Info, true > LogVerbatim
EventNumber_t event() const
Definition: EventID.h:40
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool select(const reco::MuonCollection &)
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::vector< T >::const_iterator const_iterator
int bunchCrossing() const
Definition: EventBase.h:64
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
double dydz() const
dydz slope
Definition: BeamSpot.h:80
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
def move
Definition: eostools.py:511
edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:82
double dxdz() const
dxdz slope
Definition: BeamSpot.h:78
const_iterator end() const
double sigmaZ() const
sigma z
Definition: BeamSpot.h:76
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< reco::BeamSpot > tok_BS_
std::string const & label() const
Definition: InputTag.h:36
double covariance(int i, int j) const
(i,j)-th element of error matrix
Definition: BeamSpot.h:108
edm::EventID id() const
Definition: EventBase.h:59
tuple muons
Definition: patZpeak.py:39
edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
const Point & position() const
position
Definition: BeamSpot.h:59
Log< level::Warning, false > LogWarning
std::string const & instance() const
Definition: InputTag.h:37
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
const_iterator begin() const
BeamType type() const
return beam type
Definition: BeamSpot.h:122
bool AlCaHBHEMuonProducer::select ( const reco::MuonCollection muons)
private

Definition at line 246 of file AlCaHBHEMuonProducer.cc.

References isotrackApplyRegressor::k, 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 }
tuple muons
Definition: patZpeak.py:39

Member Data Documentation

edm::InputTag AlCaHBHEMuonProducer::labelBS_
private

Definition at line 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelEB_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelEE_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelHBHE_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelMuon_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelVtx_
private

Definition at line 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

unsigned int AlCaHBHEMuonProducer::nAll_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

unsigned int AlCaHBHEMuonProducer::nGood_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

unsigned int AlCaHBHEMuonProducer::nRun_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by beginRun(), and endRun().

double AlCaHBHEMuonProducer::pMuonMin_
private

Definition at line 71 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and select().

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

Definition at line 73 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 75 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 76 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 77 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 78 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 74 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().