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…
- Fatima
sPlotExample.C (14 KB)