Extracting contour plots from TMinuit

Hello,
I’ve always used TGraph::Fit method for fitting my data with a TF1 a model function.
Now, say my function is complicate and cannot be simply wrapped by TF1.
So, I guess I have to use TMinuit for fitting and define a minizing fuction, FCN, describing the ChiSquare (or -likelihood). So my question is the following.
Once the TMinuit fit is done (best parameters and minimum fcn returned), is there a simple way to automatically get the associated contour plots (e.g. of parameter correlation, marginal contour plots corresponding e.g. to N sigmas)??

Yes, assuming you have a TMinuit object called gm, after having performed the minimization, to get the contour plot with 50 points for parameters 1 and 2:

TGraph *tg=(TGraph*)gm->Contour(50,1,2);
tg->Draw("ACP");

To get the contour plot at n sigma, before calling Contour:

gm->SetErrorDef(n*n);

Thank you;
the function minimized by TMinuit, “FCN”, is however an arbitrary function defined by the user. So:
How the FCN has to be defined to make such plots have the proper statistical meaning?
FCN = Chi2? Or FCN = Chi2/Ndof? Or something else, like FCN = -Likelihood…?

[quote=“dom_eckert”]Yes, assuming you have a TMinuit object called gm, after having performed the minimization, to get the contour plot with 50 points for parameters 1 and 2:

TGraph *tg=(TGraph*)gm->Contour(50,1,2);
tg->Draw("ACP");

To get the contour plot at n sigma, before calling Contour:

gm->SetErrorDef(n*n); [/quote]

You should use chi2, not chi2/d.o.f.

If you want to use - log(likelihood), you should beware of the normalization. E.g., in the case of Cash’s C statistics, it should be -2*log(likelihood).

Yes but…
Let’s say my FCN gives the Chi2 arising from model-data comparison.
The uncertainty bounds associated to the best-fit parameters, should also depend on the DoF (the number of data points). Shouldn’t them?
This information is not used in Minuit, when computing the TGraphs.
Are such plots reliable??

[quote=“dom_eckert”]
You should use chi2, not chi2/d.o.f.

If you want to use - log(likelihood), you should beware of the normalization. E.g., in the case of Cash’s C statistics, it should be -2*log(likelihood).[/quote]