Public Member Functions | Private Attributes | List of all members
Utils Class Reference

#include <Utils.h>

Public Member Functions

 Utils ()
 
 Utils (const Utils &)=default
 
 ~Utils ()
 
void SetSeed (int seed)
 
void SetOrigin (double *origin)
 
bool PointInFiducial (const TVector3 &point)
 
bool PointInTPC (const TVector3 &point)
 
bool PointInCalo (const TVector3 &point)
 
bool PointStopBetween (const TVector3 &point)
 
bool isThroughCalo (const TVector3 &point)
 
bool hasDecayedInCalo (const TVector3 &point)
 
bool isBarrel (const TVector3 &point)
 
bool isEndcap (const TVector3 &point)
 
bool isBackscatter (const TVector3 &spoint, const TVector3 &epoint)
 
bool isBremsstrahlung (const TVector3 &spoint, const int &pdg, const int &motherpdg)
 
float GetRamdomNumber ()
 
float GaussianSmearing (const float &mean, const float &sigma)
 
double * GetOrigin ()
 

Private Attributes

double _origin [3]
 coordinates of the origin More...
 
unsigned long int _seed
 seed More...
 
TRandom3 * _rando
 random generator More...
 
double _TPCFidRadius = 222.5
 
double _TPCFidLength = 215.
 
double _TPCRadius = 273.
 
double _TPCLength = 259.
 
double _ECALInnerRadius = 278.02
 
double _ECALOuterRadius = 322.25
 
double _ECALEndX = 374.4
 
double _ECALStartX = _ECALEndX - (_ECALOuterRadius - _ECALInnerRadius)
 

Detailed Description

Definition at line 7 of file Utils.h.

Constructor & Destructor Documentation

Utils::Utils ( )

Definition at line 3 of file Utils.cpp.

4 : _seed(0), _rando(new TRandom3(0))
5 {
6  _origin[0] = 0.;
7  _origin[1] = 0.;
8  _origin[2] = 0.;
9 }
TRandom3 * _rando
random generator
Definition: Utils.h:65
unsigned long int _seed
seed
Definition: Utils.h:64
double _origin[3]
coordinates of the origin
Definition: Utils.h:63
Utils::Utils ( const Utils )
default
Utils::~Utils ( )

Definition at line 11 of file Utils.cpp.

12 {
13  delete _rando;
14 }
TRandom3 * _rando
random generator
Definition: Utils.h:65

Member Function Documentation

float Utils::GaussianSmearing ( const float &  mean,
const float &  sigma 
)
inline

Definition at line 58 of file Utils.h.

58 { return _rando->Gaus(mean, sigma); }
TRandom3 * _rando
random generator
Definition: Utils.h:65
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:16
double* Utils::GetOrigin ( )
inline

Definition at line 60 of file Utils.h.

60 { return &_origin[0]; }
double _origin[3]
coordinates of the origin
Definition: Utils.h:63
float Utils::GetRamdomNumber ( )
inline

Definition at line 56 of file Utils.h.

56 { return _rando->Rndm(); }
TRandom3 * _rando
random generator
Definition: Utils.h:65
bool Utils::hasDecayedInCalo ( const TVector3 &  point)

Definition at line 91 of file Utils.cpp.

92 {
93  return PointInCalo(point);
94 }
bool PointInCalo(const TVector3 &point)
Definition: Utils.cpp:58
bool Utils::isBackscatter ( const TVector3 &  spoint,
const TVector3 &  epoint 
)

Definition at line 114 of file Utils.cpp.

115 {
116  bool isBackscatter = false;
117 
118  //check if started in the ECAL but made it to the tracker
119  float r_spoint = std::sqrt( spoint.Y()*spoint.Y() + spoint.Z()*spoint.Z() );
120  float r_epoint = std::sqrt( epoint.Y()*epoint.Y() + epoint.Z()*epoint.Z() );
121 
122  //in the Barrel
123  if( r_spoint > _ECALInnerRadius && r_epoint < _TPCRadius ) isBackscatter = true;
124  //in the Endcap
125  if( (r_spoint < _ECALInnerRadius && r_epoint < _TPCRadius) && ( std::abs(spoint.X()) > _ECALStartX && std::abs(epoint.X()) < _TPCLength ) ) isBackscatter = true;
126 
127  return isBackscatter;
128 }
double _TPCRadius
Definition: Utils.h:80
double _TPCLength
Definition: Utils.h:81
double _ECALStartX
Definition: Utils.h:85
T abs(T value)
bool isBackscatter(const TVector3 &spoint, const TVector3 &epoint)
Definition: Utils.cpp:114
double _ECALInnerRadius
Definition: Utils.h:82
bool Utils::isBarrel ( const TVector3 &  point)

Definition at line 96 of file Utils.cpp.

97 {
98  bool isBarrel = false;
99  float theta = std::atan(_ECALInnerRadius / std::abs(_ECALStartX) ); //angle for barrel/endcap transition
100  float r_point = std::sqrt( point.Y()*point.Y() + point.Z()*point.Z() );
101  float theta_point = std::atan(r_point / std::abs(point.X()) ); //angle for barrel/endcap transition for the point
102 
103  if( theta_point > theta ) isBarrel = true;
104  return isBarrel;
105 }
bool isBarrel(const TVector3 &point)
Definition: Utils.cpp:96
double _ECALStartX
Definition: Utils.h:85
T abs(T value)
double _ECALInnerRadius
Definition: Utils.h:82
bool Utils::isBremsstrahlung ( const TVector3 &  spoint,
const int &  pdg,
const int &  motherpdg 
)

Definition at line 130 of file Utils.cpp.

131 {
132  bool isBremsstrahlung = false;
133 
134  //Check if it has origin in the tracker and that the pdg is photon and mother is electron/positron (most probable)
135  if(PointInFiducial(spoint) && pdg == 22 && std::abs(motherpdg) == 11) isBremsstrahlung = true;
136 
137  return isBremsstrahlung;
138 }
bool isBremsstrahlung(const TVector3 &spoint, const int &pdg, const int &motherpdg)
Definition: Utils.cpp:130
T abs(T value)
bool PointInFiducial(const TVector3 &point)
Definition: Utils.cpp:29
bool Utils::isEndcap ( const TVector3 &  point)

Definition at line 107 of file Utils.cpp.

108 {
109  bool isEndcap = false;
110  if( !isBarrel(point) ) isEndcap = true;
111  return isEndcap;
112 }
bool isBarrel(const TVector3 &point)
Definition: Utils.cpp:96
bool isEndcap(const TVector3 &point)
Definition: Utils.cpp:107
bool Utils::isThroughCalo ( const TVector3 &  point)

Definition at line 86 of file Utils.cpp.

87 {
88  return !PointInTPC(point) && !PointStopBetween(point) && !PointInCalo(point);
89 }
bool PointInTPC(const TVector3 &point)
Definition: Utils.cpp:43
bool PointInCalo(const TVector3 &point)
Definition: Utils.cpp:58
bool PointStopBetween(const TVector3 &point)
Definition: Utils.cpp:72
bool Utils::PointInCalo ( const TVector3 &  point)

Definition at line 58 of file Utils.cpp.

59 {
60  //Barrel Radius 278 cm
61  //Endcap starts at 364 cm
62  bool isInCalo = false;
63  float r_point = std::sqrt( point.Y()*point.Y() + point.Z()*point.Z() );
64  //in the Barrel
65  if( r_point > _ECALInnerRadius && r_point < _ECALOuterRadius && std::abs(point.X()) < _ECALStartX ) isInCalo = true;
66  //in the Endcap
67  if( r_point < _ECALInnerRadius && std::abs(point.X()) > _ECALStartX && std::abs(point.X()) < _ECALEndX ) isInCalo = true;
68 
69  return isInCalo;
70 }
double _ECALStartX
Definition: Utils.h:85
double _ECALEndX
Definition: Utils.h:84
T abs(T value)
double _ECALOuterRadius
Definition: Utils.h:83
double _ECALInnerRadius
Definition: Utils.h:82
bool Utils::PointInFiducial ( const TVector3 &  point)

Definition at line 29 of file Utils.cpp.

30 {
31  //TPC Fiducial volume defined as
32  //R < 260 cm
33  //|X| < 250 cm
34  bool isInFiducial = true;
35 
36  float r_point = std::sqrt( point.Y()*point.Y() + point.Z()*point.Z() );
37  if( r_point > _TPCFidRadius ) isInFiducial = false;
38  if( r_point < _TPCFidRadius && std::abs(point.X()) > _TPCFidLength ) isInFiducial = false;
39 
40  return isInFiducial;
41 }
T abs(T value)
double _TPCFidRadius
Definition: Utils.h:78
double _TPCFidLength
Definition: Utils.h:79
bool Utils::PointInTPC ( const TVector3 &  point)

Definition at line 43 of file Utils.cpp.

44 {
45  //TPC volume defined as
46  //R < 260 cm
47  //|X| < 250 cm
48  if(PointInFiducial(point)) return true;
49  bool isInTPC = true;
50 
51  float r_point = std::sqrt( point.Y()*point.Y() + point.Z()*point.Z() );
52  if( r_point > _TPCRadius ) isInTPC = false;
53  if( r_point < _TPCRadius && std::abs(point.X()) > _TPCLength ) isInTPC = false;
54 
55  return isInTPC;
56 }
double _TPCRadius
Definition: Utils.h:80
double _TPCLength
Definition: Utils.h:81
T abs(T value)
bool PointInFiducial(const TVector3 &point)
Definition: Utils.cpp:29
bool Utils::PointStopBetween ( const TVector3 &  point)

Definition at line 72 of file Utils.cpp.

73 {
74  //Barrel Radius 278 cm
75  //Endcap starts at 364 cm
76  bool isStopBetween = false;
77  float r_point = std::sqrt( point.Y()*point.Y() + point.Z()*point.Z() );
78  //in the Barrel
79  if( r_point < _ECALInnerRadius && r_point > _TPCRadius && std::abs(point.X()) < _TPCLength ) isStopBetween = true;
80  //in the Endcap
81  if( r_point < _ECALInnerRadius && std::abs(point.X()) > _TPCLength && std::abs(point.X()) < _ECALStartX ) isStopBetween = true;
82 
83  return isStopBetween;
84 }
double _TPCRadius
Definition: Utils.h:80
double _TPCLength
Definition: Utils.h:81
double _ECALStartX
Definition: Utils.h:85
T abs(T value)
double _ECALInnerRadius
Definition: Utils.h:82
void Utils::SetOrigin ( double *  origin)

Definition at line 22 of file Utils.cpp.

23 {
24  _origin[0] = origin[0];
25  _origin[1] = origin[1];
26  _origin[2] = origin[2];
27 }
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
void Utils::SetSeed ( int  seed)

Definition at line 16 of file Utils.cpp.

17 {
18  _seed = seed;
19  _rando->SetSeed(_seed);
20 }
TRandom3 * _rando
random generator
Definition: Utils.h:65
unsigned long int _seed
seed
Definition: Utils.h:64

Member Data Documentation

double Utils::_ECALEndX = 374.4
private

Definition at line 84 of file Utils.h.

double Utils::_ECALInnerRadius = 278.02
private

Definition at line 82 of file Utils.h.

double Utils::_ECALOuterRadius = 322.25
private

Definition at line 83 of file Utils.h.

double Utils::_ECALStartX = _ECALEndX - (_ECALOuterRadius - _ECALInnerRadius)
private

Definition at line 85 of file Utils.h.

double Utils::_origin[3]
private

coordinates of the origin

Definition at line 63 of file Utils.h.

TRandom3* Utils::_rando
private

random generator

Definition at line 65 of file Utils.h.

unsigned long int Utils::_seed
private

seed

Definition at line 64 of file Utils.h.

double Utils::_TPCFidLength = 215.
private

Definition at line 79 of file Utils.h.

double Utils::_TPCFidRadius = 222.5
private

Definition at line 78 of file Utils.h.

double Utils::_TPCLength = 259.
private

Definition at line 81 of file Utils.h.

double Utils::_TPCRadius = 273.
private

Definition at line 80 of file Utils.h.


The documentation for this class was generated from the following files: