How to supress TMinuit warnings and retrieve FitStatus

Hi ROOT expert,
I’m fitting a lot (~100) of histograms in a single macro. I have two different problems:

  • I Get a lot (thousand) of the following errors
FUNCTION VALUE DOES NOT SEEM TO DEPEND ON ANY OF THE 4 VARIABLE PARAMETERS.
          VERIFY THAT STEP SIZES ARE BIG ENOUGH AND CHECK FCN LOGIC.

this floods my output and it’s very annoying. How can I suppress them?

  • I cannot printout the detailedfit results of every fit, but I’d like to know if some of them has aSTATUS = FAILED, CALL LIMIT or NOT POS DEF. How can I retrieve it? I’m not finding too useful this printout
TFitResultPtr r = hist->Fit("func","MRLSQ");
cout<<"Fit Status: "<<r->Status()<<endl;

Bonus (hard) question:

  • sometimes I get a call limits, to avoid this I have increased the default number to
ROOT::Math::MinimizerOptions::SetDefaultMaxFunctionCalls( 5000 );

this however increase a lot the annoying above-mentioned warnings. Is there a way to know if call limits was it -> increase max function calls -> re fit -> reset max function calls?

Thanks a lot,
Alberto


ROOT Version: 6.12/07


This is only a partial answer to your questions, but perhaps it will be sufficient until an expert gets back to you:

You can suppress output by doing:

ROOT.RooMsgService.instance().setGlobalKillBelow(ROOT.RooFit.FATAL)

where FATAL can be replaced by ERROR, WARNING, INFO, etc., depending on what output you want to see.

The status codes are detailed in this post:

You can, of course, check the value of the code instead of printing it.

I don’t really understand this part of your question. If you’re not worried about seeing WARNINGs, you can use the setGlobalKillBelow function mentioned above.

Hi,
this maybe is a silly advice but are you setting reasonable starting parameters for your function?
Since the fitter struggle to find a minimum of the Likelihood.

Cheers,
Stefano

Hi,

Concerning your questions:

  1. Normally you switch off all printing in TMinuit, when using from TH1::Fit by doing
    ROOT::Math::MinimizerOptions::SetDefaultPrintLevel(-1)

however those messages cannot be switched off. They can be serious and maybe it is worth understand their origin.
Otherwise they are coming from using as minimiser engine Improve or Simplex. These methods are found not too be very effective, so I would eventually avoid using them. If you find that you really need them, please let me know and it would be great if you can post an example where you show these are useful

  1. For getting the status you can both check FitResult::Status() but also FitResult::CovMatrixStatus()
    which has the meaning:
 /// using Minuit convention : =0 not calculated, =1 approximated, =2 made pos def , =3 accurate

Lorenzo

@Dilicus,
I’m already doing this, but my fit model runs over histograms with number of entries spanning order of magnitudes. So the starting parameters need to work both for 20k entries and 50.

@moneta
I will try not using Improve. I simply read “improved version” in the root guide and assumed it was strictly better.

Alberto

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