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 SOURCE,
21};
22
23std::string SpatialGeneratorTypesToString(const SpatialGeneratorTypes&);
24SpatialGeneratorTypes StringToSpatialGeneratorTypes(const std::string&);
25
26enum class SpatialGeneratorShapes {
27 GDML,
28 WALL,
29 CIRCLE,
30 BOX,
31 SPHERE,
32 CYLINDER,
33};
34
35std::string SpatialGeneratorShapesToString(const SpatialGeneratorShapes&);
36SpatialGeneratorShapes StringToSpatialGeneratorShapes(const std::string&);
37
38enum class EnergyDistributionTypes {
39 TH1D,
40 TH2D,
41 FORMULA,
42 FORMULA2,
43 MONO,
44 FLAT,
45 LOG,
46};
47
48std::string EnergyDistributionTypesToString(const EnergyDistributionTypes&);
49EnergyDistributionTypes StringToEnergyDistributionTypes(const std::string&);
50
51enum class EnergyDistributionFormulas {
52 COSMIC_NEUTRONS,
53 COSMIC_GAMMAS,
54};
55
56std::string EnergyDistributionFormulasToString(const EnergyDistributionFormulas&);
57EnergyDistributionFormulas StringToEnergyDistributionFormulas(const std::string&);
58TF1 EnergyDistributionFormulasToRootFormula(const EnergyDistributionFormulas&);
59
60enum class AngularDistributionTypes {
61 TH1D,
62 TH2D,
63 FORMULA,
64 FORMULA2,
65 ISOTROPIC,
66 FLUX,
67 BACK_TO_BACK,
68};
69
70std::string AngularDistributionTypesToString(const AngularDistributionTypes&);
71AngularDistributionTypes StringToAngularDistributionTypes(const std::string&);
72
73enum class AngularDistributionFormulas {
74 COS2,
75 COS3,
76};
77
78std::string AngularDistributionFormulasToString(const AngularDistributionFormulas&);
79AngularDistributionFormulas StringToAngularDistributionFormulas(const std::string&);
80TF1 AngularDistributionFormulasToRootFormula(const AngularDistributionFormulas&);
81
82enum class EnergyAndAngularDistributionFormulas {
83 COSMIC_MUONS,
84};
85
86std::string EnergyAndAngularDistributionFormulasToString(const EnergyAndAngularDistributionFormulas&);
87EnergyAndAngularDistributionFormulas StringToEnergyAndAngularDistributionFormulas(const std::string&);
88
89TF2 EnergyAndAngularDistributionFormulasToRootFormula(const EnergyAndAngularDistributionFormulas&);
90
91} // namespace TRestGeant4PrimaryGeneratorTypes
92
93class TiXmlElement;
94
97
98 public:
99 void Print() const;
100
101 private:
103 TString fSpatialGeneratorType = "point";
104
107
110
113
117
120
128
131
134
135 public:
137 inline TString GetSpatialGeneratorType() const { return fSpatialGeneratorType; }
138
140 inline TString GetSpatialGeneratorShape() const { return fSpatialGeneratorShape; }
141
144 inline TString GetSpatialGeneratorFrom() const { return fSpatialGeneratorFrom; }
145
148 inline TVector3 GetSpatialGeneratorPosition() const { return fSpatialGeneratorPosition; }
149
153
156
158 inline TVector3 GetSpatialGeneratorSize() const { return fSpatialGeneratorSize; }
159
160 inline TVector3 GetSpatialGeneratorWorldSize() const { return fSpatialGeneratorWorldSize; }
161
163 inline Double_t GetSpatialGeneratorCosmicRadius() const { return fSpatialGeneratorWorldSize.Mag(); }
164
167 const auto radius = GetSpatialGeneratorCosmicRadius();
168 return M_PI * radius * radius * 0.01; // cm2
169 }
170
174 }
175
176 friend class TRestGeant4Metadata;
177 friend class DetectorConstruction;
178};
179
180#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...