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.