# How to supress TMinuit warnings and retrieve FitStatus

**URL:** <https://root-forum.cern.ch/t/how-to-supress-tminuit-warnings-and-retrieve-fitstatus/34703>\
**Category:** ROOT\
**Created:** [June 19, 2019, 4:45pm UTC](https://root-forum.cern.ch/t/how-to-supress-tminuit-warnings-and-retrieve-fitstatus/34703 "2019-06-19T16:45:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mwilkins](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mwilkins/32/28332_2.png) [@mwilkins](https://root-forum.cern.ch/u/mwilkins)\
**Post date:** [June 19, 2019, 7:11pm UTC](https://root-forum.cern.ch/t/how-to-supress-tminuit-warnings-and-retrieve-fitstatus/34703/2 "2019-06-19T19:11:46Z")

</div>

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

> [@a.bragagnolo](#):
>
> How can I suppress them?

You can suppress output by doing:

```python
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.

> [@a.bragagnolo](#):
>
> I’m not finding too useful this printout

The status codes are detailed [in this post](https://root-forum.cern.ch/t/meaning-of-values-returned-by-roofitresult-status/16355/2):

> [@Meaning of values returned by RooFitResult::status(..)?](https://root-forum.cern.ch/t/meaning-of-values-returned-by-roofitresult-status/16355/2):
>
> This values depends on the Minimizer used for fitting. For example if you are using Minuit2, you will have:
> 
> ```auto
> status = 0 : OK
> status = 1 : Covariance was mad epos defined
> status = 2 : Hesse is invalid
> status = 3 : Edm is above max
> status = 4 : Reached call limit
> status = 5 : Any other failure
> 
> ```

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

> [@a.bragagnolo](#):
>
> Bonus (hard) question:
> 
> - sometimes I get a call limits, to avoid this I have increased the default number to
> 
> ```auto
> 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?

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.

---

_[View the full topic](https://root-forum.cern.ch/t/how-to-supress-tminuit-warnings-and-retrieve-fitstatus/34703)._
