CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HiBasicGenTest Class Reference

#include <HiBasicGenTest.h>

Inheritance diagram for HiBasicGenTest:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endJob ()
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
 HiBasicGenTest (const edm::ParameterSet &)
 
virtual ~HiBasicGenTest ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

MonitorElementb [3]
 
DQMStoredbe
 
MonitorElementdnchdeta [3]
 
MonitorElementdnchdphi [3]
 
MonitorElementdnchdpt [3]
 
edm::EDGetTokenT
< edm::HepMCProduct
generatorToken_
 
edm::ESHandle< ParticleDataTablepdt
 
MonitorElementrp
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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)
 

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(), and cppFunctionSkipper::operator.

18 {
19  dbe = 0;
21  generatorToken_ = consumes<edm::HepMCProduct> (
22  iPSet.getParameter<edm::InputTag>("generatorLabel"));
23 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::HepMCProduct > generatorToken_
DQMStore * dbe
HiBasicGenTest::~HiBasicGenTest ( )
virtual

Definition at line 25 of file HiBasicGenTest.cc.

25 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 67 of file HiBasicGenTest.cc.

References b, begin, DeDxDiscriminatorTools::charge(), end, eta(), edm::Event::getByToken(), AlCaHLTBitMon_ParallelJobs::p, phi, Pi, pi, and RecoTauCleanerPlugins::pt.

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

Setting the DQM top directories

Booking the ME's

Reimplemented from edm::EDAnalyzer.

Definition at line 27 of file HiBasicGenTest.cc.

References b.

28 {
29  if(dbe){
31  dbe->setCurrentFolder("Generator/Particles");
32 
34  for(int ibin=0; ibin<3; ibin++) {
35  dnchdeta[ibin] = dbe->book1D(Form("dnchdeta%d",ibin), ";#eta;dN^{ch}/d#eta", 100, -6.0, 6.0);
36  dnchdpt[ibin] = dbe->book1D(Form("dnchdpt%d",ibin), ";p_{T};dN^{ch}/dp_{T}", 200, 0.0, 100.0);
37  b[ibin] = dbe->book1D(Form("b%d",ibin),";b[fm];events",100, 0.0, 20.0);
38  dnchdphi[ibin] = dbe->book1D(Form("dnchdphi%d",ibin),";#phi;dN^{ch}/d#phi",100, -3.2, 3.2);
39 
40  dbe->tag(dnchdeta[ibin]->getFullname(),1+ibin*4);
41  dbe->tag(dnchdpt[ibin]->getFullname(),2+ibin*4);
42  dbe->tag(b[ibin]->getFullname(),3+ibin*4);
43  dbe->tag(dnchdphi[ibin]->getFullname(),4+ibin*4);
44  }
45 
46  rp = dbe->book1D("phi0",";#phi_{RP};events",100,-3.2,3.2);
47  dbe->tag(rp->getFullname(),13);
48 
49 
50  }
51  return;
52 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
MonitorElement * rp
MonitorElement * dnchdpt[3]
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1594
MonitorElement * dnchdeta[3]
MonitorElement * dnchdphi[3]
MonitorElement * b[3]
const std::string getFullname(void) const
get full name of ME including Pathname
DQMStore * dbe
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void HiBasicGenTest::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file HiBasicGenTest.cc.

References edm::EventSetup::getData().

60 {
61  iSetup.getData(pdt);
62  return;
63 }
void getData(T &iHolder) const
Definition: EventSetup.h:67
edm::ESHandle< ParticleDataTable > pdt
void HiBasicGenTest::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 54 of file HiBasicGenTest.cc.

54  {
55  // normalization of histograms can be done here (or in post-processor)
56  return;
57 }
void HiBasicGenTest::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file HiBasicGenTest.cc.

65 {return;}

Member Data Documentation

MonitorElement* HiBasicGenTest::b[3]
private

Definition at line 39 of file HiBasicGenTest.h.

DQMStore* HiBasicGenTest::dbe
private

Definition at line 34 of file HiBasicGenTest.h.

MonitorElement* HiBasicGenTest::dnchdeta[3]
private

Definition at line 37 of file HiBasicGenTest.h.

MonitorElement* HiBasicGenTest::dnchdphi[3]
private

Definition at line 40 of file HiBasicGenTest.h.

MonitorElement* HiBasicGenTest::dnchdpt[3]
private

Definition at line 38 of file HiBasicGenTest.h.

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

Definition at line 36 of file HiBasicGenTest.h.

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

Definition at line 43 of file HiBasicGenTest.h.

MonitorElement* HiBasicGenTest::rp
private

Definition at line 41 of file HiBasicGenTest.h.