1 #ifndef L1AddMaterial_h
2 #define L1AddMaterial_h
9 #define cnst const fvec
17 float K = 0.000307075;
18 float z = (qp > 0.) ? 1 : -1.;
23 float p =
fabs(1. / qp);
24 float E =
sqrt(M * M + p * p);
26 float betaSq = beta * beta;
28 float gammaSq = gamma * gamma;
35 (2 * me * betaSq * gammaSq) / (1 + 2 * gamma * ratio + ratio * ratio);
41 float hwp = 28.816 *
sqrt(rho * Z / A) * 1e-9;
42 dc =
log(hwp / I) +
log(beta * gamma) - 0.5;
45 return K * z * z * (Z / A) * (1. / betaSq)
46 * (0.5 *
log(2 * me * betaSq * gammaSq * Tmax / (I * I)) - betaSq
52 float K = 0.000307075;
53 float z = (qp > 0.) ? 1 : -1.;
58 float p =
fabs(1. / qp);
59 float E =
sqrt(M * M + p * p);
61 float betaSq = beta * beta;
63 float gammaSq = gamma * gamma;
65 float I = 16 * std::pow(6, 0.9) * 1e-9;
70 (2 * me * betaSq * gammaSq) / (1 + 2 * gamma * ratio + ratio * ratio);
76 float hwp = 28.816 *
sqrt(rho * Z / A) * 1e-9;
77 dc =
log(hwp / I) +
log(beta * gamma) - 0.5;
80 return K * z * z * (Z / A) * (1. / betaSq)
81 * (0.5 *
log(2 * me * betaSq * gammaSq * Tmax / (I * I)) - betaSq
87 float K = 0.000307075;
88 float z = (qp > 0.) ? 1 : -1.;
93 float p =
fabs(1. / qp);
94 float E =
sqrt(M * M + p * p);
96 float betaSq = beta * beta;
98 float gammaSq = gamma * gamma;
100 float I = 16 * std::pow(6, 0.9) * 1e-9;
103 float ratio = me / M;
105 (2 * me * betaSq * gammaSq) / (1 + 2 * gamma * ratio + ratio * ratio);
111 float hwp = 28.816 *
sqrt(rho * Z / A) * 1e-9;
112 dc =
log(hwp / I) +
log(beta * gamma) - 0.5;
115 return K * z * z * (Z / A) * (1. / betaSq)
116 * (0.5 *
log(2 * me * betaSq * gammaSq * Tmax / (I * I)) - betaSq
135 const fvec& kp0 = 2.33f;
136 const fvec& kp1 = 0.20f;
137 const fvec& kp2 = 3.00f;
138 const fvec& kp3 = 173e-9
f;
139 const fvec& kp4 = 0.49848f;
141 const float mK = 0.307075e-3
f;
142 const float _2me = 1.022e-3
f;
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;
153 const fvec lhwI =
log(28.816
f * 1e-9
f *
sqrt(rho * mZA) / mI);
157 d2 =
fvec(init & (lhwI +
x - 0.5
f));
158 const fvec& r = (x1 -
x) / (x1 - x0);
159 init = (
x > x0) & (x1 >
x);
160 d2 =
fvec(init & (lhwI +
x - 0.5
f + (0.5
f - lhwI - x0) * r * r * r))
161 +
fvec((!init) & d2);
163 return mK * mZA * (
fvec(1.
f) + bg2) / bg2
164 * (0.5
f *
log(_2me * bg2 * maxT / (mI * mI)) - bg2 / (
fvec(1.
f) + bg2)
194 const float mK = 0.307075e-3
f;
195 const float _2me = 1.022e-3
f;
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;
206 const fvec lhwI =
log(28.816
f * 1e-9
f *
sqrt(rho * mZA) / mI);
210 d2 =
fvec(init & (lhwI +
x - 0.5
f));
211 const fvec& r = (x1 -
x) / (x1 - x0);
212 init = (
x > x0) & (x1 >
x);
213 d2 =
fvec(init & (lhwI +
x - 0.5
f + (0.5
f - lhwI - x0) * r * r * r))
214 +
fvec((!init) & d2);
216 return mK * mZA * (
fvec(1.
f) + bg2) / bg2
217 * (0.5
f *
log(_2me * bg2 * maxT / (mI * mI)) - bg2 / (
fvec(1.
f) + bg2)
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;
229 float pnew =
std::sqrt(Enew * Enew - mass2);
237 const fvec& radThick,
242 const fvec& p2 = 1.f / (T.
qp * T.
qp);
243 const fvec& E2 = mass2 + p2;
254 fvec dE = bethe * radThick * tr * 9.34961f * 2.33f;
260 const fvec& E2Corrected =
261 (
sqrt(E2) + direction * dE) * (
sqrt(E2) + direction * dE);
262 fvec corr =
sqrt(p2 / (E2Corrected - mass2));
276 T.
C44 *= corr * corr;
281 const fvec& radThick,
286 const fvec& p2 = 1.f / (T.
qp * T.
qp);
287 const fvec& E2 = mass2 + p2;
292 float atomicA = 26.981f;
294 float radLen = 2.265f;
304 i = (12. * atomicZ + 7.) * 1.e-9;
306 i = (9.76 * atomicZ + 58.8 * std::pow(atomicZ, -0.19)) * 1.e-9;
319 fvec dE = bethe * radThick * tr * radLen * rho;
322 const fvec& E2Corrected =
323 (
sqrt(E2) + direction * dE) * (
sqrt(E2) + direction * dE);
324 fvec corr =
sqrt(p2 / (E2Corrected - mass2));
334 float P =
fabs(1. / qp[0]);
340 fvec STEP = radThick * tr * radLen;
341 fvec EMASS = 0.511 * 1e-3;
347 fvec XI = (153.5 * Z * STEP * RHO) / (A * BETA * BETA);
350 fvec ETA = BETA * GAMMA;
351 fvec ETASQ = ETA * ETA;
353 fvec F1 = 2. * EMASS * ETASQ;
354 fvec F2 = 1. + 2. * RATIO * GAMMA + RATIO * RATIO;
355 fvec EMAX = 1e6 * F1 / F2;
357 fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12;
359 fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6);
379 const fvec& radThick,
384 const fvec& p2 = 1.f / (T.
qp * T.
qp);
385 const fvec& E2 = mass2 + p2;
391 float atomicA = 12.011f;
393 float radLen = 18.76f;
397 i = (12. * atomicZ + 7.) * 1.e-9;
399 i = (9.76 * atomicZ + 58.8 * std::pow(atomicZ, -0.19)) * 1.e-9;
413 fvec dE = bethe * radThick * tr * rho * radLen;
416 const fvec& E2Corrected =
417 (
sqrt(E2) + direction * dE) * (
sqrt(E2) + direction * dE);
418 fvec corr =
sqrt(p2 / (E2Corrected - mass2));
426 float P =
fabs(1. / qp[0]);
432 fvec STEP = radThick * tr * radLen;
433 fvec EMASS = 0.511 * 1e-3;
439 fvec XI = (153.5 * Z * STEP * RHO) / (A * BETA * BETA);
442 fvec ETA = BETA * GAMMA;
443 fvec ETASQ = ETA * ETA;
445 fvec F1 = 2. * EMASS * ETASQ;
446 fvec F2 = 1. + 2. * RATIO * GAMMA + RATIO * RATIO;
447 fvec EMAX = 1e6 * F1 / F2;
449 fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12;
451 fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6);
475 const fvec& radThick,
480 const fvec& p2 = 1.f / (T.
qp * T.
qp);
481 const fvec& E2 = mass2 + p2;
486 float atomicA = 55.845f;
488 float radLen = 1.758f;
492 i = (12. * atomicZ + 7.) * 1.e-9;
494 i = (9.76 * atomicZ + 58.8 * std::pow(atomicZ, -0.19)) * 1.e-9;
505 fvec dE = bethe * radThick * tr * radLen * rho;
508 const fvec& E2Corrected =
509 (
sqrt(E2) + direction * dE) * (
sqrt(E2) + direction * dE);
510 fvec corr =
sqrt(p2 / (E2Corrected - mass2));
517 float P =
fabs(1. / qp[0]);
523 fvec STEP = radThick * tr * radLen;
524 fvec EMASS = 0.511 * 1e-3;
530 fvec XI = (153.5 * Z * STEP * RHO) / (A * BETA * BETA);
533 fvec ETA = BETA * GAMMA;
534 fvec ETASQ = ETA * ETA;
536 fvec F1 = 2. * EMASS * ETASQ;
537 fvec F2 = 1. + 2. * RATIO * GAMMA + RATIO * RATIO;
538 fvec EMAX = 1e6 * F1 / F2;
540 fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12;
542 fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6);
563 fvec mass2 = 0.10565
f * 0.10565
f) {
571 fvec h = txtx + tyty;
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;
580 (c1 + c2 *
log(radThick) + c3 *
h + h2 * (c4 + c5 *
h + c6 * h2)) * qp0t;
582 fvec a = ((t + mass2 * qp0 * qp0t) * radThick * s0 * s0);
584 T.
C22 += w * txtx1 * a;
585 T.
C32 += w * tx * ty * a;
586 T.
C33 += w * (
ONE + tyty) * a;
593 fvec mass2 = 0.10565
f * 0.10565
f) {
601 fvec h = txtx + tyty;
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;
610 (c1 + c2 * info.
logRadThick + c3 *
h + h2 * (c4 + c5 *
h + c6 * h2)) * qp0t;
612 fvec a = ((t + mass2 * qp0 * qp0t) * info.
RadThick * s0 * s0);
614 T.
C22 += w * txtx1 * a;
615 T.
C32 += w * tx * ty * a;
616 T.
C33 += w * (
ONE + tyty) * a;
666 bool fDownstream = 1) {
667 fvec mass2 = 0.10565f * 0.10565f;
676 fvec h = txtx + tyty;
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;
685 (c1 + c2 *
log(radThick) + c3 *
h + h2 * (c4 + c5 *
h + c6 * h2)) * qp0t;
687 fvec a = ((t + mass2 * qp0 * qp0t) * radThick * s0 * s0);
689 fvec D = (fDownstream) ? 1. : -1.;
690 fvec T23 = (thickness * thickness) / 3.0;
691 fvec T2 = thickness / 2.0;
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;
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;
703 T.
C22 += w * txtx1 * a;
704 T.
C32 += w * tx * ty * a;
705 T.
C33 += w * (
ONE + tyty) * a;
711 cnst mass2 = 0.10565f * 0.10565f;
718 fvec h = txtx + tyty;
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;
727 + h2 * (c4 + c5 *
h + c6 * h2))
730 fvec a = ((t + mass2 * qp0 * qp0t) * info.
RadThick * 0.5 * s0 * s0);
733 T.
C32 += tx * ty * a;
734 T.
C33 += (
ONE + tyty) * a;
740 fvec mass2 = 0.10565
f * 0.10565
f) {
753 fvec h = txtx + tyty;
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;
761 (c1 + c2 *
fvec(logRadThick) + c3 *
h + h2 * (c4 + c5 *
h + c6 * h2))
766 T.
C22 += w * txtx1 * a;
767 T.
C32 += w * tx * ty * a;
768 T.
C33 += w * (
ONE + tyty) * a;
774 fvec mass2 = 0.10565
f * 0.10565
f) {
783 fvec h = txtx + tyty;
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;
791 (c1 + c2 *
fvec(logRadThick) + c3 *
h + h2 * (c4 + c5 *
h + c6 * h2))
796 T.
C22 += w * txtx1 * a;
797 T.
C32 += w * tx * ty * a;
798 T.
C33 += w * (
ONE + tyty) * a;