CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
BPhysicsSpectrum Class Reference

#include <BPhysicsSpectrum.h>

Inheritance diagram for BPhysicsSpectrum:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 BPhysicsSpectrum (const edm::ParameterSet &)
 
 ~BPhysicsSpectrum () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::InputTag genparticleCollection_
 
edm::EDGetTokenT< reco::GenParticleCollectiongenparticleCollectionToken_
 
MonitorElementmass
 
double mass_max
 
double mass_min
 
std::string name
 
MonitorElementNobj
 
std::vector< int > Particles
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
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
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 34 of file BPhysicsSpectrum.h.

Constructor & Destructor Documentation

◆ BPhysicsSpectrum()

BPhysicsSpectrum::BPhysicsSpectrum ( const edm::ParameterSet iPSet)
explicit

Definition at line 13 of file BPhysicsSpectrum.cc.

14  : genparticleCollection_(iPSet.getParameter<edm::InputTag>("genparticleCollection")),
15  // do not include weights right now to allow for running on aod
16  name(iPSet.getParameter<std::string>("name")),
17  mass_min(iPSet.getParameter<double>("massmin")),
18  mass_max(iPSet.getParameter<double>("massmax")) {
19  genparticleCollectionToken_ = consumes<reco::GenParticleCollection>(genparticleCollection_);
20  Particles = iPSet.getParameter<std::vector<int> >("pdgids");
21 }

References genparticleCollection_, genparticleCollectionToken_, edm::ParameterSet::getParameter(), and Particles.

◆ ~BPhysicsSpectrum()

BPhysicsSpectrum::~BPhysicsSpectrum ( )
override

Definition at line 23 of file BPhysicsSpectrum.cc.

23 {}

Member Function Documentation

◆ analyze()

void BPhysicsSpectrum::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 32 of file BPhysicsSpectrum.cc.

32  {
35  for (reco::GenParticleCollection::const_iterator iter = genParticles->begin(); iter != genParticles->end(); ++iter) {
36  for (unsigned int i = 0; i < Particles.size(); i++) {
37  if (abs(iter->pdgId()) == abs(Particles[i])) {
38  Nobj->Fill(0.5, 1.0);
39  mass->Fill(iter->mass(), 1.0);
40  }
41  }
42  }
43 }

References funct::abs(), dqm::impl::MonitorElement::Fill(), genparticleCollectionToken_, genParticles2HepMC_cfi::genParticles, mps_fire::i, iEvent, mass, Nobj, and Particles.

◆ bookHistograms()

void BPhysicsSpectrum::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 25 of file BPhysicsSpectrum.cc.

25  {
26  DQMHelper dqm(&i);
27  i.setCurrentFolder("Generator/BPhysics");
28  Nobj = dqm.book1dHisto("NSpectrum" + name, "NSpectrum" + name, 1, 0., 1, "bin", "Number of " + name);
29  mass = dqm.book1dHisto(name + "Mass", "Mass Spectrum", 100, mass_min, mass_max, "Mass (GeV)", "Number of Events");
30 }

References mps_fire::i, mass, mass_max, mass_min, name, and Nobj.

Member Data Documentation

◆ genparticleCollection_

edm::InputTag BPhysicsSpectrum::genparticleCollection_
private

Definition at line 44 of file BPhysicsSpectrum.h.

Referenced by BPhysicsSpectrum().

◆ genparticleCollectionToken_

edm::EDGetTokenT<reco::GenParticleCollection> BPhysicsSpectrum::genparticleCollectionToken_
private

Definition at line 45 of file BPhysicsSpectrum.h.

Referenced by analyze(), and BPhysicsSpectrum().

◆ mass

MonitorElement* BPhysicsSpectrum::mass
private

◆ mass_max

double BPhysicsSpectrum::mass_max
private

Definition at line 47 of file BPhysicsSpectrum.h.

Referenced by bookHistograms().

◆ mass_min

double BPhysicsSpectrum::mass_min
private

Definition at line 47 of file BPhysicsSpectrum.h.

Referenced by bookHistograms().

◆ name

std::string BPhysicsSpectrum::name
private

◆ Nobj

MonitorElement * BPhysicsSpectrum::Nobj
private

Definition at line 43 of file BPhysicsSpectrum.h.

Referenced by analyze(), and bookHistograms().

◆ Particles

std::vector<int> BPhysicsSpectrum::Particles
private

Definition at line 48 of file BPhysicsSpectrum.h.

Referenced by analyze(), and BPhysicsSpectrum().

mps_fire.i
i
Definition: mps_fire.py:355
genParticles2HepMC_cfi.genParticles
genParticles
Definition: genParticles2HepMC_cfi.py:4
BPhysicsSpectrum::genparticleCollection_
edm::InputTag genparticleCollection_
Definition: BPhysicsSpectrum.h:44
BPhysicsSpectrum::genparticleCollectionToken_
edm::EDGetTokenT< reco::GenParticleCollection > genparticleCollectionToken_
Definition: BPhysicsSpectrum.h:45
BPhysicsSpectrum::mass_max
double mass_max
Definition: BPhysicsSpectrum.h:47
edm::Handle< reco::GenParticleCollection >
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
BPhysicsSpectrum::name
std::string name
Definition: BPhysicsSpectrum.h:46
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
iEvent
int iEvent
Definition: GenABIO.cc:224
BPhysicsSpectrum::Particles
std::vector< int > Particles
Definition: BPhysicsSpectrum.h:48
DQMHelper
Definition: DQMHelper.h:15
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
BPhysicsSpectrum::mass
MonitorElement * mass
Definition: BPhysicsSpectrum.h:43
dqm
Definition: DQMStore.h:18
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
BPhysicsSpectrum::mass_min
double mass_min
Definition: BPhysicsSpectrum.h:47
BPhysicsSpectrum::Nobj
MonitorElement * Nobj
Definition: BPhysicsSpectrum.h:43
edm::InputTag
Definition: InputTag.h:15