27 double const a3 = -2.08730442907856008e-02;
28 double const a2 = 7.68769404161671888e-02;
29 double const a1 = -2.12871094165645952e-01;
30 double const a0 = 1.57075835365209659e+00;
39 ret *= std::sqrt(1.0 - x);
40 if (xin >= 0)
return ret;
50 const std::vector<double>& yData,
52 const bool extrapolate,
56 size_t size = xData.size();
57 if (x >= xData[size - 2]) {
61 while (x > xData[i + 1])
66 double xR = xData[i + 1];
68 double yR = yData[i + 1];
70 if (x < xL)
return yL;
71 if (x > xR)
return yL;
73 const double dydx = (yR - yL) / (xR - xL);
74 return yL + dydx * (x - xL);
78 const std::vector<double>& rDistances,
85 const size_t nbins_r = parameters[k].size();
86 std::vector<double> interp_vals(nbins_r, 0.);
89 size_t size = xDistances.size();
90 if (x >= xDistances[size - 2])
93 while (x > xDistances[idx + 1])
96 for (
size_t i = 0; i < nbins_r; ++i) {
97 interp_vals[i] =
interpolate(xDistances, parameters[k][i], x,
false, idx);
101 double border_correction =
interpolate(rDistances, interp_vals, r,
false);
102 return border_correction;
107 const std::vector<double>& xData,
108 const std::vector<double>& yData1,
109 const std::vector<double>& yData2,
110 const std::vector<double>& yData3,
112 const bool extrapolate)
114 size_t size = xData.size();
116 if (x >= xData[size - 2]) {
120 while (x > xData[i + 1])
123 double xL = xData[i];
124 double xR = xData[i + 1];
125 double yL1 = yData1[i];
126 double yR1 = yData1[i + 1];
127 double yL2 = yData2[i];
128 double yR2 = yData2[i + 1];
129 double yL3 = yData3[i];
130 double yR3 = yData3[i + 1];
146 const double m = (x - xL) / (xR - xL);
147 inter[0] = m * (yR1 - yL1) + yL1;
148 inter[1] = m * (yR2 - yL2) + yL2;
149 inter[2] = m * (yR3 - yL3) + yL3;
void interpolate3(std::array< double, 3 > &inter, const std::vector< double > &xData, const std::vector< double > &yData1, const std::vector< double > &yData2, const std::vector< double > &yData3, const double x, const bool extrapolate)
constexpr auto abs(T v)
Returns the absolute value of the argument.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
double fast_acos(double xin)
double interpolate2(const std::vector< double > &xDistances, const std::vector< double > &rDistances, const std::vector< std::vector< std::vector< double >>> ¶meters, const double x, const double r, const size_t k)
General LArSoft Utilities.
double interpolate(const std::vector< double > &xData, const std::vector< double > &yData, const double x, const bool extrapolate, size_t i)