CbmRoot
L1AddMaterial.h
Go to the documentation of this file.
1 #ifndef L1AddMaterial_h
2 #define L1AddMaterial_h
3 
4 #include "CbmL1Def.h"
5 #include "L1MaterialInfo.h"
6 #include "L1TrackPar.h"
7 
8 //#define cnst static const fvec
9 #define cnst const fvec
10 
11 const fvec PipeRadThick = 7.87e-3f; // 0.7 mm Aluminium
12 const fvec TargetRadThick = 3.73e-2f * 2; // 250 mum Gold
13 
14 
15 inline fvec BetheBlochIron(const float qp) {
16 
17  float K = 0.000307075; // [GeV*cm^2/g]
18  float z = (qp > 0.) ? 1 : -1.;
19  float Z = 26;
20  float A = 55.845;
21 
22  float M = 0.10565f;
23  float p = fabs(1. / qp); //GeV
24  float E = sqrt(M * M + p * p);
25  float beta = p / E;
26  float betaSq = beta * beta;
27  float gamma = E / M;
28  float gammaSq = gamma * gamma;
29 
30  float I = 260 * 1e-9; // GeV
31 
32  float me = 0.000511; // GeV
33  float ratio = me / M;
34  float Tmax =
35  (2 * me * betaSq * gammaSq) / (1 + 2 * gamma * ratio + ratio * ratio);
36 
37  // density correction
38  float dc = 0.;
39  if (p > 0.5) { // for particles above 1 Gev
40  float rho = 7.87;
41  float hwp = 28.816 * sqrt(rho * Z / A) * 1e-9; // GeV
42  dc = log(hwp / I) + log(beta * gamma) - 0.5;
43  }
44 
45  return K * z * z * (Z / A) * (1. / betaSq)
46  * (0.5 * log(2 * me * betaSq * gammaSq * Tmax / (I * I)) - betaSq
47  - dc);
48 }
49 
50 inline fvec BetheBlochCarbon(const float qp) {
51 
52  float K = 0.000307075; // GeV * g^-1 * cm^2
53  float z = (qp > 0.) ? 1 : -1.;
54  float Z = 6;
55  float A = 12.011;
56 
57  float M = 0.10565f;
58  float p = fabs(1. / qp); //GeV
59  float E = sqrt(M * M + p * p);
60  float beta = p / E;
61  float betaSq = beta * beta;
62  float gamma = E / M;
63  float gammaSq = gamma * gamma;
64 
65  float I = 16 * std::pow(6, 0.9) * 1e-9; // GeV mean excitation energy in eV
66 
67  float me = 0.000511; // GeV
68  float ratio = me / M;
69  float Tmax =
70  (2 * me * betaSq * gammaSq) / (1 + 2 * gamma * ratio + ratio * ratio);
71 
72  // density correction
73  float dc = 0.;
74  if (p > 0.5) { // for particles above 1 Gev
75  float rho = 2.265;
76  float hwp = 28.816 * sqrt(rho * Z / A) * 1e-9; // GeV
77  dc = log(hwp / I) + log(beta * gamma) - 0.5;
78  }
79 
80  return K * z * z * (Z / A) * (1. / betaSq)
81  * (0.5 * log(2 * me * betaSq * gammaSq * Tmax / (I * I)) - betaSq
82  - dc);
83 }
84 
85 inline fvec BetheBlochAl(const float qp) {
86 
87  float K = 0.000307075; // GeV * g^-1 * cm^2
88  float z = (qp > 0.) ? 1 : -1.;
89  float Z = 13;
90  float A = 26.981;
91 
92  float M = 0.10565f;
93  float p = fabs(1. / qp); //GeV
94  float E = sqrt(M * M + p * p);
95  float beta = p / E;
96  float betaSq = beta * beta;
97  float gamma = E / M;
98  float gammaSq = gamma * gamma;
99 
100  float I = 16 * std::pow(6, 0.9) * 1e-9; // GeV mean excitation energy in eV
101 
102  float me = 0.000511; // GeV
103  float ratio = me / M;
104  float Tmax =
105  (2 * me * betaSq * gammaSq) / (1 + 2 * gamma * ratio + ratio * ratio);
106 
107  // density correction
108  float dc = 0.;
109  if (p > 0.5) { // for particles above 1 Gev
110  float rho = 2.70;
111  float hwp = 28.816 * sqrt(rho * Z / A) * 1e-9; // GeV
112  dc = log(hwp / I) + log(beta * gamma) - 0.5;
113  }
114 
115  return K * z * z * (Z / A) * (1. / betaSq)
116  * (0.5 * log(2 * me * betaSq * gammaSq * Tmax / (I * I)) - betaSq
117  - dc);
118 }
119 
120 inline fvec ApproximateBetheBloch(const fvec& bg2) {
121  //
122  // This is the parameterization of the Bethe-Bloch formula inspired by Geant.
123  //
124  // bg2 - (beta*gamma)^2
125  // kp0 - density [g/cm^3]
126  // kp1 - density effect first junction point
127  // kp2 - density effect second junction point
128  // kp3 - mean excitation energy [GeV]
129  // kp4 - mean Z/A
130  //
131  // The default values for the kp* parameters are for silicon.
132  // The returned value is in [GeV/(g/cm^2)].
133  //
134 
135  const fvec& kp0 = 2.33f;
136  const fvec& kp1 = 0.20f;
137  const fvec& kp2 = 3.00f;
138  const fvec& kp3 = 173e-9f;
139  const fvec& kp4 = 0.49848f;
140 
141  const float mK = 0.307075e-3f; // [GeV*cm^2/g]
142  const float _2me = 1.022e-3f; // [GeV/c^2]
143  const fvec& rho = kp0;
144  const fvec& x0 = kp1 * 2.303f;
145  const fvec& x1 = kp2 * 2.303f;
146  const fvec& mI = kp3;
147  const fvec& mZA = kp4;
148  const fvec& maxT = _2me * bg2; // neglecting the electron mass
149 
150  //*** Density effect
151  fvec d2(0.f);
152  const fvec x = 0.5f * log(bg2);
153  const fvec lhwI = log(28.816f * 1e-9f * sqrt(rho * mZA) / mI);
154 
155  fvec init = x > x1;
156 
157  d2 = fvec(init & (lhwI + x - 0.5f));
158  const fvec& r = (x1 - x) / (x1 - x0);
159  init = (x > x0) & (x1 > x);
160  d2 = fvec(init & (lhwI + x - 0.5f + (0.5f - lhwI - x0) * r * r * r))
161  + fvec((!init) & d2);
162 
163  return mK * mZA * (fvec(1.f) + bg2) / bg2
164  * (0.5f * log(_2me * bg2 * maxT / (mI * mI)) - bg2 / (fvec(1.f) + bg2)
165  - d2);
166 }
167 
168 inline fvec ApproximateBetheBloch(const fvec& bg2,
169  const fvec& kp0,
170  const fvec& kp1,
171  const fvec& kp2,
172  const fvec& kp3,
173  const fvec& kp4) {
174  //
175  // This is the parameterization of the Bethe-Bloch formula inspired by Geant.
176  //
177  // bg2 - (beta*gamma)^2
178  // kp0 - density [g/cm^3]
179  // kp1 - density effect first junction point
180  // kp2 - density effect second junction point
181  // kp3 - mean excitation energy [GeV]
182  // kp4 - mean Z/A
183  //
184  // The default values for the kp* parameters are for silicon.
185  // The returned value is in [GeV/(g/cm^2)].
186  //
187 
188  // const fvec &kp0 = 2.33f;
189  // const fvec &kp1 = 0.20f;
190  // const fvec &kp2 = 3.00f;
191  // const fvec &kp3 = 173e-9f;
192  // const fvec &kp4 = 0.49848f;
193 
194  const float mK = 0.307075e-3f; // [GeV*cm^2/g]
195  const float _2me = 1.022e-3f; // [GeV/c^2]
196  const fvec& rho = kp0;
197  const fvec& x0 = kp1 * 2.303f;
198  const fvec& x1 = kp2 * 2.303f;
199  const fvec& mI = kp3;
200  const fvec& mZA = kp4;
201  const fvec& maxT = _2me * bg2; // neglecting the electron mass
202 
203  //*** Density effect
204  fvec d2(0.f);
205  const fvec x = 0.5f * log(bg2);
206  const fvec lhwI = log(28.816f * 1e-9f * sqrt(rho * mZA) / mI);
207 
208  fvec init = x > x1;
209 
210  d2 = fvec(init & (lhwI + x - 0.5f));
211  const fvec& r = (x1 - x) / (x1 - x0);
212  init = (x > x0) & (x1 > x);
213  d2 = fvec(init & (lhwI + x - 0.5f + (0.5f - lhwI - x0) * r * r * r))
214  + fvec((!init) & d2);
215 
216  return mK * mZA * (fvec(1.f) + bg2) / bg2
217  * (0.5f * log(_2me * bg2 * maxT / (mI * mI)) - bg2 / (fvec(1.f) + bg2)
218  - d2);
219 }
220 
221 
222 inline float CalcQpAfterEloss(float qp, float eloss, float mass2) {
223 
224  float p = fabs(1. / qp);
225  float E = sqrt(p * p + mass2);
226  float q = (qp > 0) ? 1. : -1.;
227  float Enew = E + eloss;
228  // float pnew = (Enew > sqrt(mass2)) ? std::sqrt(Enew * Enew - mass2) : 0.;
229  float pnew = std::sqrt(Enew * Enew - mass2);
230  // if (pnew!=0)
231  return q / pnew;
232  // else { return 1e5; }
233 }
234 
236  const fvec& mass2,
237  const fvec& radThick,
238  fvec& qp0,
239  fvec direction,
240  fvec w = 1,
241  fvec /*dE_*/ = 0) {
242  const fvec& p2 = 1.f / (T.qp * T.qp);
243  const fvec& E2 = mass2 + p2;
244 
245  // fvec qp =T.qp;
246 
247  const fvec& bethe = ApproximateBetheBloch(p2 / mass2);
248 
249  // fvec bethe2 = BetheBlochAl(qp[0]);
250 
251 
252  fvec tr = sqrt(fvec(1.f) + T.tx * T.tx + T.ty * T.ty);
253 
254  fvec dE = bethe * radThick * tr * 9.34961f * 2.33f;
255  // fvec dE2 = bethe2 * radThick*tr*2.265f* 2.70f;
256 
257  // dE = fabs(dE_);//dE2;//bethe * radThick*tr * 9.34961f*2.33f ;
258 
259 
260  const fvec& E2Corrected =
261  (sqrt(E2) + direction * dE) * (sqrt(E2) + direction * dE);
262  fvec corr = sqrt(p2 / (E2Corrected - mass2));
263  fvec init = fvec(!(corr == corr)) | fvec(w < 1);
264  corr = fvec(fvec(1.f) & init) + fvec(corr & fvec(!(init)));
265 
266 
267  qp0 *= corr;
268  // fvec dqp = CalcQpAfterEloss(qp[0], (direction*dE)[0], mass2[0]);
269  // qp0 = dqp;
270  // T.qp = dqp;
271  T.qp *= corr;
272  T.C40 *= corr;
273  T.C41 *= corr;
274  T.C42 *= corr;
275  T.C43 *= corr;
276  T.C44 *= corr * corr;
277 }
278 
280  const fvec& mass2,
281  const fvec& radThick,
282  fvec& qp0,
283  fvec direction,
284  fvec w = 1,
285  fvec /*dE_*/ = 0) {
286  const fvec& p2 = 1.f / (T.qp * T.qp);
287  const fvec& E2 = mass2 + p2;
288 
289  fvec qp = T.qp;
290 
291  int atomicZ = 13;
292  float atomicA = 26.981f;
293  float rho = 2.70f;
294  float radLen = 2.265f;
295 
296  // int atomicZ = 18;
297  // float atomicA = 39.95;
298  // float rho = 0.001780;
299  // float radLen = 1.097e+04;
300 
301 
302  fvec i;
303  if (atomicZ < 13)
304  i = (12. * atomicZ + 7.) * 1.e-9;
305  else
306  i = (9.76 * atomicZ + 58.8 * std::pow(atomicZ, -0.19)) * 1.e-9;
307 
308  const fvec& bethe =
309  ApproximateBetheBloch(p2 / mass2, rho, 0.20, 3.00, i, atomicZ / atomicA);
310 
311  // const fvec& bethe = ApproximateBetheBloch( p2/mass2 );
312 
313  // fvec bethe2 = BetheBlochAl(qp[0]);
314 
315 
316  fvec tr = sqrt(fvec(1.f) + T.tx * T.tx + T.ty * T.ty);
317 
318  // fvec dE2 = 2*bethe * radThick*tr * 9.34961f*2.33f ;
319  fvec dE = bethe * radThick * tr * radLen * rho;
320 
321 
322  const fvec& E2Corrected =
323  (sqrt(E2) + direction * dE) * (sqrt(E2) + direction * dE);
324  fvec corr = sqrt(p2 / (E2Corrected - mass2));
325  fvec init = fvec(!(corr == corr)) | fvec(w < 1);
326  corr = fvec(fvec(1.f) & init) + fvec(corr & fvec(!(init)));
327 
328  qp0 *= corr;
329  // fvec dqp = CalcQpAfterEloss(qp[0], (direction*dE)[0], mass2[0]);
330  // qp0 = dqp;
331  // T.qp = dqp;
332  T.qp *= corr;
333 
334  float P = fabs(1. / qp[0]); // GeV
335 
336  float Z = atomicZ;
337  float A = atomicA;
338  float RHO = rho;
339 
340  fvec STEP = radThick * tr * radLen;
341  fvec EMASS = 0.511 * 1e-3; // GeV
342 
343  fvec BETA = P / sqrt(E2);
344  fvec GAMMA = sqrt(E2) / sqrt(mass2);
345 
346  // Calculate xi factor (KeV).
347  fvec XI = (153.5 * Z * STEP * RHO) / (A * BETA * BETA);
348 
349  // Maximum energy transfer to atomic electron (KeV).
350  fvec ETA = BETA * GAMMA;
351  fvec ETASQ = ETA * ETA;
352  fvec RATIO = EMASS / sqrt(mass2);
353  fvec F1 = 2. * EMASS * ETASQ;
354  fvec F2 = 1. + 2. * RATIO * GAMMA + RATIO * RATIO;
355  fvec EMAX = 1e6 * F1 / F2;
356 
357  fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12;
358 
359  fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6);
360 
361 
362  // T.C40 *= corr;
363  // T.C41 *= corr;
364  // T.C42 *= corr;
365  // T.C43 *= corr;
366  // T.C44 *= corr*corr;
367  T.C44 += fabs(SDEDX);
368 
369  // T.C40 *= corr;
370  // T.C41 *= corr;
371  // T.C42 *= corr;
372  // T.C43 *= corr;
373  // T.C44 *= corr*corr;
374 }
375 
376 
378  const fvec& mass2,
379  const fvec& radThick,
380  fvec& qp0,
381  fvec direction,
382  fvec w = 1,
383  fvec /*dE_*/ = 0) {
384  const fvec& p2 = 1.f / (T.qp * T.qp);
385  const fvec& E2 = mass2 + p2;
386 
387  fvec qp = T.qp;
388 
389 
390  int atomicZ = 6;
391  float atomicA = 12.011f;
392  float rho = 2.265;
393  float radLen = 18.76f;
394 
395  fvec i;
396  if (atomicZ < 13)
397  i = (12. * atomicZ + 7.) * 1.e-9;
398  else
399  i = (9.76 * atomicZ + 58.8 * std::pow(atomicZ, -0.19)) * 1.e-9;
400 
401  const fvec& bethe =
402  ApproximateBetheBloch(p2 / mass2, rho, 0.20, 3.00, i, atomicZ / atomicA);
403 
404 
405  // const fvec& bethe = ApproximateBetheBloch( p2/mass2 );
406 
407  // fvec bethe2 = BetheBlochCarbon(qp[0]);
408 
409 
410  fvec tr = sqrt(fvec(1.f) + T.tx * T.tx + T.ty * T.ty);
411 
412 
413  fvec dE = bethe * radThick * tr * rho * radLen;
414  // fvec dE2 = bethe2 * radThick*tr*2.70f* 18.76f;
415 
416  const fvec& E2Corrected =
417  (sqrt(E2) + direction * dE) * (sqrt(E2) + direction * dE);
418  fvec corr = sqrt(p2 / (E2Corrected - mass2));
419  fvec init = fvec(!(corr == corr)) | fvec(w < 1);
420  corr = fvec(fvec(1.f) & init) + fvec(corr & fvec(!(init)));
421 
422  qp0 *= corr;
423  T.qp *= corr;
424 
425 
426  float P = fabs(1. / qp[0]); // GeV
427 
428  float Z = atomicZ;
429  float A = atomicA;
430  float RHO = rho;
431 
432  fvec STEP = radThick * tr * radLen;
433  fvec EMASS = 0.511 * 1e-3; // GeV
434 
435  fvec BETA = P / sqrt(E2Corrected);
436  fvec GAMMA = sqrt(E2) / sqrt(mass2);
437 
438  // Calculate xi factor (KeV).
439  fvec XI = (153.5 * Z * STEP * RHO) / (A * BETA * BETA);
440 
441  // Maximum energy transfer to atomic electron (KeV).
442  fvec ETA = BETA * GAMMA;
443  fvec ETASQ = ETA * ETA;
444  fvec RATIO = EMASS / sqrt(mass2);
445  fvec F1 = 2. * EMASS * ETASQ;
446  fvec F2 = 1. + 2. * RATIO * GAMMA + RATIO * RATIO;
447  fvec EMAX = 1e6 * F1 / F2;
448 
449  fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12;
450 
451  fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6);
452 
453  // fvec dqp = CalcQpAfterEloss(qp[0], (direction*dE)[0], mass2[0]);
454  // qp0 = dqp;
455  // T.qp = dqp;
456 
457 
458  // T.C40 *= corr;
459  // T.C41 *= corr;
460  // T.C42 *= corr;
461  // T.C43 *= corr;
462  // T.C44 *= corr*corr;
463  T.C44 += fabs(SDEDX);
464 
465  // T.C40 *= corr;
466  // T.C41 *= corr;
467  // T.C42 *= corr;
468  // T.C43 *= corr;
469  // T.C44 *= corr*corr;
470 }
471 
472 
474  const fvec& mass2,
475  const fvec& radThick,
476  fvec& qp0,
477  fvec direction,
478  fvec w = 1,
479  fvec /*dE_*/ = 0) {
480  const fvec& p2 = 1.f / (T.qp * T.qp);
481  const fvec& E2 = mass2 + p2;
482 
483  fvec qp = T.qp;
484 
485  int atomicZ = 26;
486  float atomicA = 55.845f;
487  float rho = 7.87;
488  float radLen = 1.758f;
489 
490  fvec i;
491  if (atomicZ < 13)
492  i = (12. * atomicZ + 7.) * 1.e-9;
493  else
494  i = (9.76 * atomicZ + 58.8 * std::pow(atomicZ, -0.19)) * 1.e-9;
495 
496  const fvec& bethe =
497  ApproximateBetheBloch(p2 / mass2, rho, 0.20, 3.00, i, atomicZ / atomicA);
498 
499  // fvec bethe2 = BetheBlochIron(T.qp[0]);
500 
501 
502  fvec tr = sqrt(fvec(1.f) + T.tx * T.tx + T.ty * T.ty);
503 
504 
505  fvec dE = bethe * radThick * tr * radLen * rho;
506  //fvec dE2 = bethe2 * radThick*tr * 1.758f*2.33;
507 
508  const fvec& E2Corrected =
509  (sqrt(E2) + direction * dE) * (sqrt(E2) + direction * dE);
510  fvec corr = sqrt(p2 / (E2Corrected - mass2));
511  fvec init = fvec(!(corr == corr)) | fvec(w < 1);
512  corr = fvec(fvec(1.f) & init) + fvec(corr & fvec(!(init)));
513 
514  qp0 *= corr;
515  T.qp *= corr;
516 
517  float P = fabs(1. / qp[0]); // GeV
518 
519  float Z = atomicZ;
520  float A = atomicA;
521  float RHO = rho;
522 
523  fvec STEP = radThick * tr * radLen;
524  fvec EMASS = 0.511 * 1e-3; // GeV
525 
526  fvec BETA = P / sqrt(E2Corrected);
527  fvec GAMMA = sqrt(E2) / sqrt(mass2);
528 
529  // Calculate xi factor (KeV).
530  fvec XI = (153.5 * Z * STEP * RHO) / (A * BETA * BETA);
531 
532  // Maximum energy transfer to atomic electron (KeV).
533  fvec ETA = BETA * GAMMA;
534  fvec ETASQ = ETA * ETA;
535  fvec RATIO = EMASS / sqrt(mass2);
536  fvec F1 = 2. * EMASS * ETASQ;
537  fvec F2 = 1. + 2. * RATIO * GAMMA + RATIO * RATIO;
538  fvec EMAX = 1e6 * F1 / F2;
539 
540  fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12;
541 
542  fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6);
543 
544  // T.C40 *= corr;
545  // T.C41 *= corr;
546  // T.C42 *= corr;
547  // T.C43 *= corr;
548  // T.C44 *= corr*corr;
549  T.C44 += fabs(SDEDX);
550 
551  // T.C40 *= corr;
552  // T.C41 *= corr;
553  // T.C42 *= corr;
554  // T.C43 *= corr;
555  // T.C44 *= corr*corr;
556 }
557 
558 
559 inline void L1AddMaterial(L1TrackPar& T,
560  fvec radThick,
561  fvec qp0,
562  fvec w = 1,
563  fvec mass2 = 0.10565f * 0.10565f) {
564  cnst ONE = 1.;
565 
566  fvec tx = T.tx;
567  fvec ty = T.ty;
568  fvec txtx = tx * tx;
569  fvec tyty = ty * ty;
570  fvec txtx1 = txtx + ONE;
571  fvec h = txtx + tyty;
572  fvec t = sqrt(txtx1 + tyty);
573  fvec h2 = h * h;
574  fvec qp0t = qp0 * t;
575 
576  cnst c1 = 0.0136f, c2 = c1 * 0.038f, c3 = c2 * 0.5f, c4 = -c3 / 2.0f,
577  c5 = c3 / 3.0f, c6 = -c3 / 4.0f;
578 
579  fvec s0 =
580  (c1 + c2 * log(radThick) + c3 * h + h2 * (c4 + c5 * h + c6 * h2)) * qp0t;
581  //fvec a = ( (ONE+mass2*qp0*qp0t)*radThick*s0*s0 );
582  fvec a = ((t + mass2 * qp0 * qp0t) * radThick * s0 * s0);
583 
584  T.C22 += w * txtx1 * a;
585  T.C32 += w * tx * ty * a;
586  T.C33 += w * (ONE + tyty) * a;
587 }
588 
589 inline void L1AddMaterial(L1TrackPar& T,
590  L1MaterialInfo& info,
591  fvec qp0,
592  fvec w = 1,
593  fvec mass2 = 0.10565f * 0.10565f) {
594  cnst ONE = 1.f;
595 
596  fvec tx = T.tx;
597  fvec ty = T.ty;
598  fvec txtx = tx * tx;
599  fvec tyty = ty * ty;
600  fvec txtx1 = txtx + ONE;
601  fvec h = txtx + tyty;
602  fvec t = sqrt(txtx1 + tyty);
603  fvec h2 = h * h;
604  fvec qp0t = qp0 * t;
605 
606  cnst c1 = 0.0136f, c2 = c1 * 0.038f, c3 = c2 * 0.5f, c4 = -c3 / 2.0f,
607  c5 = c3 / 3.0f, c6 = -c3 / 4.0f;
608 
609  fvec s0 =
610  (c1 + c2 * info.logRadThick + c3 * h + h2 * (c4 + c5 * h + c6 * h2)) * qp0t;
611  //fvec a = ( (ONE+mass2*qp0*qp0t)*info.RadThick*s0*s0 );
612  fvec a = ((t + mass2 * qp0 * qp0t) * info.RadThick * s0 * s0);
613 
614  T.C22 += w * txtx1 * a;
615  T.C32 += w * tx * ty * a;
616  T.C33 += w * (ONE + tyty) * a;
617 }
618 
619 // inline void L1AddThickMaterial( L1TrackPar &T, fvec radThick, fvec qp0, fvec thickness=0, fvec w = 1, fvec mass2 = 0.10565f*0.10565f, bool fDownstream = 1 )
620 // {
621 // cnst ONE = 1.;
622 //
623 // fvec tx = T.tx;
624 // fvec ty = T.ty;
625 // fvec txtx = tx*tx;
626 // fvec tyty = ty*ty;
627 // fvec txtx1 = txtx + ONE;
628 // fvec h = txtx + tyty;
629 // fvec t = sqrt(txtx1 + tyty);
630 // fvec h2 = h*h;
631 // fvec qp0t = qp0*t;
632 //
633 // cnst c1=0.0136f, c2=c1*0.038f, c3=c2*0.5f, c4=-c3/2.0f, c5=c3/3.0f, c6=-c3/4.0f;
634 //
635 // fvec s0 = (c1+c2*log(radThick) + c3*h + h2*(c4 + c5*h +c6*h2) )*qp0t;
636 // //fvec a = ( (ONE+mass2*qp0*qp0t)*radThick*s0*s0 );
637 // fvec a = ( (t+mass2*qp0*qp0t)*radThick*s0*s0 );
638 //
639 // fvec D = (fDownstream) ? 1. : -1.;
640 // fvec T23 = (thickness * thickness) / 3.0;
641 // fvec T2 = thickness / 2.0;
642 //
643 //
644 //
645 //
646 // T.C00 += w*txtx1*a * T23;
647 // T.C10 += w*tx*ty*a * T23;
648 // T.C20 += w*txtx1*a * D * T2;
649 // T.C30 += w*tx*ty*a * D * T2;
650 //
651 // T.C11 += w*(ONE+tyty)*a * T23;
652 // T.C21 += w*tx*ty*a * D * T2;
653 // T.C31 += w*(ONE+tyty)*a * D * T2;
654 //
655 // T.C22 += w*txtx1*a;
656 // T.C32 += w*tx*ty*a;
657 // T.C33 += w*(ONE+tyty)*a;
658 //
659 // }
660 
662  fvec radThick,
663  fvec qp0,
664  fvec w,
665  fvec thickness = 0,
666  bool fDownstream = 1) {
667  fvec mass2 = 0.10565f * 0.10565f;
668 
669  cnst ONE = 1.;
670 
671  fvec tx = T.tx;
672  fvec ty = T.ty;
673  fvec txtx = tx * tx;
674  fvec tyty = ty * ty;
675  fvec txtx1 = txtx + ONE;
676  fvec h = txtx + tyty;
677  fvec t = sqrt(txtx1 + tyty);
678  fvec h2 = h * h;
679  fvec qp0t = qp0 * t;
680 
681  cnst c1 = 0.0136f, c2 = c1 * 0.038f, c3 = c2 * 0.5f, c4 = -c3 / 2.0f,
682  c5 = c3 / 3.0f, c6 = -c3 / 4.0f;
683 
684  fvec s0 =
685  (c1 + c2 * log(radThick) + c3 * h + h2 * (c4 + c5 * h + c6 * h2)) * qp0t;
686  //fvec a = ( (ONE+mass2*qp0*qp0t)*radThick*s0*s0 );
687  fvec a = ((t + mass2 * qp0 * qp0t) * radThick * s0 * s0);
688 
689  fvec D = (fDownstream) ? 1. : -1.;
690  fvec T23 = (thickness * thickness) / 3.0;
691  fvec T2 = thickness / 2.0;
692 
693 
694  T.C00 += w * txtx1 * a * T23;
695  T.C10 += w * tx * ty * a * T23;
696  T.C20 += w * txtx1 * a * D * T2;
697  T.C30 += w * tx * ty * a * D * T2;
698 
699  T.C11 += w * (ONE + tyty) * a * T23;
700  T.C21 += w * tx * ty * a * D * T2;
701  T.C31 += w * (ONE + tyty) * a * D * T2;
702 
703  T.C22 += w * txtx1 * a;
704  T.C32 += w * tx * ty * a;
705  T.C33 += w * (ONE + tyty) * a;
706 }
707 
708 
709 inline void L1AddHalfMaterial(L1TrackPar& T, L1MaterialInfo& info, fvec qp0) {
710  cnst ONE = 1.;
711  cnst mass2 = 0.10565f * 0.10565f;
712 
713  fvec tx = T.tx;
714  fvec ty = T.ty;
715  fvec txtx = tx * tx;
716  fvec tyty = ty * ty;
717  fvec txtx1 = txtx + ONE;
718  fvec h = txtx + tyty;
719  fvec t = sqrt(txtx1 + tyty);
720  fvec h2 = h * h;
721  fvec qp0t = qp0 * t;
722 
723  cnst c1 = 0.0136f, c2 = c1 * 0.038f, c3 = c2 * 0.5f, c4 = -c3 / 2.0f,
724  c5 = c3 / 3.0f, c6 = -c3 / 4.0f;
725 
726  fvec s0 = (c1 + c2 * (info.logRadThick + log(0.5)) + c3 * h
727  + h2 * (c4 + c5 * h + c6 * h2))
728  * qp0t;
729  //fvec a = ( (ONE+mass2*qp0*qp0t)*info.RadThick*0.5*s0*s0 );
730  fvec a = ((t + mass2 * qp0 * qp0t) * info.RadThick * 0.5 * s0 * s0);
731 
732  T.C22 += txtx1 * a;
733  T.C32 += tx * ty * a;
734  T.C33 += (ONE + tyty) * a;
735 }
736 
738  fvec qp0,
739  fvec w = 1,
740  fvec mass2 = 0.10565f * 0.10565f) {
741  cnst ONE = 1.f;
742 
743  // static const fscal RadThick=0.0009f;//0.5/18.76;
744  // static const fscal logRadThick=log(RadThick);
745  //const fscal RadThick=0.0009f;//0.5/18.76;
746 
747  const fscal logRadThick = log(PipeRadThick[0]);
748  fvec tx = T.tx;
749  fvec ty = T.ty;
750  fvec txtx = tx * tx;
751  fvec tyty = ty * ty;
752  fvec txtx1 = txtx + ONE;
753  fvec h = txtx + tyty;
754  fvec t = sqrt(txtx1 + tyty);
755  fvec h2 = h * h;
756  fvec qp0t = qp0 * t;
757 
758  cnst c1 = 0.0136f, c2 = c1 * 0.038f, c3 = c2 * 0.5f, c4 = -c3 / 2.0f,
759  c5 = c3 / 3.0f, c6 = -c3 / 4.0f;
760  fvec s0 =
761  (c1 + c2 * fvec(logRadThick) + c3 * h + h2 * (c4 + c5 * h + c6 * h2))
762  * qp0t;
763  //fvec a = ( (ONE+mass2*qp0*qp0t)*RadThick*s0*s0 );
764  fvec a = ((t + mass2 * qp0 * qp0t) * PipeRadThick * s0 * s0);
765 
766  T.C22 += w * txtx1 * a;
767  T.C32 += w * tx * ty * a;
768  T.C33 += w * (ONE + tyty) * a;
769 }
770 
772  fvec qp0,
773  fvec w = 1,
774  fvec mass2 = 0.10565f * 0.10565f) {
775  cnst ONE = 1.f;
776 
777  const fscal logRadThick = log(TargetRadThick[0]);
778  fvec tx = T.tx;
779  fvec ty = T.ty;
780  fvec txtx = tx * tx;
781  fvec tyty = ty * ty;
782  fvec txtx1 = txtx + ONE;
783  fvec h = txtx + tyty;
784  fvec t = sqrt(txtx1 + tyty);
785  fvec h2 = h * h;
786  fvec qp0t = qp0 * t;
787 
788  cnst c1 = 0.0136f, c2 = c1 * 0.038f, c3 = c2 * 0.5f, c4 = -c3 / 2.0f,
789  c5 = c3 / 3.0f, c6 = -c3 / 4.0f;
790  fvec s0 =
791  (c1 + c2 * fvec(logRadThick) + c3 * h + h2 * (c4 + c5 * h + c6 * h2))
792  * qp0t;
793  //fvec a = ( (ONE+mass2*qp0*qp0t)*RadThick*s0*s0 );
794  fvec a = ((t + mass2 * qp0 * qp0t) * TargetRadThick * s0 * s0);
795 
796  T.C22 += w * txtx1 * a;
797  T.C32 += w * tx * ty * a;
798  T.C33 += w * (ONE + tyty) * a;
799 }
800 
801 #undef cnst
802 
803 #endif
CalcQpAfterEloss
float CalcQpAfterEloss(float qp, float eloss, float mass2)
Definition: L1AddMaterial.h:222
L1TrackPar::C10
fvec C10
Definition: L1TrackPar.h:9
L1MaterialInfo::RadThick
fvec RadThick
Definition: L1MaterialInfo.h:11
L1AddTargetMaterial
void L1AddTargetMaterial(L1TrackPar &T, fvec qp0, fvec w=1, fvec mass2=0.10565f *0.10565f)
Definition: L1AddMaterial.h:771
fscal
float fscal
Definition: L1/vectors/P4_F32vec4.h:250
L1TrackPar::qp
fvec qp
Definition: L1TrackPar.h:9
h
Generates beam ions for transport simulation.
Definition: CbmBeamGenerator.h:17
f
float f
Definition: L1/vectors/P4_F32vec4.h:24
L1TrackPar::C20
fvec C20
Definition: L1TrackPar.h:9
F32vec4
Definition: L1/vectors/P4_F32vec4.h:47
L1TrackPar::C41
fvec C41
Definition: L1TrackPar.h:10
BetheBlochIron
fvec BetheBlochIron(const float qp)
Definition: L1AddMaterial.h:15
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
L1TrackPar::C30
fvec C30
Definition: L1TrackPar.h:9
L1TrackPar::C31
fvec C31
Definition: L1TrackPar.h:9
fvec
F32vec4 fvec
Definition: L1/vectors/P4_F32vec4.h:249
L1AddHalfMaterial
void L1AddHalfMaterial(L1TrackPar &T, L1MaterialInfo &info, fvec qp0)
Definition: L1AddMaterial.h:709
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
L1MaterialInfo
Definition: L1MaterialInfo.h:7
L1TrackPar::C42
fvec C42
Definition: L1TrackPar.h:10
EnergyLossCorrectionIron
void EnergyLossCorrectionIron(L1TrackPar &T, const fvec &mass2, const fvec &radThick, fvec &qp0, fvec direction, fvec w=1, fvec=0)
Definition: L1AddMaterial.h:473
L1MaterialInfo::logRadThick
fvec logRadThick
Definition: L1MaterialInfo.h:11
L1TrackPar::ty
fvec ty
Definition: L1TrackPar.h:9
L1TrackPar::C32
fvec C32
Definition: L1TrackPar.h:9
L1AddMaterial
void L1AddMaterial(L1TrackPar &T, fvec radThick, fvec qp0, fvec w=1, fvec mass2=0.10565f *0.10565f)
Definition: L1AddMaterial.h:559
BetheBlochCarbon
fvec BetheBlochCarbon(const float qp)
Definition: L1AddMaterial.h:50
BetheBlochAl
fvec BetheBlochAl(const float qp)
Definition: L1AddMaterial.h:85
CbmL1Def.h
L1TrackPar::C44
fvec C44
Definition: L1TrackPar.h:10
EnergyLossCorrection
void EnergyLossCorrection(L1TrackPar &T, const fvec &mass2, const fvec &radThick, fvec &qp0, fvec direction, fvec w=1, fvec=0)
Definition: L1AddMaterial.h:235
L1AddPipeMaterial
void L1AddPipeMaterial(L1TrackPar &T, fvec qp0, fvec w=1, fvec mass2=0.10565f *0.10565f)
Definition: L1AddMaterial.h:737
ApproximateBetheBloch
fvec ApproximateBetheBloch(const fvec &bg2)
Definition: L1AddMaterial.h:120
EnergyLossCorrectionCarbon
void EnergyLossCorrectionCarbon(L1TrackPar &T, const fvec &mass2, const fvec &radThick, fvec &qp0, fvec direction, fvec w=1, fvec=0)
Definition: L1AddMaterial.h:377
L1TrackPar::tx
fvec tx
Definition: L1TrackPar.h:9
log
friend F32vec4 log(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:135
L1TrackPar.h
L1AddThickMaterial
void L1AddThickMaterial(L1TrackPar &T, fvec radThick, fvec qp0, fvec w, fvec thickness=0, bool fDownstream=1)
Definition: L1AddMaterial.h:661
L1TrackPar::C21
fvec C21
Definition: L1TrackPar.h:9
L1TrackPar::C00
fvec C00
Definition: L1TrackPar.h:9
EnergyLossCorrectionAl
void EnergyLossCorrectionAl(L1TrackPar &T, const fvec &mass2, const fvec &radThick, fvec &qp0, fvec direction, fvec w=1, fvec=0)
Definition: L1AddMaterial.h:279
cnst
#define cnst
Definition: L1AddMaterial.h:9
L1TrackPar::C33
fvec C33
Definition: L1TrackPar.h:9
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
L1TrackPar
Definition: L1TrackPar.h:6
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:60
L1TrackPar::C40
fvec C40
Definition: L1TrackPar.h:10
L1TrackPar::C11
fvec C11
Definition: L1TrackPar.h:9
TargetRadThick
const fvec TargetRadThick
Definition: L1AddMaterial.h:12
L1MaterialInfo.h
PipeRadThick
const fvec PipeRadThick
Definition: L1AddMaterial.h:11
L1TrackPar::C43
fvec C43
Definition: L1TrackPar.h:10
NS_L1TrackFitter::ONE
const fvec ONE
Definition: L1TrackFitter.cxx:33
L1TrackPar::C22
fvec C22
Definition: L1TrackPar.h:9