Computing covariance matrix from the result of a RooAbsPdf

Dear all,

I am trying to reproduce the covariance matrix returned by the fit in RooFit. This is a fit to a toy data set (signal =3000 events, gaussian distributed and background = 1100 events distributed as an exponential in mass). I fit this toy, set the parameters apart from the yields as constant, and fit again, so I have just the two yields floating and therefore a 2x2 matrix. The fit returns:
| 0 | 1 |

0 | 3470 -531
1 | -531 1692
–> very sensible. The diagonal elements are err^2 and the sum of rows == fitted yield of signal and background.

For my own version of it, I first compute the inverse covariance matrix:

InvCov(s,b) = sum{ [ p_s( x_i ) p_b( x_i ) ] / [ N_{sig} p_{sig}( x_i ) + N_{bkg} p_{bkg}( x_i ) ]^2 }

where s and b are the two species signal and background, the N signify their total yield and the p signify the value of their pdfs. The x_i is the mass of the ith event. I invert the matrix I get from the above exercise using
TMatrixD covMatrix(TMatrixD::kInverted,covInv);
and get the following:
Covariance matrix (User):
| 0 | 1 |

0 | 2.601e+06 -4.266e+04
1 | -4.266e+04 1057

–> very far off!

Can someone comment on how to understand this? I have checked that my signal and background pdfs are normalized to unity. I looked at their integral in the mass range that I use them in, and it is 1.

I attach a code to reproduce this. To run it, do

root -l .L sPlotExample.C+ makefit(0,0,0)
and it will print the covariance matrix from the fit and also my own computation.

Thanks a lot for any hints…

Hello again,

Just for the record (or may be every one knows this point already).

The problem was that the RooExponential pdf does not return the values from a normalized pdf if you do

Even though I checked and the myexpo.createIntegral() method returned me a value of 1, the myexpo.evaluate() method returns just the height of the pdf not normalizing it. I found this out by doing this for an exponential manually and finding different result wrt the roofit pdf. The solution was to do

  • Fatima