17 namespace ActsFatras {
41 template <
typename generator_t>
53 std::array<double, 4> scattering_params;
59 double beta2Inv = 1 + mOverP * mOverP;
60 double beta = 1 / std::sqrt(beta2Inv);
62 double tob2 = tInX0 * beta2Inv;
63 if (tob2 > 0.6 / std::pow(slab.
material().
Z(), 0.6)) {
74 theta =
gaussmix(generator, scattering_params);
77 auto scattering_params_sg =
81 theta =
semigauss(generator, scattering_params_sg);
87 slab, particle.
pdg(), particle.
mass(),
89 theta = std::normal_distribution<double>(0.0, theta0)(generator);
92 return M_SQRT2 *
theta;
97 std::array<double, 4>
getGaussian(
double beta,
double p,
double tInX0,
99 std::array<double, 4> scattering_params;
101 scattering_params[0] = 15. / beta / p * std::sqrt(tInX0) * scale;
102 scattering_params[1] = 1.0;
103 scattering_params[2] = 1.0;
104 scattering_params[3] = 0.5;
105 return scattering_params;
109 double Z,
double scale)
const {
110 std::array<double, 4> scattering_params;
111 scattering_params[0] = 15. / beta / p * std::sqrt(tInX0) *
113 double d1 = std::log(tInX0 / (beta * beta));
114 double d2 = std::log(std::pow(Z, 2.0 / 3.0) * tInX0 / (beta * beta));
116 double var1 = (-1.843e-3 * d1 + 3.347e-2) * d1 + 8.471
e-1;
119 epsi = (6.096e-4 * d2 + 6.348e-3) * d2 + 4.841
e-2;
121 epsi = (-5.729e-3 * d2 + 1.106e-1) * d2 - 1.908
e-2;
122 scattering_params[1] = var1;
123 scattering_params[2] = (1 - (1 - epsi) * var1) / epsi;
124 scattering_params[3] = epsi;
125 return scattering_params;
129 double Z,
double scale)
const {
130 std::array<double, 6> scattering_params;
131 double N = tInX0 * 1.587E7 * std::pow(Z, 1.0 / 3.0) / (beta * beta) /
132 (Z + 1) / std::log(287 / std::sqrt(Z));
133 scattering_params[4] = 15. / beta / p * std::sqrt(tInX0) *
135 double rho = 41000 / std::pow(Z, 2.0 / 3.0);
136 double b = rho / std::sqrt(N * (std::log(rho) - 0.5));
137 double n = std::pow(Z, 0.1) * std::log(N);
138 double var1 = (5.783E-4 * n + 3.803E-2) * n + 1.827E-1;
140 (((-4.590E-5 * n + 1.330E-3) * n - 1.355E-2) * n + 9.828E-2) * n +
142 double epsi = (1 - var1) / (a * a * (std::log(b / a) - 0.5) - var1);
143 scattering_params[3] =
144 (epsi > 0) ? epsi : 0.0;
145 scattering_params[0] = a;
146 scattering_params[1] = b;
147 scattering_params[2] = var1;
148 scattering_params[5] =
N;
149 return scattering_params;
160 template <
typename generator_t>
162 const std::array<double, 4> &scattering_params)
const {
163 std::uniform_real_distribution<double> udist(0.0, 1.0);
164 double sigma_tot = scattering_params[0];
165 double var1 = scattering_params[1];
166 double var2 = scattering_params[2];
167 double epsi = scattering_params[3];
168 bool ind = udist(generator) > epsi;
169 double u = udist(generator);
171 return std::sqrt(var1) * std::sqrt(-2 * std::log(u)) * sigma_tot;
173 return std::sqrt(var2) * std::sqrt(-2 * std::log(u)) * sigma_tot;
184 template <
typename generator_t>
186 const std::array<double, 6> &scattering_params)
const {
187 std::uniform_real_distribution<double> udist(0.0, 1.0);
188 double a = scattering_params[0];
189 double b = scattering_params[1];
190 double var1 = scattering_params[2];
191 double epsi = scattering_params[3];
192 double sigma_tot = scattering_params[4];
193 bool ind = udist(generator) > epsi;
194 double u = udist(generator);
196 return std::sqrt(var1) * std::sqrt(-2 * std::log(u)) * sigma_tot;
198 return a * b * std::sqrt((1 - u) / (u * b * b + a * a)) * sigma_tot;