Utils.h
Go to the documentation of this file.
1 #ifndef UTILS_H
2 #define UTILS_H 1
3 
4 #include "TVector3.h"
5 #include "TRandom3.h"
6 
7 class Utils
8 {
9 public:
10 
11  /* Default constructor */
12  Utils();
13 
14  /* Copy constructor */
15  Utils(const Utils &) = default;
16 
17  /* Destructor */
18  ~Utils();
19 
20  /* Set the seed */
21  void SetSeed(int seed);
22 
23  /* Set the origin */
24  void SetOrigin(double *origin);
25 
26  /* Check if MCP point is in fiducial */
27  bool PointInFiducial(const TVector3 &point);
28 
29  /* Check if MCP point is in TPC Volume (can be outside Fid) */
30  bool PointInTPC(const TVector3 &point);
31 
32  /* Check if MCP point is in the ECAL */
33  bool PointInCalo(const TVector3 &point);
34 
35  /* Check if MCP point is in between the TPC and the ECAL */
36  bool PointStopBetween(const TVector3 &point);
37 
38  /* Check if MCP point is not in the fiducial and not in the ECAL */
39  bool isThroughCalo(const TVector3 &point);
40 
41  /* Check if MCP decayed in calo */
42  bool hasDecayedInCalo(const TVector3 &point);
43 
44  /* Check if MCP is in the Barrel region */
45  bool isBarrel(const TVector3 &point);
46 
47  /* Check if MCP is in the Endcap region */
48  bool isEndcap(const TVector3 &point);
49 
50  /* Check if the mcp is a backscatter */
51  bool isBackscatter(const TVector3 &spoint, const TVector3 &epoint);
52 
53  /* Check if it is a Bremsstrahlung photon */
54  bool isBremsstrahlung(const TVector3 &spoint, const int& pdg, const int& motherpdg);
55 
56  float GetRamdomNumber() { return _rando->Rndm(); }
57 
58  float GaussianSmearing(const float& mean, const float& sigma) { return _rando->Gaus(mean, sigma); }
59 
60  double* GetOrigin() { return &_origin[0]; }
61 
62 private:
63  double _origin[3]; ///< coordinates of the origin
64  unsigned long int _seed; ///< seed
65  TRandom3 *_rando; ///< random generator
66 
67  /* HARDCODED */
68  // double _TPCFidRadius = 222.5;
69  // double _TPCFidLength = 215.;
70  // double _TPCRadius = 273.;
71  // double _TPCLength = 259.;
72  // double _ECALInnerRadius = 278.;
73  // double _ECALOuterRadius = 321.;
74  // double _ECALStartX = 364.;
75  // double _ECALEndX = 406.;
76 
77  //SPY v3 geometry with ECAL inside Magnet/SPY PV
78  double _TPCFidRadius = 222.5;
79  double _TPCFidLength = 215.;
80  double _TPCRadius = 273.;
81  double _TPCLength = 259.;
82  double _ECALInnerRadius = 278.02;
83  double _ECALOuterRadius = 322.25;
84  double _ECALEndX = 374.4;
85  double _ECALStartX = _ECALEndX - (_ECALOuterRadius - _ECALInnerRadius); //calculated from the cryostat beginning
86 };
87 
88 #endif
bool isBarrel(const TVector3 &point)
Definition: Utils.cpp:96
double _TPCRadius
Definition: Utils.h:80
bool isBremsstrahlung(const TVector3 &spoint, const int &pdg, const int &motherpdg)
Definition: Utils.cpp:130
double _TPCLength
Definition: Utils.h:81
double _ECALStartX
Definition: Utils.h:85
~Utils()
Definition: Utils.cpp:11
Utils()
Definition: Utils.cpp:3
float GaussianSmearing(const float &mean, const float &sigma)
Definition: Utils.h:58
TRandom3 * _rando
random generator
Definition: Utils.h:65
double _ECALEndX
Definition: Utils.h:84
bool hasDecayedInCalo(const TVector3 &point)
Definition: Utils.cpp:91
double * GetOrigin()
Definition: Utils.h:60
bool PointInTPC(const TVector3 &point)
Definition: Utils.cpp:43
unsigned long int _seed
seed
Definition: Utils.h:64
bool isThroughCalo(const TVector3 &point)
Definition: Utils.cpp:86
double _ECALOuterRadius
Definition: Utils.h:83
void SetOrigin(double *origin)
Definition: Utils.cpp:22
bool isBackscatter(const TVector3 &spoint, const TVector3 &epoint)
Definition: Utils.cpp:114
bool PointInCalo(const TVector3 &point)
Definition: Utils.cpp:58
void SetSeed(int seed)
Definition: Utils.cpp:16
double _ECALInnerRadius
Definition: Utils.h:82
double _TPCFidRadius
Definition: Utils.h:78
bool PointInFiducial(const TVector3 &point)
Definition: Utils.cpp:29
Definition: Utils.h:7
double _TPCFidLength
Definition: Utils.h:79
bool isEndcap(const TVector3 &point)
Definition: Utils.cpp:107
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:16
bool PointStopBetween(const TVector3 &point)
Definition: Utils.cpp:72
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:227
double _origin[3]
coordinates of the origin
Definition: Utils.h:63
float GetRamdomNumber()
Definition: Utils.h:56