Landau functions in MathCore

Dear ROOTers,

I would like to complete the implementation of the CERNLIB routines for the Landau distribution (G110, … 0/top.html) in the MathCore library.

I propose to:

  • add a function
    double landau_quantile(double z, double sigma = 1, double x0 = 0)
    to QuantFuncMathCore (this is a slightly edited version of TRandom::Landau, which is a translation of RANLAN),
  • add two functions
    double truncated_landau_moment1(…)
    double trunctaed_landau_moment2(…)
    that are translations of XM1LAN and XM2LAN
    to a new file MomentsFuncMathCore
  • rewrite TRandom::Landau to use landau_quantile
  • add functions to TMath:
    Double_t LandauQuantile
    Double_t LandauMoment1
    Double_t LandauMoment2

Any comments, in particular concerning naming of the routines?

Cheers, Benno

Hello Benno,

I agree to add these functions, in particular the inverse of the landau (landau_quantile), which as you said could be used then to generate the random numbers.

For the first and second moment Landau functions, do you have already the C++ code translated from Cernlib ?

Thank you for the suggestions,


Dear Lorenzo,

yes, I have the C++ code for XM1LAN and XM2LAN. They compile, run, and look reasonable, though I haven’t yet written a program to verify them against the original code.
As of now I included them in (my copy of) PdfFuncMathCore under the names landau_xm1 and landau_xm2, but I don’t think that’s a good solution.

Cheers, Benno

Hi Benno,

please send me your code and I will include in ROOT. If you have also a test or an example macro it would be great otherwise I will add one myself

Thank you


These new Landau functions are since revision 33348 in MathCore

Thank you Benno for sending the code