Fitting problem!


Can someone tell me why ROOT doesn’t want to fit this distribution when the error bars (ex and ey) are set to 1.6 (l. 106 & 107) ?
If I set ex and ey to 0, ROOT fits the distribution.

Here’s the code:

Thank you

Chis_test2.C (6.9 KB)

Your fit has the “STATUS=FAILED” (you could see it if you removed the “Q” fitting option).

You need to set “reasonable” initial values of fit parameters so, try something like this:

TF1 *gr_fit = ((TF1 *)(gROOT->GetFunction("pol1")));
gr_fit->SetParameters(-20, 2);
gr->Fit(gr_fit, "Q");

Or you can try to “help” to make your fit more “foolproof”:

TF1 *gr_fit = ((TF1 *)(gROOT->GetFunction("pol1")));
gr->Fit(gr_fit, "WQ"); // "initial pre-fit"
gr->Fit(gr_fit, "Q"); // "final fit"

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.