IntegralError and RooBernstein

Hi experts,

I want to caluclate the error on the integral in a subrange with RooFit, using a composite signal+bg model, the bg model being a Bernstein polynomial. Learning from previous discussions I managed to do this, however I observe something strange with RooBernstein with more than 3 free parameters.

I attached a minimal macro, I calculate the integral error first from the total S+B model (error is 240), and then only for the bernstein component, and now suddenly the error is about 6000, though I use the same covariance matrix from the same fit. This makes no sense to my mind. But when eliminating one order of the bernstein the two uncertainties are about the same size again. It also works fine with an exponential as bg model btw. I tested it with Root 5.34 and 5.32.

Am I doing something wrong? Is there a way to stabilize the uncertainty even when the bernstein has more than 3 free parameters?

Thanks
Jana
fitanderror.C (2.08 KB)

Hi Jana,
Have you ever resolved this problem?

I suspect the issue is due to wrong covariance matrix plugged into the IntegralError function.
I think it is something to do with RooConst(1.0) parameter of the Bernstein.
In fact I suspect that even for Bern of 3d order it is a coincidence that it returns a meaningful result because the parameters supplied to the function come from the fit of SplusB and include ns which is now sort of replaces b0 const parameter of the bernsten.
Any thoughts?

Best,
Andrey