# How to extract error matrix uncertainty with root macro

Hi,

when fitting my histogram MINUIT prints an ERROR MATRIX UNCERTAINTY onto my terminal. Because I do many fits, I would like to be able to extract the ERROR MATRIX UNCERTAINTY with my root macro. I saw that there is documentation out there to extract the error matrix, but I do not know how to get from there to the uncertainty of the matrix.

Valeria

Hi,

after having fitted the histogram, you can retrieve the a pointer to the covariance matrix of the last fit, by doing:

``````TVirtualFitter * fitter = TVirtualFitter::GetFitter();
double * covMatrix = fitter->GetCovarianceMatrix(); ``````

if you are interested in the element (i,j) you can also do:

``````double * covMatrix = fitter->GetCovarianceMatrixElement(i,j);
``````

Regards

Lorenzo

Hi,

May I have not thought it through, but how do I get then to the uncertainty of the matrix?

Cheers,

Valeria

Hi,
what do you mean by uncertainty in the error matrix ?

Sorry for being not clear enough.
When fitting a function you get an output like:

FCN=0.174573 FROM MIGRAD STATUS=CONVERGED 346 CALLS 347 TOTAL
EDM=3.91293e-12 STRATEGY= 1 ERROR MATRIX UNCERTAINTY 2.9 per cent
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 4.05975e-01 6.31878e-01 1.10421e-04 -3.63564e-05
2 p1 2.92294e+00 8.41999e-01 -1.44105e-04 -9.42899e-06
3 p2 6.07383e-01 1.57087e+00 2.28443e-04 1.04867e-05

How do I get the ERROR MATRIX UNCERTAINTY which is printed on the screen in a root macro?

Cheers,

Valeria

This is an internal parameter used inside Minuit to monitor the minimization, and it depends on the change of the matrix with respect to the previos iteration.
It has no use outside and it cannot be retrieved.
You should run “HESSE”, to be sure to have a correct error matrix, since the full second derivatives are used in this case.
You can do that by using option “E” when fitting.

Lorenzo

Hi Lorenzo,

thank you very much for the answer! I think that closes our discussion.

Cheers,

Valeria