Switching between Minuit1 and Minuit2

In my fitter, I create a RooMinuit object, feeding it my negative-log-likelihood, and then asking it to fit in Minuit2:

RooAbsReal* nll_hf = model_modified->createNLL(*data);
RooMinuit* minuit_hf = new RooMinuit(*nll_hf);
RooFit::Minimizer("Minuit2");
minuit_hf->setStrategy(2);
minuit_hf->fit("smh");

After the fitting, I want to do some plotting. However, I want to switch to Minuit1 for the plotting (for the minuit_hf->contour). May I ask how to do it?

Perhaps @Jonas can help? Anyone else who knows about this question, would greatly appreciate too

Hi @delick,

thanks for your question and you’re correct, @jonas should be able to help here!

Cheers,
Marta

Hi!

What you are attempting there in the code doesn’t work. The RooMinuit class is a wrapper around the old Minuit 1. To be able to switch between Miniut 1 and Minuit 2, use the newer RooMinimizer class.

Then, you can switch the underlying minimizer at any time, also between calling Migrad and contour:

  m.setMinimizerType("Minuit");  // for Minuit 1
  m.setMinimizerType("Minuit2"); // for Minuit 2

You can find more info about the switch from RooMinuit to RooMinimizer here:

Also note that RooFit::Minimizer("Minuit2") like in your snippet has absolutely no effect. It only makes sense as a command argument to RooAbsPdf::fitTo() to control the Minimizer type used in the fit.

Cheers,
Jonas

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