CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  virtual ~BPhysicsValidation();
41 
42  virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override;
43  virtual void dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) override;
44  virtual 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 i
Definition: DBlmapReader.cc:9
ParticleMonitor(std::string name_, const edm::ParameterSet &p_)
MonitorElement * Nobj
BPhysicsValidation(const edm::ParameterSet &)
edm::EDGetTokenT< reco::GenParticleCollection > genparticleCollectionToken_
virtual double phi() const final
momentum azimuthal angle
void Fill(long long x)
ParticleMonitor particle
virtual 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
virtual double mass() const final
mass
virtual void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:273
void FillDaughters(const reco::GenParticle *p)
virtual int pdgId() const final
PDG identifier.
void Fill(const reco::GenParticle *p, double weight)
std::vector< ParticleMonitor > daughters
virtual double eta() const final
momentum pseudorapidity
Definition: Run.h:43
virtual double pt() const final
transverse momentum
virtual void analyze(edm::Event const &, edm::EventSetup const &) override