Fit to data doesn't seem to use data error

Hi! I have a problem with fit to data in RooFit. I have to fit my MC to data in 4 regions. Here is the code I use to fill a DataSet.

RooRealVar x("x", "x", 0, 9);
RooRealVar w("weight", "weight", 1);
RooCategory cat("region", "region");
RooDataSet data("data", "data", RooArgSet(x, w, cat), WeightVar("weight"), StoreError(RooArgSet(x, w)));

for (int i=1; i<=nBins; i++) {
    x = DMBHist[0] -> GetBinCenter(i);
    cat.setLabel("A"); data.add(RooArgSet(x, cat), DMBHist[0] -> GetBinContent(i), DMBHist[0] -> GetBinError(i));
    cat.setLabel("B"); data.add(RooArgSet(x, cat), DMBHist[1] -> GetBinContent(i), DMBHist[1] -> GetBinError(i));
    cat.setLabel("C"); data.add(RooArgSet(x, cat), DMBHist[2] -> GetBinContent(i), DMBHist[2] -> GetBinError(i));
    cat.setLabel("D"); data.add(RooArgSet(x, cat), DMBHist[3] -> GetBinContent(i), DMBHist[3] -> GetBinError(i));

Then I perform a binned fit using RooMinimizer, but the fit doesn’t seem to use data error at all beacuse error for data is huge, but the final estimate has very small error.

When I change the last argument in data.add() method that is supposed to be the error of the bin to any number I get the same error for the final estimate. Here is how I perform a fit.

RooArgList models;
for(int j=0; j<4; j++) models.add(*TRooFit::BuildModel(*hist[j], data));

RooSimultaneous model("model", "model", models, cat);

RooAbsReal *nll = model.createNLL(data);
RooMinimizer m(*nll);


What can be a problem and how to make RooMinimizer use data error correctly?
Thanks in advance!

I think @moneta can help you.

By default when doing a binned fit, it is assumed that the bin content is distributed according to a Poisson distribution given the observed number of events. If you have a defined bin error for each bin, you should use either a chi2 fit , or a weighted likelihood fit. In this second case you can use the option SumW2Error(true) when calling fitTo. You need to call fitTo and not use createNLL and the RooMinimizer



Thanks a lot! The problem is that the relative error of the estimate that I get is ~100 times less, than the relative error of data and of MC that is used for the fit. That’s why I thaught RooFit doesn’t use error of data. The estimate itself is pretty adequate, but it’s relative error is less than 0.5% which doesn’t seem to be right.
Is it possible for error to fall so significantly during the fit? What could be the problem?

Best regards


Yes this can be possible if something is not correct during the minimization, for example the estimated Covariance matrix from the fit could be wring due to numerical errors. I see you also call Minos. Is Minos running correctly ? Are the errors from Minos compatible with the Hessian ones ?



This happened because migrad could not converge. I have changed the upper limit for fit parameters, so it could converge and the error is correct now.

Thank you a lot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.