 |
Belle II Software
release-05-02-19
|
11 #include <generators/utilities/InitialParticleGeneration.h>
12 #include <framework/gearbox/Const.h>
13 #include <framework/logging/Logger.h>
27 MultivariateNormalGenerator& gen)
30 if (!gen.size()) gen.setMeanCov(initial, cov);
31 return gen.generateVec3();
43 if (gen.
size() != 3) gen.
setMeanCov(TVector3(initial.E(), 0, 0), cov);
64 const double sx = sin(p[1]);
65 const double cx = cos(p[1]);
66 const double sy = sin(p[2]);
67 const double cy = cos(p[2]);
68 const double px = sy * cx * pz;
69 const double py = -sx * pz;
70 TLorentzVector result(px, py, cx * cy * pz, p[0]);
72 result.RotateY(initial.Theta());
87 B2FATAL(
"Cannot generate beam without valid BeamParameters");
101 m_event->setGenerationFlags(0);
102 her =
m_event->getLabToCMS() * her;
103 ler =
m_event->getLabToCMS() * ler;
113 B2FATAL(
"Cannot generate beam without valid BeamParameters");
134 auto previous =
m_event->getVertex();
138 return vtx - previous;
TVector3 generateVertex(const TVector3 &initial, const TMatrixDSym &cov, MultivariateNormalGenerator &gen)
generate the vertex
Eigen::VectorXd generate() const
Generate a set of correlated random numbers with the previouly set mean and covariance.
@ c_smearBeamEnergy
smear energy of HER and LER (but not direction)
@ c_smearBeam
smear the full beam momentum (energy and direction)
TVector3 updateVertex(bool force=false)
Update the vertex position:
StoreObjPtr< MCInitialParticles > m_event
Datastore object containing the generated event.
@ c_smearBeamDirection
smear direction of HER and LER (but not energy)
MultivariateNormalGenerator m_generateHER
Generator for HER.
MultivariateNormalGenerator m_generateVertex
Generator for Vertex.
TLorentzVector generateBeam(const TLorentzVector &initial, const TMatrixDSym &cov, MultivariateNormalGenerator &gen)
generate 4 vector for one beam
static const double electronMass
electron mass
@ c_smearVertex
smear vertex
Class to generate normal distributed, correlated random numbers given the mean values and the covaria...
@ c_generateCMS
generate initial event in CMS instead of lab
Abstract base class for different kinds of events.
MultivariateNormalGenerator m_generateLER
Generator for LER.
size_t size() const
Return the number of elements to be generated on generate()
int m_allowedFlags
Allowed generation flags.
DBObjPtr< BeamParameters > m_beamParams
Datastore object containing the nominal beam parameters.
void initialize()
function to be executed on initialize()
MCInitialParticles & generate()
Generate a new event.
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...
void reset()
reset the generator setting the size to 0.