I am not sure of the differences between ROOT::Math::Minimizer and ROOT::Fit::Fitter. I have reviewed the documentation and looked at some examples, but there seems to be a lot of overlap between these two classes. Although one is called a “Minimizer”, I thought that a “Fit” task could be considered as a minimization of an objective function (e.g. a chi-squared function), and so I’m not really sure when one class should be used versus the other.
Is one of these classes newer and/or more supported than the other? Is there effectively no difference at all, and a user can use either class with no problem?
@moneta can you take a look please whenever you will have time? Thank you!
Sorry for my late reply.
Fitter class is an higher level class than the Minimizer. It is used to perform a fit, given a function modeling the data plus a data set (binned or unbinned). It can perform a binned likelihood fit, an unbinned likelihood fit or a least square fit (chi2).
Minimizer is instead a lower level class which find just the minimum of a multi-dimensional function. It is used by the Fitter to find the minimum.
You can create your likelihood function yourself and then use the MInimizer class for doing the fit. On the other hand, also in this case, it is more convenient to use still the Fitter class , which provides an interface to pass your own objective function, see Fitter::FitFCN. The advantage of using the FItter class is that you can easly set and configure the fit parameters and you have the results returned in a class, the
ROOT::Fit::FitResult. This is not the case if you are using the
So, in conclusion, if you are just interested in finding just the minimum of a function, use the
Minimizer class. If instead you are performing a fit is more convenient to use the
Thank you for the clear explanation.