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 <TLorentzVector.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");
28 addParam("MCParticlesStoreArrayName", m_mcParticlesName,
"Name of the MC particles StoreArray.", std::string(
""));
45 B2WARNING(
"BeamParameters changed within the same process, check if this is fine according to the primary generator you are using.");
52 TLorentzVector momentum = mcParticle.get4Vector();
53 mcParticle.set4Vector(
m_boost * momentum);
54 if (mcParticle.getProductionTime() != 0.) {
55 TLorentzVector productionVertex{mcParticle.getProductionVertex(),
Const::speedOfLight * mcParticle.getProductionTime()};
56 productionVertex =
m_boost * productionVertex;
57 mcParticle.setProductionVertex(productionVertex.X(), productionVertex.Y(), productionVertex.Z());
60 if (mcParticle.getDecayTime() != 0.) {
61 TLorentzVector decayVertex{mcParticle.getDecayVertex(),
Const::speedOfLight * mcParticle.getDecayTime()};
62 decayVertex =
m_boost * decayVertex;
63 mcParticle.setDecayVertex(decayVertex.X(), decayVertex.Y(), decayVertex.Z());
Module for boosting the MCParticles from CM to LAB frame.
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.
TLorentzRotation m_boost
Boost rotation.
InitialParticleGeneration m_initial
Initial particle generation.
StoreArray< MCParticle > m_mcParticles
MC particles.
static const double speedOfLight
[cm/ns]
This class contains the initial state for the given event.
const TLorentzRotation & getCMSToLab() const
Return the LorentzRotation to convert from CMS to lab frame.
A Class to store the Monte Carlo particle information.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
#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.