Suppressing warning from histogram fitting

Hi all.

When I fit a histogram, I sometimes see following warning message.


Maybe I am doing something wrong in fitting.
But I want to suppress the warning.

This is a ridiculous fitting just for reproducing the warning.

TH1F hist("hist","hist",2,0,10); hist.Fill(5); TF1 f1("f1","gaus"); f1.SetParLimits(1,-1,-0.5); hist.Fit("f1","");

How can I suppress the warning ?

I use v5.22, and I didn’t have the warning when I used v.5.20.

Thank you.

hist.Fit(“f1”,“Q”); // to avoid printing stuff


hist.Fit(“f1”,“QN”); // also to avoid plotting/adding function to histogram storage

BTW, that was nasty fit on 2 bin 1 entry histogram with Gaussian :slight_smile:

Thank you for reply.

I tried hist.Fit(“f1”,“QN”), but I still have the warning.

Could you please try the example, with ROOT v5.22 ?
Do you think it can depend on platform or configure option ?

I compiled from source on Scientific Linux.

[code]> root-config --version

root-config --features
asimage astiff builtin_afterimage builtin_ftgl builtin_freetype builtin_pcre builtin_zlib cintex exceptions fftw3 krb5 ldap genvector memstat mysql opengl pgsql python reflex roofit shadowpw shared ssl xft xml xrootd thread

root-config --platform

I don’t see much point in tickling old versions.

Update root to svn and then your problems would get much more attention from developers :slight_smile:.

and no, it should not be dependent on OS or flags.

Thank you for suggestion.

I tried SVN version, but I still have the probelm.

[code] *******************************************

  •                                     *
  •    W E L C O M E  to  R O O T       *
  •                                     *
  • Version 5.23/01 18 December 2008 *
  •                                     *
  • You are welcome to visit our Web site *
  •            *
  •                                     *

ROOT 5.23/01 (trunk@27444, Feb 13 2009, 03:16:58 on linux)[/code]

The fitting of my example is only for reproducing the problem, since actual code of our analysis software is too long to put here.
We are using fitting of histograms during event reconstruction of experiment. The result of fitting is ok.
We are using v5.18 as our collaboration’s standard, and we are thinking to upgrade to v5.22. (v5.22 is the latest production version.)

It is rather annoying that we have this warning for milions of events we are analyzing.
(Maybe, we should also check if we are using fitting correctly.)
So, I would like to know how to suppress the warning.

Thank you.

I found that the following should get rid of warnings.
But it does not .


You might wana look at those TFitter, TMinuit classes and figure out whats going on.
But since you compile it yourself anyway, you may just change

fLwarn = kTRUE;


fLwarn = kFALSE;

in TMinuit.cxx

and keep doing useful work instead :slight_smile:.

I modified TMinuitMinimizer.cxx locally, and recompiled ROOT.
Then the warning disappeared.

[code]— 2009-02-15 04:44:22.000000000 +0100
+++ TMinuitMinimizer.cxx 2009-02-15 04:45:04.000000000 +0100
@@ -146,6 +146,8 @@
int ierr= 0;

fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
  • // suppress warning in case Printlevel() == 0
  • if (PrintLevel() == 0) fMinuit->mnexcm(“SET NOW”,arglist,0,ierr);


@@ -186,6 +188,8 @@
int ierr= 0;

fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
  • // suppress warning in case Printlevel() == 0

  • if (PrintLevel() == 0) fMinuit->mnexcm(“SET NOW”,arglist,0,ierr);

    // set gradient
    // use default case to check for derivative calculations (not force it)[/code]

Thank you for your help.



I’m having the same issue. Basically what I do is that:

for(int i = 0 ;i< N ;i++){
TH1F* histo = (TH1F*) myFile->Get(Form(“histo%i”,i)); // Retrieve histo #i
histo->Fit(“MyFunction”) // Fit it

where MyFunction whose parameters have limits.

I get the tedious warning :

I tried to call the mnexcm command but I don’t know how to call it.
I tried to add that at the beggining of my code but nothing changed :

Int_t ierr=0;
TMinuit t; // I assumed I had to create an instance of TMinuit before calling gMinuit … but I don’t know
gMinuit->mnexcm(“SET NOWarnings”,0,0,ierr);

Could someone help me ?

Thank you very much.