HerdSoftware  0.1.1
MCGenerationInfo.h
Go to the documentation of this file.
1 /*
2  * MCGenerationInfo.h
3  *
4  * Created on: 5 Nov 2018
5  * Author: Nicola Mori
6  */
7 
10 #ifndef HERD_MCGENERATIONINFO_H_
11 #define HERD_MCGENERATIONINFO_H_
12 
13 #include "dataobjects/Point.h"
14 #include "dataobjects/Rectangle.h"
15 
16 #ifdef HS_USE_ROOT
17 #include "Rtypes.h"
18 #endif
19 
20 namespace Herd {
21 
28 public:
31 
33  virtual ~MCGenerationInfo() = default;
34 
39  void SetGeneratorName(std::string name);
40 
45  std::string GeneratorName() const;
46 
51  void SetAcceptanceCheck(bool accChecked);
52 
57  bool WasAcceptanceCheckActive() const;
58 
63  void SetParticlePDGCode(int pdgCode);
64 
69  int ParticlePDGCode() const;
70 
71  /* ******* POSITION ******* */
72 
74  enum class Position { NONE, POINT, SPHERE, RECTANGLE };
75 
82  Position PositionType() const { return _position; }
83 
88  void SetPositionType(Position pos);
89 
99  Point FixedPoint() const;
100 
109  void SetFixedPoint(Point genPoint);
110 
119  Point SphereCapCenter() const;
120 
130  Vec3D SphereCapPosition() const;
131 
141  float SphereCapExtension() const;
142 
155  void SetSphereCap(Point sphereCapCenter, Vec3D sphereCapPosition, float sphereCapExtension);
156 
162  Herd::Rectangle Rectangle() const;
163 
174  void SetRectangle(std::array<Point, 3> points);
175 
176  /* ******* DIRECTION ******* */
177 
179  enum class Direction { NONE, FIXED, ISOTROPIC, UNIFORM };
180 
187  Direction DirectionType() const { return _direction; }
188 
193  void SetDirectionType(Direction dir);
194 
203  Vec3D FixedDirection() const;
204 
213  void SetFixedDirection(Vec3D dir);
214 
224  std::pair<float, float> IsotropicPolarAngleRange() const;
225 
235  std::pair<float, float> IsotropicAzimuthAngleRange() const;
236 
246  std::pair<float, float> UniformAzimuthAngleRange() const;
247 
257  std::pair<float, float> UniformPolarAngleRange() const;
258 
272  void SetIsotropicAnglesRanges(float minPolar, float maxPolar, float minAzimuth, float maxAzimuth);
273 
287  void SetUniformAnglesRanges(float minPolar, float maxPolar, float minAzimuth, float maxAzimuth);
288 
289  /* ******* SPECTRUM ******* */
290 
292  enum class Spectrum { NONE, MONOCHROMATIC, POWERLAW };
293 
300  Spectrum SpectrumType() const { return _spectrum; }
301 
306  void SetSpectrumType(Spectrum sp);
307 
316  float FixedEnergy() const;
317 
326  void SetFixedEnergy(float energy);
327 
336  std::pair<float, float> EnergyRange() const;
337 
346  float SpectralIndex() const;
347 
358  void SetPowerLawSpectrum(float minEnergy, float maxEnergy, float spectralIndex);
359 
360 private:
361  std::string _generatorName;
364 
365  /* *** Position ***/
367  // fixed
369  // sphere
372  float _sphereCapExtension; // rad
373  // rectangle
375 
376  /* *** Direction *** */
378  // fixed
380  // isotropic
382 
383  /* *** Spectrum *** */
385  // monochromatic
386  float _fixedShootingEnergy; // GeV
387  // power law
388  float _minEnergy, _maxEnergy; // GeV
390 
391 #ifdef HS_USE_ROOT
392  ClassDef(MCGenerationInfo, 1)
393 #endif
394 };
395 
396 } // namespace Herd
397 
398 #endif /* HERD_MCGENERATIONINFO_H_ */
virtual ~MCGenerationInfo()=default
Destructor.
void SetPositionType(Position pos)
Sets the type of position generation.
Definition: MCGenerationInfo.cpp:35
float SpectralIndex() const
Gets the spectral index used for power-law spectrum generation.
Definition: MCGenerationInfo.cpp:230
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
A rectangle in 3D space.
Definition: Rectangle.h:26
std::pair< float, float > IsotropicAzimuthAngleRange() const
Gets the minimum and maximum azimuth angles for isotropic generation.
Definition: MCGenerationInfo.cpp:139
Herd::Rectangle Rectangle() const
Gets the generation rectangle.
Definition: MCGenerationInfo.cpp:90
float _minAzimuth
Definition: MCGenerationInfo.h:381
float _fixedShootingEnergy
Definition: MCGenerationInfo.h:386
void SetAcceptanceCheck(bool accChecked)
Sets the acceptance check flag.
Definition: MCGenerationInfo.cpp:25
void SetFixedPoint(Point genPoint)
Sets the particle generation point.
Definition: MCGenerationInfo.cpp:53
void SetIsotropicAnglesRanges(float minPolar, float maxPolar, float minAzimuth, float maxAzimuth)
Sets the minimum and maximum polar and azimuth angles for isotropic generation.
Definition: MCGenerationInfo.cpp:160
int ParticlePDGCode() const
Gets the PDG code of the generated particle.
Definition: MCGenerationInfo.cpp:31
void SetGeneratorName(std::string name)
Sets the name of the particle generator.
Definition: MCGenerationInfo.cpp:21
void SetPowerLawSpectrum(float minEnergy, float maxEnergy, float spectralIndex)
Sets the power-law spectrum generation.
Definition: MCGenerationInfo.cpp:237
Vec3D FixedDirection() const
Gets the fixed generation direction.
Definition: MCGenerationInfo.cpp:118
std::pair< float, float > UniformAzimuthAngleRange() const
Gets the minimum and maximum azimuth angles for uniform generation.
Definition: MCGenerationInfo.cpp:153
Point FixedPoint() const
Gets the particle generation point.
Definition: MCGenerationInfo.cpp:46
float _sphereCapExtension
Definition: MCGenerationInfo.h:372
std::pair< float, float > IsotropicPolarAngleRange() const
Gets the minimum and maximum polar angles for isotropic generation.
Definition: MCGenerationInfo.cpp:132
Direction
Definition: MCGenerationInfo.h:179
A class describing a vector in 3D space.
Definition: Vec3D.h:33
void SetFixedDirection(Vec3D dir)
Sets the fixed generation direction.
Definition: MCGenerationInfo.cpp:125
std::string GeneratorName() const
Gets the name of the particle generator.
Definition: MCGenerationInfo.cpp:23
float SphereCapExtension() const
Gets the extension of the generation sphere cap.
Definition: MCGenerationInfo.cpp:74
bool WasAcceptanceCheckActive() const
Checks if the acceptance check was active during particle generation.
Definition: MCGenerationInfo.cpp:27
float _minEnergy
Definition: MCGenerationInfo.h:388
bool _acceptanceCheck
Definition: MCGenerationInfo.h:362
Herd::Rectangle _rectangle
Definition: MCGenerationInfo.h:374
Position _position
Definition: MCGenerationInfo.h:366
float _minPolar
Definition: MCGenerationInfo.h:381
std::string _generatorName
Definition: MCGenerationInfo.h:361
void SetSphereCap(Point sphereCapCenter, Vec3D sphereCapPosition, float sphereCapExtension)
Sets the generation sphere cap.
Definition: MCGenerationInfo.cpp:81
Spectrum _spectrum
Definition: MCGenerationInfo.h:384
Herd::Vec3D _fixedShootingDirection
Definition: MCGenerationInfo.h:379
void SetSpectrumType(Spectrum sp)
Sets the type of spectrum generation.
Definition: MCGenerationInfo.cpp:198
Position
Enum for the kind of position generation.
Definition: MCGenerationInfo.h:74
std::pair< float, float > UniformPolarAngleRange() const
Gets the minimum and maximum polar angles for uniform generation.
Definition: MCGenerationInfo.cpp:146
int _particlePdgCode
Definition: MCGenerationInfo.h:363
float _maxAzimuth
Definition: MCGenerationInfo.h:381
void SetDirectionType(Direction dir)
Sets the type of direction generation.
void SetParticlePDGCode(int pdgCode)
Sets the PDG code of the generated particle.
Definition: MCGenerationInfo.cpp:29
Point _fixedShootingPoint
Definition: MCGenerationInfo.h:368
float FixedEnergy() const
Gets the fixed generation energy.
Definition: MCGenerationInfo.cpp:209
Position PositionType() const
Gets the type of position generation.
Definition: MCGenerationInfo.h:82
Spectrum SpectrumType() const
Gets the type of spectrum generation.
Definition: MCGenerationInfo.h:300
Point _sphereCapCenter
Definition: MCGenerationInfo.h:370
Point SphereCapCenter() const
Gets the center of the generation sphere cap.
Definition: MCGenerationInfo.cpp:60
Direction _direction
Definition: MCGenerationInfo.h:377
Information about particle generation in MC simulation.
Definition: MCGenerationInfo.h:27
void SetFixedEnergy(float energy)
Sets the fixed generation energy.
Definition: MCGenerationInfo.cpp:216
void SetUniformAnglesRanges(float minPolar, float maxPolar, float minAzimuth, float maxAzimuth)
Sets the minimum and maximum polar and azimuth angles for uniform generation.
Definition: MCGenerationInfo.cpp:178
Vec3D SphereCapPosition() const
Gets the position of the generation sphere cap.
Definition: MCGenerationInfo.cpp:67
Spectrum
Enum for the kind of spectrum generation.
Definition: MCGenerationInfo.h:292
float _spectralIndex
Definition: MCGenerationInfo.h:389
std::pair< float, float > EnergyRange() const
Gets the energy range used for power-law spectrum generation.
Definition: MCGenerationInfo.cpp:223
float _maxPolar
Definition: MCGenerationInfo.h:381
float _maxEnergy
Definition: MCGenerationInfo.h:388
Direction DirectionType() const
Gets the type of direction generation.
Definition: MCGenerationInfo.h:187
MCGenerationInfo()
Default constructor.
Definition: MCGenerationInfo.cpp:14
Vec3D _sphereCapPosition
Definition: MCGenerationInfo.h:371
void SetRectangle(std::array< Point, 3 > points)
Sets the generation rectangle.
Definition: MCGenerationInfo.cpp:97