CMS 3D CMS Logo

BPhysicsValidation.h
Go to the documentation of this file.
1 #ifndef BPhysicsValidation_H
2 #define BPhysicsValidation_H
3 
4 /*class BPhysicsValidation
5  *
6  * Class to fill Event Generator dqm monitor elements; works on HepMCProduct
7  *
8  *
9  */
10 #include <iostream>
11 #include "TMath.h"
12 // framework & common header files
13 
17 
22 
23 //DQM services
28 
32 
34 
35 
36 
38  public:
39  explicit BPhysicsValidation(const edm::ParameterSet&);
40  ~BPhysicsValidation() override;
41 
42  void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override;
43  void dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) override;
44  void analyze(edm::Event const&, edm::EventSetup const&) override;
45 
46  private:
47 
49  public:
50  ParticleMonitor(std::string name_,const edm::ParameterSet &p_):p(p_),name(name_),pdgid(p.getParameter<int>("pdgid")){};
52 
55  double mass_min=p.getParameter<double>("massmin");
56  double mass_max=p.getParameter<double>("massmax");
57  DQMHelper dqm(&i); i.setCurrentFolder("Generator/BPhysics");
58  // Number of analyzed events
59  pt = dqm.book1dHisto(name+"PT", "P_{t} of the "+pname+"s", 100, 0., 100,"P_{t} (GeV)","Number of Events");
60  eta = dqm.book1dHisto(name+"ETA", "#eta of the "+pname+"s", 100, -5., 5.,"#eta","Number of Events");
61  phi = dqm.book1dHisto(name+"PHI", "#phi of the "+pname+"s", 100, 0, 2*TMath::Pi(),"#phi","Number of Events");
62  mass = dqm.book1dHisto(name+"MASS", "Mass of the "+pname+"s", 100, mass_min, mass_max,"Mass (GeV)","Number of Events");
63  }
64 
65  void Fill(const reco::GenParticle* p, double weight){
66  if(abs(p->pdgId())==abs(pdgid)){
67  pt->Fill(p->pt(),weight);
68  eta->Fill(p->eta(),weight);
69  phi->Fill(p->phi(),weight);
70  mass->Fill(p->mass(),weight);
71  }
72  }
73  int PDGID(){return pdgid;}
74 
75  private:
78  int pdgid;
80  };
81 
82  void FillDaughters(const reco::GenParticle* p);
87  std::vector<ParticleMonitor> daughters;
89 };
90 
91 #endif
const double Pi
void Configure(DQMStore::IBooker &i)
T getParameter(std::string const &) const
int pdgId() const final
PDG identifier.
ParticleMonitor(std::string name_, const edm::ParameterSet &p_)
double eta() const final
momentum pseudorapidity
MonitorElement * Nobj
BPhysicsValidation(const edm::ParameterSet &)
~BPhysicsValidation() override
edm::EDGetTokenT< reco::GenParticleCollection > genparticleCollectionToken_
double pt() const final
transverse momentum
Definition: weight.py:1
void Fill(long long x)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
ParticleMonitor particle
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
edm::InputTag genparticleCollection_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
void FillDaughters(const reco::GenParticle *p)
void Fill(const reco::GenParticle *p, double weight)
std::vector< ParticleMonitor > daughters
double phi() const final
momentum azimuthal angle
Definition: Run.h:44
double mass() const final
mass
void analyze(edm::Event const &, edm::EventSetup const &) override