unbin fit vs binned fit : technical aspect

From: Marc Escalier <escalier_at_lal.in2p3.fr>
Date: Sat, 12 Dec 2009 00:08:17 +0100


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 - 00:08:22 CET

This archive was generated by hypermail 2.2.0 : Sat Dec 12 2009 - 05:50:07 CET