9#include <generators/modules/BeamParametersModule.h>
10#include <framework/database/Database.h>
12#include <Math/Vector3D.h>
28 setDescription(
"Setting of beam parameters. This module allows to set the "
29 "beamparameters to be used by generators and analyis. One can "
30 "either select from a list of predefined parameter sets or "
31 "manually set the parameters to use.");
36 "Negative values are interpreted as pi - value", 0.0415);
38 "Negative values are interpreted as pi - value", 0.0);
39 addParam(
"covHER",
m_covHER,
"covariance matrix of the High Energy Ring. This "
40 "can either be one value which is the squared energy spread, three "
41 "values corresponding to the variances of energy and the horizontal "
42 "and vertial spread (E, theta_x, theta_y) or a full covariance "
43 "matrix with 9 elements", std::vector<double>(1, 0));
46 "Negative values are interpreted as pi - value", -0.0415);
48 "Negative values are interpreted as pi - value", 0.0);
49 addParam(
"covLER",
m_covLER,
"covariance matrix of the Low Energy Ring. This "
50 "can either be one value which is the squared energy spread, three "
51 "values corresponding to the variances of energy and the horizontal "
52 "and vertial spread (E, theta_x, theta_y) or a full covariance "
53 "matrix with 9 elements", std::vector<double>(1, 0));
54 addParam(
"vertex",
m_vertex,
"nominal vertex position", std::vector<double>(3, 0));
56 "position. Can be either one value which is the common variance for "
57 "all directions, three values for the variance of x, y and z or a "
58 "full covariance matrix", std::vector<double>(1, 0));
60 "initial events",
true);
62 "when generating initial events",
true);
64 "generating initial events",
true);
68 "with the iov given with the payloadIov parameter",
false);
70 "of four numbers: first experiment, first run, last experiment, "
78 ROOT::Math::XYZVector vertex;
82 B2ERROR(
"Vertex position needs to have 3 entries");
bool m_generateCMS
if true, generate events in CMS, not lab system
bool m_createPayload
if true create a new payload with the given parameters
bool m_smearEnergy
if true, smear energy when generating initial events
virtual void initialize() override
Create the Beamparameters.
std::vector< double > m_covHER
Covariance matrix for the High Energy Ring.
double m_angleXLER
theta angle of the Low Energy Ring in the x-z plane
std::vector< double > m_covLER
Covariance matrix for the Low Energy Ring.
double m_energyHER
Energy of the High Energy Ring.
bool m_smearVertex
if true, smear vertex position when generating initial events
BeamParametersModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::vector< int > m_payloadIov
iov when creating a database payload
bool m_smearDirection
if true, smear beam direction when generating initial events
std::vector< double > m_covVertex
covariance matrix for the vertex position
double m_energyLER
Energy of the Low Energy Ring.
BeamParameters m_beamParams
Copy of the beamparameters created from the parameters.
double m_angleYHER
theta angle of the High Energy Ring in the y-z plane
std::vector< double > m_vertex
nominal vertex position
double m_angleXHER
theta angle of the High Energy Ring in the x-z plane
double m_angleYLER
theta angle of the Low Energy Ring in the y-z plane
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
void setHER(double energy, double angleX, double angleY, const std::vector< double > &cov)
Set the HER FourVector and error matrix from beam energy, angle and covariance entries.
void setLER(double energy, double angleX, double angleY, const std::vector< double > &cov)
Set the LER FourVector and error matrix from beam energy, angle and covariance entries.
void setVertex(const ROOT::Math::XYZVector &vertex, const std::vector< double > &cov)
Set the vertex position and error matrix.
void setGenerationFlags(int flags) override
Set the generation flags to be used for event generation (ORed combination of EGenerationFlags).
A class that describes the interval of experiments/runs for which an object in the database is valid.
@ c_smearVertex
smear vertex
@ 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)
void setDescription(const std::string &description)
Sets the description of the module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
static Database & Instance()
Instance of a singleton Database.
static DBStore & Instance()
Instance of a singleton DBStore.
bool storeData(const std::string &name, TObject *object, const IntervalOfValidity &iov)
Store an object in the database.
void addConstantOverride(const std::string &name, TObject *obj, bool oneRun=false)
Add constant override payload.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.