8 #include "GaudiKernel/MsgStream.h"
12 #include "GeoModelHelpers/throwExcept.h"
48 unsigned int nb_points(31);
60 fitter.set_number_of_coefficients(8);
65 fitter.set_number_of_coefficients(8);
70 fitter.set_number_of_coefficients(8);
75 std::vector<SamplePoint> sample_points(nb_points);
88 log << MSG::INFO <<
"UNPHYSICAL MAXIMUM DRIFT RADIUS OF " <<
m_r_max <<
", WILL BE SET TO 17.0!" <<
endmsg;
95 double prev_integral = 0;
96 for (
unsigned int k = 0;
k < nb_points;
k++) {
99 double new_r = rt->
radius(time);
100 double new_integral = 1.0e9 *
integral(prev_r, new_r, rt) + prev_integral;
101 sample_points[
k].set_x2(new_integral);
102 sample_points[
k].set_error(1.0);
104 prev_integral = new_integral;
108 fitter.fit_parameters(sample_points, 1, nb_points, legendre);
116 constexpr
double precision{0.010};
124 double t_guess, r_guess;
127 t_guess = t_min + (t_max - t_min) / (r_max - r_min) * (
r - r_min);
128 r_guess = rt->
radius(t_guess);
136 }
while (t_max - t_min > 0.1 && std::abs(r_guess -
r) > precision);
158 if (r_max < r_min) {
return 0.0; }
186 double B_perp{std::hypot(B_wire, B_mu)};
189 double precision{0.1};
210 while (t_max - t_min > precision) {
213 integ +=
m_alpha[
k] * std::legendre(
k, 2 * (0.5 * (t_min + t_max) - tmean) / tlength);
215 if (0.5 * (t_min + t_max) + B_factor * integ > time) {
216 t_max = 0.5 * (t_min + t_max);
218 t_min = 0.5 * (t_min + t_max);
222 return B_factor * integ;
230 const double B_perp{std::hypot(B_wire, B_mu)};
249 integ +=
m_alpha[
k] * std::legendre(
k, 2 * (time - tmean) / tlength);
252 return B_factor * integ;