Daer experts,
I would like to know how the chi-square is computed when one tries to fit a histogram with “L” fit option.
I see that there are some references to the paper:

CLARIFICATION OF THE USE OF CHI-SQUARE AND LIKELIHOOD FUNCTIONS IN FITS TO HISTOGRAMS Steve BAKER and Robert D. COUSINS

I implemented the formula written in the paper on page 439, but I get a different chi2 with respect to what is reported from ROOT at the end of the fit.

The formula in the paper says: 2 * sum[ yi - ni + ni * ln(ni / yi) ]

Indeed the number I obtain with your suggestion matches the formula on the paper.
So the question now is: which number shall I sue to make goodness of fit test?
this one double chi2 = 2 * result->MinFcnValue();
or this one myFcn->GetChisquare();
(where myFcn is the function I use to perform the fit)

Either case, which number of degrees of freedom shall I use?