Re: unbin fit vs binned fit : technical aspect

From: Arthur E. Snyder <snyder_at_slac.stanford.edu>
Date: Fri, 11 Dec 2009 20:32:21 -0800


Well 100-140 does seem wide enough that numerically the normalization should be good enough. If fit probes large sigmas while fitting there could be problems .. though I'm a little suprised that starting 1.5sigma you'd have any trouble, so may be it's something else ...

You may need to put integral (a difference between |erf|s) over your range in the denominator of your function.

A.E. Snyder, Group EC                        \!c*p?/
SLAC Mail Stop #95                          ((.   .))
Box 4349                                        |
Stanford, Ca, USA, 94309                      '\|/`
e-mail:snyder_at_slac.stanford.edu                 o
phone:650-926-2701                              _
http://www.slac.stanford.edu/~snyder          BaBar
FAX:650-926-2657                          Collaboration



On Sat, 12 Dec 2009, Marc Escalier wrote:

> Dear all,
>
> i occur a problem with the unbin fit compared the binned fit for a (non
> normalised) gaussian distributed histogram
>
> the problem is the following
>
> 1) i do a projection to a histogram (TH1F) of a given variable in a Tree,
> with a given selection, then do a gaus fit (Fit("gaus")
>
> ==>i obtain a given resolution, let's say it is around sigma=1.5
>
> 2) let's do the same with a unbin fit
>
> ...
> open the file
> reads the tree...
> ...
> TCanvas *mycanvas=new TCanvas("mycanvas","mycanvas");
>
> TF1 *unbin_fit_function=new
> TF1("unbin_fit_function","gaus(0)/(sqrt(2*3.14159)*[2])",100,140); //the
> function must be self-normalized for unbin fit (from root documentation)
> unbin_fit_function->SetParLimits(0,1,1); //mandatory to fix normalization
> variable for unbin fit (from root documentation)
> unbin_fit_function->SetParameter(0,1);
> unbin_fit_function->SetParameter(1,120); //initial value near the one from
> binned fit
> unbin_fit_function->SetParameter(2,1.5); //initial value near the one from
> binned fit
>
> mytree->UnbinnedFit("unbin_fit_function","myvariable >>
> myhisto",myTCutSelection);
> myhisto->Draw();
> unbin_fit_function->Draw("same");
>
> mycanvas->SaveAs("mycanvas.gif");
>
> ==>the problem is that the sigma of the fit with binned version is very very
> bad : the sigma obtained is about 2 (the error is small, the fit converged)
>
> and the Draw of the function in superposition to the histogram is almost flat
>
> ==>so i increased the value and limits of the parameter 0 that is fixed (if
> this number is not fixed, the unbin fit fails)
>
> and after some tests to find a good value of this [0] parameter, i can then
> obtain a gauss function in superposition with the histogram
> ==>but the sigma is still very bad (about =2 with small error) compared to
> the one from the "binned fit"
>
> ==>would you have a idea ?
>
> by the way, how can i know the number i should put to the [0] value ?
> ===>i tried many values, as myhisto->GetMaximum(), same with *sqrt(2pi)
> nothing satisfactory
>
> would you have a idea ?
>
> thanks
>
>
Received on Sat Dec 12 2009 - 05:32:32 CET

This archive was generated by hypermail 2.2.0 : Sat Dec 12 2009 - 23:50:02 CET