Hi,
I have problems with fitting parabolas to a TGraph(Errors). The fit that I make with my own defined function is not the best fit and is even totally different as the fit I acquire when I fit with the fitpanel.
I can show my problem with the folowing interactive session :
root [0] TCanvas c1 = new TCanvas()
root [1] TGraphErrors * gr1 = new TGraphErrors(“Run00088842_5st_lateral55.txt”,"%lg %lg %lg")
root [2] gr1->Draw("A")
root [3] gStyle->SetOptFit(1111)
root [4] TF1 *fit = new TF1(“fit”,“pol2”,1.7,2.7);
root [5] Fitting results:
Parameters:
NO. VALUE ERROR
0 14.423373 0.727944
1 -11.539979 0.756400
2 2.383357 0.195939
The above results are the fit results obtained from the fitpanel, when fitting a pol2
root [5] gr1->Fit(fit)
Fitting results:
Parameters:
NO. VALUE ERROR
0 -0.286274 0.639518
1 3.274469 0.670442
2 -1.317574 0.175321
(Int_t)0
These are the fit results obtained from when fitting a defined pol2. These fit results are totally different. Why?
root [14] TF1 fit2 = new TF1(“fit”,"-[0](x-2)(x-2)-[1](x-2)+[2]",1.7,2.7);
I now define a parabola myself
root [15] gr1->Fit(fit2)
** 5 **MIGRAD 5000 2.874e-06
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
FCN=2947.66 FROM MIGRAD STATUS=CONVERGED 62 CALLS 63 TOTAL
EDM=6.08427e-17 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 1.31757e+00 1.75321e-01 1.10009e-03 1.92219e-07
2 p1 1.99583e+00 4.60246e-02 2.42141e-04 -7.46514e-07
3 p2 9.92370e-01 7.05961e-03 5.03829e-05 -2.66262e-06
FCN=2947.66 FROM MIGRAD STATUS=CONVERGED 62 CALLS 63 TOTAL
EDM=6.08427e-17 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 1.31757e+00 1.75321e-01 1.10009e-03 1.92219e-07
2 p1 1.99583e+00 4.60246e-02 2.42141e-04 -7.46514e-07
3 p2 9.92370e-01 7.05961e-03 5.03829e-05 -2.66262e-06
(Int_t)0
And this gives essentially the same results as the fit done with pol2 except the parameter values of course, but again totally different as the fitpanel.
So my question is : what is the different between the user-defined pol2 or parabola, and the one that fitpanel uses? And how can I obtain the best parabola fit?
Thanks,
Tom
Run00088842_5st_lateral55.txt (427 Bytes)