REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Loading...
Searching...
No Matches
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 FORMULA,
41 FORMULA2,
42 MONO,
43 FLAT,
44 LOG,
45};
46
47std::string EnergyDistributionTypesToString(const EnergyDistributionTypes&);
48EnergyDistributionTypes StringToEnergyDistributionTypes(const std::string&);
49
50enum class EnergyDistributionFormulas {
51 COSMIC_NEUTRONS,
52 COSMIC_GAMMAS,
53};
54
55std::string EnergyDistributionFormulasToString(const EnergyDistributionFormulas&);
56EnergyDistributionFormulas StringToEnergyDistributionFormulas(const std::string&);
57TF1 EnergyDistributionFormulasToRootFormula(const EnergyDistributionFormulas&);
58
59enum class AngularDistributionTypes {
60 TH1D,
61 FORMULA,
62 FORMULA2,
63 ISOTROPIC,
64 FLUX,
65 BACK_TO_BACK,
66};
67
68std::string AngularDistributionTypesToString(const AngularDistributionTypes&);
69AngularDistributionTypes StringToAngularDistributionTypes(const std::string&);
70
71enum class AngularDistributionFormulas {
72 COS2,
73 COS3,
74};
75
76std::string AngularDistributionFormulasToString(const AngularDistributionFormulas&);
77AngularDistributionFormulas StringToAngularDistributionFormulas(const std::string&);
78TF1 AngularDistributionFormulasToRootFormula(const AngularDistributionFormulas&);
79
80enum class EnergyAndAngularDistributionFormulas {
81 COSMIC_MUONS,
82};
83
84std::string EnergyAndAngularDistributionFormulasToString(const EnergyAndAngularDistributionFormulas&);
85EnergyAndAngularDistributionFormulas StringToEnergyAndAngularDistributionFormulas(const std::string&);
86
87TF2 EnergyAndAngularDistributionFormulasToRootFormula(const EnergyAndAngularDistributionFormulas&);
88
89} // namespace TRestGeant4PrimaryGeneratorTypes
90
91class TiXmlElement;
92
95
96 public:
97 void Print() const;
98
99 private:
101 TString fSpatialGeneratorType = "point";
102
105
108
111
115
118
126
129
132
133 public:
135 inline TString GetSpatialGeneratorType() const { return fSpatialGeneratorType; }
136
138 inline TString GetSpatialGeneratorShape() const { return fSpatialGeneratorShape; }
139
142 inline TString GetSpatialGeneratorFrom() const { return fSpatialGeneratorFrom; }
143
146 inline TVector3 GetSpatialGeneratorPosition() const { return fSpatialGeneratorPosition; }
147
151
154
156 inline TVector3 GetSpatialGeneratorSize() const { return fSpatialGeneratorSize; }
157
158 inline TVector3 GetSpatialGeneratorWorldSize() const { return fSpatialGeneratorWorldSize; }
159
161 inline Double_t GetSpatialGeneratorCosmicRadius() const { return fSpatialGeneratorWorldSize.Mag(); }
162
165 const auto radius = GetSpatialGeneratorCosmicRadius() / 10.;
166 return M_PI * radius * radius;
167 }
168
173
174 friend class TRestGeant4Metadata;
175 friend class DetectorConstruction;
176};
177
178#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...