11 #include <TLorentzVector.h>
12 #include <Math/AxisAngle.h>
13 #include <Math/Boost.h>
14 #include <Math/LorentzRotation.h>
15 #include <Math/Vector3D.h>
16 #include <Math/Vector4D.h>
18 #include <framework/geometry/B2Vector3.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 B2Vector3D& vertex)
107 void setHER(
const ROOT::Math::PxPyPzEVector& her)
114 void setLER(
const ROOT::Math::PxPyPzEVector& ler)
214 ROOT::Math::PxPyPzEVector beam =
m_her +
m_ler;
221 m_labToCMS =
new ROOT::Math::LorentzRotation();
222 m_CMSToLab =
new ROOT::Math::LorentzRotation();
227 m_labToCMS =
new ROOT::Math::LorentzRotation(ROOT::Math::Boost(beam.BoostToCM()));
229 const ROOT::Math::PxPyPzEVector electronCMS = (*m_labToCMS) *
m_her;
231 const ROOT::Math::XYZVector zaxis(0., 0., 1.);
232 ROOT::Math::XYZVector rotaxis = zaxis.Cross(electronCMS.Vect()) / electronCMS.P();
233 double rotangle = TMath::ASin(rotaxis.R());
234 const ROOT::Math::LorentzRotation rotation(ROOT::Math::AxisAngle(rotaxis, -rotangle));
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 set(const ROOT::Math::PxPyPzEVector &her, const ROOT::Math::PxPyPzEVector &ler, const B2Vector3D &vertex)
Set the initial event values, i.e.
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.
void setVertex(const B2Vector3D &vertex)
Set the vertex position.
MCInitialParticles & operator=(const MCInitialParticles &b)
Assignment operator.
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)
B2Vector3D m_vertex
collision position
MCInitialParticles()
Default constructor.
const ROOT::Math::LorentzRotation & getLabToCMS() const
Return the LorentzRotation to convert from lab to CMS frame.
bool hasGenerationFlags(int flags) const
Check if a certain set of EGenerationFlags is set.
ClassDef(MCInitialParticles, 4)
ROOT Dictionary.
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.
const B2Vector3D & getVertex() const
Get the position of the collision.
double getMass() const
Get the invariant mass of the collision (= energy in CMS)
double getTime() const
Get collison time.
void resetBoost()
Reset cached transformations after changing parameters.
void calculateBoost() const
Calculate the boost if necessary.
Abstract base class for different kinds of events.