Likelihood fit

Hi rooters,

I have two questions:

  1. I tried to fit a histogram with likelihood fit option like:
    h1->Fit("myFunction", "LR0")
and I got following error: 
Warning in <Fit>: Abnormal termination of minimization.
and all fitted parameters are shown to be 0. However, it works fine with default chi2 fit. Am I missing something?
  1. I tried to calculate the unbinned log likelihood of a fit of a variable in tree. So, I need data of the variables. How do I get the data from the tree directly without writing TBranch etc. For an example:

To draw the variable (say px) from the tree (myTree), I do

   myTree->Draw("px", "cuts")

Is there any way to get the data “px” (with cuts) from the tree like above?


  1. You probably need better value of the initial fit parameters. You can start for example from the resulting values of the chi2 fit.
    If you histogram is weighted (if the errors are not distributed according to a Poisson distribution, bin Error = sqrt(bin content) ), your likelihood fit will not be valid

  2. You can do :


You can get the data of a tree by doing:

myTree->Draw("px", "cuts");
double * data = myTree->GetV1();

If you don’t want to draw the tree you can use the option “goff”