6 if(order >= 1) { total += p[1] * x; }
7 if(order >= 2) { total += p[2] * (2 * x * x - 1); }
8 if(order >= 3) { total += p[3] * (4 * x * x * x - 3 * x); }
9 if(order >= 4) { total += p[4] * (8 * x * x * x * x - 8 * x * x + 1); }
10 if(order >= 5) { total += p[5] * (16 * x * x * x * x * x - 20 * x * x * x + 5 * x); }
11 if(order >= 6) { total += p[6] * (32 * x * x * x * x * x * x - 48 * x * x * x * x + 18 * x * x - 1); }
12 if(order >= 7) { total += p[7] * (64 * x * x * x * x * x * x * x - 112 * x * x * x * x * x + 56 * x * x * x - 7 * x); }
19 if(order >= 1) { total += p[1] * x; }
20 if(order >= 2) { total += p[2] * (3 * x * x - 1) / 2; }
21 if(order >= 3) { total += p[3] * (5 * x * x * x - 3 * x) / 2; }
22 if(order >= 4) { total += p[4] * (35 * x * x * x * x - 30 * x * x - 3) / 8; }
23 if(order >= 5) { total += p[5] * (63 * x * x * x * x * x - 70 * x * x * x + 15 * x) / 8; }
24 if(order >= 6) { total += p[6] * (231 * x * x * x * x * x * x - 315 * x * x * x * x + 105 * x * x - 5) / 16; }
25 if(order >= 7) { total += p[7] * (429 * x * x * x * x * x * x * x - 693 * x * x * x * x * x + 315 * x * x * x - 35 * x) / 16; }
31 return amplitude * 1.0 / (sqrt(2.0 * TMath::Pi() * pow(stddev, 2))) * TMath::Exp(-pow((x - mean), 2) / (2.0 * pow(stddev, 2)));
36 double differentiator = (x - mean) / stddev;
37 if(differentiator > -alpha) {
39 return amplitude * exp(-pow(x - mean, 2) / (2 * pow(stddev, 2)));
42 double absAlpha = fabs(alpha);
43 double A =
calcA(n, absAlpha);
44 double B =
calcB(n, absAlpha);
47 return amplitude * A * pow(B - ((x - mean) / stddev), -n);
52 return pow(n / absAlpha, n) * exp(-pow(absAlpha, 2) / 2);
56 return (n / absAlpha) - absAlpha;
static double calcA(double n, double absAlpha)
Calculates a portion of the crystal ball function.
static double calcB(double n, double absAlpha)
Calculates a portion of the crystal ball function.
static double ChebyshevFunction(double x, double *p, int order)
Defines a Chebyshev polynomial function.
static double CrystalBall(double x, double amplitude, double mean, double stddev, double alpha, double n)
Defines a crystal ball function for signal-fitting.
static double Gaussian(double x, double amplitude, double mean, double stddev)
Defines a Gaussian function for signal-fitting.
static double LegendreFunction(double x, double *p, int order)
Define a Legendre polynomial function.