Minuit1 vs Minuit2

I am trying to port some code from Minuit1 to Minuit2. Some times I do get the exact same result, but some others I don’t. I believe this is because I have not set everything in Minuit2 to be exactly the same as Minuit1.

These are some things I don’t know how to set equally in Minuit2 (or I am not 100% sure)

arglist[0] = 1.0;
rfitter->mnexcm("SET ERR", arglist , 1, ierflg); 

Is this the same as having Up() in Minuit2 return 1?

arglist[0] = 6.0; 
rfitter->mnexcm("CALL FCN", arglist, 1, ierflg); 

What is this, how do I set Minuit2 with the same?

arglist[0] = 500.0;
arglist[1] = 0.1;
rfitter->mnexcm("MIGRAD", arglist, 2, ierflg);

Same as above. How to set the same for Minuit2.

  1. Once this are set equally in Minuit1 and Minuit2. Should I always get the exact same result from both? As I said, I do get the same result now in some cases. Some others (mostly when it fails) I don’t get the same.

I assume it is because I haven’t set up the same number of calls, etc.

Thanks.

Hi @Daniel_Duque ,
I think @moneta will be able to help, let’s ping him.

Cheers,
Enrico

Hi,
Here are the answers:

  1. This is the same as re-defining Up() value in Minuit2. You can use the SetErrorDef method on the function class (see ROOT: ROOT::Minuit2::FCNBase Class Reference) or if using the ROOT::Math::Minimizer interface, the SetErrorDef of the MInimizerOptions class (see ROOT: ROOT::Math::MinimizerOptions Class Reference).

  2. Here in F77Minuit we are calling the FCN function passing the special flag=6. There is no such funcitonality in Minuit2. The user defines the FCN function and he can call directly as he prefers.

  3. This is calling MIGRAD with Maxfunction calls = 500 and tolerance = 0.1. In Minuit2 they are passed directly when you call Minimize (see ROOT: ROOT::Minuit2::ModularFunctionMinimizer Class Reference) or set again as options in the MinimizerOptions class when using the ROOT::Math::Minimizer interface.

  4. You should get same result, but not exactly identical. There are some small differences, for example I think a slightly different definition of the tolerance, and in some cases a couple of fixes applied in Minuit2. If you observe a large difference, for example a different minimum and incorrect in Minuit2, please let me know. I will be interested in that case to get the reproducible code so I can investigate it

Cheers

Lorenzo