How does TH1->Fit() treat empty histogram bins ?
To find out, I created a histogram, in which half the bins were empty and half the bins had one entry. I then fitted a flat line to it. This was done by:
TH1F fun(“fun”,“fun”,10,0.5,10.5);
fun.Fill(6.);
fun.Fill(7.);
fun.Fill(8.);
fun.Fill(9.);
fun.Fill(10.);
fun.Fit(“pol0”,“V”)
The fit gives a line with equation y=1. Clearly the fit has ignored all bins with zero entries. (This fact should be stated in the TH1 entry of the ROOT Reference Manual).
If I repeat this exercise, but using a likelihood fit:
fun.Fit(“pol0”,“LV”);
then I get the same results. This is worrying. I likelihood fit should take into account bins with zero entries, otherwise it will give the wrong answer. If this is considered a “feature”, a clear warning about it needs to be placed in the Reference Manual.
(I am using ROOT 4.03/04)
Regards,
Ian Tomalin