Need help with TGraph::Fit("pol1")

I have a TGraph object w/ points essentially on a line. When I do TGraph::Fit(“pol1”) the fit results look funny. I’ve attached the pictures and .ROOT file. To demonstrate for yourself type

TFile f("diag.root") pgx->Draw("ap"); pgx->Fit("pol1") Any help would be greatly appreciated

I am using 5.05/1 on win32 (P4)

Thank!
Ed Oltman
diag.root (14.3 KB)


Ed,

Your two graphs have many points at [0,0]. If you remove these points,
you will get a correct fit, otherwise these weights have a strong weight
during the fit (all together).

Rene

Rene,
I did not realize that calling TGraph::TGraph(n) creates n points at (0,0) . The fix was to call TGraph::Set(actualNumberOfPoints) before doing the fit. Thanks!
Ed