Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooFit::Detail::MathFuncs Namespace Reference

Functions

double approxErf (double arg)
 
template<typename DoubleArray >
double bernstein (double x, double xmin, double xmax, DoubleArray coefs, int nCoefs)
 The caller needs to make sure that there is at least one coefficient.
 
template<typename DoubleArray >
double bernsteinIntegral (double xlo, double xhi, double xmin, double xmax, DoubleArray coefs, int nCoefs)
 
double bifurGauss (double x, double mean, double sigmaL, double sigmaR)
 
double bifurGaussIntegral (double xMin, double xMax, double mean, double sigmaL, double sigmaR)
 
template<typename DoubleArray >
unsigned int binNumber (double x, double coef, DoubleArray boundaries, unsigned int nBoundaries, int nbins, int blo)
 
double binomial (int n, int k)
 Calculates the binomial coefficient n over k.
 
double cbShape (double m, double m0, double sigma, double alpha, double n)
 
double cbShapeIntegral (double mMin, double mMax, double m0, double sigma, double alpha, double n)
 
template<typename DoubleArray >
double chebychev (DoubleArray coeffs, unsigned int nCoeffs, double x_in, double xMin, double xMax)
 
template<typename DoubleArray >
double chebychevIntegral (DoubleArray coeffs, unsigned int nCoeffs, double xMin, double xMax, double xMinFull, double xMaxFull)
 
double chi2Asymmetric (double mu, double weight, double errLo, double errHi)
 Chi-squared contribution of one bin with asymmetric (Poisson-style) data errors.
 
double chi2Expected (double mu, double weight)
 Chi-squared contribution of one bin with "expected" errors: \( \sigma^2 = \mu \).
 
double chi2Symmetric (double mu, double weight, double sigma2)
 Chi-squared contribution of one bin with a user-supplied symmetric error squared (e.g.
 
double efficiency (double effFuncVal, int catIndex, int sigCatIndex)
 
double effProd (double eff, double pdf)
 
double expm1OverX (double x)
 (exp(x) - 1) / x with the removable singularity at x = 0 filled in.
 
double expm1OverXDerivative (double x)
 Derivative of expm1OverX().
 
double exponentialIntegral (double xMin, double xMax, double constant)
 Integral of exp(constant * x) from xMin to xMax.
 
double exponentialIntegralDConstant (double xMin, double xMax, double constant)
 Derivative of exponentialIntegral() with respect to the constant, i.e.
 
double fast_fma (double x, double y, double z) noexcept
 use fast FMA if available, fall back to normal arithmetic if not
 
template<typename ParamsArray , typename DoubleArray >
double flexibleInterp (unsigned int code, ParamsArray params, unsigned int n, DoubleArray low, DoubleArray high, double boundary, double nominal, int doCutoff)
 
double flexibleInterpSingle (unsigned int code, double low, double high, double boundary, double nominal, double paramVal, double res)
 
double gaussian (double x, double mean, double sigma)
 Function to evaluate an un-normalized Gaussian.
 
double gaussianIntegral (double xMin, double xMax, double mean, double sigma)
 Function to calculate the integral of an un-normalized RooGaussian over x.
 
template<typename DoubleArray >
double interpolate1d (double low, double high, double val, unsigned int numBins, DoubleArray vals)
 
double landau (double x, double mu, double sigma)
 
double logGaussian (double x, double mean, double sigma)
 Evaluate the logarithm of an un-normalized Gaussian.
 
double logNormal (double x, double k, double m0)
 
double logNormalIntegral (double xMin, double xMax, double m0, double k)
 
double logNormalIntegralStandard (double xMin, double xMax, double mu, double sigma)
 
double logNormalStandard (double x, double sigma, double mu)
 
template<typename DoubleArray >
double multipdf (int idx, DoubleArray pdfs)
 
template<typename XArray , typename MuArray , typename CovArray >
double multiVarGaussian (int n, XArray x, MuArray mu, CovArray covI)
 
double nll (double pdf, double weight, int doBinOffset)
 The negative log-likelihood of one bin in a binned fit.
 
double poisson (double x, double par)
 
double poissonIntegral (int code, double mu, double x, double integrandMin, double integrandMax, unsigned int protectNegative)
 
template<bool pdfMode = false, typename DoubleArray >
double polynomial (DoubleArray coeffs, int nCoeffs, int lowestOrder, double x)
 In pdfMode, a coefficient for the constant term of 1.0 is implied if lowestOrder > 0.
 
template<bool pdfMode = false, typename DoubleArray >
double polynomialIntegral (DoubleArray coeffs, int nCoeffs, int lowestOrder, double xMin, double xMax)
 In pdfMode, a coefficient for the constant term of 1.0 is implied if lowestOrder > 0.
 
template<typename DoubleArray >
double product (DoubleArray factors, std::size_t nFactors)
 
double ratio (double numerator, double denominator)
 
template<typename DoubleArray >
unsigned int rawBinNumber (double x, DoubleArray boundaries, std::size_t nBoundaries)
 
template<typename DoubleArray >
double recursiveFraction (DoubleArray a, unsigned int n)
 
template<typename DoubleArray >
double stepFunctionIntegral (double xmin, double xmax, std::size_t nBins, DoubleArray boundaries, DoubleArray coefs)
 
unsigned int uniformBinNumber (double low, double high, double val, unsigned int numBins, double coef)
 

Function Documentation

◆ approxErf()

double RooFit::Detail::MathFuncs::approxErf ( double arg)
inline

Definition at line 490 of file MathFuncs.h.

◆ bernstein()

template<typename DoubleArray >
double RooFit::Detail::MathFuncs::bernstein ( double x,
double xmin,
double xmax,
DoubleArray coefs,
int nCoefs )

The caller needs to make sure that there is at least one coefficient.

Definition at line 50 of file MathFuncs.h.

◆ bernsteinIntegral()

template<typename DoubleArray >
double RooFit::Detail::MathFuncs::bernsteinIntegral ( double xlo,
double xhi,
double xmin,
double xmax,
DoubleArray coefs,
int nCoefs )

Definition at line 851 of file MathFuncs.h.

◆ bifurGauss()

double RooFit::Detail::MathFuncs::bifurGauss ( double x,
double mean,
double sigmaL,
double sigmaR )
inline

Definition at line 117 of file MathFuncs.h.

◆ bifurGaussIntegral()

double RooFit::Detail::MathFuncs::bifurGaussIntegral ( double xMin,
double xMax,
double mean,
double sigmaL,
double sigmaR )
inline

Definition at line 542 of file MathFuncs.h.

◆ binNumber()

template<typename DoubleArray >
unsigned int RooFit::Detail::MathFuncs::binNumber ( double x,
double coef,
DoubleArray boundaries,
unsigned int nBoundaries,
int nbins,
int blo )

Definition at line 205 of file MathFuncs.h.

◆ binomial()

double RooFit::Detail::MathFuncs::binomial ( int n,
int k )
inline

Calculates the binomial coefficient n over k.

Equivalent to TMath::Binomial, but inlined.

Definition at line 32 of file MathFuncs.h.

◆ cbShape()

double RooFit::Detail::MathFuncs::cbShape ( double m,
double m0,
double sigma,
double alpha,
double n )
inline

Definition at line 470 of file MathFuncs.h.

◆ cbShapeIntegral()

double RooFit::Detail::MathFuncs::cbShapeIntegral ( double mMin,
double mMax,
double m0,
double sigma,
double alpha,
double n )
inline

Definition at line 786 of file MathFuncs.h.

◆ chebychev()

template<typename DoubleArray >
double RooFit::Detail::MathFuncs::chebychev ( DoubleArray coeffs,
unsigned int nCoeffs,
double x_in,
double xMin,
double xMax )

Definition at line 151 of file MathFuncs.h.

◆ chebychevIntegral()

template<typename DoubleArray >
double RooFit::Detail::MathFuncs::chebychevIntegral ( DoubleArray coeffs,
unsigned int nCoeffs,
double xMin,
double xMax,
double xMinFull,
double xMaxFull )

Definition at line 652 of file MathFuncs.h.

◆ chi2Asymmetric()

double RooFit::Detail::MathFuncs::chi2Asymmetric ( double mu,
double weight,
double errLo,
double errHi )
inline

Chi-squared contribution of one bin with asymmetric (Poisson-style) data errors.

The side facing the prediction is used: errHi when \( \mu > \mathrm{weight} \), otherwise errLo.

Definition at line 429 of file MathFuncs.h.

◆ chi2Expected()

double RooFit::Detail::MathFuncs::chi2Expected ( double mu,
double weight )
inline

Chi-squared contribution of one bin with "expected" errors: \( \sigma^2 = \mu \).

Empty/no-prediction bins contribute zero; bins with non-positive \( \mu \) but non-empty data yield NaN (to let the minimizer recover).

Definition at line 400 of file MathFuncs.h.

◆ chi2Symmetric()

double RooFit::Detail::MathFuncs::chi2Symmetric ( double mu,
double weight,
double sigma2 )
inline

Chi-squared contribution of one bin with a user-supplied symmetric error squared (e.g.

SumW2 weights from the data).

Definition at line 414 of file MathFuncs.h.

◆ efficiency()

double RooFit::Detail::MathFuncs::efficiency ( double effFuncVal,
int catIndex,
int sigCatIndex )
inline

Definition at line 126 of file MathFuncs.h.

◆ effProd()

double RooFit::Detail::MathFuncs::effProd ( double eff,
double pdf )
inline

Definition at line 391 of file MathFuncs.h.

◆ expm1OverX()

double RooFit::Detail::MathFuncs::expm1OverX ( double x)
inline

(exp(x) - 1) / x with the removable singularity at x = 0 filled in.

The derivative is expm1OverXDerivative(), also registered with clad at the end of this header: differentiating the branches would give zero at x = 0.

Definition at line 561 of file MathFuncs.h.

◆ expm1OverXDerivative()

double RooFit::Detail::MathFuncs::expm1OverXDerivative ( double x)
inline

Derivative of expm1OverX().

The closed form (x * exp(x) - expm1(x)) / x^2 cancels for small x, so a Taylor expansion is used there. Both branches are accurate to about 1e-15 at the switching point.

Definition at line 569 of file MathFuncs.h.

◆ exponentialIntegral()

double RooFit::Detail::MathFuncs::exponentialIntegral ( double xMin,
double xMax,
double constant )
inline

Integral of exp(constant * x) from xMin to xMax.

The naive form (exp(constant * xMax) - exp(constant * xMin)) / constant cancels when constant * (xMax - xMin) is small. Factoring out the larger exponential and using std::expm1 for the rest is accurate for any constant and only overflows if the integral itself does. The derivative with respect to the constant is exponentialIntegralDConstant(), also registered with clad at the end of this header (https://github.com/root-project/root/issues/23724).

Definition at line 588 of file MathFuncs.h.

◆ exponentialIntegralDConstant()

double RooFit::Detail::MathFuncs::exponentialIntegralDConstant ( double xMin,
double xMax,
double constant )
inline

Derivative of exponentialIntegral() with respect to the constant, i.e.

the integral of x * exp(constant * x). With a the endpoint where constant * x is larger and d the signed distance to the other one, substituting x = a + s gives exp(constant * a) * d * (a * expm1OverX(w) + d * expm1OverXDerivative(w)) with w = constant * d <= 0, so the helpers only see bounded arguments.

Definition at line 606 of file MathFuncs.h.

◆ fast_fma()

double RooFit::Detail::MathFuncs::fast_fma ( double x,
double y,
double z )
inlinenoexcept

use fast FMA if available, fall back to normal arithmetic if not

Definition at line 637 of file MathFuncs.h.

◆ flexibleInterp()

template<typename ParamsArray , typename DoubleArray >
double RooFit::Detail::MathFuncs::flexibleInterp ( unsigned int code,
ParamsArray params,
unsigned int n,
DoubleArray low,
DoubleArray high,
double boundary,
double nominal,
int doCutoff )

Definition at line 363 of file MathFuncs.h.

◆ flexibleInterpSingle()

double RooFit::Detail::MathFuncs::flexibleInterpSingle ( unsigned int code,
double low,
double high,
double boundary,
double nominal,
double paramVal,
double res )
inline

Definition at line 248 of file MathFuncs.h.

◆ gaussian()

double RooFit::Detail::MathFuncs::gaussian ( double x,
double mean,
double sigma )
inline

Function to evaluate an un-normalized Gaussian.

Definition at line 96 of file MathFuncs.h.

◆ gaussianIntegral()

double RooFit::Detail::MathFuncs::gaussianIntegral ( double xMin,
double xMax,
double mean,
double sigma )
inline

Function to calculate the integral of an un-normalized RooGaussian over x.

To calculate the integral over mean, just interchange the respective values of x and mean.

Parameters
xMinMinimum value of variable to integrate wrt.
xMaxMaximum value of of variable to integrate wrt.
meanMean.
sigmaSigma.
Returns
The integral of an un-normalized RooGaussian over the value in x.

Definition at line 507 of file MathFuncs.h.

◆ interpolate1d()

template<typename DoubleArray >
double RooFit::Detail::MathFuncs::interpolate1d ( double low,
double high,
double val,
unsigned int numBins,
DoubleArray vals )

Definition at line 213 of file MathFuncs.h.

◆ landau()

double RooFit::Detail::MathFuncs::landau ( double x,
double mu,
double sigma )
inline

Definition at line 374 of file MathFuncs.h.

◆ logGaussian()

double RooFit::Detail::MathFuncs::logGaussian ( double x,
double mean,
double sigma )
inline

Evaluate the logarithm of an un-normalized Gaussian.

Definition at line 88 of file MathFuncs.h.

◆ logNormal()

double RooFit::Detail::MathFuncs::logNormal ( double x,
double k,
double m0 )
inline

Definition at line 381 of file MathFuncs.h.

◆ logNormalIntegral()

double RooFit::Detail::MathFuncs::logNormalIntegral ( double xMin,
double xMax,
double m0,
double k )
inline

Definition at line 765 of file MathFuncs.h.

◆ logNormalIntegralStandard()

double RooFit::Detail::MathFuncs::logNormalIntegralStandard ( double xMin,
double xMax,
double mu,
double sigma )
inline

Definition at line 775 of file MathFuncs.h.

◆ logNormalStandard()

double RooFit::Detail::MathFuncs::logNormalStandard ( double x,
double sigma,
double mu )
inline

Definition at line 386 of file MathFuncs.h.

◆ multipdf()

template<typename DoubleArray >
double RooFit::Detail::MathFuncs::multipdf ( int idx,
DoubleArray pdfs )

Definition at line 176 of file MathFuncs.h.

◆ multiVarGaussian()

template<typename XArray , typename MuArray , typename CovArray >
double RooFit::Detail::MathFuncs::multiVarGaussian ( int n,
XArray x,
MuArray mu,
CovArray covI )

Definition at line 878 of file MathFuncs.h.

◆ nll()

double RooFit::Detail::MathFuncs::nll ( double pdf,
double weight,
int doBinOffset )
inline

The negative log-likelihood of one bin in a binned fit.

Definition at line 444 of file MathFuncs.h.

◆ poisson()

double RooFit::Detail::MathFuncs::poisson ( double x,
double par )
inline

Definition at line 233 of file MathFuncs.h.

◆ poissonIntegral()

double RooFit::Detail::MathFuncs::poissonIntegral ( int code,
double mu,
double x,
double integrandMin,
double integrandMax,
unsigned int protectNegative )
inline

Definition at line 718 of file MathFuncs.h.

◆ polynomial()

template<bool pdfMode = false, typename DoubleArray >
double RooFit::Detail::MathFuncs::polynomial ( DoubleArray coeffs,
int nCoeffs,
int lowestOrder,
double x )

In pdfMode, a coefficient for the constant term of 1.0 is implied if lowestOrder > 0.

Definition at line 140 of file MathFuncs.h.

◆ polynomialIntegral()

template<bool pdfMode = false, typename DoubleArray >
double RooFit::Detail::MathFuncs::polynomialIntegral ( DoubleArray coeffs,
int nCoeffs,
int lowestOrder,
double xMin,
double xMax )

In pdfMode, a coefficient for the constant term of 1.0 is implied if lowestOrder > 0.

Definition at line 618 of file MathFuncs.h.

◆ product()

template<typename DoubleArray >
double RooFit::Detail::MathFuncs::product ( DoubleArray factors,
std::size_t nFactors )

Definition at line 102 of file MathFuncs.h.

◆ ratio()

double RooFit::Detail::MathFuncs::ratio ( double numerator,
double denominator )
inline

Definition at line 112 of file MathFuncs.h.

◆ rawBinNumber()

template<typename DoubleArray >
unsigned int RooFit::Detail::MathFuncs::rawBinNumber ( double x,
DoubleArray boundaries,
std::size_t nBoundaries )

Definition at line 193 of file MathFuncs.h.

◆ recursiveFraction()

template<typename DoubleArray >
double RooFit::Detail::MathFuncs::recursiveFraction ( DoubleArray a,
unsigned int n )

Definition at line 459 of file MathFuncs.h.

◆ stepFunctionIntegral()

template<typename DoubleArray >
double RooFit::Detail::MathFuncs::stepFunctionIntegral ( double xmin,
double xmax,
std::size_t nBins,
DoubleArray boundaries,
DoubleArray coefs )

Definition at line 895 of file MathFuncs.h.

◆ uniformBinNumber()

unsigned int RooFit::Detail::MathFuncs::uniformBinNumber ( double low,
double high,
double val,
unsigned int numBins,
double coef )
inline

Definition at line 186 of file MathFuncs.h.