Help in retrieving covariance matrix

Dear experts,
I’m trying to retrieve the correlation matrix from a fit.

After the fit is finished,

FCN=70.2662 FROM HESSE STATUS=OK 18 CALLS 105 TOTAL
EDM=1840.63 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER INTERNAL INTERNAL
NO. NAME VALUE ERROR STEP SIZE VALUE
1 scale 1.04367e+00 8.10065e-03 5.35317e-01 -9.46315e-01
2 reso 5.01731e-01 1.10803e-02 5.27313e-01 -9.32167e-01

from the prompt I write:

TVirtualFitter *f = TVirtualFitter::GetFitter()
root [25] f->GetCovarianceMatrixElement(1,1)
(const Double_t)1.77723891436366211e+159
while the outputfor the error is correct
root [24] f->GetParError(1)
(const Double_t)1.10802898701365133e-02
Also the non diagonal elements of the covariance matrix are non sense.

Am I missing somthing?
Thanks,
Marianna.

see the documentation of TH1::Fit at root.cern.ch/root/html/TH1.html#TH1:Fit%1
You will read:

// Access to the fit result // ======================== // The function returns a TFitResultPtr which can hold a pointer to a TFitResult object. // By default the TFitResultPtr contains only the status of the fit which is return by an // automatic conversion of the TFitResultPtr to an integer. One can write in this case directly: // Int_t fitStatus = h->Fit(myFunc) // // If the option "S" is instead used, TFitResultPtr contains the TFitResult and behaves as a smart // pointer to it. For example one can do: // TFitResultPtr r = h->Fit(myFunc,"S"); // TMatrixDSym cov = r->GetCovarianceMatrix(); // to access the covariance matrix // Double_t chi2 = r->Chi2(); // to retrieve the fit chi2 // Double_t par0 = r->Parameter(0); // retrieve the value for the parameter 0 // Double_t err0 = r->ParError(0); // retrieve the error for the parameter 0 // r->Print("V"); // print full information of fit including covariance matrix // r->Write(); // store the result in a file // // The fit parameters, error and chi2 (but not covariance matrix) can be retrieved also // from the fitted function. // If the histogram is made persistent, the list of // associated functions is also persistent. Given a pointer (see above) // to an associated function myfunc, one can retrieve the function/fit // parameters with calls such as: // Double_t chi2 = myfunc->GetChisquare(); // Double_t par0 = myfunc->GetParameter(0); //value of 1st parameter // Double_t err0 = myfunc->GetParError(0); //error on first parameter

Rene

Hi,
the example you put, as I understand, is for fit histogram with functions,
while I’m using minuit as in the macro in the attachment. How to do in this case?
Thanks,
Marianna.
Etmissfitbin.C (11.6 KB)