TGraph::Fit() is not behaving like it did before root 5.20

I’m having really strange problems to fit and draw my functions since root version 5.20. I tried 5.21 and 5.19. 5.19 worked fine. Since 5.20 it does not draw the fitted graph anymore, or it does not fit at all. Is this Problem known?

Update the problem seems to be located. Try this code out:

{ TCanvas* my_canvas = new TCanvas("my_canvas","my canvas",400,400); my_canvas->SetLogy(1); double x_val[10] = {0. ,0.5 ,1. ,1.5 ,2. ,2.5 ,3. ,3.5 , 4., 4.5}; double y_val[10] = {0. ,0.2 ,0.4,0.8 ,0.9,0.8 ,0.4,0.2 , 0.1, 0.}; TGraphErrors* _test = new TGraphErrors(10, x_val, y_val); //TGraph* _test = new TGraph(10, x_val, y_val); TF1 *f1 = new TF1("f1","gaus",0.,4.5); _test->Fit("f1","RW"); _test->Draw("AL"); }
It does not like to use TGraphErrors with no errors for fitting. Even the option W did not help. This code works with TGraph perfectly. What am I doing wrong? In 5.19 it works for both cases…


thank you very much for reporting this. The problem is due to a bug in the case of TGraphErrors when all errors are zero. I will fix later on in svn.
For the moment just creates a TGraph. If you don’t have errors you don’t need a TgraphErrors.