REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGeant4PrimaryGeneratorInfo.h
1
2#ifndef REST_TRESTGEANT4PRIMARYGENERATORINFO_H
3#define REST_TRESTGEANT4PRIMARYGENERATORINFO_H
4
5#include <TF1.h>
6#include <TF2.h>
7#include <TString.h>
8#include <TVector3.h>
9
10#include <string>
11
12namespace TRestGeant4PrimaryGeneratorTypes {
13
14enum class SpatialGeneratorTypes {
15 CUSTOM,
16 VOLUME,
17 SURFACE,
18 POINT,
19 COSMIC,
20};
21
22std::string SpatialGeneratorTypesToString(const SpatialGeneratorTypes&);
23SpatialGeneratorTypes StringToSpatialGeneratorTypes(const std::string&);
24
25enum class SpatialGeneratorShapes {
26 GDML,
27 WALL,
28 CIRCLE,
29 BOX,
30 SPHERE,
31 CYLINDER,
32};
33
34std::string SpatialGeneratorShapesToString(const SpatialGeneratorShapes&);
35SpatialGeneratorShapes StringToSpatialGeneratorShapes(const std::string&);
36
37enum class EnergyDistributionTypes {
38 TH1D,
39 FORMULA,
40 FORMULA2,
41 MONO,
42 FLAT,
43 LOG,
44};
45
46std::string EnergyDistributionTypesToString(const EnergyDistributionTypes&);
47EnergyDistributionTypes StringToEnergyDistributionTypes(const std::string&);
48
49enum class EnergyDistributionFormulas {
50 COSMIC_NEUTRONS,
51 COSMIC_GAMMAS,
52};
53
54std::string EnergyDistributionFormulasToString(const EnergyDistributionFormulas&);
55EnergyDistributionFormulas StringToEnergyDistributionFormulas(const std::string&);
56TF1 EnergyDistributionFormulasToRootFormula(const EnergyDistributionFormulas&);
57
58enum class AngularDistributionTypes {
59 TH1D,
60 FORMULA,
61 FORMULA2,
62 ISOTROPIC,
63 FLUX,
64 BACK_TO_BACK,
65};
66
67std::string AngularDistributionTypesToString(const AngularDistributionTypes&);
68AngularDistributionTypes StringToAngularDistributionTypes(const std::string&);
69
70enum class AngularDistributionFormulas {
71 COS2,
72 COS3,
73};
74
75std::string AngularDistributionFormulasToString(const AngularDistributionFormulas&);
76AngularDistributionFormulas StringToAngularDistributionFormulas(const std::string&);
77TF1 AngularDistributionFormulasToRootFormula(const AngularDistributionFormulas&);
78
79enum class EnergyAndAngularDistributionFormulas {
80 COSMIC_MUONS,
81};
82
83std::string EnergyAndAngularDistributionFormulasToString(const EnergyAndAngularDistributionFormulas&);
84EnergyAndAngularDistributionFormulas StringToEnergyAndAngularDistributionFormulas(const std::string&);
85
86TF2 EnergyAndAngularDistributionFormulasToRootFormula(const EnergyAndAngularDistributionFormulas&);
87
88} // namespace TRestGeant4PrimaryGeneratorTypes
89
90class TiXmlElement;
91
94
95 public:
96 void Print() const;
97
98 private:
100 TString fSpatialGeneratorType = "point";
101
104
107
110
114
117
125
128
131
132 public:
134 inline TString GetSpatialGeneratorType() const { return fSpatialGeneratorType; }
135
137 inline TString GetSpatialGeneratorShape() const { return fSpatialGeneratorShape; }
138
141 inline TString GetSpatialGeneratorFrom() const { return fSpatialGeneratorFrom; }
142
145 inline TVector3 GetSpatialGeneratorPosition() const { return fSpatialGeneratorPosition; }
146
150
153
155 inline TVector3 GetSpatialGeneratorSize() const { return fSpatialGeneratorSize; }
156
157 inline TVector3 GetSpatialGeneratorWorldSize() const { return fSpatialGeneratorWorldSize; }
158
160 inline Double_t GetSpatialGeneratorCosmicRadius() const { return fSpatialGeneratorWorldSize.Mag(); }
161
164 const auto radius = GetSpatialGeneratorCosmicRadius() / 10.;
165 return M_PI * radius * radius;
166 }
167
171 }
172
173 friend class TRestGeant4Metadata;
174 friend class DetectorConstruction;
175};
176
177#endif // REST_TRESTGEANT4PRIMARYGENERATORINFO_H
The main class to store the Geant4 simulation conditions that will be used by restG4.
TVector3 fSpatialGeneratorSize
The size of the generator. Stores up to three dimensions according to the shape box: length,...
TString GetSpatialGeneratorType() const
Returns a std::string specifying the generator type (volume, surface, point, virtualWall,...
TString fSpatialGeneratorFrom
The volume name where the events are generated, in case of volume or surface generator types.
TString fSpatialGeneratorSpatialDensityFunction
Defines density distribution of the generator shape. rho=F(x,y,z), in range 0~1.
TVector3 GetSpatialGeneratorPosition() const
Returns a 3d-std::vector with the position of the primary event generator. This value has meaning onl...
TVector3 fSpatialGeneratorWorldSize
The size of the world volume (box half lengths for x, y and z)
Double_t fSpatialGeneratorRotationValue
degrees of rotation for generator virtual shape along the axis
TVector3 fSpatialGeneratorPosition
The position of the generator for virtual, and point, generator types.
Double_t GetSpatialGeneratorRotationValue() const
Returns the degree of rotation.
Double_t GetSpatialGeneratorCosmicSurfaceTermCm2() const
Returns cosmic surface term (cm2) for simulation time computation.
TVector3 fSpatialGeneratorRotationAxis
A 3d-std::vector with the angles, measured in degrees, of a XYZ rotation applied to the virtual gener...
Double_t GetSpatialGeneratorCosmicRadius() const
Returns cosmic generator radius (mm)
TVector3 GetSpatialGeneratorSize() const
Returns the main spatial dimension of virtual generator. It is the size of a virtualBox.
TString GetSpatialGeneratorSpatialDensityFunction() const
Returns the density function of the generator.
TString GetSpatialGeneratorShape() const
Returns a std::string specifying the generator shape (point, wall, box, etc )
TVector3 GetSpatialGeneratorRotationAxis() const
Returns a 3d-std::vector, fGenRotation, with the XYZ rotation angle values in degrees....
TString fSpatialGeneratorShape
Shape of spatial generator (wall, GDML, sphere, etc)
TString fSpatialGeneratorType
Type of spatial generator (point, surface, volume, custom)
TString GetSpatialGeneratorFrom() const
Returns the name of the GDML volume where primary events are produced. This value has meaning only wh...