Hi,
I posted this originally in the PyRoot section http://root.cern.ch/phpBB3//viewtopic.php?f=14&t=12701, but have since verified that I see the same thing in Cint as well.
{
const Double_t yVal[3] = {0.95, 1, 1.1};
const Double_t xVal[3] = {-1, 0, 1};
TCanvas *canvas = new TCanvas;
TGraph *graph = new TGraph ( 3, xVal, yVal);
graph->SetMarkerStyle (20);
graph->SetMarkerColor (kRed);
graph->SetMarkerSize (1.4);
graph->SetMaximum (1.3);
graph->SetMinimum (0.7);
TF1 *fun = new TF1("fun", "pol2");
fun->FixParameter(0, 1);
graph->Fit (fun);
graph->Draw ("AP");
canvas->Print ("fit.png");
}
Produces a good fit in 5.22:
[code]root [0]
Processing fitSTC.C…
Minimizer is Linear
Chi2 = 6.16298e-32
NDf = 0
Par_0 = 1 (fixed)
Par_1 = 0.075 +/- 0.707107
Par_2 = 0.025 +/- 0.707107
Info in TCanvas::Print: file fit.png has been created
root [1] .q
[/code]
But messes the fit up in 5.27.06b
Processing fitSTC.C...
****************************************
Minimizer is Linear
Chi2 = 2
NDf = 0
p0 = 1 (fixed)
p1 = 0.075 +/- 0.707107
p2 = 1.025 +/- 0.707107
Info in <TCanvas::Print>: file fit.png has been created
One thing that is peculiar is that the fit parameter p1 (or par_1) has the same value, but p2/par_2 value differ by exactly 1.
Cheers,
Charles