16 static const double kSqrt2 = 1.41421356237309515;
33 return 0.5 - std::atan(2.0 * (
x-x0) / gamma) /
M_PI;
39 return 0.5 + std::atan(2.0 * (
x-x0) / gamma) /
M_PI;
45 return 0.5 - std::atan( (
x-x0) /
b) /
M_PI;
51 return 0.5 + std::atan( (
x-x0) /
b) /
M_PI;
68 MATH_ERROR_MSG(
"crystalball_cdf",
"CrystalBall cdf not defined for n <=1");
69 return std::numeric_limits<double>::quiet_NaN();
73 double C =
n/
abs_alpha * 1./(
n-1.) * std::exp(-alpha*alpha/2.);
83 MATH_ERROR_MSG(
"crystalball_cdf_c",
"CrystalBall cdf not defined for n <=1");
84 return std::numeric_limits<double>::quiet_NaN();
87 double C =
n/
abs_alpha * 1./(
n-1.) * std::exp(-alpha*alpha/2.);
107 MATH_ERROR_MSG(
"crystalball_integral",
"CrystalBall function not defined at alpha=0");
112 MATH_WARN_MSG(
"crystalball_integral",
"No physical meaning when n<=0");
114 double z = (
x - mean) /
sigma;
131 double A =
r * std::exp(-0.5 * alpha * alpha);
135 intpow = A * (1 - std::pow(
r / (B - z),
n - 1)) / (
n - 1);
139 intpow = A * std::pow(
r,
n - 1) * (std::log(B - z) - std::log(
r));
154 if ((
x-x0) < 0)
return 1.0;
155 else return std::exp(- lambda * (
x-x0));
161 if ((
x-x0) < 0)
return 0.0;
170 if (
n < 0 ||
m < 0)
return std::numeric_limits<double>::quiet_NaN();
172 double z =
m/(
m +
n*(
x-x0));
185 return std::numeric_limits<double>::quiet_NaN();
187 double z =
n*(
x-x0)/(
m +
n*(
x-x0));
189 if (z > 0.9 &&
n > 1 &&
m > 1)
202 double gamma_cdf(
double x,
double alpha,
double theta,
double x0)
210 double z = (std::log((
x-x0))-
m)/(s*
kSqrt2);
218 double z = (std::log((
x-x0))-
m)/(s*
kSqrt2);
243 double sign = (
p>0) ? 1. : -1;
251 double sign = (
p>0) ? 1. : -1;
258 if ((
x-x0) <
a)
return 1.0;
259 else if ((
x-x0) >=
b)
return 0.0;
260 else return (
b-(
x-x0))/(
b-
a);
266 if ((
x-x0) <
a)
return 0.0;
267 else if ((
x-x0) >=
b)
return 1.0;
268 else return ((
x-x0)-
a)/(
b-
a);
293 if ( k >=
n)
return 0;
303 if ( k >=
n)
return 1.0;
323 if (
n < 0)
return 0;
336 static double p1[5] = {0.2514091491e+0,-0.6250580444e-1, 0.1458381230e-1,-0.2108817737e-2, 0.7411247290e-3};
337 static double q1[5] = {1.0 ,-0.5571175625e-2, 0.6225310236e-1,-0.3137378427e-2, 0.1931496439e-2};
339 static double p2[4] = {0.2868328584e+0, 0.3564363231e+0, 0.1523518695e+0, 0.2251304883e-1};
340 static double q2[4] = {1.0 , 0.6191136137e+0, 0.1720721448e+0, 0.2278594771e-1};
342 static double p3[4] = {0.2868329066e+0, 0.3003828436e+0, 0.9950951941e-1, 0.8733827185e-2};
343 static double q3[4] = {1.0 , 0.4237190502e+0, 0.1095631512e+0, 0.8693851567e-2};
345 static double p4[4] = {0.1000351630e+1, 0.4503592498e+1, 0.1085883880e+2, 0.7536052269e+1};
346 static double q4[4] = {1.0 , 0.5539969678e+1, 0.1933581111e+2, 0.2721321508e+2};
348 static double p5[4] = {0.1000006517e+1, 0.4909414111e+2, 0.8505544753e+2, 0.1532153455e+3};
349 static double q5[4] = {1.0 , 0.5009928881e+2, 0.1399819104e+3, 0.4200002909e+3};
351 static double p6[4] = {0.1000000983e+1, 0.1329868456e+3, 0.9162149244e+3,-0.9605054274e+3};
352 static double q6[4] = {1.0 , 0.1339887843e+3, 0.1055990413e+4, 0.5532224619e+3};
354 static double a1[4] = {0 ,-0.4583333333e+0, 0.6675347222e+0,-0.1641741416e+1};
355 static double a2[4] = {0 , 1.0 ,-0.4227843351e+0,-0.2043403138e+1};
357 double v = (
x - x0)/xi;
364 lan = 0.3989422803*std::exp(-1./
u)*std::sqrt(
u)*(1+(
a1[1]+(
a1[2]+
a1[3]*
u)*
u)*
u);
395 u = 1./(
v-
v*std::log(
v)/(
v+1));
407 static double p1[5] = {-0.8949374280E+0, 0.4631783434E+0,-0.4053332915E-1,
408 0.1580075560E-1,-0.3423874194E-2};
409 static double q1[5] = { 1.0 , 0.1002930749E+0, 0.3575271633E-1,
410 -0.1915882099E-2, 0.4811072364E-4};
411 static double p2[5] = {-0.8933384046E+0, 0.1161296496E+0, 0.1200082940E+0,
412 0.2185699725E-1, 0.2128892058E-2};
413 static double q2[5] = { 1.0 , 0.4935531886E+0, 0.1066347067E+0,
414 0.1250161833E-1, 0.5494243254E-3};
415 static double p3[5] = {-0.8933322067E+0, 0.2339544896E+0, 0.8257653222E-1,
416 0.1411226998E-1, 0.2892240953E-3};
417 static double q3[5] = { 1.0 , 0.3616538408E+0, 0.6628026743E-1,
418 0.4839298984E-2, 0.5248310361E-4};
419 static double p4[4] = { 0.9358419425E+0, 0.6716831438E+2,-0.6765069077E+3,
421 static double q4[4] = { 1.0 , 0.7752562854E+2,-0.5637811998E+3,
423 static double p5[4] = { 0.9489335583E+0, 0.5561246706E+3, 0.3208274617E+5,
425 static double q5[4] = { 1.0 , 0.6028275940E+3, 0.3716962017E+5,
427 static double a0[6] = {-0.4227843351E+0,-0.1544313298E+0, 0.4227843351E+0,
428 0.3276496874E+1, 0.2043403138E+1,-0.8681296500E+1};
429 static double a1[4] = { 0, -0.4583333333E+0, 0.6675347222E+0,
431 static double a2[5] = { 0, -0.1958333333E+1, 0.5563368056E+1,
432 -0.2111352961E+2, 0.1006946266E+3};
434 double v = (
x-x0)/xi;
438 double u = std::exp(
v+1);
471 double u =
v-
v*std::log(
v)/(
v+1);
472 v = 1/(
u-
u*(
u+ std::log(
u)-
v)/(
u+1));
487 static double p1[5] = { 0.1169837582E+1,-0.4834874539E+0, 0.4383774644E+0,
488 0.3287175228E-2, 0.1879129206E-1};
489 static double q1[5] = { 1.0 , 0.1795154326E+0, 0.4612795899E-1,
490 0.2183459337E-2, 0.7226623623E-4};
491 static double p2[5] = { 0.1157939823E+1,-0.3842809495E+0, 0.3317532899E+0,
492 0.3547606781E-1, 0.6725645279E-2};
493 static double q2[5] = { 1.0 , 0.2916824021E+0, 0.5259853480E-1,
494 0.3840011061E-2, 0.9950324173E-4};
495 static double p3[4] = { 0.1178191282E+1, 0.1011623342E+2,-0.1285585291E+2,
497 static double q3[4] = { 1.0 , 0.8614160194E+1, 0.3118929630E+2,
499 static double p4[5] = { 0.1030763698E+1, 0.1216758660E+3, 0.1637431386E+4,
500 -0.2171466507E+4, 0.7010168358E+4};
501 static double q4[5] = { 1.0 , 0.1022487911E+3, 0.1377646350E+4,
502 0.3699184961E+4, 0.4251315610E+4};
503 static double p5[4] = { 0.1010084827E+1, 0.3944224824E+3, 0.1773025353E+5,
505 static double q5[4] = { 1.0 , 0.3605950254E+3, 0.1392784158E+5,
507 static double a0[7] = {-0.2043403138E+1,-0.8455686702E+0,-0.3088626596E+0,
508 0.5821346754E+1, 0.4227843351E+0, 0.6552993748E+1,
510 static double a1[4] = { 0. ,-0.4583333333E+0, 0.6675347222E+0,
512 static double a2[4] = {-0.1958333333E+1, 0.5563368056E+1,-0.2111352961E+2,
514 static double a3[4] = {-1.0 , 0.4458333333E+1,-0.2116753472E+2,
517 double v = (
x-x0)/xi;
521 double u = std::exp(
v+1);
557 double u =
v-
v*std::log(
v)/(
v+1);
558 v = 1/(
u-
u*(
u+log(
u)-
v)/(
u+1));
563 if (x0 == 0)
return xm2lan*xi*xi;
#define MATH_ERROR_MSG(loc, str)
#define MATH_WARN_MSG(loc, str)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
double poisson_cdf(unsigned int n, double mu)
Cumulative distribution function of the Poisson distribution Lower tail of the integral of the poisso...
double crystalball_integral(double x, double alpha, double n, double sigma, double x0=0)
Integral of the not-normalized Crystal Ball function.
double uniform_cdf(double x, double a, double b, double x0=0)
Cumulative distribution function of the uniform (flat) distribution (lower tail).
double binomial_cdf_c(unsigned int k, double p, unsigned int n)
Complement of the cumulative distribution function of the Binomial distribution.
double lognormal_cdf(double x, double m, double s, double x0=0)
Cumulative distribution function of the lognormal distribution (lower tail).
double cauchy_cdf_c(double x, double b, double x0=0)
Complement of the cumulative distribution function (upper tail) of the Cauchy distribution which is a...
double fdistribution_cdf(double x, double n, double m, double x0=0)
Cumulative distribution function of the F-distribution (lower tail).
double binomial_cdf(unsigned int k, double p, unsigned int n)
Cumulative distribution function of the Binomial distribution Lower tail of the integral of the binom...
double landau_cdf(double x, double xi=1, double x0=0)
Cumulative distribution function of the Landau distribution (lower tail).
double lognormal_cdf_c(double x, double m, double s, double x0=0)
Complement of the cumulative distribution function of the lognormal distribution (upper tail).
double uniform_cdf_c(double x, double a, double b, double x0=0)
Complement of the cumulative distribution function of the uniform (flat) distribution (upper tail).
double fdistribution_cdf_c(double x, double n, double m, double x0=0)
Complement of the cumulative distribution function of the F-distribution (upper tail).
double crystalball_cdf_c(double x, double alpha, double n, double sigma, double x0=0)
Complement of the Cumulative distribution for the Crystal Ball distribution.
double normal_cdf_c(double x, double sigma=1, double x0=0)
Complement of the cumulative distribution function of the normal (Gaussian) distribution (upper tail)...
double chisquared_cdf(double x, double r, double x0=0)
Cumulative distribution function of the distribution with degrees of freedom (lower tail).
double negative_binomial_cdf_c(unsigned int k, double p, double n)
Complement of the cumulative distribution function of the Negative Binomial distribution.
double gamma_cdf_c(double x, double alpha, double theta, double x0=0)
Complement of the cumulative distribution function of the gamma distribution (upper tail).
double beta_cdf(double x, double a, double b)
Cumulative distribution function of the beta distribution Upper tail of the integral of the beta_pdf.
double crystalball_cdf(double x, double alpha, double n, double sigma, double x0=0)
Cumulative distribution for the Crystal Ball distribution function.
double negative_binomial_cdf(unsigned int k, double p, double n)
Cumulative distribution function of the Negative Binomial distribution Lower tail of the integral of ...
double breitwigner_cdf_c(double x, double gamma, double x0=0)
Complement of the cumulative distribution function (upper tail) of the Breit_Wigner distribution and ...
double normal_cdf(double x, double sigma=1, double x0=0)
Cumulative distribution function of the normal (Gaussian) distribution (lower tail).
double breitwigner_cdf(double x, double gamma, double x0=0)
Cumulative distribution function (lower tail) of the Breit_Wigner distribution and it is similar (jus...
double exponential_cdf_c(double x, double lambda, double x0=0)
Complement of the cumulative distribution function of the exponential distribution (upper tail).
double tdistribution_cdf(double x, double r, double x0=0)
Cumulative distribution function of Student's t-distribution (lower tail).
double beta_cdf_c(double x, double a, double b)
Complement of the cumulative distribution function of the beta distribution.
double poisson_cdf_c(unsigned int n, double mu)
Complement of the cumulative distribution function of the Poisson distribution.
double chisquared_cdf_c(double x, double r, double x0=0)
Complement of the cumulative distribution function of the distribution with degrees of freedom (upp...
double cauchy_cdf(double x, double b, double x0=0)
Cumulative distribution function (lower tail) of the Cauchy distribution which is also Lorentzian dis...
double tdistribution_cdf_c(double x, double r, double x0=0)
Complement of the cumulative distribution function of Student's t-distribution (upper tail).
double gamma_cdf(double x, double alpha, double theta, double x0=0)
Cumulative distribution function of the gamma distribution (lower tail).
double exponential_cdf(double x, double lambda, double x0=0)
Cumulative distribution function of the exponential distribution (lower tail).
double inc_gamma_c(double a, double x)
Calculates the normalized (regularized) upper incomplete gamma function (upper integral)
double inc_beta(double x, double a, double b)
Calculates the normalized (regularized) incomplete beta function.
double erfc(double x)
Complementary error function.
double inc_gamma(double a, double x)
Calculates the normalized (regularized) lower incomplete gamma function (lower integral)
double erf(double x)
Error function encountered in integrating the normal distribution.
double landau_xm1(double x, double xi=1, double x0=0)
First moment (mean) of the truncated Landau distribution.
double landau_xm2(double x, double xi=1, double x0=0)
Second moment of the truncated Landau distribution.
Namespace for new Math classes and functions.
double expm1(double x)
exp(x) -1 with error cancellation when x is small
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
static const double kSqrt2
double gaussian_cdf_c(double x, double sigma=1, double x0=0)
Alternative name for same function.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...