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
27 
31 
33 
35 public:
36  explicit BPhysicsValidation(const edm::ParameterSet &);
37  ~BPhysicsValidation() override;
38 
39  void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override;
40  void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override;
41  void analyze(edm::Event const &, edm::EventSetup const &) override;
42 
43 private:
45  public:
47  : p(p_), name(name_), pdgid(p.getParameter<int>("pdgid")){};
49 
52  double mass_min = p.getParameter<double>("massmin");
53  double mass_max = p.getParameter<double>("massmax");
54  DQMHelper dqm(&i);
55  i.setCurrentFolder("Generator/BPhysics");
56  // Number of analyzed events
57  pt = dqm.book1dHisto(name + "PT", "P_{t} of the " + pname + "s", 100, 0., 100, "P_{t} (GeV)", "Number of Events");
58  eta = dqm.book1dHisto(name + "ETA", "#eta of the " + pname + "s", 100, -5., 5., "#eta", "Number of Events");
59  phi = dqm.book1dHisto(
60  name + "PHI", "#phi of the " + pname + "s", 100, 0, 2 * TMath::Pi(), "#phi", "Number of Events");
61  mass = dqm.book1dHisto(
62  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 &)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
~BPhysicsValidation() override
edm::EDGetTokenT< reco::GenParticleCollection > genparticleCollectionToken_
double pt() const final
transverse momentum
Definition: weight.py:1
void Fill(long long x)
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:45
double mass() const final
mass
void analyze(edm::Event const &, edm::EventSetup const &) override