Hi,
I am trying to run toys with a relatively simple RooFit set up.
It is a simultaneous fit, with 160 categories. For each category there are also some shape parameters to describe a mass distribution but all of these parameters are fixed. To go with these shapes, each category has 21 yields which are made up of RooRealVar and RooFormulaVar and eventually end up with 292 floating parameters to cover all categories.
The problem I am having is that the memory usage varies quite a lot between seeds for the toys. For example one would use around 4GB, but another would use ~40GB. I am using the exact same code in these cases, the only difference between the seed with which the toys are generated. All toys are generated with roughly the same number of events (they are Poisson distributed about a mean). They are generated as binned datasets (RooDataHist) and each time with the same number of bins (50 bins per category). The amount of memory/time for the toy generation does not vary hugely.
I am using Minuit2 as the minimizer. I have also tried Minuit, but find that the convergence rate for my toys is reduced significantly and sometimes the memory usage is also quite high.
I am also running these toys on condor (1 toy per job) and have found that setting the PrintLevel to -1 (i.e. no output) reduced the memory usage for some toys.
Is this something that anyone else has come across?
Does anyone have any suggestions for a fix or what to do to further investigate the issue?
Below is a code snippet of the fit function I am using after using createNLL
RooFitResult * B2DhPartRecoGGSZCPFitter::fit(RooAbsReal* nll, bool fit_1) {
RooMinimizer minimizer = RooMinimizer(*nll);
STD_OUT("OK in fit function");
minimizer.setMinimizerType("Minuit2"); // Minuit, Minuit2, can't use Fumili, GSLMultiMin
minimizer.optimizeConst(true);
minimizer.setProfile();
minimizer.setMaxFunctionCalls(1E6);
minimizer.setMaxIterations(1E6);
minimizer.setOffsetting(true);
minimizer.setEps(0.01);
minimizer.setPrintEvalErrors(-1);
minimizer.setPrintLevel(-1);//1); // None =-1 , Reduced =0 , Normal =1 , ExtraForProblem =2 , Maximum =3
if(fit_1){
minimizer.setStrategy(0);
minimizer.migrad();
}
else{
for (int strat = 1; strat <= 2; strat++){
minimizer.setStrategy(strat);
minimizer.migrad();
minimizer.hesse();
const RooFitResult& res = *RooMinimizer::lastMinuitFit();
if (res.status() != 0 || res.covQual() != 3){
STD_OUT("FAILED TO CONVERGE WITH STRATEGY " << strat << " -- STATUS " << res.status());
STD_OUT("FAILED TO CONVERGE WITH STRATEGY " << strat << " -- COVQUAL " << res.covQual());
}
else{
break;
}
}
}
return minimizer.save();
}
Thanks,
Seophine