I first posted this topic on the general forum [cannot add link due to being a new user], but did so at the beginning of the Christmas holidays and got no replies. I am afraid it might have been automatically locked before the relevant people could see it. I hope posting it again here is not frowned upon (moderators could remove the previous topic if it helps?).

I am running into an issue when running Minuit2 “Contour” function, in which the output points do not have the desired “height”, which I previously set with SetErrorDef(). I am changing ErrorDef based on my weak attempt at interpreting the code - the documentation itself refers to ErrorUp, but it does not appear anywhere else, as far as I can tell.

Here is a snippet of code to ilustrate what I am trying to do:

```
/*** Initialize minimizer, variables ***/
ROOT::Math::Minimizer* rootmin = ROOT::Math::Factory::CreateMinimizer("Minuit2","Combined");
rootmin->SetMaxFunctionCalls(100000);
rootmin->SetMaxIterations(100000);
rootmin->SetTolerance(0.02);
rootmin->SetFunction(LFunc);
//LFunc is a log-likelihood ( -2*log(L) ) function/functor defined earlier in the code
rootmin->SetLimitedVariable(0,"Variable0",pars[0],0.1,0.01, 1e4);
rootmin->SetLimitedVariable(1,"Variable1",pars[1],0.1,0.01, 1e4);
rootmin->SetLimitedVariable(2,"Variable2",pars[2],0.1,0.01, 1e4);
rootmin->SetLimitedVariable(3,"Variable3",pars[3],0.1,0.01, 1e4);
//pars, holding initial guesses for fit, is also defined earlier
/*** Run minimiser, contour ***/
double Delta2LogL = 2.7;
rootmin->SetErrorDef(Delta2LogL);
rootmin->Minimize();
cout << " Value of minimum log-Likelihood : " << rootmin->MinValue() << endl;
double varcont0_pts[npointscont];
double varcont1_pts[npointscont];
unsigned int npoints = 100;
rootmin->Contour(0, 1, npoints, varcont0_pts, varcont1_pts);
```

So now varcont0_pts and varcont1_pts hold the coordinates of the contour, which I would expect all have a minimum log-likelihood that is Delta2LogL points above the minimum found by the minimiser.

However, if I do the following:

```
size_t i_cont = 0; //choose any value between 0 and 99
rootmin->SetVariableValue(0, varcont0_pts[i_cont]);
rootmin->FixVariable(0);
rootmin->SetVariableValue(1, varcont1_pts[i_cont]);
rootmin->FixVariable(1);
rootmin->Minimize();
cout << " Value of log-Likelihood at contour : " << rootmin->MinValue() << endl;
```

I find that the difference in log-likelihood (between the minimum and the points in the contour) is not what I asked for with SetErrorDef(). In fact, I find the same contour points no matter what value I request for the difference.

I assume I am not using the minimizer properly somehow, but I don’t know how to proceed from here. Could anyone help me?

Thank you for your time!