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);
m.migrad();
m.hesse();
m.minos();
What can be a problem and how to make RooMinimizer use data error correctly?
Thanks in advance!