What's the calculation of uncertainty in TF1->Draw("E")?


When I Use A formula of TF1 to fit TGraphErrors, I got a covariance matrix. But If I calculate the uncertainty of y using sqrt(derivative * Cov_matrix * derivative). The result is effectively different from the TF1->Draw(“E”). So how to get the uncertainty of Draw(“E”)?

TF1* f = new TF1("doke_fit","[0]/0.0137-[0]/[1]*x",0,20);
auto fitResult = g_s2b->Fit(f,"ES","P same");
TVirtualFitter *fitter = TVirtualFitter::GetFitter();
TMatrixDSym covMatrix(2);
double x[100],y[100],ey[100];
for(int i=0;i<100;i++){
x[i]  = x_lo + i*1.0/100*(x_hi-x_lo);
y[i]  = f->Eval(x[i]);
double d0 = f->Eval(x[i])/f->GetParameter(0);
double d1 = f->GetParameter(0)*x[i]/(f->GetParameter(1)*f->GetParameter(1));
ey[i] = sqrt(d0*d0*fitter->GetCovarianceMatrixElement(0,0)+d1*d1*fitter->GetCovarianceMatrixElement(1,1)+2*d0*d1*fitter->GetCovarianceMatrixElement(0,1));
}
TGraphErrors* ge = new TGraphErrors(100,x,y,NULL,ey);
ge->SetFillColorAlpha(kGreen,0.35);
ge->Draw("3");
f->Draw("E same");

d0(d1) is the derivative df/d[0] (df/d[1]).The red TGrph is from TF1->Draw(“E”), and the thin green band is from my calculation. The difference is so large. Dose anyone could help me


?

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi @chenchenghan12, Thank you for your post.

@jonas could you please take a look?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.