TFitterMinuit in Minuit2

Hello,

I am using the new Minuit2 interface in ROOT to minimize chi squared function. I use the TFitterMinuit interface to do this. The relevant code is as follows.

	TFitterMinuit * minuit = new TFitterMinuit();
	// fcn is an object that defines the FCN function
	minuit->SetMinuitFCN(&fcn);
	//set and initialize the parameters
	minuit->CreateMinimizer(TFitterMinuit::kSimplex);
	minuit->Minimize();

	TGraph* gConf = new TGraph(20);  // the graph which holds the contours
	TVirtualFitter* tvf = minuit->GetFitter();
	tvf->GetConfidenceIntervals(gConf,0.95);   // 95% confidence interval

The above code minimizes the chi-squared successfully. However, when I try to plot the confidence region, the code crashes. I find that minuit->GetFitter() returns a NULL pointer. This causes a segmentation violation subsequently. Can I fix this or is there any other way of plotting the confidence region in Minuit2?
I tried another function unsuccessfully.

virtual void GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t* x, Double_t* ci, Double_t cl = 0.95)

I also need to know the value of minimized chi-squared from the TFitterMinuit interface but I can’t find a suitable function. Any help is appreciated for these two issues.

Cheers,
Tarak.

Hi,
The class TFitterMinuit is deprecated (I will add a message in the next release).
You should use the Minimizer interface, if you do a simple minimization
(see root.cern.ch/drupal/content/nume … idim_minim )
or the Fitter interface if you are doing a fit and you need the confidence intervals after the fit.
In your case, you can do the fit and get the confidence intervals as following:

ROOT::Fit::Fitter  fitter; 
fitter.SetFunction(modelFunction); 
fitter.Fit(data); 
ROOT::Fit::FitResult & result = fitter.Result();
result.Print(std::cout); // to print result of the fit
std::vector<double> ci(npoints); 
result.GetConfidenceIntervals(data,&ci[0],confLevel);  

Lorenzo

Thank you, Lorenzo.

I have now implemented the ROOT::Math::Minimizer interface to invoke Minuit2 applications. I have a related question. Where do I find the an explanation of the error related functions such as SetEDM, SetTolerence, SetErrorDef, SetPrecision, SetValidError? I am a grad. student and I need to know these to carry out statistical analysis.

Tarak.