10#include <generators/modules/BoostMCParticlesModule.h>
13#include <framework/dataobjects/MCInitialParticles.h>
14#include <framework/gearbox/Const.h>
15#include <framework/logging/Logger.h>
18#include <Math/Vector4D.h>
27 R
"DOC(Module for boosting the MCParticles from CM to LAB frame. The module must be appended to the path only when HepMC, Hepevt or LHE input files are used.)DOC");
45 B2WARNING(
"BeamParameters changed within the same process, check if this is fine according to the primary generator you are using.");
52 ROOT::Math::PxPyPzEVector momentum = mcParticle.get4Vector();
53 mcParticle.set4Vector(
m_boost * momentum);
54 if (mcParticle.getProductionTime() != 0.) {
55 ROOT::Math::XYZVector v = mcParticle.getProductionVertex();
56 ROOT::Math::PxPyPzEVector productionVertex(v.X(), v.Y(), v.Z(),
Const::speedOfLight * mcParticle.getProductionTime());
57 productionVertex =
m_boost * productionVertex;
58 mcParticle.setProductionVertex(productionVertex.X(), productionVertex.Y(), productionVertex.Z());
61 if (mcParticle.getDecayTime() != 0.) {
62 ROOT::Math::XYZVector v = mcParticle.getDecayVertex();
63 ROOT::Math::PxPyPzEVector decayVertex(v.X(), v.Y(), v.Z(),
Const::speedOfLight * mcParticle.getDecayTime());
64 decayVertex =
m_boost * decayVertex;
65 mcParticle.setDecayVertex(decayVertex.X(), decayVertex.Y(), decayVertex.Z());
bool m_firstEvent
Flag for keeping track of the first call of the event() method.
DBObjPtr< BeamParameters > m_beamParameters
Beam parameters.
void initialize() override
Initialize.
std::string m_mcParticlesName
Name of the MC particles StoreArray.
void event() override
Event.
BoostMCParticlesModule()
Constructor.
InitialParticleGeneration m_initial
Initial particle generation.
StoreArray< MCParticle > m_mcParticles
MC particles.
ROOT::Math::LorentzRotation m_boost
Boost rotation.
static const double speedOfLight
[cm/ns]
This class contains the initial state for the given event.
const ROOT::Math::LorentzRotation & getCMSToLab() const
Return the LorentzRotation to convert from CMS to lab frame.
A Class to store the Monte Carlo particle information.
void setDescription(const std::string &description)
Sets the description of the module.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
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.
void initialize()
function to be executed on initialize()
MCInitialParticles & generate()
Generate a new event.
Abstract base class for different kinds of events.