From 00cebaa249490fc29e6084283f01ea08a05d92c2 Mon Sep 17 00:00:00 2001
From: Lorenzo Moneta <Lorenzo.Moneta@cern.ch>
Date: Tue, 15 Jul 2008 13:10:27 +0000
Subject: [PATCH] - improve documentation for Landau distribution - also fix
 landau_pdf to return normalized distribution when scale is different than 1

git-svn-id: http://root.cern.ch/svn/root/trunk@24832 27541ba8-7e3a-0410-8455-c3a389f83636
---
 math/mathcore/inc/Math/PdfFuncMathCore.h | 5 +++--
 math/mathcore/src/PdfFuncMathCore.cxx    | 2 +-
 math/mathcore/src/TMath.cxx              | 8 ++++++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/math/mathcore/inc/Math/PdfFuncMathCore.h b/math/mathcore/inc/Math/PdfFuncMathCore.h
index d6249e72103..00cf35f96d9 100644
--- a/math/mathcore/inc/Math/PdfFuncMathCore.h
+++ b/math/mathcore/inc/Math/PdfFuncMathCore.h
@@ -262,7 +262,7 @@ namespace Math {
    
    */
 
-   double landau_pdf(double x, double sigma = 1, double x0 = 0.); 
+   double landau_pdf(double x, double s = 1, double x0 = 0.); 
 
 
   /**
@@ -274,7 +274,8 @@ namespace Math {
   for x>0. For detailed description see 
   <A HREF="http://mathworld.wolfram.com/LogNormalDistribution.html">
   Mathworld</A>. 
-
+  @param s scale parameter (not the sigma of the distribution which is not even defined)
+  @param x0  location parameter, corresponds approximatly to the most probable value. For x0 = 0, sigma = 1, the x_mpv = -0.22278
   
   @ingroup PdfFunc
 
diff --git a/math/mathcore/src/PdfFuncMathCore.cxx b/math/mathcore/src/PdfFuncMathCore.cxx
index cf4ff6bd437..96c8ca3ad57 100644
--- a/math/mathcore/src/PdfFuncMathCore.cxx
+++ b/math/mathcore/src/PdfFuncMathCore.cxx
@@ -187,7 +187,7 @@ namespace Math {
          u   = 1/(v-v*std::log(v)/(v+1));
          denlan = u*u*(1+(a2[0]+a2[1]*u)*u);
       }
-      return denlan;
+      return denlan/sigma;
 }
 
       
diff --git a/math/mathcore/src/TMath.cxx b/math/mathcore/src/TMath.cxx
index 5abc8d27e2c..bb2982140e3 100644
--- a/math/mathcore/src/TMath.cxx
+++ b/math/mathcore/src/TMath.cxx
@@ -498,12 +498,16 @@ Double_t TMath::Gaus(Double_t x, Double_t mean, Double_t sigma, Bool_t norm)
 //______________________________________________________________________________
 Double_t TMath::Landau(Double_t x, Double_t mpv, Double_t sigma, Bool_t norm)
 {
-   // The LANDAU function with mpv(most probable value) and sigma.
+   // The LANDAU function. 
+   // mpv is a location parameter and correspond approximatly to the most probable value
+   // and sigma is a scale parameter (not the sigma of the full distribution which is not defined)
+   // Note that for mpv=0 and sigma=1 (default values) the exact location of the maximum of the distribution (most proble value) is at 
+   // x = -0.22278
    // This function has been adapted from the CERNLIB routine G110 denlan.
    // If norm=kTRUE (default is kFALSE) the result is divided by sigma
 
    if (sigma <= 0) return 0; 
-   Double_t den = ::ROOT::Math::landau_pdf(x, sigma, mpv); 
+   Double_t den = ::ROOT::Math::landau_pdf( (x-mpv)/sigma ); 
    if (!norm) return den;
    return den/sigma;
 }
-- 
GitLab