14 #include <b2bii/modules/B2BIIMCParticlesMonitor/B2BIIMCParticlesMonitorModule.h>
17 #include <framework/core/HistoModule.h>
20 #include <framework/datastore/StoreArray.h>
23 #include <framework/gearbox/Const.h>
26 #include <mdst/dataobjects/MCParticle.h>
43 setDescription(
"This module creates and fills B2BII MCParticles monitoring histograms.");
47 B2BIIMCParticlesMonitorModule::~B2BIIMCParticlesMonitorModule()
51 void B2BIIMCParticlesMonitorModule::defineHisto()
53 mcPDG =
new TH1F(
"mcPDG",
"PDG values of MCParticles", 100, -22500, 22500);
54 mcM =
new TH1F(
"mcM",
"M", 100, 0, 11.6);
55 mcPx =
new TH1F(
"mcPx",
"Px", 100, -5.8, 5.8);
56 mcPy =
new TH1F(
"mcPy",
"Py", 100, -5.8, 5.8);
57 mcPz =
new TH1F(
"mcPz",
"Pz", 100, -4.2, 8.6);
58 mcE =
new TH1F(
"mcE",
"E", 100, 0, 12.6);
59 mcVx =
new TH1F(
"mcVx",
"Vx", 100, -4500, 5100);
60 mcVy =
new TH1F(
"mcVy",
"Vy", 100, -5000, 4200);
61 mcVz =
new TH1F(
"mcVz",
"Vz", 100, -9000, 9800);
62 mcPiPlusMother =
new TH1F(
"mcPiPlusMother",
"Pi+ Mother PDG's", 102, -498000, 9498000);
63 mcPiMinusMother =
new TH1F(
"mcPiMinusMother",
"Pi- Mother PDG's", 102, -498000, 9498000);
64 mcPi0Mother =
new TH1F(
"mcPi0Mother",
"Pi0 Mother PDG's", 102, -498000, 9498000);
65 mcNDau =
new TH1F(
"mcNDau",
"Number of Daughters", 56, 0, 56);
68 void B2BIIMCParticlesMonitorModule::initialize()
73 void B2BIIMCParticlesMonitorModule::beginRun()
77 void B2BIIMCParticlesMonitorModule::event()
80 if (!mc_particles) B2ERROR(
"Cannot find MCParticles array");
84 for (
int i = 0; i < nentries; i++) {
86 const MCParticle* mcparticle = mc_particles[i];
88 mcPDG->Fill(mcparticle->
getPDG());
90 mcM->Fill(mcparticle->
getMass());
100 int mcparticle_pdg = mcparticle->
getPDG();
103 if (mcparticle_pdg == Const::pion.getPDGCode()) mcPiPlusMother->Fill(mcparticle->
getMother()->
getPDG());
104 if (mcparticle_pdg == -Const::pion.getPDGCode()) mcPiMinusMother->Fill(mcparticle->
getMother()->
getPDG());
105 if (mcparticle_pdg == Const::pi0.getPDGCode()) mcPi0Mother->Fill(mcparticle->
getMother()->
getPDG());
112 void B2BIIMCParticlesMonitorModule::endRun()
116 void B2BIIMCParticlesMonitorModule::terminate()
Declaration of class B2BIIMCParticlesMonitor.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
A Class to store the Monte Carlo particle information.
float getEnergy() const
Return particle energy in GeV.
float getMass() const
Return the particle mass in GeV.
TVector3 getMomentum() const
Return momentum.
int getNDaughters() const
Return number of daughter MCParticles.
int getPDG() const
Return PDG code of particle.
TVector3 getProductionVertex() const
Return production vertex position.
int getEntries() const
Get the number of objects in the array.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
MCParticle * getMother() const
Returns a pointer to the mother particle.
Abstract base class for different kinds of events.