9 #include <cdc/modules/cdcDigitizer/EDepInGas.h>
10 #include <framework/gearbox/Unit.h>
11 #include <framework/logging/Logger.h>
13 #include <TDatabasePDG.h>
32 EDepInGas::EDepInGas() {}
34 EDepInGas::~EDepInGas() {}
36 void EDepInGas::initialize()
40 const double aHe = 4.003;
44 const double aC = 12.011;
48 const double aH = 1.008;
51 double f = fHe + fC + fH;
55 m_z1 = fHe * zHe + fC * zC + fH * zH;
56 m_a1 = fHe * aHe + fC * aC + fH * aH;
63 const double aW = 183.842;
66 const double zAl = 13;
67 const double aAl = 26.982;
73 m_z2 = fW * zW + fAl * zAl;
74 m_a2 = fW * aW + fAl * aAl;
84 f = fHe + fC + fH + fW + fAl;
90 m_z0 = fHe * zHe + fC * zC + fH * zH + fW * zW + fAl * zAl;
91 m_a0 = fHe * aHe + fC * aC + fH * aH + fW * aW + fAl * aAl;
101 m_ak1[2][0] = 0.8135;
102 m_ak1[2][1] = -11.33;
103 m_ak1[3][0] = 0.00402;
104 m_ak1[3][1] = -10.36;
105 m_ak1[4][0] = - 1.7564;
106 m_ak1[4][1] = - 9.611;
107 m_ak1[5][0] = - 1.5065;
108 m_ak1[5][1] = - 8.6753;
110 m_bk1[0][0] = - 8.5619;
112 m_bk1[1][0] = - 4.5857;
114 m_bk1[2][0] = - 2.1447;
116 m_bk1[3][0] = - 1.1582;
118 m_bk1[4][0] = 0.67256;
120 m_bk1[5][0] = 1.0156;
123 m_ck1[0][0] = 1.82804;
125 m_ck1[1][0] = 1.27579;
127 m_ck1[2][0] = 0.93676;
129 m_ck1[3][0] = 0.79975;
131 m_ck1[4][0] = 0.49093;
133 m_ck1[5][0] = 0.44805;
137 double EDepInGas::getEDepInGas(
int mode,
int pdg,
double mom,
double dx,
double e3)
const
139 double xi1 = m_rho1 * (m_z1 / m_a1);
140 double xi2 = m_rho2 * (m_z2 / m_a2);
142 if (mode == 0)
return e3 * xi1 / (xi1 + xi2);
144 static TDatabasePDG* ptrTDatabasePDG = TDatabasePDG::Instance();
145 const double mass = ptrTDatabasePDG->GetParticle(pdg)->Mass();
146 const double chrg = fabs(ptrTDatabasePDG->GetParticle(pdg)->Charge() / 3);
148 const double me1 = getMostProbabEDep(mom, mass, chrg, dx, m_z1, m_a1, m_i1, m_rho1);
150 const double me0 = getMostProbabEDep(mom, mass, chrg, dx, m_z0, m_a0, m_i0, m_rho0);
151 return e3 * me1 / me0;
153 const double me2 = getMostProbabEDep(mom, mass, chrg, dx, m_z2, m_a2, m_i2, m_rho2);
154 if (mode == 1)
return e3 * me1 / (me1 + me2);
159 const double mom2 = mom * mom;
160 const double beta2 = mom2 / (mass * mass + mom2);
161 const double buf = 0.1535e-3 * dx * chrg * chrg / beta2;
164 const double xi1i = 1 / xi1;
165 const double xi2i = 1 / xi2;
166 const double lm1min = -me1 * xi1i;
167 const double lm1max = (e3 - me1) * xi1i;
168 double lm1 = (e3 * me1 / (me1 + me2) - me1) * xi1i;
169 lm1 = min(lm1, lm1max);
170 lm1 = max(lm1, lm1min);
175 const double lm2b = (e3 - me1 - me2) * xi2i;
176 const double r = xi1 * xi2i;
179 while (itry <= 2 || fabs(lm1 - lm1old) > 0.001) {
187 lm1 = max(lm1min, lm1);
188 lm1 = min(lm1max, lm1);
189 double lm2 = lm2b - r * lm1;
190 double emlm1 = exp(-lm1);
191 double emlm2 = exp(-lm2);
192 double dldlm1 = 1 - emlm1 - r + r * emlm2;
193 double dl2dlm12 = emlm1 + r * r * emlm2;
194 deltal = dldlm1 / dl2dlm12;
198 if (mode == 3)
return xi1 * lm1 + me1;
200 double lm2 = lm2b - r * lm1;
201 double lmin = 0.5 * (lm1 + lm2 + exp(-lm1) + exp(-lm2));
202 const double ymax = exp(-lmin);
206 const double lm1w = lm1max - lm1min;
215 lm1 = (e3 * me1 / (me1 + me2) - me1) * xi1i;
218 gRandom->RndmArray(2, urndm);
219 lm1 = lm1min + lm1w * urndm[0];
220 lm2 = lm2b - r * lm1;
221 double l = 0.5 * (lm1 + lm2 + exp(-lm1) + exp(-lm2));
226 return xi1 * lm1 + me1;
229 double EDepInGas::getMostProbabEDep(
double p,
double mass,
double zi,
double dx,
double Z,
230 double A,
double I,
double rho)
const
245 const double psq = p * p;
246 const double masq = mass * mass;
247 const double tote = psq + masq;
248 const double beta2 = psq / tote;
249 const double bgam2 = psq / masq;
250 const double gamma =
sqrt(tote) / mass;
251 const double alft = 0.1535e6 * rho * dx * Z / A;
252 const double k = log(m_massE * alft / I / I) + 0.891;
253 const double k1 = k - log(dx);
254 const double alngam = log(gamma);
255 const double alggam = log10(gamma);
260 if (alggam > 3.6) irgn = 1;
261 aa = (m_ak1[1][irgn] - m_ak1[0][irgn]) * (6. - k1) + m_ak1[0][irgn];
262 bb = (m_bk1[1][irgn] - m_bk1[0][irgn]) * (6. - k1) + m_bk1[0][irgn];
263 cc = (m_ck1[1][irgn] - m_ck1[0][irgn]) * (6. - k1) + m_ck1[0][irgn];
264 }
else if (k1 < 7.) {
265 if (alggam > 3.6) irgn = 1;
266 aa = (m_ak1[1][irgn] - m_ak1[0][irgn]) * (k1 - 6.) + m_ak1[0][irgn];
267 bb = (m_bk1[1][irgn] - m_bk1[0][irgn]) * (k1 - 6.) + m_bk1[0][irgn];
268 cc = (m_ck1[1][irgn] - m_ck1[0][irgn]) * (k1 - 6.) + m_ck1[0][irgn];
269 }
else if (k1 < 8.) {
270 if (alggam > 3.6) irgn = 1;
271 aa = (m_ak1[2][irgn] - m_ak1[1][irgn]) * (k1 - 7.) + m_ak1[1][irgn];
272 bb = (m_bk1[2][irgn] - m_bk1[1][irgn]) * (k1 - 7.) + m_bk1[1][irgn];
273 cc = (m_ck1[2][irgn] - m_ck1[1][irgn]) * (k1 - 7.) + m_ck1[1][irgn];
274 }
else if (k1 < 9.) {
275 if (alggam > 3.6) irgn = 1;
276 aa = (m_ak1[3][irgn] - m_ak1[2][irgn]) * (k1 - 8.) + m_ak1[2][irgn];
277 bb = (m_bk1[3][irgn] - m_bk1[2][irgn]) * (k1 - 8.) + m_bk1[2][irgn];
278 cc = (m_ck1[3][irgn] - m_ck1[2][irgn]) * (k1 - 8.) + m_ck1[2][irgn];
279 }
else if (k1 < 10.) {
280 if (alggam > 3.6) irgn = 1;
281 aa = (m_ak1[4][irgn] - m_ak1[3][irgn]) * (k1 - 9.) + m_ak1[3][irgn];
282 bb = (m_bk1[4][irgn] - m_bk1[3][irgn]) * (k1 - 9.) + m_bk1[3][irgn];
283 cc = (m_ck1[4][irgn] - m_ck1[3][irgn]) * (k1 - 9.) + m_ck1[3][irgn];
284 }
else if (k1 < 11.) {
285 if (alggam > 4.0) irgn = 1;
286 aa = (m_ak1[5][irgn] - m_ak1[4][irgn]) * (k1 - 10.) + m_ak1[4][irgn];
287 bb = (m_bk1[5][irgn] - m_bk1[4][irgn]) * (k1 - 10.) + m_bk1[4][irgn];
288 cc = (m_ck1[5][irgn] - m_ck1[4][irgn]) * (k1 - 10.) + m_ck1[4][irgn];
290 if (alggam > 4.0) irgn = 1;
291 aa = (m_ak1[5][irgn] - m_ak1[4][irgn]) * (k1 - 11.) + m_ak1[5][irgn];
292 bb = (m_bk1[5][irgn] - m_bk1[4][irgn]) * (k1 - 11.) + m_bk1[5][irgn];
293 cc = (m_ck1[5][irgn] - m_ck1[4][irgn]) * (k1 - 11.) + m_ck1[5][irgn];
296 double delta = aa + alggam * (bb + cc * alggam);
297 delta = max(delta, 0.);
298 delta = min(delta, fabs(log(bgam2)));
300 double val = zi * zi * alft * (k + 2 * alngam - beta2 - delta) / beta2;
The Class for Energy deposit in the gas.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.