Public Member Functions | Private Attributes | List of all members
sim::ProtoDUNEBeamInstrument Class Reference

#include <ProtoDUNEBeamInstrument.h>

Public Member Functions

 ProtoDUNEBeamInstrument ()
 
 ~ProtoDUNEBeamInstrument ()
 
 ProtoDUNEBeamInstrument (std::string name, Float_t x, Float_t y, Float_t z, Float_t t, Float_t Px, Float_t Py, Float_t Pz, Int_t PDGid, Int_t EventID, Int_t TrackID, Float_t Resolution)
 
 ProtoDUNEBeamInstrument (std::string name, std::vector< Float_t > position, Float_t t, std::vector< Float_t > momentum, Int_t PDGid, Int_t EventID, Int_t TrackID, Float_t Resolution)
 Vector-based constructor. More...
 
 ProtoDUNEBeamInstrument (std::string name, TVector3 position, Float_t t, TVector3 momentum, Int_t PDGid, Int_t EventID, Int_t TrackID, Float_t Resolution)
 
 ProtoDUNEBeamInstrument (const ProtoDUNEBeamInstrument &rhs)
 
std::string GetInstrumentName () const
 
Float_t GetX () const
 
Float_t GetY () const
 
Float_t GetZ () const
 
Float_t GetT () const
 
Float_t GetPx () const
 
Float_t GetPy () const
 
Float_t GetPz () const
 
Int_t GetPDGid () const
 
Int_t GetEventID () const
 
Int_t GetTrackID () const
 
Float_t GetSmearedVar1 () const
 
Float_t GetSmearedVar2 () const
 
Float_t GetResolution () const
 
void SetInstrumentName (std::string name)
 
void SetX (Float_t val)
 
void SetY (Float_t val)
 
void SetZ (Float_t val)
 
void SetT (Float_t val)
 
void SetPx (Float_t val)
 
void SetPy (Float_t val)
 
void SetPz (Float_t val)
 
void SetPDGid (Int_t val)
 
void SetEventID (Int_t val)
 
void SetTrackID (Int_t val)
 
void SetSmearedVar1 (Float_t val)
 
void SetSmearedVar2 (Float_t val)
 
void SetResolution (Float_t val)
 
Float_t UnitGauss (Float_t mean, Float_t value, Float_t sigma)
 

Private Attributes

std::string fInstrumentName
 
Float_t fX
 
Float_t fY
 
Float_t fZ
 
Float_t fT
 
Float_t fPx
 
Float_t fPy
 
Float_t fPz
 
Int_t fPDGid
 
Int_t fEventID
 
Int_t fTrackID
 
Float_t fSmearedVar1
 
Float_t fSmearedVar2
 
Float_t fResolution
 

Detailed Description

Definition at line 18 of file ProtoDUNEBeamInstrument.h.

Constructor & Destructor Documentation

sim::ProtoDUNEBeamInstrument::ProtoDUNEBeamInstrument ( )

Definition at line 14 of file ProtoDUNEBeamInstrument.cxx.

14  {
15  fInstrumentName = "default";
16  fX = 0.0;
17  fY = 0.0;
18  fZ = 0.0;
19  fT = 0.0;
20  fPx = 0.0;
21  fPy = 0.0;
22  fPz = 0.0;
23  fPDGid = 0;
24  fEventID = 0;
25  fTrackID = 0;
26  fSmearedVar1 = 0.0;
27  fSmearedVar2 = 0.0;
28  fResolution = 0.0;
29  }
sim::ProtoDUNEBeamInstrument::~ProtoDUNEBeamInstrument ( )

Definition at line 32 of file ProtoDUNEBeamInstrument.cxx.

32  {
33 
34  }
sim::ProtoDUNEBeamInstrument::ProtoDUNEBeamInstrument ( std::string  name,
Float_t  x,
Float_t  y,
Float_t  z,
Float_t  t,
Float_t  Px,
Float_t  Py,
Float_t  Pz,
Int_t  PDGid,
Int_t  EventID,
Int_t  TrackID,
Float_t  Resolution 
)

Definition at line 36 of file ProtoDUNEBeamInstrument.cxx.

48  {
50  fX = x; fY = y; fZ = z; fT = t;
51  fPx = Px; fPy = Py; fPz = Pz;
52  fPDGid = PDGid;
53  fEventID = EventID;
54  fTrackID = TrackID;
55  fResolution = Resolution;
56  srand (static_cast <unsigned> (time(NULL)));
57  if (name == "TOF1" || name == "TRIG2"){
58  Float_t delta_t = 20.;
59 // if (name == "TOF1") srand (static_cast <unsigned> (time(0)*9));
60  Float_t t_test = t - delta_t/2. + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(delta_t)));
61  Float_t p_test = static_cast <float> (rand()) /( static_cast <float> (RAND_MAX));
62  Float_t p_gauss = ProtoDUNEBeamInstrument::UnitGauss(t,t_test,fResolution);
63  while (p_test > p_gauss){
64  p_test = static_cast <float> (rand()) /( static_cast <float> (RAND_MAX));
65  t_test = t -delta_t/2. + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(delta_t)));
67  }
68  fSmearedVar1 = t_test;
69  }
70  if (name == "BPROFEXT" || name == "BPROF4"){
71  Float_t delta_x = 40.;
72 // srand (static_cast <unsigned> (time(0)*99));
73  Float_t x_test = x -delta_x/2. + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(delta_x)));
74  Float_t p_test = static_cast <float> (rand()) /( static_cast <float> (RAND_MAX));
75  Float_t p_gauss = ProtoDUNEBeamInstrument::UnitGauss(x,x_test,fResolution);
76  while (p_test > p_gauss){
77  p_test = static_cast <float> (rand()) /( static_cast <float> (RAND_MAX));
78  x_test = x -delta_x/2. + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(delta_x)));
80  }
81  fSmearedVar1 = x_test;
82 
83  Float_t delta_y = 40.;
84 // srand (static_cast <unsigned> (time(0)*7));
85  Float_t y_test = y -delta_y/2. + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(delta_y)));
86  p_test = static_cast <float> (rand()) /( static_cast <float> (RAND_MAX));
88  while (p_test > p_gauss){
89  p_test = static_cast <float> (rand()) /( static_cast <float> (RAND_MAX));
90  y_test = y -delta_y + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(delta_y)));
92  }
94 }
95  if (name == "CHERENKOV1"){
96 // srand (static_cast <unsigned> (time(0)*77));
97  Float_t p_test = static_cast <float> (rand()) /( static_cast <float> (RAND_MAX));
98  fSmearedVar1 = 0;
99  if (p_test <= fResolution){
100  Float_t Ptot = pow(pow(Px,2)+pow(Py,2)+pow(Pz,2),0.5)/1000.;
101  if (Ptot <= 2.0){
102  if (abs(PDGid) == 2212 || abs(PDGid) == 310) fSmearedVar1 = 0;
103  if (abs(PDGid) == 11) fSmearedVar1 = 1;
104  if (abs(PDGid) == 211) fSmearedVar1 = 1;
105 }
106  if (Ptot <= 3.0 && Ptot >2.0){
107  if (abs(PDGid) == 2212 || abs(PDGid) == 310) fSmearedVar1 = 0;
108  if (abs(PDGid) == 11) fSmearedVar1 = 1;
109  if (abs(PDGid) == 211) fSmearedVar1 = 1;
110 }
111  if (Ptot <= 5.0 && Ptot > 3.0){
112  if (abs(PDGid) == 2212 || abs(PDGid) == 310) fSmearedVar1 = 0;
113  if (abs(PDGid) == 11) fSmearedVar1 = 1;
114  if (abs(PDGid) == 211) fSmearedVar1 = 1;
115 }
116  if (Ptot > 5.0){
117  if (abs(PDGid) == 2212 || abs(PDGid) == 310) fSmearedVar1 = 0;
118  if (abs(PDGid) == 11) fSmearedVar1 = 0;
119  if (abs(PDGid) == 211) fSmearedVar1 = 1;
120 }
121 }
122 std::cout << "Particle ID: " << fPDGid << std::endl;
123 std::cout << "Cherenkov 1: " << fSmearedVar1 << std::endl;
124 }
125  if (name == "CHERENKOV2"){
126 // srand (static_cast <unsigned> (time(0)*97));
127  Float_t p_test = static_cast <float> (rand()) /( static_cast <float> (RAND_MAX));
128  fSmearedVar1 = 0;
129  if (p_test <= fResolution){
130  Float_t Ptot = pow(pow(Px,2)+pow(Py,2)+pow(Pz,2),0.5)/1000.;
131  if (Ptot <= 2.0){
132  if (abs(PDGid) == 2212 || abs(PDGid) == 310) fSmearedVar1 = 0;
133  if (abs(PDGid) == 11) fSmearedVar1 = 0;
134  if (abs(PDGid) == 211) fSmearedVar1 = 1;
135 }
136  if (Ptot <= 3.0 && Ptot >2.0){
137  if (abs(PDGid) == 2212 || abs(PDGid) == 310) fSmearedVar1 = 0;
138  if (abs(PDGid) == 11) fSmearedVar1 = 0;
139  if (abs(PDGid) == 211) fSmearedVar1 = 1;
140 }
141  if (Ptot <= 5.0 && Ptot > 3.0){
142  if (abs(PDGid) == 2212 || abs(PDGid) == 310) fSmearedVar1 = 0;
143  if (abs(PDGid) == 11) fSmearedVar1 = 0;
144  if (abs(PDGid) == 211) fSmearedVar1 = 1;
145 }
146  if (Ptot > 5.0){
147  if (abs(PDGid) == 2212 || abs(PDGid) == 310) fSmearedVar1 = 0;
148  if (abs(PDGid) == 11) fSmearedVar1 = 0;
149  if (abs(PDGid) == 211) fSmearedVar1 = 1;
150 }
151 std::cout << "Cherenkov 2: " << fSmearedVar1 << std::endl;
152 }
153 }
154 }
static QCString name
Definition: declinfo.cpp:673
constexpr T pow(T x)
Definition: pow.h:72
T abs(T value)
list x
Definition: train.py:276
QTextStream & endl(QTextStream &s)
Float_t UnitGauss(Float_t mean, Float_t value, Float_t sigma)
sim::ProtoDUNEBeamInstrument::ProtoDUNEBeamInstrument ( std::string  name,
std::vector< Float_t >  position,
Float_t  t,
std::vector< Float_t >  momentum,
Int_t  PDGid,
Int_t  EventID,
Int_t  TrackID,
Float_t  Resolution 
)

Vector-based constructor.

Definition at line 157 of file ProtoDUNEBeamInstrument.cxx.

165  {
167  fX = position[0]; fY = position[1]; fZ = position[2]; fT = t;
168  fPx = momentum[0]; fPy = momentum[1]; fPz = momentum[2];
169  fPDGid = PDGid;
170  fEventID = EventID;
171  fTrackID = TrackID;
172  fResolution = Resolution;
173 
174  }
static QCString name
Definition: declinfo.cpp:673
sim::ProtoDUNEBeamInstrument::ProtoDUNEBeamInstrument ( std::string  name,
TVector3  position,
Float_t  t,
TVector3  momentum,
Int_t  PDGid,
Int_t  EventID,
Int_t  TrackID,
Float_t  Resolution 
)

Definition at line 177 of file ProtoDUNEBeamInstrument.cxx.

185  {
187  fX = position.X(); fY = position.Y(); fZ = position.Z(); fT = t;
188  fPx = momentum.X(); fPy = momentum.Y(); fPz = momentum.Z();
189  fPDGid = PDGid;
190  fEventID = EventID;
191  fTrackID = TrackID;
192  fResolution = Resolution;
193 
194  }
static QCString name
Definition: declinfo.cpp:673
def momentum(x1, x2, x3, scale=1.)
sim::ProtoDUNEBeamInstrument::ProtoDUNEBeamInstrument ( const ProtoDUNEBeamInstrument rhs)

Definition at line 196 of file ProtoDUNEBeamInstrument.cxx.

196  {
197  fX = rhs.fX; fY = rhs.fY; fZ = rhs.fZ; fT = rhs.fT;
198  fPx = rhs.fPx; fPy = rhs.fPy; fPz = rhs.fPz;
199  fPDGid = rhs.fPDGid;
200  fEventID = rhs.fEventID;
201  fTrackID = rhs.fTrackID;
202  fInstrumentName = rhs.fInstrumentName;
203  fSmearedVar1 = rhs.fSmearedVar1;
204  fSmearedVar2 = rhs.fSmearedVar2;
205  fResolution = rhs.fResolution;
206  }

Member Function Documentation

Int_t sim::ProtoDUNEBeamInstrument::GetEventID ( ) const
inline

Definition at line 72 of file ProtoDUNEBeamInstrument.h.

std::string sim::ProtoDUNEBeamInstrument::GetInstrumentName ( ) const
inline

Definition at line 63 of file ProtoDUNEBeamInstrument.h.

Int_t sim::ProtoDUNEBeamInstrument::GetPDGid ( ) const
inline

Definition at line 71 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::GetPx ( ) const
inline

Definition at line 68 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::GetPy ( ) const
inline

Definition at line 69 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::GetPz ( ) const
inline

Definition at line 70 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::GetResolution ( ) const
inline

Definition at line 76 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::GetSmearedVar1 ( ) const
inline

Definition at line 74 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::GetSmearedVar2 ( ) const
inline

Definition at line 75 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::GetT ( ) const
inline

Definition at line 67 of file ProtoDUNEBeamInstrument.h.

Int_t sim::ProtoDUNEBeamInstrument::GetTrackID ( ) const
inline

Definition at line 73 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::GetX ( ) const
inline

Definition at line 64 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::GetY ( ) const
inline

Definition at line 65 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::GetZ ( ) const
inline

Definition at line 66 of file ProtoDUNEBeamInstrument.h.

void sim::ProtoDUNEBeamInstrument::SetEventID ( Int_t  val)
inline
void sim::ProtoDUNEBeamInstrument::SetInstrumentName ( std::string  name)
inline

Definition at line 78 of file ProtoDUNEBeamInstrument.h.

static QCString name
Definition: declinfo.cpp:673
void sim::ProtoDUNEBeamInstrument::SetPDGid ( Int_t  val)
inline
void sim::ProtoDUNEBeamInstrument::SetPx ( Float_t  val)
inline

Definition at line 83 of file ProtoDUNEBeamInstrument.h.

void sim::ProtoDUNEBeamInstrument::SetPy ( Float_t  val)
inline

Definition at line 84 of file ProtoDUNEBeamInstrument.h.

void sim::ProtoDUNEBeamInstrument::SetPz ( Float_t  val)
inline

Definition at line 85 of file ProtoDUNEBeamInstrument.h.

void sim::ProtoDUNEBeamInstrument::SetResolution ( Float_t  val)
inline
void sim::ProtoDUNEBeamInstrument::SetSmearedVar1 ( Float_t  val)
inline
void sim::ProtoDUNEBeamInstrument::SetSmearedVar2 ( Float_t  val)
inline
void sim::ProtoDUNEBeamInstrument::SetT ( Float_t  val)
inline

Definition at line 82 of file ProtoDUNEBeamInstrument.h.

void sim::ProtoDUNEBeamInstrument::SetTrackID ( Int_t  val)
inline
void sim::ProtoDUNEBeamInstrument::SetX ( Float_t  val)
inline

Definition at line 79 of file ProtoDUNEBeamInstrument.h.

void sim::ProtoDUNEBeamInstrument::SetY ( Float_t  val)
inline

Definition at line 80 of file ProtoDUNEBeamInstrument.h.

void sim::ProtoDUNEBeamInstrument::SetZ ( Float_t  val)
inline

Definition at line 81 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::UnitGauss ( Float_t  mean,
Float_t  value,
Float_t  sigma 
)
inline

Definition at line 94 of file ProtoDUNEBeamInstrument.h.

94  {
95  Float_t p = exp(-0.5*pow((mean-value),2)/(pow(sigma,2)));
96  return p;}
constexpr T pow(T x)
Definition: pow.h:72
p
Definition: test.py:223
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:16

Member Data Documentation

Int_t sim::ProtoDUNEBeamInstrument::fEventID
private

Definition at line 112 of file ProtoDUNEBeamInstrument.h.

std::string sim::ProtoDUNEBeamInstrument::fInstrumentName
private

Definition at line 102 of file ProtoDUNEBeamInstrument.h.

Int_t sim::ProtoDUNEBeamInstrument::fPDGid
private

Definition at line 111 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::fPx
private

Definition at line 108 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::fPy
private

Definition at line 109 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::fPz
private

Definition at line 110 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::fResolution
private

Definition at line 116 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::fSmearedVar1
private

Definition at line 114 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::fSmearedVar2
private

Definition at line 115 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::fT
private

Definition at line 107 of file ProtoDUNEBeamInstrument.h.

Int_t sim::ProtoDUNEBeamInstrument::fTrackID
private

Definition at line 113 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::fX
private

Definition at line 104 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::fY
private

Definition at line 105 of file ProtoDUNEBeamInstrument.h.

Float_t sim::ProtoDUNEBeamInstrument::fZ
private

Definition at line 106 of file ProtoDUNEBeamInstrument.h.


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