I have an issue with IntegralError and I think I nailed it down to a specific problem where I need help.
So, I use RooFit (in pyRoot) and do this:
then I get parameters (mzg is my integrating variable):
and make a TF1 from the fit:
Now I want to get an integral and its error:
integ = f1.Integral(110,170)
params = f1.GetParameters()
covmat = fit_result.covarianceMatrix()
intError = f1.IntegralError(110, 170, params, covmat.GetMatrixArray())
the integral is calculated fine, but the intError returns Zero.
I believe the problem is due to the fact that my pdf contains a constant parameter, which is not included in covariance matrix, covmat.
So, the f1.GetNpar() returns 5 but the covmat is 4x4.
My question is how to get the full covariant matrix from RooFitResult that would include constant parameters? (fit_result is a RooFitResult object). Other ways to overcome this issue?
usually, things like this:
f1 = pdf.asTF(RooArgList(mzg), RooArgList(pars))don’t work well with RooFit, as it plays fast and loose with const correctness and temporary life times. Since these life times differ between Python and C++, such examples tend to accidentally work with C++, but fail in Python.
l1, l2 = RooArgList(mzg), RooArgList(pars)
f1 = pdf.asTF(l1, l2)
Same for the other cases.
(Since I don’t have the your code example, I can’t test, and so it may yet be something else. But since you say the number of parameters don’t match, the above seems a logical guess.)
Thanks for the suggestion, but it didn’t make a difference.
I think the problem is the covariance matrix due to the same reason as descrived in Note2 of this reference: http://root.cern.ch/root/html/TF1.html#TF1:IntegralError
Since there is a constant parameter in my pdf, the RooFit doesn’t include it in the matrix.
My code is too involved to put here, but please have a look at his older post:
[url]IntegralError and RooBernstein
There is a .C file attached (and it runs). This is very similar to what I do (I fit to a Bernstein with constant p0 parameter). Except that in the example the fit is performed to S+B, while I just fit the distribution to B only.
So, if you could help resove the issue in that posting it would probably resolve my problem as well.