# Difference between ROOT::Math::Minimizer and ROOT::Fit::Fitter?

**URL:** <https://root-forum.cern.ch/t/difference-between-root-minimizer-and-root-fitter/44277>\
**Category:** Newbie\
**Created:** [April 3, 2021, 1:17pm UTC](https://root-forum.cern.ch/t/difference-between-root-minimizer-and-root-fitter/44277 "2021-04-03T13:17:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eggsAndCoffee](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/ecb155/32.png) [@eggsAndCoffee](https://root-forum.cern.ch/u/eggsAndCoffee)\
**Post date:** [April 3, 2021, 1:17pm UTC](https://root-forum.cern.ch/t/difference-between-root-minimizer-and-root-fitter/44277/1 "2021-04-03T13:17:05Z")

</div>

Hello,

I am not sure of the differences between [ROOT::Math::Minimizer](https://root.cern/doc/v610/classROOT_1_1Math_1_1Minimizer.html) and [ROOT::Fit::Fitter](https://root.cern.ch/doc/master/classROOT_1_1Fit_1_1Fitter.html). 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?

Thank you.

---

<div class="post-metadata">

**Author:** ![oshadura](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/oshadura/32/14460_2.png) [@oshadura](https://root-forum.cern.ch/u/oshadura)\
**Post date:** [April 5, 2021, 5:25am UTC](https://root-forum.cern.ch/t/difference-between-root-minimizer-and-root-fitter/44277/2 "2021-04-05T05:25:51Z")

</div>

@moneta can you take a look please whenever you will have time? Thank you!

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [April 12, 2021, 4:20pm UTC](https://root-forum.cern.ch/t/difference-between-root-minimizer-and-root-fitter/44277/3 "2021-04-12T16:20:54Z")

</div>

Hi,  
Sorry for my late reply.  
The `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).  
The `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](https://root.cern.ch/doc/master/classROOT_1_1Fit_1_1Fitter.html#a855f1c96040f9587d35319b9228b5f04). 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 `Minimizer` class.

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 `Fitter` class.

Best regards

Lorenzo

---

<div class="post-metadata">

**Author:** ![eggsAndCoffee](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/ecb155/32.png) [@eggsAndCoffee](https://root-forum.cern.ch/u/eggsAndCoffee)\
**Post date:** [April 12, 2021, 4:45pm UTC](https://root-forum.cern.ch/t/difference-between-root-minimizer-and-root-fitter/44277/4 "2021-04-12T16:45:16Z")

</div>

Thank you for the clear explanation.
