CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
IonizationGTS Class Reference

#include <IonizationGTS.h>

+ Inheritance diagram for IonizationGTS:

Public Member Functions

 IonizationGTS ()
 
 ~IonizationGTS ()
 
void init (unsigned int random, ICgemGeomSvc *geomSvc, double magConfig)
 
void setDebugging (bool debugging)
 
void setTrack (int particle, int charge, double p, double trkPosIn[], double trkPosOut[])
 
int getNumberIonE ()
 
double getEx (int nElec)
 
double getEy (int nElec)
 
double getEz (int nElec)
 
double getEt (int nElec)
 
int getNumberIonC ()
 
double getCx (int nClus)
 
double getCy (int nClus)
 
double getCz (int nClus)
 
double getCt (int nClus)
 
bool generate_primary_ele ()
 
int generate_secondary_ele ()
 
void compute_pos (double trkPosIn[], double trkPosOut[], double &x, double &y, double &z)
 
void from_glo_to_loc (double xg, double yg, double zg, double &xl, double &yl, double &zl)
 
- Public Member Functions inherited from Ionization
 Ionization ()
 
virtual ~Ionization ()
 

Detailed Description

Definition at line 13 of file IonizationGTS.h.

Constructor & Destructor Documentation

◆ IonizationGTS()

IonizationGTS::IonizationGTS ( )

Definition at line 42 of file IonizationGTS.cxx.

42 {
43}

◆ ~IonizationGTS()

IonizationGTS::~IonizationGTS ( )

Definition at line 45 of file IonizationGTS.cxx.

45 {
46 if(m_testing == true) {
47 output->Write();
48 output->Close();
49 }
50}
#define m_testing

Member Function Documentation

◆ compute_pos()

void IonizationGTS::compute_pos ( double trkPosIn[],
double trkPosOut[],
double & x,
double & y,
double & z )

Definition at line 205 of file IonizationGTS.cxx.

205 {
206
207 double t = (m_track_length_limit - m_track_length)/m_track_length_limit;
208 x = posin[0] * t + posout[0] * (1 - t);
209 y = posin[1] * t + posout[1] * (1 - t);
210 z = posin[2] * t + posout[2] * (1 - t);
211
212}
Double_t x[10]
int t()
Definition t.c:1

Referenced by setTrack().

◆ from_glo_to_loc()

void IonizationGTS::from_glo_to_loc ( double xg,
double yg,
double zg,
double & xl,
double & yl,
double & zl )

◆ generate_primary_ele()

bool IonizationGTS::generate_primary_ele ( )

Definition at line 169 of file IonizationGTS.cxx.

169 {
170
171 double u = gRandom->Uniform(0, 1); // CHECK 6) TRandom
172 // step along the trajectory, that for now is a straight line [x0, z0] -> [x1, z1]
173 double dl_extracted = -(1./m_n_ion_mm) * TMath::Log(1 - u);
174 m_track_length += dl_extracted;
175
176 // cout << "m_track_length " << m_track_length << " dl_extracted " << dl_extracted << endl;
177
178
179 if(m_track_length > m_track_length_limit) return false;
180
181 m_nIonC++;
182 m_nIonE++;
183 return true;
184}

Referenced by setTrack().

◆ generate_secondary_ele()

int IonizationGTS::generate_secondary_ele ( )

Definition at line 188 of file IonizationGTS.cxx.

188 {
189 int n_elec=0;
190 double prob = gRandom->Uniform(0, 1); // CHECK 6) TRandom
191
192 for(int iele = 0; iele < 100; iele++) { // CHECK 4) cut at 100
193 n_elec = iele + 1;
194 if(prob < int_prob_electron_per_cluster[iele]) break;
195 }
196
197 if(n_elec>100) {
198 std::cout << "IonizationGTS::generate_secondary_ele: increase the size above 100"<<endl; // CHECK 4)
199 n_elec=100;
200 }
201
202 return n_elec;
203}
const double int_prob_electron_per_cluster[100]

Referenced by setTrack().

◆ getCt()

double IonizationGTS::getCt ( int nClus)
inline

Definition at line 39 of file IonizationGTS.h.

39{return m_ct[nClus];}

◆ getCx()

double IonizationGTS::getCx ( int nClus)
inline

Definition at line 36 of file IonizationGTS.h.

36{return m_cx[nClus];}

◆ getCy()

double IonizationGTS::getCy ( int nClus)
inline

Definition at line 37 of file IonizationGTS.h.

37{return m_cy[nClus];}

◆ getCz()

double IonizationGTS::getCz ( int nClus)
inline

Definition at line 38 of file IonizationGTS.h.

38{return m_cz[nClus];}

◆ getEt()

double IonizationGTS::getEt ( int nElec)
inlinevirtual

Implements Ionization.

Definition at line 32 of file IonizationGTS.h.

32{return m_et[nElec];}

◆ getEx()

double IonizationGTS::getEx ( int nElec)
inlinevirtual

Implements Ionization.

Definition at line 29 of file IonizationGTS.h.

29{return m_ex[nElec];}

◆ getEy()

double IonizationGTS::getEy ( int nElec)
inlinevirtual

Implements Ionization.

Definition at line 30 of file IonizationGTS.h.

30{return m_ey[nElec];}

◆ getEz()

double IonizationGTS::getEz ( int nElec)
inlinevirtual

Implements Ionization.

Definition at line 31 of file IonizationGTS.h.

31{return m_ez[nElec];}

◆ getNumberIonC()

int IonizationGTS::getNumberIonC ( )
inline

Definition at line 35 of file IonizationGTS.h.

35{return m_nIonC;}

◆ getNumberIonE()

int IonizationGTS::getNumberIonE ( )
inlinevirtual

Implements Ionization.

Definition at line 28 of file IonizationGTS.h.

28{return m_nIonE;}

◆ init()

void IonizationGTS::init ( unsigned int random,
ICgemGeomSvc * geomSvc,
double magConfig )
virtual

Implements Ionization.

Definition at line 52 of file IonizationGTS.cxx.

52 {
53 double time_spent = 0.;
54 clock_t begin = clock();
55
56 // std::cout << "IonizationGTS::init" << std::endl;
57 m_random = random;
58 gRandom->SetSeed(m_random); // CHECK 6) TRandom
59 m_geomSvc = geomSvc;
60 m_magConfig = magConfig;
61
62 cout << "IonizationGTS::init: m_testing " << m_testing << endl;
63
64
65 if(m_testing==true) {
66 output = new TFile("ionization.root", "RECREATE");
67 h_distance_cluster = new TH1F("h_distance_cluster", "distance between two consecutive clusters", 100, 0, 5);
68 h_nof_cluster = new TH1F("h_nof_cluster", "number of clusters", 100, 0, 100);
69 }
70
71 clock_t end = clock();
72 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
73 }

◆ setDebugging()

void IonizationGTS::setDebugging ( bool debugging)
inlinevirtual

Implements Ionization.

Definition at line 19 of file IonizationGTS.h.

19{m_debugging = debugging;}

◆ setTrack()

void IonizationGTS::setTrack ( int particle,
int charge,
double p,
double trkPosIn[],
double trkPosOut[] )
virtual

cout << "m_n_ion_mm " << m_n_ion_mm << " N_PRI_AVE " << N_PRI_AVE << " m_track_length_limit " << m_track_length_limit << endl; cout << "xIN " << trkPosIn[0] << " yIN " << trkPosIn[1] << " zIN " << trkPosIn[2] << endl;
cout << "xOUT " << trkPosOut[0] << " yOUT " << trkPosOut[1] << " zOUT " << trkPosOut[2] << endl;

Implements Ionization.

Definition at line 77 of file IonizationGTS.cxx.

77 {
78
79 double time_spent = 0.;
80 clock_t begin = clock();
81
82 clear();
83 // cout << "IonizationGTS setTrack" << endl;
84
85 // CHECK 1) 3D
86 m_track_length_limit = TMath::Sqrt((trkPosOut[0] - trkPosIn[0])*(trkPosOut[0] - trkPosIn[0]) + (trkPosOut[1] - trkPosIn[1])*(trkPosOut[1] - trkPosIn[1]) + (trkPosOut[2] - trkPosIn[2])*(trkPosOut[2] - trkPosIn[2]));
87 m_track_length = 0;
88
89 m_n_ion_mm = N_PRI_AVE/m_track_length_limit; // CHECK 2) N_PRI_AVE
90
91 /**
92 cout << "m_n_ion_mm " << m_n_ion_mm << " N_PRI_AVE " << N_PRI_AVE << " m_track_length_limit " << m_track_length_limit << endl;
93 cout << "xIN " << trkPosIn[0] << " yIN " << trkPosIn[1] << " zIN " << trkPosIn[2] << endl;
94 cout << "xOUT " << trkPosOut[0] << " yOUT " << trkPosOut[1] << " zOUT " << trkPosOut[2] << endl;
95 **/
96
97 // loop over ionization clusters
98 int counter = 0;
99
100 double last_x;
101 double last_y;
102 double last_z;
103 double last_t;
104
105 while(1) {
106
107 // primary ionization
108 bool is_inside = generate_primary_ele();
109 if(!is_inside) break;
110
111 // secondary ionization
112 int nof_sec_ele = generate_secondary_ele();
113 m_nIonE += nof_sec_ele;
114
115 // compute position
116 double x = 0;
117 double y = 0;
118 double z = 0;
119 double t = 0; // <-track_time; // CHECK 3) add the track time
120 compute_pos(trkPosIn, trkPosOut, x, y, z);
121 // cout << "ionization electron pos " << x << " " << y << " " << z << endl;
122
123 // set cluster pos
124 m_cx.push_back(x); // CHECK 5) cluster info
125 m_cy.push_back(y); // CHECK 5) cluster info
126 m_cz.push_back(z); // CHECK 5) cluster info
127 m_ct.push_back(t); // CHECK 5) cluster info
128
129 // cout << "x " << x << " y " << y << " z " << z << " t " << t << endl;
130
131 if(m_testing==true && counter > 0) {
132 double distance = TMath::Sqrt((last_x - x)*(last_x - x) + (last_y - y)*(last_y - y) + (last_z - z)*(last_z - z));
133 h_distance_cluster->Fill(distance);
134 last_x = x;
135 last_y = y;
136 last_z = z;
137 last_t = t;
138 }
139
140 // set ele pos
141 for(int iele = 0; iele < nof_sec_ele + 1; iele++)
142 {
143 m_ex.push_back(x);
144 m_ey.push_back(y);
145 m_ez.push_back(z);
146 m_et.push_back(t);
147
148 }
149 counter++;
150 // cout << "ion position " << x << " " << y << " " << z << endl;
151
152 }
153
154 if(m_nIonE != m_ex.size()) std::cout << "IonizationGTS::setTrack ERRRRRRRRRRRRRROR" << std::endl; // CHECK delete this
155
156 if(m_testing==true) h_nof_cluster->Fill(counter-1);
157
158 clock_t end = clock();
159 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
160 cout << "Sampling::ionization " << m_nIonE << " time " << time_spent << " seconds" << endl;
161
162
163
164
165}
#define N_PRI_AVE
void compute_pos(double trkPosIn[], double trkPosOut[], double &x, double &y, double &z)
bool generate_primary_ele()
int generate_secondary_ele()

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