Switching from RooMinuit to RooMinimizer

I noticed that RooMinuit is deprecated and will be removed in Root v6.30, and that RooMinimizer should be used.

My current code has:

RooAbsReal* nll_hf = model_modified->createNLL(*data);
RooMinuit* minuit_hf = new RooMinuit(*nll_hf);

To write the equivalent code with RooMinimizer, am I right that I can construct the object and set strategy the same way, but need to split the fitting part up myself? In essence:

RooAbsReal* nll_hf = model_modified->createNLL(*data);
RooMinimizer* minuit_hf = new RooMinimizer(*nll_hf);
minuit_hf->hesse(); //Calculate errors for initial step size
minuit_hf->migrad(); //Fit
minuit_hf->hesse(); //Calculate final errors

Hi @delick.

thanks for your question. Maybe @jonas could take a look here?


That’s correct!

As a side note, you can also look at the old code of RooMinuit to see what RooMinimizer routines the characters in the option string correspond to:

Thanks a lot @Jonas . When I run the first minuit_hf->hesse();, RooMinimizer complains that I need to run MIGRAD before running HESSE. I want to run HESSE before MIGRAD to get the initial step size (just like how my old code does, as explained above in my question). Is there a way of overcoming that issue?

Hi @Jonas, may I follow up on my most recent question? Would greatly appreciate!

Hi! It is not necessary to do the initial Hesse explicitly like this. If the step size is not estimated yet when running migrad for the first time with Minuit strategy 2, it will do an initial Hesse anyway. The new interface is more pedantic there so the user does not do unnecessary steps.

But still, there seem to have been cases where this initial Hesse can help with the fit, as this tutorial indicates:

I don’t see how this would help, but it would be good to also get @moneta’s opinion on that. Was at a mistake to prevent this initial Hesse call in the RooMinimzier? It was never possible with the RooMinimizer because of this check:

If calling HESSE before Migrad would actually be useful, it’s very surprising that nobody reported that it doesn’t work.

The only thing that I can say for certain is that if your fit converges, it’s fine :+1:

Does the initial Hesse actually help in your fit? If yes, could you please let us know so we can understand these cases where forcing an initial Hesse call is necessary?

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