9 #include <analysis/utility/PCmsLabTransform.h>
11 #include <analysis/modules/EventKinematics/EventKinematicsModule.h>
13 #include <analysis/dataobjects/ParticleList.h>
14 #include <analysis/dataobjects/Particle.h>
16 #include <framework/logging/Logger.h>
17 #include <framework/gearbox/Const.h>
33 EventKinematicsModule::EventKinematicsModule() :
Module()
36 setDescription(
"Module to compute global event kinematic attributes like missing momentum and energy.");
48 auto arrayName = (!
m_usingMC) ?
"EventKinematics" :
"EventKinematicsFromMC";
67 float missingMass2 = missingEnergyCMS * missingEnergyCMS - missingMomentumCMS.R() * missingMomentumCMS.R();
89 int nParticleLists = particleLists.size();
90 B2DEBUG(10,
"Number of ParticleLists to calculate Event Kinematics variables: " << nParticleLists);
92 for (
int i_pl = 0; i_pl != nParticleLists; ++i_pl) {
93 string particleListName = particleLists[i_pl];
94 B2DEBUG(10,
"ParticleList: " << particleListName);
96 int m_part = plist->getListSize();
97 for (
int i = 0; i < m_part; i++) {
98 const Particle* part = plist->getParticle(i);
99 if (part->getParticleSource() == Particle::EParticleSourceObject::c_MCParticle and !
m_usingMC) {
100 B2FATAL(
"EventKinematics received MCParticles as an input, but usingMC flag is false");
102 if (part->getParticleSource() != Particle::EParticleSourceObject::c_MCParticle and
m_usingMC) {
103 B2FATAL(
"EventKinematics received reconstructed Particles as an input, but usingMC flag is true");
106 ROOT::Math::PxPyPzEVector p_lab = part->get4Vector();
109 if ((part->getParticleSource() == Particle::EParticleSourceObject::c_ECLCluster or
110 part->getParticleSource() == Particle::EParticleSourceObject::c_MCParticle)
126 ROOT::Math::XYZVector p = beam.Vect();
128 for (
int i = 0; i < nParticles; ++i) {
136 ROOT::Math::XYZVector p(0., 0., 0.);
138 for (
int i = 0; i < nParticles; ++i) {
149 for (
int i = 0; i < nParticles; ++i) {
157 float visibleE = 0.0;
159 for (
int i = 0; i < nParticles; ++i) {
167 float photonsEnergy = 0.0;
169 for (
int i = 0; i < nParticles; ++i) {
172 return photonsEnergy;
int getPDGCode() const
PDG code.
static const ParticleType photon
photon particle
ROOT::Math::XYZVector getMissingMomentum()
Calculate the missing momentum in the lab system for this event.
float getMissingEnergyCMS()
Calculate the missing energy in the CMS for this event.
float getVisibleEnergyCMS()
Calculate the visible energy in the CMS for this event.
std::vector< ROOT::Math::PxPyPzEVector > m_particleMomentumListCMS
A vector of the particles' 4-momenta in the CMS.
virtual void initialize() override
Define the physical parameters.
void getParticleMomentumLists(std::vector< std::string > particleLists)
Fill the lists of particles' momenta.
virtual void event() override
Define event parameters.
bool m_usingMC
Is from MC.
virtual void terminate() override
finish the execution
float getTotalPhotonsEnergy()
Calculate the energy for the photons in this event.
StoreObjPtr< EventKinematics > m_eventKinematics
event kinematics object pointer
virtual ~EventKinematicsModule()
free memory
std::vector< std::string > m_particleLists
Name of the ParticleList.
std::vector< ROOT::Math::PxPyPzEVector > m_photonsMomentumList
A vector of the photons' 4-momenta in the lab.
std::vector< ROOT::Math::PxPyPzEVector > m_particleMomentumList
A vector of the particles' 4-momenta in lab.
ROOT::Math::XYZVector getMissingMomentumCMS()
Calculate the missing momentum in the CMS for this event.
Class for collecting variables related to the global kinematics of the event.
void setDescription(const std::string &description)
Sets the description of the module.
Class to store reconstructed particles.
Type-safe access to single objects in the data store.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.