9 #include <generators/utilities/InitialParticleGeneration.h>
10 #include <framework/gearbox/Const.h>
11 #include <framework/logging/Logger.h>
41 if (gen.
size() != 3) gen.
setMeanCov(TVector3(initial.E(), 0, 0), cov);
62 const double sx = sin(p[1]);
63 const double cx = cos(p[1]);
64 const double sy = sin(p[2]);
65 const double cy = cos(p[2]);
66 const double px = sy * cx * pz;
67 const double py = -sx * pz;
68 TLorentzVector result(px, py, cx * cy * pz, p[0]);
70 result.RotateY(initial.Theta());
85 B2FATAL(
"Cannot generate beam without valid BeamParameters");
100 her =
m_event->getLabToCMS() * her;
101 ler =
m_event->getLabToCMS() * ler;
111 B2FATAL(
"Cannot generate beam without valid BeamParameters");
132 auto previous =
m_event->getVertex();
136 return vtx - previous;
static const double electronMass
electron mass
DBObjPtr< BeamParameters > m_beamParams
Datastore object containing the nominal beam parameters.
int m_allowedFlags
Allowed generation flags.
MultivariateNormalGenerator m_generateHER
Generator for HER.
StoreObjPtr< MCInitialParticles > m_event
Datastore object containing the generated event.
MultivariateNormalGenerator m_generateLER
Generator for LER.
MultivariateNormalGenerator m_generateVertex
Generator for Vertex.
This class contains the initial state for the given event.
@ 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)
Class to generate normal distributed, correlated random numbers given the mean values and the covaria...
size_t size() const
Return the number of elements to be generated on generate()
bool setMeanCov(int n, const double *mean, const double *cov)
set the mean and covariance for the distribution with array interface: mean and covariance are passed...
Eigen::VectorXd generate() const
Generate a set of correlated random numbers with the previouly set mean and covariance.
void reset()
reset the generator setting the size to 0.
TVector3 generateVec3() const
Generate a set of correlated random numbers with the previouly set mean and covariance and return a T...
TVector3 updateVertex(bool force=false)
Update the vertex position:
void initialize()
function to be executed on initialize()
MCInitialParticles & generate()
Generate a new event.
TVector3 generateVertex(const TVector3 &initial, const TMatrixDSym &cov, MultivariateNormalGenerator &gen)
generate the vertex
TLorentzVector generateBeam(const TLorentzVector &initial, const TMatrixDSym &cov, MultivariateNormalGenerator &gen)
generate 4 vector for one beam
Abstract base class for different kinds of events.