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 analyze(edm::Event const &, edm::EventSetup const &) override;
41 
42 private:
44  public:
46  : p(p_), name(name_), pdgid(p.getParameter<int>("pdgid")){};
48 
51  double mass_min = p.getParameter<double>("massmin");
52  double mass_max = p.getParameter<double>("massmax");
53  DQMHelper dqm(&i);
54  i.setCurrentFolder("Generator/BPhysics");
55  // Number of analyzed events
56  pt = dqm.book1dHisto(name + "PT", "P_{t} of the " + pname + "s", 100, 0., 100, "P_{t} (GeV)", "Number of Events");
57  eta = dqm.book1dHisto(name + "ETA", "#eta of the " + pname + "s", 100, -5., 5., "#eta", "Number of Events");
58  phi = dqm.book1dHisto(
59  name + "PHI", "#phi of the " + pname + "s", 100, 0, 2 * TMath::Pi(), "#phi", "Number of Events");
60  mass = dqm.book1dHisto(
61  name + "MASS", "Mass of the " + pname + "s", 100, mass_min, mass_max, "Mass (GeV)", "Number of Events");
62  }
63 
64  void Fill(const reco::GenParticle *p, double weight) {
65  if (abs(p->pdgId()) == abs(pdgid)) {
66  pt->Fill(p->pt(), weight);
67  eta->Fill(p->eta(), weight);
68  phi->Fill(p->phi(), weight);
69  mass->Fill(p->mass(), weight);
70  }
71  }
72  int PDGID() { return pdgid; }
73 
74  private:
77  int pdgid;
79  };
80 
81  void FillDaughters(const reco::GenParticle *p);
86  std::vector<ParticleMonitor> daughters;
88 };
89 
90 #endif
BPhysicsValidation::ParticleMonitor::eta
MonitorElement * eta
Definition: BPhysicsValidation.h:78
dqm::impl::MonitorElement
Definition: MonitorElement.h:99
Handle.h
BPhysicsValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Definition: BPhysicsValidation.cc:28
mps_fire.i
i
Definition: mps_fire.py:428
BPhysicsValidation::ParticleMonitor::pt
MonitorElement * pt
Definition: BPhysicsValidation.h:78
ESHandle.h
BPhysicsValidation
Definition: BPhysicsValidation.h:34
BPhysicsValidation::ParticleMonitor::mass
MonitorElement * mass
Definition: BPhysicsValidation.h:78
reco::GenParticle
Definition: GenParticle.h:21
edm::Run
Definition: Run.h:45
edm::EDGetTokenT< reco::GenParticleCollection >
mps_merge.weight
weight
Definition: mps_merge.py:88
DQMStore.h
BPhysicsValidation::FillDaughters
void FillDaughters(const reco::GenParticle *p)
Definition: BPhysicsValidation.cc:50
GenParticle.h
DQMHelper.h
BPhysicsValidation::daughters
std::vector< ParticleMonitor > daughters
Definition: BPhysicsValidation.h:86
BPhysicsValidation::Nobj
MonitorElement * Nobj
Definition: BPhysicsValidation.h:87
BPhysicsValidation::ParticleMonitor::pdgid
int pdgid
Definition: BPhysicsValidation.h:77
BPhysicsValidation::ParticleMonitor::p
const edm::ParameterSet p
Definition: BPhysicsValidation.h:75
Service.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
GenParticleFwd.h
BPhysicsValidation::ParticleMonitor::phi
MonitorElement * phi
Definition: BPhysicsValidation.h:78
Run.h
BPhysicsValidation::ParticleMonitor::PDGID
int PDGID()
Definition: BPhysicsValidation.h:72
unpackData-CaloStage2.pname
pname
Definition: unpackData-CaloStage2.py:76
DQMEDAnalyzer.h
BPhysicsValidation::ParticleMonitor::Configure
void Configure(DQMStore::IBooker &i)
Definition: BPhysicsValidation.h:49
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
BPhysicsValidation::ParticleMonitor::Fill
void Fill(const reco::GenParticle *p, double weight)
Definition: BPhysicsValidation.h:64
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BPhysicsValidation::ParticleMonitor::ParticleMonitor
ParticleMonitor(std::string name_, const edm::ParameterSet &p_)
Definition: BPhysicsValidation.h:45
Event.h
BPhysicsValidation::analyze
void analyze(edm::Event const &, edm::EventSetup const &) override
Definition: BPhysicsValidation.cc:38
createfilelist.int
int
Definition: createfilelist.py:10
BPhysicsValidation::ParticleMonitor
Definition: BPhysicsValidation.h:43
BPhysicsValidation::particle
ParticleMonitor particle
Definition: BPhysicsValidation.h:85
edm::EventSetup
Definition: EventSetup.h:58
BPhysicsValidation::name
std::string name
Definition: BPhysicsValidation.h:84
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
InputTag.h
DQMHelper
Definition: DQMHelper.h:15
BPhysicsValidation::~BPhysicsValidation
~BPhysicsValidation() override
Definition: BPhysicsValidation.cc:26
BPhysicsValidation::genparticleCollectionToken_
edm::EDGetTokenT< reco::GenParticleCollection > genparticleCollectionToken_
Definition: BPhysicsValidation.h:83
BPhysicsValidation::BPhysicsValidation
BPhysicsValidation(const edm::ParameterSet &)
Definition: BPhysicsValidation.cc:13
BPhysicsValidation::ParticleMonitor::name
std::string name
Definition: BPhysicsValidation.h:76
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
dqm
Definition: DQMStore.h:18
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
BPhysicsValidation::ParticleMonitor::~ParticleMonitor
~ParticleMonitor()
Definition: BPhysicsValidation.h:47
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
weight
Definition: weight.py:1
BPhysicsValidation::genparticleCollection_
edm::InputTag genparticleCollection_
Definition: BPhysicsValidation.h:82