ROOT Discussion Forums

Landau distribution, most probable value.

Discuss installing and running ROOT here. Please post bug reports here.

Moderator: rootdev

Landau distribution, most probable value.

Unread postby Cele » Tue Jul 08, 2008 17:51

Hi, i'm using TMath::Landau to fit a histogram of data i've collected.
I've seen on documentation that the second argument of this function is the most probable value, while the third is the width of the distribution.
However, if i use TF1::GetMaximumX with the function i've used, i see that the value of x where there's maximum is not equal to the second parameter of the distribution.

Could someone tell me why this appens?

Thanks in advance

Posts: 12
Joined: Mon Jun 30, 2008 18:32

Unread postby brun » Tue Jul 08, 2008 18:09

Could you send the shortest possible RUNNING script explaining/showing the problem?

User avatar
Posts: 5837
Joined: Wed Aug 27, 2003 9:49
Location: CERN

Unread postby Cele » Wed Jul 09, 2008 7:55

i don't use root with scripts, but inside c++ code.
Here's a working example
Code: Select all
#include <iostream>
#include <TApplication.h>
#include <TMath.h>
#include <TCanvas.h>
#include <TF1.h>

using namespace std;
TApplication gui("gui",0,NULL);
double f(double *x,double *par){
   double t;
   t=TMath::Landau(x[0],par[0],par[1],0); //p0 is MP,p1 is sigma
   return t;
   TF1 fun("fun",f,-100,100,2);
   fun.SetParameter(0,20); //MP is 20
   fun.SetParameter(1,5); //sigma is 5
   TCanvas c;
   double x;
   cout<<"x is "<<x<<endl;

when i run it, i see that x (line 22) is 18.8861 and not 20: so the most probable value in TMath::Landau is not the maximum of this function.

Posts: 12
Joined: Mon Jun 30, 2008 18:32

Unread postby moneta » Mon Jul 14, 2008 12:16


the definition used in TMath::Landau for the mpv and sigma of the Landau is only approximate. It is like a normal-like parameterization of the distribution, which is somehow convenient when you are doing for example a fit.
In reality the maximum of the Landau (mpv) occurs not a zero but a value of x = -0.22278 and the sigma (variance) is not even defined.

We should update the documentation in TMath to avoid this confusion

For more detail you can consult the following paper:
K.S. Kölbig and B. Schorr, A program package for the Landau distribution, Computer Phys. Comm. 31 (1984) 97-111.

Thank you for your report

Posts: 1804
Joined: Fri Jun 03, 2005 14:38
Location: CERN

Unread postby Cele » Mon Jul 14, 2008 21:30

Thanks for your reply!

Posts: 12
Joined: Mon Jun 30, 2008 18:32

Return to ROOT Support

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests