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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

MonitorElementb [3]
 
MonitorElementdnchdeta [3]
 
MonitorElementdnchdphi [3]
 
MonitorElementdnchdpt [3]
 
edm::EDGetTokenT< edm::HepMCProductgeneratorToken_
 
edm::ESHandle< ParticleDataTablepdt
 
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 >
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 21 of file HiBasicGenTest.h.

Constructor & Destructor Documentation

◆ HiBasicGenTest()

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

Definition at line 17 of file HiBasicGenTest.cc.

17  {
18  generatorToken_ = consumes<edm::HepMCProduct>(iPSet.getParameter<edm::InputTag>("generatorLabel"));
19 }

References edm::ParameterSet::getParameter().

◆ ~HiBasicGenTest()

HiBasicGenTest::~HiBasicGenTest ( )
override

Definition at line 21 of file HiBasicGenTest.cc.

21 {}

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 42 of file HiBasicGenTest.cc.

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

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

◆ 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 23 of file HiBasicGenTest.cc.

23  {
25  ibooker.setCurrentFolder("Generator/Particles");
26 
28  for (int ibin = 0; ibin < 3; ibin++) {
29  dnchdeta[ibin] = ibooker.book1D(Form("dnchdeta%d", ibin), ";#eta;dN^{ch}/d#eta", 100, -6.0, 6.0);
30 
31  dnchdpt[ibin] = ibooker.book1D(Form("dnchdpt%d", ibin), ";p_{T};dN^{ch}/dp_{T}", 200, 0.0, 100.0);
32 
33  b[ibin] = ibooker.book1D(Form("b%d", ibin), ";b[fm];events", 100, 0.0, 20.0);
34  dnchdphi[ibin] = ibooker.book1D(Form("dnchdphi%d", ibin), ";#phi;dN^{ch}/d#phi", 100, -3.2, 3.2);
35  }
36 
37  rp = ibooker.book1D("phi0", ";#phi_{RP};events", 100, -3.2, 3.2);
38 }

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

◆ dqmBeginRun()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 40 of file HiBasicGenTest.cc.

40 { iSetup.getData(pdt); }

References edm::EventSetup::getData().

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.

◆ rp

MonitorElement* HiBasicGenTest::rp
private

Definition at line 35 of file HiBasicGenTest.h.

HiggsValidation_cfi.pdg_id
pdg_id
Definition: HiggsValidation_cfi.py:6
CaloTowersParam_cfi.mc
mc
Definition: CaloTowersParam_cfi.py:8
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::Handle
Definition: AssociativeIterator.h:50
HiBasicGenTest::b
MonitorElement * b[3]
Definition: HiBasicGenTest.h:33
end
#define end
Definition: vmac.h:39
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
ParticleData
HepPDT::ParticleData ParticleData
Definition: ParticleDataTable.h:9
part
part
Definition: HCALResponse.h:20
PVValHelper::eta
Definition: PVValidationHelpers.h:69
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
HiBasicGenTest::dnchdpt
MonitorElement * dnchdpt[3]
Definition: HiBasicGenTest.h:32
HiBasicGenTest::dnchdeta
MonitorElement * dnchdeta[3]
Definition: HiBasicGenTest.h:31
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
iEvent
int iEvent
Definition: GenABIO.cc:224
DDAxes::phi
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
hi
Definition: HiEvtPlaneList.h:38
HiBasicGenTest::pdt
edm::ESHandle< ParticleDataTable > pdt
Definition: HiBasicGenTest.h:37
HiBasicGenTest::rp
MonitorElement * rp
Definition: HiBasicGenTest.h:35
HiBasicGenTest::generatorToken_
edm::EDGetTokenT< edm::HepMCProduct > generatorToken_
Definition: HiBasicGenTest.h:30
HiBasicGenTest::dnchdphi
MonitorElement * dnchdphi[3]
Definition: HiBasicGenTest.h:34
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
pi
const Double_t pi
Definition: trackSplitPlot.h:36
edm::InputTag
Definition: InputTag.h:15
begin
#define begin
Definition: vmac.h:32