TGraphErrors

Hello

I have a problem using TGraphErrors:
Somehow the program doesn’ take errors in x-direction into account.
Here’s a simple example:

void error()
{
Double_t x[2]={1,2};
Double_t y[2]={2,4};
Double_t ex[2]={0.3,0.3};
Double_t ey[2]={0.1,0.1};

TCanvas *myc = new TCanvas(“myc”, “Fitting TGraphErrors”);

TGraphErrors *gre3 = new TGraphErrors(2, x, y, 0,ey);
TF1 ploynom=new TF1(“polynom”,“pol1”);
gre3->Draw("a
");
gre3->Fit(polynom);
}

Everything is done correctly. But if I replace the 0 in TGraphErrors with ey, the error estimates stay the same even if I take very large errors like in this example. Why doesn’t root take the errors in x-direction into account for the error estimate?

Thanks for your help…

see the documentation of TGraph::Fit, in particular this note:

[quote] Note, that the linear fitter doesn’t take into account the errors in x. If errors
in x are important, go through minuit (use option “F” for polynomial fitting).
[/quote]

so in your case do:

gre3->Fit(polynom,"f");

Rene

Thanks a lot, worked perfectly

Cheers