11 #include <framework/gearbox/Const.h>
13 #include <TLorentzVector.h>
14 #include <Math/AxisAngle.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)
214 static ROOT::Math::LorentzRotation
cmsToLab(
double bX,
double bY,
double bZ,
double angleXZ,
double angleYZ);
255 ROOT::Math::PxPyPzEVector beam =
m_her +
m_ler;
262 m_labToCMS =
new ROOT::Math::LorentzRotation();
263 m_CMSToLab =
new ROOT::Math::LorentzRotation();
268 m_labToCMS =
new ROOT::Math::LorentzRotation(ROOT::Math::Boost(beam.BoostToCM()));
270 const ROOT::Math::PxPyPzEVector electronCMS = (*m_labToCMS) *
m_her;
272 const ROOT::Math::XYZVector zaxis(0., 0., 1.);
273 ROOT::Math::XYZVector rotaxis = zaxis.Cross(electronCMS.Vect()) / electronCMS.P();
274 double rotangle = TMath::ASin(rotaxis.R());
275 const ROOT::Math::LorentzRotation rotation(ROOT::Math::AxisAngle(rotaxis, -rotangle));
double getMass() const
Particle mass.
static const ChargedStable electron
electron particle
This class contains the initial state for the given event.
const ROOT::Math::PxPyPzEVector & getLER() const
Get 4vector of the low energy beam.
int m_generationFlags
Flags to be used when generating events.
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...
void setVertex(const ROOT::Math::XYZVector &vertex)
Set the vertex position.
const ROOT::Math::PxPyPzEVector & getHER() const
Get 4vector of the high energy beam.
double m_time
collision time
ROOT::Math::PxPyPzEVector m_ler
LER 4vector.
void setTime(double time)
Set collison time.
double getEnergy() const
Get the 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::XYZVector & getVertex() const
Get the position of the collision.
MCInitialParticles & operator=(const MCInitialParticles &b)
Assignment operator.
ROOT::Math::XYZVector m_vertex
collision position
std::string getGenerationFlagString(const std::string &separator=" ") const
Return string representation of all active flags for printing.
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.
const ROOT::Math::LorentzRotation & getLabToCMS() const
Return the LorentzRotation to convert from lab to CMS frame.
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.
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.
const ROOT::Math::LorentzRotation & getCMSToLab() const
Return the LorentzRotation to convert from CMS to lab frame.
double getMass() const
Get the invariant mass of the collision (= energy in CMS)
double getTime() const
Get collison 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 boost if necessary.
double sqrt(double a)
sqrt for double
static const double me
electron mass
Abstract base class for different kinds of events.