Changing minimizer options in RooAbsPdf fitTo

Hello,

I’m facing a problem with changing the minimizer options when performing my unbinned weighted likelihood fit.
The ROOT::Math::MinimizerOptions commands do not change anything in the RooMinuit or RooMinimizer which is used in fitTo in the following code :

ROOT::Math::MinimizerOptions::SetDefaultTolerance(1.0); 
ROOT::Math::MinimizerOptions::SetDefaultMaxIterations(10000); 
ROOT::Math::MinimizerOptions::SetDefaultMaxFunctionCalls(10000);
ROOT::Math::MinimizerOptions::SetDefaultMinimizer("Minuit2");
RooFitResult *r = sig->fitTo(wdata, Save(), SumW2Error(kTRUE), PrintLevel(0));

I have tried many changes, like using RooMinimizer directly, but this is not a very satisfactory solution for me because it does not correct the covariance matrix like the SumW2Error(kTRUE) option does above.
I can only change the Minimizer in fitTo but I’d also like to change e.g the tolerance and the number of calls…

Here is what i tried with RooMinimizer:

RooFitResult *r = 0;
RooNLLVar *nllt = new RooNLLVar("nllt","-log(L)",*sig,wdata,DataError(RooAbsData::SumW2)) ;
RooMinimizer mini(*nllt) ;
mini.optimizeConst(kTRUE) ;
mini.setEps(100);
mini.setMaxIterations(10000);
mini.minimize("Minuit2","Migrad") ;
mini.hesse() ;
r = mini.save() ;

Can anyone please help me?
Cheers,
Fabrice

Hi,

It is true that tolerance and max-iterations cannot be passed as options in fitTo, but they can be controlled via RooMinimizer::setEps and RooMinimizer::setMaxIterations.
We should ad this possibility, the only solution is to use directly the RooMinimizer class. But in this case you need to perform two minimization to apply the correction, one to the standard weighted likelihood and one to the likelihood weighted with the square of the weights.
See the RoOAbsPdf implementation at root.cern.ch/root/html/src/RooAb … .html#1219 (from line 1220 to 1270)

Best Regards

Lorenzo

Hi Lorenzo,
thanks a lot for your answer, I think this is a good spare solution for me for the moment.
Cheers
Fabrice