Hi,
I would like to fit a TGraph with two different functions and show the fit statistics from the two fits.
Somehow I do not manage to achieve it, since I only the information from the first fit…
Below is an example:
{
float x[5]={1,2,3,4,5};
float y[5]={1,2,5,4,5};
TGraph *gr = new TGraph(5,x,y);
gr->SetMarkerStyle(20);
gr->SetMarkerSize(1.3);
gr->SetMarkerColor(2);
gr->Fit(“pol1”,“Q0”);
gr->Fit(“pol2”,“Q0+”);
TF1 *fit1 = gr->GetFunction(“pol1”);
TF1 *fit2 = gr->GetFunction(“pol2”);
gStyle->SetOptFit(1111);
gr->Draw(“AP”);
fit1->Draw(“sames”);
fit2->Draw(“sames”);
}
Any suggestion is appreciated.
Cheers,
Sergio