11#include <framework/gearbox/Const.h>
12#include <framework/utilities/LabToCms.h>
15#include <Math/Boost.h>
16#include <Math/LorentzRotation.h>
17#include <Math/Vector3D.h>
18#include <Math/Vector4D.h>
74#if defined(MCP_DBL_CMP) || defined(MCP_VEC3_CMP) || defined(MCP_VEC4_CMP)
75#error Macro already defined, cannot continue
77#define MCP_DBL_CMP(a,b,x) ((a.X()==b.X())||(std::abs(a.X()-b.X())<1e-10))
78#define MCP_VEC3_CMP(a,b) (MCP_DBL_CMP(a,b,X) && MCP_DBL_CMP(a,b,Y) && MCP_DBL_CMP(a,b,Z))
79#define MCP_VEC4_CMP(a,b) (MCP_VEC3_CMP(a,b) && MCP_DBL_CMP(a,b,E))
80 return MCP_VEC4_CMP(
m_her, b.m_her) && MCP_VEC4_CMP(
m_ler, b.m_ler) && MCP_VEC3_CMP(
m_vertex, b.m_vertex)
97 void set(
const ROOT::Math::PxPyPzEVector& her,
const ROOT::Math::PxPyPzEVector& ler,
const ROOT::Math::XYZVector& vertex)
117 const ROOT::Math::XYZVector& vertex)
123 m_CMSToLab =
new ROOT::Math::LorentzRotation();
124 m_labToCMS =
new ROOT::Math::LorentzRotation();
129 double p = sqrt(Ecms * Ecms / 4 - me * me);
130 m_her = (*m_CMSToLab) * ROOT::Math::PxPyPzEVector(0.0, 0.0, p, Ecms / 2);
131 m_ler = (*m_CMSToLab) * ROOT::Math::PxPyPzEVector(0.0, 0.0, -p, Ecms / 2);
138 void setHER(
const ROOT::Math::PxPyPzEVector& her)
145 void setLER(
const ROOT::Math::PxPyPzEVector& ler)
220 static ROOT::Math::LorentzRotation
cmsToLab(
double bX,
double bY,
double bZ,
double angleXZ,
double angleYZ);
263 ROOT::Math::PxPyPzEVector beam =
m_her +
m_ler;
270 m_labToCMS =
new ROOT::Math::LorentzRotation();
271 m_CMSToLab =
new ROOT::Math::LorentzRotation();
275 m_boostedHER = ROOT::Math::LorentzRotation(ROOT::Math::Boost(beam.BoostToCM())) *
m_her;
double getMass() const
Particle mass.
static const ChargedStable electron
electron particle
static ROOT::Math::LorentzRotation rotateLabToCms(const ROOT::Math::XYZVector &boostVector, double cmsAngleXZ, double cmsAngleYZ)
Function takes 3D boostVector and angles of the HER momentum in the CM system obtained by pure boost.
This class contains the initial state for the given event.
int m_generationFlags
Flags to be used when generating events.
const ROOT::Math::PxPyPzEVector & getHER() const
Get 4vector of the high energy beam.
ROOT::Math::LorentzRotation * m_CMSToLab
transient
bool operator==(const MCInitialParticles &b) const
Equality operator.
int getGenerationFlags() const
Get the generation flags to be used for event generation (ORed combination of EGenerationFlags)
bool getValidFlag() const
Get the flag to check if a valid MCInitialParticles object was already generated and filled in an eve...
ROOT::Math::PxPyPzEVector m_boostedHER
transient
ROOT::Math::PxPyPzEVector getBoostedHER() const
Get the 4-vector of electron beam in CM system obtained by pure boost.
void setVertex(const ROOT::Math::XYZVector &vertex)
Set the vertex position.
double m_time
collision time
const ROOT::Math::PxPyPzEVector & getLER() const
Get 4vector of the low energy beam.
ROOT::Math::PxPyPzEVector m_ler
LER 4vector.
void setTime(double time)
Set collision time.
double getEnergy() const
Get the actual collision energy (in lab system)
ROOT::Math::PxPyPzEVector m_her
HER 4vector.
EGenerationFlags
Possible Flags for initial event generation.
@ c_smearVertex
smear vertex
@ c_smearBeam
smear the full beam momentum (energy and direction)
@ c_generateCMS
generate initial event in CMS instead of lab
@ c_smearBeamEnergy
smear energy of HER and LER (but not direction)
@ c_smearBeamDirection
smear direction of HER and LER (but not energy)
ROOT::Math::LorentzRotation * m_labToCMS
Boost from Lab into CMS.
const ROOT::Math::LorentzRotation & getLabToCMS() const
Return the LorentzRotation to convert from lab to CMS frame.
ROOT::Math::XYZVector m_vertex
collision position
const ROOT::Math::LorentzRotation & getCMSToLab() const
Return the LorentzRotation to convert from CMS to lab frame.
std::string getGenerationFlagString(const std::string &separator=" ") const
Return string representation of all active flags for printing.
MCInitialParticles & operator=(const MCInitialParticles &b)
Assignment operator.
virtual void setGenerationFlags(int flags)
Set the generation flags to be used for event generation (ORed combination of EGenerationFlags)
static ROOT::Math::LorentzRotation cmsToLab(double bX, double bY, double bZ, double angleXZ, double angleYZ)
Return the LorentzRotation from CMS to LAB based on the following parameters.
MCInitialParticles()
Default constructor.
void setByLorentzTransformation(double Ecms, double bX, double bY, double bZ, double angleXZ, double angleYZ, const ROOT::Math::XYZVector &vertex)
Initialize the event values from CMS energy and parameters of the Lorentz transformation between LAB ...
bool hasGenerationFlags(int flags) const
Check if a certain set of EGenerationFlags is set.
const ROOT::Math::XYZVector & getVertex() const
Get the position of the collision.
void setHER(const ROOT::Math::PxPyPzEVector &her)
Set the High Energy Beam 4-momentum.
MCInitialParticles(const MCInitialParticles &b)
Copy constructor.
void setLER(const ROOT::Math::PxPyPzEVector &ler)
Set the Low Energy Beam 4-momentum.
bool m_validFlag
transient
double m_invariantMass
transient
virtual ~MCInitialParticles()
Free memory of the LorentzRotation if it was created.
ROOT::Math::XYZVector getBoostVector() const
Get the boost vector (velocity of system produced in the collision)
double getMass() const
Get the invariant mass of the collision (= energy in CMS)
double getTime() const
Get collision time.
void set(const ROOT::Math::PxPyPzEVector &her, const ROOT::Math::PxPyPzEVector &ler, const ROOT::Math::XYZVector &vertex)
Set the initial event values, i.e.
ClassDef(MCInitialParticles, 5)
ROOT Dictionary.
void resetBoost()
Reset cached transformations after changing parameters.
void calculateBoost() const
Calculate the Lorentz transformations LAB->CMS & CMS->LAB if necessary.
Abstract base class for different kinds of events.