I am trying to fit a TH1 defined with uneven binning, with the fitTo() function of RooFit. I attached a minimal example of the code I am using here: test_uneven_binning.C (1.1 KB)
I noticed that the result of the fit is very different from the result if I have with a constant binning, that I obtain with a similar, but different code.
Would it be possible to tell me if there are things I should change in my code, please?
Thank you very much for the answer!
Actually I already saw the post that you mention, and I was doing something similar in my code when I use the option:
Import(*h_bkg, kTRUE)
in the RooDataHist creation.
Indeed, the fit looks good, however, the magnitude of the uncertainties on the fit parameters and the minimized -log(L) values are very different from the ones with constant binning, which indicates that I am doing something wrong.
Actually, while I was stetting up the code for you, I think I understood better what was the problem:
I was using Import(*h_bkg, kTRUE) for uneven binning and Import(*h_bkg, kFALSE) for constant binning. So in one case, I was dividing by the bin width and in the other not. So in one case, the errors were scaled down (by ~100), in the same way that the errors are scaled when one use the Scale function of ROOT and in the other, not.
The problem is that, for uneven binning, one should use the kTRUE option, if we want to keep the shape, no?
So my question is: for uneven binning, is it possible to keep the shape unchanged, but without scaling the errors?