Sumw2(kTRUE) parameter problem

Dear all

Recently I faced a problem with error propagation after scaling. First I would like to describe what I am doing. I have a histogram and building a function to fit it. The histogram has already weighted errors. If I give:

Warning in TH1D::Sumw2: Sum of squares of weights structure already created

which to my understanding I already have the errors calculated. So when I am fitting like
RooFitResult* r_full = model.fitTo(modelData,SumW2Error(kFALSE)) ;
I am getting the Poisson errors calculated succsesfully. But when I am doing
RooFitResult* r_full = model.fitTo(modelData,SumW2Error(kTRUE)) ;
I am getting huge errors.

Any help is much appreciated




You need to provide a few more details for me to understand what is the problem.

The TH1::SumW2 feature enables the storing of the sum-of-weights squared in a
TH1 which allows to calculate the ‘sum-of-weight^2’ error for a given histogram bin
(otherwise the error would always be sqrt(N))

These are the errors on your data points.

I assume you import this TH1 filled with weighted events into a RooDataHist on which
you perform a binned likelihood fit. Since likelihoods by construction don’t use errors
assigned to data points (as stored in TH1) the default likelihood fit ignores that information
and returns errors on the fit parameters that reflect the wrong assumption that the error on the
data points was sqrt(N).

To fix that one can either use a chi^2 fit, which does (always) use the error provided with
each data point, in RooFit you do this with function.chi2FitTo(binnedData,…), or you
do a likelihood fit where you perform an a posteriori correction of the covariance matrix
which amounts to the same error calculation as ‘sum-of-weights’. If you have many event with
small weights (<1) in your dataset you expect the errors to be smaller in that case, if you have
many events with large weights, or with partly negative weights you expect parameter errors
to be larger. They should however come out roughly to the magnitude of the chi^2 fit, so can
you check that? If you still see problems, please post a self-contained macro that I can use to
look further into this.


1 Like