# Landau definition in ROOT

Hello, In a Landau fit

`TF1 *fitev = new TF1("Fit", "landau");`

I get three parameters

``````fitev->SetParName(0,"C");
fitev->SetParName(1,"MPV");
fitev->SetParName(2,"#sigma");
``````

I see the definition of Landau function is ROOT: Probability Density Functions (PDF)

then are

1. My MPV = the lambda
2. my sigma = c
3. my C= the under the curve???

@moneta surely you know it

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Hi,
p[1] and p[2] are just some location and scaling parameter , rescaling a `landau(x)` in a `landau( ( x - p[1] )/p[2])`, so p[1] is not exactly the landau MPV. See ROOT: TMath Namespace Reference

p[0] is instead a normalization parameter which corresponds to the area under the curve, since landau(x) is a normalized function (its integral is 1).

Cheers

Lorenzo

Thank you @moneta

`mu is a location parameter and correspond approximately to the most probable value and sigma is a scale parameter (not the sigma of the full distribution which is not defined)`

Then, for exampl, in this plot

can I say that MPV= p[1] =0.327703 ± 0.000045 , or would I do a big error?
Otherway, what is the relation between p[1] and MPV?

Thank you

`gROOT->GetFunction("landau")->Print();`
`gROOT->GetFunction("landaun")->Print();`

See also “`landau`” and “`landaun`” descriptions in the old TFormula::Analyze method description.

Thank you @Wile_E_Coyote

``````root [1] gROOT->GetFunction("landau")->Print();
Formula based function:     landau
landau : landau Ndim= 1, Npar= 3, Number= 400
Formula expression:
[Constant]*TMath::Landau(x,[MPV],[Sigma],false)
``````

then, I think I can approximate the MPV…

Ps. I can’t understand the difference bewenn landau and landaun

`In the same way the expression "landau" is a substitute for [0]*[TMath](https://root.cern/root/html534/TMath.html)::[Landau](https://root.cern/root/html534/TMath.html#TMath:Landau)(x,[1],[2],[kFALSE](https://root.cern/root/html534/ListOfTypes.html#Bool_t)) to obtain a standard normalized landau, use "landaun" instead of "landau" the expression "landaun" is a substitute for [0]*[TMath](https://root.cern/root/html534/TMath.html)::[Landau](https://root.cern/root/html534/TMath.html#TMath:Landau)(x,[1],[2],[kTRUE](https://root.cern/root/html534/ListOfTypes.html#Bool_t)) WARNING: landau and landaun are mutually exclusive in the same expression.`

ie. what is the diffence between false and true in the formua?

For the correct MPV, just do:

``````TF1 f("f","landau",0.2,2.);
f.SetParameters( p0,p1,p2);
double mpv = f.GetMaximumX();
``````

Lorenzo

HEllo @moneta, I wrote

``````TF1 f1("f1","landau",0.2,2.);
f1.SetParametrs(p0,p1,p2);
double mpv1 = f1.GetMaximumX();

TF1 f2("f2","landau",0.2,2.);
f2.SetParametrs(p0,p1,p2);
double mpv2 = f2.GetMaximumX();
``````

but I get this error

``````/data_collamaf/DataFausto/Muon_Collider/III_anno/Tesi/Simulazioni_per_tesi/LEMMA_R=075_d=2cm_gaussian300um/Circolari/Energia_depositata/Be_1.5mm/simlemmaev.cpp:80:20: error: use of undeclared identifier 'p0'
f1.SetParametrs(p0,p1,p2);
^
/data_collamaf/DataFausto/Muon_Collider/III_anno/Tesi/Simulazioni_per_tesi/LEMMA_R=075_d=2cm_gaussian300um/Circolari/Energia_depositata/Be_1.5mm/simlemmaev.cpp:80:23: error: use of undeclared identifier 'p1'
f1.SetParametrs(p0,p1,p2);
^
/data_collamaf/DataFausto/Muon_Collider/III_anno/Tesi/Simulazioni_per_tesi/LEMMA_R=075_d=2cm_gaussian300um/Circolari/Energia_depositata/Be_1.5mm/simlemmaev.cpp:80:26: error: use of undeclared identifier 'p2'
f1.SetParametrs(p0,p1,p2);
^
/data_collamaf/DataFausto/Muon_Collider/III_anno/Tesi/Simulazioni_per_tesi/LEMMA_R=075_d=2cm_gaussian300um/Circolari/Energia_depositata/Be_1.5mm/simlemmaev.cpp:143:7: error: no member named 'SetParametrs' in 'TF1'
f2.SetParametrs(p0,p1,p2);
~~ ^
/data_collamaf/DataFausto/Muon_Collider/III_anno/Tesi/Simulazioni_per_tesi/LEMMA_R=075_d=2cm_gaussian300um/Circolari/Energia_depositata/Be_1.5mm/simlemmaev.cpp:143:20: error: use of undeclared identifier 'p0'
f2.SetParametrs(p0,p1,p2);
^
/data_collamaf/DataFausto/Muon_Collider/III_anno/Tesi/Simulazioni_per_tesi/LEMMA_R=075_d=2cm_gaussian300um/Circolari/Energia_depositata/Be_1.5mm/simlemmaev.cpp:143:23: error: use of undeclared identifier 'p1'
f2.SetParametrs(p0,p1,p2);
^
/data_collamaf/DataFausto/Muon_Collider/III_anno/Tesi/Simulazioni_per_tesi/LEMMA_R=075_d=2cm_gaussian300um/Circolari/Energia_depositata/Be_1.5mm/simlemmaev.cpp:143:26: error: use of undeclared identifier 'p2'
f2.SetParametrs(p0,p1,p2);
``````

It is `SetParameters` and not `SetParametrs` and then you have to define or use directly the values for the 3 parameters of the Landau that you are using to make the figure above !

Thank you @moneta! it worked,
Is there a way to get the uncertinty on the MPV?

Hi,
Which uncertainty ? The one obtained from a fit using a Landau ?

Hi @moneta the uncertainty on this value

TF1 f(“f”,“landau”,0.2,2.);
f.SetParameters( p0,p1,p2);
double mpv = f.GetMaximumX();

You can control the accuracy using the “`epsilon`” and “`maxiter`” parameters: TF1::GetMaximumX

Hi @Wile_E_Coyote I don’t see how to get the uncertainty…

Or is it just a function Draw (i.e not release to the fit), then it doesn’t have uncertainty?

Hi,
`TF1::GetMaximumX` it is a function based on the `Brent` 1d minimisation method. See ROOT: ROOT::Math::BrentMinimizer1D Class Reference.
The numerical uncertainty of the result is controlled, by the `epsilon` parameter, i.e. it will be smaller than `epsilon` when using a large value for `maxiter` (maximum number of iterations).

Lorenzo

Hello @moneta, then the GetMaxmiumX (and consequently the MPV) doesn’t have uncertainty?? right?

There is always some numerical uncertainty in every calculation done. This can be controlled and kept small, but cannot be less than the double numerical precision ( ~ 1.E-16).

Thank you @moneta, so is there a code to get its value?

Hi,
Which value ? The actual uncertainty of a calculation ? No, there is not something implemented in ROOT, since it can be difficult and very tricky. You can just use the provided `epsilon` as a rough upper estimation. But why do you need that precise value ? Normally other uncertainties (e.g. statistical in estimating your function parameters) are much larger

Lorenzo

I see, then I will just use the parameter! thank you @moneta