Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
ROOT::Math::VavilovAccurate Class Reference

Class describing a Vavilov distribution.

The probability density function of the Vavilov distribution as function of Landau's parameter is given by:

p(λL;κ,β2)=12πicic+iϕ(s)eλLsds

where ϕ(s)=eCeψ(s) with C=κ(1+β2γ) and ψ(s)=slnκ+(s+β2κ)(011estκtdtγ)κesκ. γ=0.5772156649 is Euler's constant.

For the class VavilovAccurate, Pdf returns the Vavilov distribution as function of Landau's parameter λL=λV/κlnκ, which is the convention used in the CERNLIB routines, and in the tables by S.M. Seltzer and M.J. Berger: Energy loss stragglin of protons and mesons: Tabulation of the Vavilov distribution, pp 187-203 in: National Research Council (U.S.), Committee on Nuclear Science: Studies in penetration of charged particles in matter, Nat. Akad. Sci. Publication 1133, Nucl. Sci. Series Report No. 39, Washington (Nat. Akad. Sci.) 1964, 388 pp. Available from Google books

Therefore, for small values of κ<0.01, pdf approaches the Landau distribution.

For values κ>10, the Gauss approximation should be used with μ and σ given by Vavilov::mean(kappa, beta2) and sqrt(Vavilov::variance(kappa, beta2).

The original Vavilov pdf is obtained by v.Pdf(lambdaV/kappa-log(kappa))/kappa.

For detailed description see B. Schorr, Programs for the Landau and the Vavilov distributions and the corresponding random numbers, Computer Phys. Comm. 7 (1974) 215-224, which has been implemented in CERNLIB (G116).

The class stores coefficients needed to calculate p(λ;κ,β2) for fixed values of κ and β2. Changing these values is computationally expensive.

The parameter κ should be in the range 0.01κ10. In contrast to the CERNLIB implementation, all values of κ0.001 may be used, but may result in slower running and/or inaccurate results.

The parameter β2 must be in the range 0β21.

Two parameters which are fixed in the CERNLIB implementation may be set by the user:

  • epsilonPM corresponds to ϵ+=ϵ in Eqs. (2.1) and (2.2) of Schorr's paper. epsilonPM gives an estimate on the integral of the cumulative distribution function outside the range λminλλmax where the approximation is valid. Thus, it determines the support of the approximation used here (called $T_0 - T_1$ in the paper). Schorr recommends ϵ+=ϵ=5104. The code from CERNLIB has been extended such that also smaller values are possible.
  • epsilon corresponds to ϵ in Eq. (4.10) of Schorr's paper. It determines the accuracy of the series expansion. Schorr recommends ϵ=105.

For the quantile calculation, the algorithm given by Schorr is not used, because it turns out to be very slow and still inaccurate. Instead, an initial estimate is calculated based on a pre-calculated table, which is subsequently improved by Newton iterations.

While the CERNLIB implementation calculates at most 156 terms in the series expansion for the pdf and cdf calculation, this class calculates up to 500 terms, depending on the values of epsilonPM and epsilon.

Average times on a Pentium Core2 Duo P8400 2.26GHz:

  • 38us per call to SetKappaBeta2 or constructor
  • 0.49us per call to Pdf, Cdf
  • 8.2us per first call to Quantile after SetKappaBeta2 or constructor
  • 0.83us per subsequent call to Quantile

Benno List, June 2010

Definition at line 131 of file VavilovAccurate.h.

Public Member Functions

 VavilovAccurate (double kappa=1, double beta2=1, double epsilonPM=5E-4, double epsilon=1E-5)
 Initialize an object to calculate the Vavilov distribution.
 
 ~VavilovAccurate () override
 Destructor.
 
double Cdf (double x) const override
 Evaluate the Vavilov cumulative probability density function.
 
double Cdf (double x, double kappa, double beta2) override
 Evaluate the Vavilov cumulative probability density function, and set kappa and beta2, if necessary.
 
double Cdf_c (double x) const override
 Evaluate the Vavilov complementary cumulative probability density function.
 
double Cdf_c (double x, double kappa, double beta2) override
 Evaluate the Vavilov complementary cumulative probability density function, and set kappa and beta2, if necessary.
 
double GetBeta2 () const override
 Return the current value of β2.
 
double GetEpsilon () const
 Return the current value of ϵ.
 
double GetEpsilonPM () const
 Return the current value of ϵ+=ϵ.
 
double GetKappa () const override
 Return the current value of κ.
 
double GetLambdaMax () const override
 Return the maximum value of λ for which p(λ;κ,β2) is nonzero in the current approximation.
 
double GetLambdaMin () const override
 Return the minimum value of λ for which p(λ;κ,β2) is nonzero in the current approximation.
 
double GetNTerms () const
 Return the number of terms used in the series expansion.
 
double Mode () const override
 Return the value of λ where the pdf is maximal.
 
double Mode (double kappa, double beta2) override
 Return the value of λ where the pdf is maximal function, and set kappa and beta2, if necessary.
 
double Pdf (double x) const override
 Evaluate the Vavilov probability density function.
 
double Pdf (double x, double kappa, double beta2) override
 Evaluate the Vavilov probability density function, and set kappa and beta2, if necessary.
 
double Quantile (double z) const override
 Evaluate the inverse of the Vavilov cumulative probability density function.
 
double Quantile (double z, double kappa, double beta2) override
 Evaluate the inverse of the Vavilov cumulative probability density function, and set kappa and beta2, if necessary.
 
double Quantile_c (double z) const override
 Evaluate the inverse of the complementary Vavilov cumulative probability density function.
 
double Quantile_c (double z, double kappa, double beta2) override
 Evaluate the inverse of the complementary Vavilov cumulative probability density function, and set kappa and beta2, if necessary.
 
void Set (double kappa, double beta2, double epsilonPM=5E-4, double epsilon=1E-5)
 (Re)Initialize the object
 
void SetKappaBeta2 (double kappa, double beta2) override
 Change κ and β2 and recalculate coefficients if necessary.
 
- Public Member Functions inherited from ROOT::Math::Vavilov
 Vavilov ()
 Default constructor.
 
virtual ~Vavilov ()
 Destructor.
 
virtual double Kurtosis () const
 Return the theoretical kurtosis γ2=1/3β2/4κ3σ4.
 
virtual double Mean () const
 Return the theoretical mean μ=γ1lnκβ2, where γ=0.5772 is Euler's constant.
 
virtual double Skewness () const
 Return the theoretical skewness γ1=1/2β2/3κ2σ3.
 
virtual double Variance () const
 Return the theoretical variance σ2=1β2/2κ.
 

Static Public Member Functions

static VavilovAccurateGetInstance ()
 Returns a static instance of class VavilovFast.
 
static VavilovAccurateGetInstance (double kappa, double beta2)
 Returns a static instance of class VavilovFast, and sets the values of kappa and beta2.
 
- Static Public Member Functions inherited from ROOT::Math::Vavilov
static double Kurtosis (double kappa, double beta2)
 Return the theoretical kurtosis γ2=1/3β2/4κ3σ4.
 
static double Mean (double kappa, double beta2)
 Return the theoretical Mean μ=γ1lnκβ2.
 
static double Skewness (double kappa, double beta2)
 Return the theoretical skewness γ1=1/2β2/3κ2σ3.
 
static double Variance (double kappa, double beta2)
 Return the theoretical Variance σ2=1β2/2κ.
 

Private Member Functions

double G116f1 (double x) const
 
double G116f2 (double x) const
 
void InitQuantile () const
 
int Rzero (double a, double b, double &x0, double eps, int mxf, double(VavilovAccurate::*f)(double) const) const
 

Static Private Member Functions

static double E1plLog (double x)
 

Private Attributes

double fA_cdf [MAXTERMS+1]
 
double fA_pdf [MAXTERMS+1]
 
double fB_cdf [MAXTERMS+1]
 
double fB_pdf [MAXTERMS+1]
 
double fBeta2
 
double fEpsilon
 
double fEpsilonPM
 
double fH [8]
 
double fKappa
 
double fLambda [kNquantMax]
 
int fNQuant
 
double fOmega
 
double fQuant [kNquantMax]
 
bool fQuantileInit
 
double fT
 
double fT0
 
double fT1
 
double fX0
 

Static Private Attributes

static VavilovAccuratefgInstance = nullptr
 
static constexpr int kNquantMax {32}
 
static constexpr int MAXTERMS {500}
 

#include <Math/VavilovAccurate.h>

Inheritance diagram for ROOT::Math::VavilovAccurate:
[legend]

Constructor & Destructor Documentation

◆ VavilovAccurate()

ROOT::Math::VavilovAccurate::VavilovAccurate ( double kappa = 1,
double beta2 = 1,
double epsilonPM = 5E-4,
double epsilon = 1E-5 )

Initialize an object to calculate the Vavilov distribution.

Parameters
kappaThe parameter κ, which must be in the range κ0.001
beta2The parameter β2, which must be in the range 0β21
epsilonPMϵ+=ϵ in Eqs. (2.1) and (2.2) of Schorr's paper; gives an estimate on the integral of the cumulative distribution function outside the range λminλλmax where the approximation is valid.
epsilonϵ in Eq. (4.10) of Schorr's paper; determines the accuracy of the series expansion.

Definition at line 51 of file VavilovAccurate.cxx.

◆ ~VavilovAccurate()

ROOT::Math::VavilovAccurate::~VavilovAccurate ( )
override

Destructor.

Definition at line 57 of file VavilovAccurate.cxx.

Member Function Documentation

◆ Cdf() [1/2]

double ROOT::Math::VavilovAccurate::Cdf ( double x) const
overridevirtual

Evaluate the Vavilov cumulative probability density function.

Parameters
xThe Landau parameter x=λL

Implements ROOT::Math::Vavilov.

Definition at line 256 of file VavilovAccurate.cxx.

◆ Cdf() [2/2]

double ROOT::Math::VavilovAccurate::Cdf ( double x,
double kappa,
double beta2 )
overridevirtual

Evaluate the Vavilov cumulative probability density function, and set kappa and beta2, if necessary.

Parameters
xThe Landau parameter x=λL
kappaThe parameter κ, which must be in the range κ0.001
beta2The parameter β2, which must be in the range 0β21

Implements ROOT::Math::Vavilov.

Definition at line 291 of file VavilovAccurate.cxx.

◆ Cdf_c() [1/2]

double ROOT::Math::VavilovAccurate::Cdf_c ( double x) const
overridevirtual

Evaluate the Vavilov complementary cumulative probability density function.

Parameters
xThe Landau parameter x=λL

Implements ROOT::Math::Vavilov.

Definition at line 296 of file VavilovAccurate.cxx.

◆ Cdf_c() [2/2]

double ROOT::Math::VavilovAccurate::Cdf_c ( double x,
double kappa,
double beta2 )
overridevirtual

Evaluate the Vavilov complementary cumulative probability density function, and set kappa and beta2, if necessary.

Parameters
xThe Landau parameter x=λL
kappaThe parameter κ, which must be in the range κ0.001
beta2The parameter β2, which must be in the range 0β21

Implements ROOT::Math::Vavilov.

Definition at line 331 of file VavilovAccurate.cxx.

◆ E1plLog()

double ROOT::Math::VavilovAccurate::E1plLog ( double x)
staticprivate

Definition at line 644 of file VavilovAccurate.cxx.

◆ G116f1()

double ROOT::Math::VavilovAccurate::G116f1 ( double x) const
private

Definition at line 486 of file VavilovAccurate.cxx.

◆ G116f2()

double ROOT::Math::VavilovAccurate::G116f2 ( double x) const
private

Definition at line 495 of file VavilovAccurate.cxx.

◆ GetBeta2()

double ROOT::Math::VavilovAccurate::GetBeta2 ( ) const
overridevirtual

Return the current value of β2.

Implements ROOT::Math::Vavilov.

Definition at line 671 of file VavilovAccurate.cxx.

◆ GetEpsilon()

double ROOT::Math::VavilovAccurate::GetEpsilon ( ) const

Return the current value of ϵ.

Definition at line 703 of file VavilovAccurate.cxx.

◆ GetEpsilonPM()

double ROOT::Math::VavilovAccurate::GetEpsilonPM ( ) const

Return the current value of ϵ+=ϵ.

Definition at line 699 of file VavilovAccurate.cxx.

◆ GetInstance() [1/2]

VavilovAccurate * ROOT::Math::VavilovAccurate::GetInstance ( )
static

Returns a static instance of class VavilovFast.

Definition at line 450 of file VavilovAccurate.cxx.

◆ GetInstance() [2/2]

VavilovAccurate * ROOT::Math::VavilovAccurate::GetInstance ( double kappa,
double beta2 )
static

Returns a static instance of class VavilovFast, and sets the values of kappa and beta2.

Parameters
kappaThe parameter κ, which must be in the range κ0.001
beta2The parameter β2, which must be in the range 0β21

Definition at line 455 of file VavilovAccurate.cxx.

◆ GetKappa()

double ROOT::Math::VavilovAccurate::GetKappa ( ) const
overridevirtual

Return the current value of κ.

Implements ROOT::Math::Vavilov.

Definition at line 667 of file VavilovAccurate.cxx.

◆ GetLambdaMax()

double ROOT::Math::VavilovAccurate::GetLambdaMax ( ) const
overridevirtual

Return the maximum value of λ for which p(λ;κ,β2) is nonzero in the current approximation.

Implements ROOT::Math::Vavilov.

Definition at line 663 of file VavilovAccurate.cxx.

◆ GetLambdaMin()

double ROOT::Math::VavilovAccurate::GetLambdaMin ( ) const
overridevirtual

Return the minimum value of λ for which p(λ;κ,β2) is nonzero in the current approximation.

Implements ROOT::Math::Vavilov.

Definition at line 659 of file VavilovAccurate.cxx.

◆ GetNTerms()

double ROOT::Math::VavilovAccurate::GetNTerms ( ) const

Return the number of terms used in the series expansion.

Definition at line 707 of file VavilovAccurate.cxx.

◆ InitQuantile()

void ROOT::Math::VavilovAccurate::InitQuantile ( ) const
private

Definition at line 185 of file VavilovAccurate.cxx.

◆ Mode() [1/2]

double ROOT::Math::VavilovAccurate::Mode ( ) const
overridevirtual

Return the value of λ where the pdf is maximal.

Reimplemented from ROOT::Math::Vavilov.

Definition at line 675 of file VavilovAccurate.cxx.

◆ Mode() [2/2]

double ROOT::Math::VavilovAccurate::Mode ( double kappa,
double beta2 )
overridevirtual

Return the value of λ where the pdf is maximal function, and set kappa and beta2, if necessary.

Parameters
kappaThe parameter κ, which must be in the range κ0.001
beta2The parameter β2, which must be in the range 0β21

Reimplemented from ROOT::Math::Vavilov.

Definition at line 694 of file VavilovAccurate.cxx.

◆ Pdf() [1/2]

double ROOT::Math::VavilovAccurate::Pdf ( double x) const
overridevirtual

Evaluate the Vavilov probability density function.

Parameters
xThe Landau parameter x=λL

Implements ROOT::Math::Vavilov.

Definition at line 217 of file VavilovAccurate.cxx.

◆ Pdf() [2/2]

double ROOT::Math::VavilovAccurate::Pdf ( double x,
double kappa,
double beta2 )
overridevirtual

Evaluate the Vavilov probability density function, and set kappa and beta2, if necessary.

Parameters
xThe Landau parameter x=λL
kappaThe parameter κ, which must be in the range κ0.001
beta2The parameter β2, which must be in the range 0β21

Implements ROOT::Math::Vavilov.

Definition at line 251 of file VavilovAccurate.cxx.

◆ Quantile() [1/2]

double ROOT::Math::VavilovAccurate::Quantile ( double z) const
overridevirtual

Evaluate the inverse of the Vavilov cumulative probability density function.

Parameters
zThe argument z, which must be in the range 0z1

Implements ROOT::Math::Vavilov.

Definition at line 336 of file VavilovAccurate.cxx.

◆ Quantile() [2/2]

double ROOT::Math::VavilovAccurate::Quantile ( double z,
double kappa,
double beta2 )
overridevirtual

Evaluate the inverse of the Vavilov cumulative probability density function, and set kappa and beta2, if necessary.

Parameters
zThe argument z, which must be in the range 0z1
kappaThe parameter κ, which must be in the range κ0.001
beta2The parameter β2, which must be in the range 0β21

Implements ROOT::Math::Vavilov.

Definition at line 383 of file VavilovAccurate.cxx.

◆ Quantile_c() [1/2]

double ROOT::Math::VavilovAccurate::Quantile_c ( double z) const
overridevirtual

Evaluate the inverse of the complementary Vavilov cumulative probability density function.

Parameters
zThe argument z, which must be in the range 0z1

Implements ROOT::Math::Vavilov.

Definition at line 388 of file VavilovAccurate.cxx.

◆ Quantile_c() [2/2]

double ROOT::Math::VavilovAccurate::Quantile_c ( double z,
double kappa,
double beta2 )
overridevirtual

Evaluate the inverse of the complementary Vavilov cumulative probability density function, and set kappa and beta2, if necessary.

Parameters
zThe argument z, which must be in the range 0z1
kappaThe parameter κ, which must be in the range κ0.001
beta2The parameter β2, which must be in the range 0β21

Implements ROOT::Math::Vavilov.

Definition at line 445 of file VavilovAccurate.cxx.

◆ Rzero()

int ROOT::Math::VavilovAccurate::Rzero ( double a,
double b,
double & x0,
double eps,
int mxf,
double(VavilovAccurate::*)(double) const f ) const
private

Definition at line 504 of file VavilovAccurate.cxx.

◆ Set()

void ROOT::Math::VavilovAccurate::Set ( double kappa,
double beta2,
double epsilonPM = 5E-4,
double epsilon = 1E-5 )

(Re)Initialize the object

Parameters
kappaThe parameter κ, which must be in the range κ0.001
beta2The parameter β2, which must be in the range 0β21
epsilonPMϵ+=ϵ in Eqs. (2.1) and (2.2) of Schorr's paper; gives an estimate on the integral of the cumulative distribution function outside the range λminλλmax where the approximation is valid.
epsilonϵ in Eq. (4.10) of Schorr's paper; determines the accuracy of the series expansion.

Definition at line 66 of file VavilovAccurate.cxx.

◆ SetKappaBeta2()

void ROOT::Math::VavilovAccurate::SetKappaBeta2 ( double kappa,
double beta2 )
overridevirtual

Change κ and β2 and recalculate coefficients if necessary.

Parameters
kappaThe parameter κ, which must be in the range κ0.001
beta2The parameter β2, which must be in the range 0β21

Implements ROOT::Math::Vavilov.

Definition at line 62 of file VavilovAccurate.cxx.

Member Data Documentation

◆ fA_cdf

double ROOT::Math::VavilovAccurate::fA_cdf[MAXTERMS+1]
private

Definition at line 333 of file VavilovAccurate.h.

◆ fA_pdf

double ROOT::Math::VavilovAccurate::fA_pdf[MAXTERMS+1]
private

Definition at line 333 of file VavilovAccurate.h.

◆ fB_cdf

double ROOT::Math::VavilovAccurate::fB_cdf[MAXTERMS+1]
private

Definition at line 333 of file VavilovAccurate.h.

◆ fB_pdf

double ROOT::Math::VavilovAccurate::fB_pdf[MAXTERMS+1]
private

Definition at line 333 of file VavilovAccurate.h.

◆ fBeta2

double ROOT::Math::VavilovAccurate::fBeta2
private

Definition at line 334 of file VavilovAccurate.h.

◆ fEpsilon

double ROOT::Math::VavilovAccurate::fEpsilon
private

Definition at line 335 of file VavilovAccurate.h.

◆ fEpsilonPM

double ROOT::Math::VavilovAccurate::fEpsilonPM
private

Definition at line 335 of file VavilovAccurate.h.

◆ fgInstance

VavilovAccurate * ROOT::Math::VavilovAccurate::fgInstance = nullptr
staticprivate

Definition at line 345 of file VavilovAccurate.h.

◆ fH

double ROOT::Math::VavilovAccurate::fH[8]
private

Definition at line 333 of file VavilovAccurate.h.

◆ fKappa

double ROOT::Math::VavilovAccurate::fKappa
private

Definition at line 334 of file VavilovAccurate.h.

◆ fLambda

double ROOT::Math::VavilovAccurate::fLambda[kNquantMax]
mutableprivate

Definition at line 341 of file VavilovAccurate.h.

◆ fNQuant

int ROOT::Math::VavilovAccurate::fNQuant
mutableprivate

Definition at line 338 of file VavilovAccurate.h.

◆ fOmega

double ROOT::Math::VavilovAccurate::fOmega
private

Definition at line 333 of file VavilovAccurate.h.

◆ fQuant

double ROOT::Math::VavilovAccurate::fQuant[kNquantMax]
mutableprivate

Definition at line 340 of file VavilovAccurate.h.

◆ fQuantileInit

bool ROOT::Math::VavilovAccurate::fQuantileInit
mutableprivate

Definition at line 337 of file VavilovAccurate.h.

◆ fT

double ROOT::Math::VavilovAccurate::fT
private

Definition at line 333 of file VavilovAccurate.h.

◆ fT0

double ROOT::Math::VavilovAccurate::fT0
private

Definition at line 333 of file VavilovAccurate.h.

◆ fT1

double ROOT::Math::VavilovAccurate::fT1
private

Definition at line 333 of file VavilovAccurate.h.

◆ fX0

double ROOT::Math::VavilovAccurate::fX0
private

Definition at line 333 of file VavilovAccurate.h.

◆ kNquantMax

constexpr int ROOT::Math::VavilovAccurate::kNquantMax {32}
staticconstexprprivate

Definition at line 339 of file VavilovAccurate.h.

◆ MAXTERMS

constexpr int ROOT::Math::VavilovAccurate::MAXTERMS {500}
staticconstexprprivate

Definition at line 332 of file VavilovAccurate.h.

Libraries for ROOT::Math::VavilovAccurate:

The documentation for this class was generated from the following files: