Understanding MINUIT

Dear All,
This post is for understanding a bit better TMinuit.
The following lines:

TVirtualFitter::SetDefaultFitter("Minuit"); TVirtualFitter * minuit = TVirtualFitter::Fitter(0,10); for (int i = 0; i < 10; ++i) { minuit->SetParameter... } minuit->SetFCN(myFcn); double arglist[100]; arglist[0] = 0; // set print level minuit->ExecuteCommand("SET PRINT",arglist,2); // minimize arglist[0] = 5000; // number of function calls arglist[1] = 0.01; // tolerance minuit->ExecuteCommand("MIGRAD",arglist,2);

are taken from the ROOT tutorial:

https://root.cern.ch/root/html/tutorials/fit/TwoHistoFit2D.C.html

I am not really sure about a few points:

  1. TVirtualFitter * minuit = TVirtualFitter::Fitter(0,10);

I guess that the 10 refers to the number of parameters, but I am not too sure about the zero.

  1. double arglist[100]; arglist[0] = 0; // set print level minuit->ExecuteCommand("SET PRINT",arglist,2);

why arglist[0] = 0 and the final 2 after SET PRINT??

  1. most importantly,
    // minimize arglist[0] = 5000; // number of function calls arglist[1] = 0.01; // tolerance minuit->ExecuteCommand("MIGRAD",arglist,2);

this is surely related in the error assignment to each parameter. I am not sure how to change the tolerance and how it would impact the error itself. I can only see it changes WILDLY. I have read the original MINUIT papers for FORTRAN, and it says that ERROR DEF should be 1.0 for a normal ChiSquare…

Any help is really appreciated!!
Thanks,
Simone

@moneta can you please help here?

Thank you in advance,
Oksana.

HI,

You are using the old TFitter class that is not recommended anymore.
It is based on the original Fortran API, so if you want to use it you should look at the
Minuit Fortran manual and you understand the meaning of the arlglist parameters passed in
ExecuteCommand

I would suggest you to use directly the ROOT::Fit::Fitter class, which has a C++ API, as in the example

line3Dfit.C https://root.cern.ch/doc/master/line3Dfit_8C.html

or use the lower level Minimiser interface, as in

https://root.cern.ch/doc/master/NumericalMinimization_8C.html

If you have questions, please let me know

Lorenzo

Thanks for the suggestions!

I will surely have a look.

I was actually specifically asking for this one, because I had previously read the original FORTRAN MINUIT manual, but it is a bit unclear how arglist is/would be related to the ERRORDEF.

Thanks,

Simone

Hi

Sorry I was not clear. The argilst is an array used to pass the input parameters for the MINUIT Fortran commands. The available commands are available in the Users Guide
see https://root.cern.ch/download/minuit.pdf page 19

For example:

  • the command MIGRAD takes two parameters (maxcalls and tolerance ), so you need to have an argilst of size 2 with argils[0] = maxcalls and arglist[0] = tolerance
arglist[0] = 5000; // number of function calls
arglist[1] = 0.01;  // tolerance
minuit->ExecuteCommand("MIGRAD",arglist,2);
  • the error definition (1 for chi-2 minimisations, 0.5 for negative log-likelihood) is set by using the command SET ERR . The command takes one parameter, the error level (e.g. 1 or 0.5)
arglist[0] = 1;   // error level for chi2 minimisation
minuit->ExecuteCommand("SET ERR",arglist,1);

Lorenzo

Many thanks!

This was really clear and confirmed what I suspected.

I had confused a bit the tolerance level with the errordef…

Many thanks,

Simone

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