CMS 3D CMS Logo

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

#include <HiBasicGenTest.h>

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

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &r, const edm::EventSetup &c) override
 
 HiBasicGenTest (const edm::ParameterSet &)
 
 ~HiBasicGenTest () 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
 
 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
 
 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
 

Private Attributes

MonitorElementb [3]
 
MonitorElementdnchdeta [3]
 
MonitorElementdnchdphi [3]
 
MonitorElementdnchdpt [3]
 
edm::EDGetTokenT< edm::HepMCProductgeneratorToken_
 
edm::ESHandle< ParticleDataTablepdt
 
edm::ESGetToken< ParticleDataTable, edm::DefaultRecordpdtToken_
 
MonitorElementrp
 

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 >
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
 
- 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 21 of file HiBasicGenTest.h.

Constructor & Destructor Documentation

◆ HiBasicGenTest()

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

Definition at line 17 of file HiBasicGenTest.cc.

References edm::ParameterSet::getParameter().

17  {
18  generatorToken_ = consumes<edm::HepMCProduct>(iPSet.getParameter<edm::InputTag>("generatorLabel"));
19  pdtToken_ = esConsumes<edm::Transition::BeginRun>();
20 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::HepMCProduct > generatorToken_
edm::ESGetToken< ParticleDataTable, edm::DefaultRecord > pdtToken_

◆ ~HiBasicGenTest()

HiBasicGenTest::~HiBasicGenTest ( )
override

Definition at line 22 of file HiBasicGenTest.cc.

22 {}

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 45 of file HiBasicGenTest.cc.

References b, ALCARECOTkAlJpsiMuMu_cff::charge, mps_fire::end, PVValHelper::eta, iEvent, CaloTowersParam_cfi::mc, AlCaHLTBitMon_ParallelJobs::p, HiggsValidation_cfi::pdg_id, Pi, pi, and DiDispStaMuonMonitor_cfi::pt.

45  {
47  iEvent.getByToken(generatorToken_, mc);
48  const HepMC::GenEvent* evt = mc->GetEvent();
49  const HepMC::HeavyIon* hi = evt->heavy_ion();
50 
51  int cbin = 0;
52  double phi0 = 0.;
53 
54  if (hi) {
55  double ip = hi->impact_parameter();
56  phi0 = hi->event_plane_angle();
57 
58  // fill reaction plane distribution
59  rp->Fill(phi0);
60 
61  // if the event is in one of the centrality bins of interest fill hists
62  int cbin = -1;
63  if (ip < 5.045)
64  cbin = 0;
65  else if (ip < 7.145 && ip > 5.045)
66  cbin = 1;
67  else if (ip < 15.202 && ip > 14.283)
68  cbin = 2;
69  if (cbin < 0)
70  return;
71 
72  // fill impact parameter distributions
73  b[cbin]->Fill(ip);
74  }
75 
76  // loop over particles
77  HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
78  HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
79  for (HepMC::GenEvent::particle_const_iterator it = begin; it != end; ++it) {
80  // only fill hists for status=1 particles
81  if ((*it)->status() != 1)
82  continue;
83 
84  // only fill hists for charged particles
85  int pdg_id = (*it)->pdg_id();
86  const ParticleData* part = pdt->particle(pdg_id);
87  int charge = static_cast<int>(part->charge());
88  if (charge == 0)
89  continue;
90 
91  float eta = (*it)->momentum().eta();
92  float phi = (*it)->momentum().phi();
93  float pt = (*it)->momentum().perp();
94 
95  dnchdeta[cbin]->Fill(eta);
96  dnchdpt[cbin]->Fill(pt);
97 
98  double pi = TMath::Pi();
99  double p = phi - phi0;
100  if (p > pi)
101  p = p - 2 * pi;
102  if (p < -1 * pi)
103  p = p + 2 * pi;
104  dnchdphi[cbin]->Fill(p);
105  }
106 
107  return;
108 }
const double Pi
MonitorElement * rp
edm::EDGetTokenT< edm::HepMCProduct > generatorToken_
MonitorElement * dnchdpt[3]
const Double_t pi
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
MonitorElement * dnchdeta[3]
Definition: EPCuts.h:4
MonitorElement * dnchdphi[3]
MonitorElement * b[3]
HepPDT::ParticleData ParticleData
part
Definition: HCALResponse.h:20
edm::ESHandle< ParticleDataTable > pdt

◆ bookHistograms()

void HiBasicGenTest::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Setting the DQM top directories

Booking the ME's

Implements DQMEDAnalyzer.

Definition at line 24 of file HiBasicGenTest.cc.

References b, dqm::implementation::IBooker::book1D(), and dqm::implementation::NavigatorBase::setCurrentFolder().

24  {
26  ibooker.setCurrentFolder("Generator/Particles");
27 
29  for (int ibin = 0; ibin < 3; ibin++) {
30  dnchdeta[ibin] = ibooker.book1D(Form("dnchdeta%d", ibin), ";#eta;dN^{ch}/d#eta", 100, -6.0, 6.0);
31 
32  dnchdpt[ibin] = ibooker.book1D(Form("dnchdpt%d", ibin), ";p_{T};dN^{ch}/dp_{T}", 200, 0.0, 100.0);
33 
34  b[ibin] = ibooker.book1D(Form("b%d", ibin), ";b[fm];events", 100, 0.0, 20.0);
35  dnchdphi[ibin] = ibooker.book1D(Form("dnchdphi%d", ibin), ";#phi;dN^{ch}/d#phi", 100, -3.2, 3.2);
36  }
37 
38  rp = ibooker.book1D("phi0", ";#phi_{RP};events", 100, -3.2, 3.2);
39 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MonitorElement * rp
MonitorElement * dnchdpt[3]
MonitorElement * dnchdeta[3]
MonitorElement * dnchdphi[3]
MonitorElement * b[3]
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ dqmBeginRun()

void HiBasicGenTest::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 41 of file HiBasicGenTest.cc.

References edm::EventSetup::getHandle().

41  {
42  pdt = iSetup.getHandle(pdtToken_);
43 }
edm::ESGetToken< ParticleDataTable, edm::DefaultRecord > pdtToken_
edm::ESHandle< ParticleDataTable > pdt

Member Data Documentation

◆ b

MonitorElement* HiBasicGenTest::b[3]
private

Definition at line 33 of file HiBasicGenTest.h.

◆ dnchdeta

MonitorElement* HiBasicGenTest::dnchdeta[3]
private

Definition at line 31 of file HiBasicGenTest.h.

◆ dnchdphi

MonitorElement* HiBasicGenTest::dnchdphi[3]
private

Definition at line 34 of file HiBasicGenTest.h.

◆ dnchdpt

MonitorElement* HiBasicGenTest::dnchdpt[3]
private

Definition at line 32 of file HiBasicGenTest.h.

◆ generatorToken_

edm::EDGetTokenT<edm::HepMCProduct> HiBasicGenTest::generatorToken_
private

Definition at line 30 of file HiBasicGenTest.h.

◆ pdt

edm::ESHandle<ParticleDataTable> HiBasicGenTest::pdt
private

Definition at line 37 of file HiBasicGenTest.h.

◆ pdtToken_

edm::ESGetToken<ParticleDataTable, edm::DefaultRecord> HiBasicGenTest::pdtToken_
private

Definition at line 38 of file HiBasicGenTest.h.

◆ rp

MonitorElement* HiBasicGenTest::rp
private

Definition at line 35 of file HiBasicGenTest.h.