TH1::IntegralError question

Hi,

An example is provided in this previous post

Basically you need to get the full covariance matrix from the total fit (using TFitResult::GetCovarianceMatrix) and then extract the sub matrix for the parameters 0 and 1, and use this matrix in TF1::IntegralError.

From your code do something like :

TF1 *total = new TF1("total","expo(0)+expo(2)+expo(4)",0,5);
total->SetParameters(par);
TFitResultPtr r = hpT->Fit(total,"R");
TMatrixDSym covTot = r->GetCovarianceMatrix();    
// make sub matrix with first two elements
TMatrixDSym covGG(0,1, covTot.GetMatrixArray() );

TF1 *expoGG = new TF1("expoGG","expo",0.0,5);

expoGG->SetParameter(0,total->GetParameter(0));
expoGG->SetParameter(1,total->GetParameter(1));
expoGG->SetParError(0,total->GetParError(0));
expoGG->SetParError(1,total->GetParError(1));

double errNgg=expoGG->IntegralError(0.1,0.7, expoGG->GetParameters(), covGG-GetMatrixArray());

Lorenzo