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::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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 &ev, edm::EventSetup const &es) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 21 of file HiBasicGenTest.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file HiBasicGenTest.cc.

References edm::ParameterSet::getParameter().

18 {
19  generatorToken_ = consumes<edm::HepMCProduct> (
20  iPSet.getParameter<edm::InputTag>("generatorLabel"));
21 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::HepMCProduct > generatorToken_
HiBasicGenTest::~HiBasicGenTest ( )
override

Definition at line 23 of file HiBasicGenTest.cc.

23 {}

Member Function Documentation

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

Definition at line 59 of file HiBasicGenTest.cc.

References b, begin, ALCARECOTkAlJpsiMuMu_cff::charge, DEFINE_FWK_MODULE, end, PVValHelper::eta, edm::Event::getByToken(), edm::HepMCProduct::GetEvent(), CaloTowersParam_cfi::mc, AlCaHLTBitMon_ParallelJobs::p, HiggsValidation_cfi::pdg_id, Pi, pi, and EnergyCorrector::pt.

60 {
61 
63  iEvent.getByToken(generatorToken_, mc);
64  const HepMC::GenEvent *evt = mc->GetEvent();
65  const HepMC::HeavyIon *hi = evt->heavy_ion();
66 
67  int cbin = 0;
68  double phi0 =0.;
69 
70  if(hi){
71 
72  double ip = hi->impact_parameter();
73  phi0 = hi->event_plane_angle();
74 
75  // fill reaction plane distribution
76  rp->Fill(phi0);
77 
78  // if the event is in one of the centrality bins of interest fill hists
79  int cbin=-1;
80  if(ip < 5.045) cbin=0;
81  else if (ip < 7.145 && ip > 5.045) cbin=1;
82  else if (ip < 15.202 && ip > 14.283) cbin=2;
83  if(cbin<0) return;
84 
85  // fill impact parameter distributions
86  b[cbin]->Fill(ip);
87  }
88 
89  // loop over particles
90  HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
91  HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
92  for(HepMC::GenEvent::particle_const_iterator it = begin; it != end; ++it){
93 
94  // only fill hists for status=1 particles
95  if((*it)->status() != 1) continue;
96 
97  // only fill hists for charged particles
98  int pdg_id = (*it)->pdg_id();
99  const ParticleData * part = pdt->particle(pdg_id);
100  int charge = static_cast<int>(part->charge());
101  if(charge==0) continue;
102 
103  float eta = (*it)->momentum().eta();
104  float phi = (*it)->momentum().phi();
105  float pt = (*it)->momentum().perp();
106 
107  dnchdeta[cbin]->Fill(eta);
108  dnchdpt[cbin]->Fill(pt);
109 
110  double pi = TMath::Pi();
111  double p = phi-phi0;
112  if(p > pi) p = p - 2*pi;
113  if(p < -1*pi) p = p + 2*pi;
114  dnchdphi[cbin]->Fill(p);
115 
116  }
117 
118  return;
119 
120 }
const double Pi
MonitorElement * rp
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< edm::HepMCProduct > generatorToken_
MonitorElement * dnchdpt[3]
edm::ESHandle< ParticleDataTable > pdt
void Fill(long long x)
const Double_t pi
MonitorElement * dnchdeta[3]
MonitorElement * dnchdphi[3]
MonitorElement * b[3]
#define end
Definition: vmac.h:39
HepPDT::ParticleData ParticleData
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
part
Definition: HCALResponse.h:20
#define begin
Definition: vmac.h:32
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 25 of file HiBasicGenTest.cc.

References b, DQMStore::IBooker::book1D(), DQMStore::IBooker::setCurrentFolder(), and DQMStore::IBooker::tag().

26  {
27 
29  ibooker.setCurrentFolder("Generator/Particles");
30 
32  for (int ibin = 0; ibin < 3; ibin++) {
33  dnchdeta[ibin] = ibooker.book1D(Form("dnchdeta%d", ibin), ";#eta;dN^{ch}/d#eta",
34  100, -6.0, 6.0);
35 
36  dnchdpt[ibin] = ibooker.book1D(Form("dnchdpt%d", ibin), ";p_{T};dN^{ch}/dp_{T}",
37  200, 0.0, 100.0);
38 
39  b[ibin] = ibooker.book1D(Form("b%d",ibin),";b[fm];events", 100, 0.0, 20.0);
40  dnchdphi[ibin] = ibooker.book1D(Form("dnchdphi%d", ibin), ";#phi;dN^{ch}/d#phi",
41  100, -3.2, 3.2);
42 
43  ibooker.tag(dnchdeta[ibin], 1+ibin*4);
44  ibooker.tag(dnchdpt[ibin], 2+ibin*4);
45  ibooker.tag(b[ibin], 3+ibin*4);
46  ibooker.tag(dnchdphi[ibin], 4+ibin*4);
47  }
48 
49  rp = ibooker.book1D("phi0", ";#phi_{RP};events", 100, -3.2, 3.2);
50  ibooker.tag(rp, 13);
51 }
MonitorElement * rp
MonitorElement * dnchdpt[3]
MonitorElement * dnchdeta[3]
MonitorElement * dnchdphi[3]
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
void tag(MonitorElement *, unsigned int)
Definition: DQMStore.cc:286
MonitorElement * b[3]
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
void HiBasicGenTest::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
override

Definition at line 53 of file HiBasicGenTest.cc.

References edm::EventSetup::getData().

54 {
55  iSetup.getData(pdt);
56 }
edm::ESHandle< ParticleDataTable > pdt

Member Data Documentation

MonitorElement* HiBasicGenTest::b[3]
private

Definition at line 37 of file HiBasicGenTest.h.

MonitorElement* HiBasicGenTest::dnchdeta[3]
private

Definition at line 35 of file HiBasicGenTest.h.

MonitorElement* HiBasicGenTest::dnchdphi[3]
private

Definition at line 38 of file HiBasicGenTest.h.

MonitorElement* HiBasicGenTest::dnchdpt[3]
private

Definition at line 36 of file HiBasicGenTest.h.

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

Definition at line 34 of file HiBasicGenTest.h.

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

Definition at line 41 of file HiBasicGenTest.h.

MonitorElement* HiBasicGenTest::rp
private

Definition at line 39 of file HiBasicGenTest.h.