Problen fitting TGraphError

Hello,
I try to fit a TGraphError with the macro below, but the results is clearly wrong and nothing is plotted. Everything works if I just use a TGraph. Any idea?
I run root 6.16 on MacOs Mojave 10.14.6.
Cheers,
Anna

**void** errfit()

{

TCanvas*c1=new TCanvas("c1","c1",400,400);

**float** a1,a2,a3,a4,a5,a6,a7,a8,a9;

TGraphErrors*g=new TGraphErrors();

ifstream in; in.open("califa.txt");

**for** ( **int** i=0; i<6; i++)

{

in>>a1>>a2>>a3>>a4>>a5>>a6>>a7>>a8>>a9;


g->SetPoint(i,a4,a7);

g->SetPointError(i,a5,0.001);

}

TF1*ff=new TF1("ff","[0]+[1]*x");

g->Draw("A*");

g->Fit("pol1","F");

c1->Update();

}

Do you see graph data points (i.e. “*”) and their errors drawn?
If yes, try:
g->Fit("pol1", "WQN"); g->Fit("pol1", "F");

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