10#include <framework/utilities/Spline.h>
13#include <framework/logging/Logger.h>
17void Spline::muidSpline(
int n,
double dx,
double Y[],
double B[],
double C[],
double D[])
20 B2FATAL(
"The spline interpolation can't be applied (histograms with less than 3 bins).");
22 C[1] = (Y[1] - Y[0]) / dx;
23 for (
int i = 1; i < n - 1; i++) {
26 C[i + 1] = (Y[i + 1] - Y[i]) / dx;
27 C[i] = C[i + 1] - C[i];
31 C[0] = (C[2] - C[1]) / 6.0;
32 C[n - 1] = -(C[n - 2] - C[n - 3]) / 6.0;
33 for (
int i = 1; i < n; i++) {
34 double temp = dx / B[i - 1];
36 C[i] -= temp * C[i - 1];
39 for (
int i = n - 2; i >= 0; i--) {
40 C[i] = (C[i] - D[i] * C[i + 1]) / B[i];
42 B[n - 1] = (Y[n - 1] - Y[n - 2]) / dx + (C[n - 2] + C[n - 1] * 2.0) * dx;
43 for (
int i = 0; i < n - 1; i++) {
44 B[i] = (Y[i + 1] - Y[i]) / dx - (C[i + 1] + C[i] * 2.0) * dx;
45 D[i] = (C[i + 1] - C[i]) / dx;
48 C[n - 1] = C[n - 1] * 3.0;
Abstract base class for different kinds of events.