Bin errors in TH1::Fit with "L" option

Hello,

When fitting a TH1 with the binned likelihood method (fit option “L”), how can I force
the fitter to use some value other than sqrt (bin content) as the error per bin?
In the “Associated Errors” section of the Users Guide v5.26, it is suggested that this can be
accomplished by calling the Sumw2() method of the TH1 being fitted, but this does not
seem to work. When I execute the example below (in root version 5.24/00), I expect the
uncertainty on the fit parameter to be different for h0 and h1, but it is not. Is this
somehow a property of the likelihood fit, which I am overlooking?

Thanks,
Jim

TH1F h0(“h0”,“h0”,3,-0.5,2.5)
h0.Sumw2()
h0.SetBinContent(1,100.)
h0.SetBinContent(2,100.)
h0.SetBinContent(3,100.)
h0.SetBinError(1,10.)
h0.SetBinError(2,10.)
h0.SetBinError(3,10.)
h0.Fit(“pol0”,“LN”)

TH1F h1(“h1”,“h1”,3,-0.5,2.5)
h1.Sumw2()
h1.SetBinContent(1,100.)
h1.SetBinContent(2,100.)
h1.SetBinContent(3,100.)
h1.SetBinError(1,1.)
h1.SetBinError(2,1.)
h1.SetBinError(3,1.)
h1.Fit(“pol0”,“LN”)

Hi,

Only from version 5.30 you can use the option “WL” to fit a weighted histogram with a binned likelihood method. Also, If you are filling the histogram with data points and normal errors, it is perfectly fine to use the default least square (chi2) method for fitting

Lorenzo

Thanks, Lorenzo! – Jim