i occur a strange behaviour with roofit.
Let’s start from a given TH1 HistoInitial, transformed to RooDataset via import function, then make a fit with a given model.
It gives result1 for the parameters of the fit
Let’s now create a void TH2 HistoFinal, where we do something like HistoFinal.Add(HistoInitial, 1)
for a weight of 1, the fit of the HistoFinal gives the same results
But if one put a weight of 2 (for example), the results are a bit differents
Note that i reinitialized the parameters of the RooRealVar before doing each fit, in order to be in the same conditions.
I put a minimum example here :
/afs/cern.ch/user/e/escalier/public/MinimumProblem/
==>
root -b
.L MinimumProblem.C
MinimumProblem()
then just change the Add with 2 instead of 1 and you will see that the two fits (the initial one and the final one, don’t give the same results)
When using RooFit, a fit to a binned data set uses by default a Poisson p.d.f for each bin. When you are scaling an histogram this is not correct anymore. For this reason you get same parameter values, but different errors.
In principle this should be corrected when using the option, ,RooFit::SumW2Error(1). In this case this option does not work (I don’t know if this is a bug or a limitation).
If you have scaled or weighted histograms, I would perform a chi2 square fit, which should work
Yes, I can reproduce the NAN. I think is a problem of the normalization, the TF1 you are getting from RooAbsPdf::asTF is normalized. When you are doing a chi2 fit the function does not need to be normalized to 1 and you need to add an extra parameter to adjust for the overall normalization
indeed with your example using root, the nominal parameters are insensitive to the scaling
(actually, the fraction of CB is not exactly the same when the scaling is done)
But all the errors are changed, whereas they should have not changed, since Sumw2() was considered at the construction of the histogram.
==>
frac_CB is not the exactly the same
all the errors are different when the scaling is done, while the histograms have correctly be given Sumw2() at the construction
Hi Marc,
I think the differences can be due to numerical errors in the error calculations, given the fact that you have also applied a large scaling factor. Only the last parameters also changes because is more sensitive to it. It is the ratio of the two amplitudes.
Also, remember the estimate is biased (for example due to the fact you have bins without entries). This I guess is not independent of the scaling.
So, I am not surprised to see small differences like in your case.