Predefined function 'gauss' retains step-size across fits


I’m confused by the following: running successive fits with the predefined ‘gauss’ function across different histograms, it appears that the function retains the fitted parameters’ error as it’s new step-size after each run.

I do understand that this behavior is fine for custom functions, but I couldn’t find how to reset the step-size to its automatically computed values for the predefined function.

I’ve came across this behavior while working on my own code, but it is easily reproduced by running the simple minuit2GausFit.C macro in tutorials/fit. Here is how to reproduce (I am running a freshly compiled heads/master@v6-00-01-866-g5a260b2, from commit 5a260b25ee0f6d1298e28ffab142fc9ca675b633):

1- the following tiny modifications to minuit2GausFit.C allow to make the output more verbose:




2- run the macro:

root -l ./tutorials/fit/minuit2GausFit.C >> minuit2Gauss.out

3- investigate the results:

  • Original parameter values:
    NO.   NAME         VALUE      STEP SIZE      LIMITS
     1 Constant     4.57135e+01  1.37141e+01     no limits
     2 Mean         2.76000e-02  8.28000e-03     no limits
     3 Sigma        1.03818e+00  5.19090e-01    0.00000e+00  1.03818e+01
  • Results from fit1:
 FCN=65.1586 FROM MIGRAD    STATUS=CONVERGED      68 CALLS          69 TOTAL
                     EDM=3.87576e-09    STRATEGY= 1      ERROR MATRIX ACCURATE 
  EXT PARAMETER                  PARABOLIC         MINOS ERRORS        
  NO.   NAME      VALUE            ERROR      NEGATIVE      POSITIVE   
   1  Constant     3.63132e+01   1.52625e+00                            
   2  Mean         1.30820e-02   3.47499e-02                            
   3  Sigma        1.03413e+00   2.88039e-02  
  • New parameter values before fit2:
    NO.   NAME         VALUE      STEP SIZE      LIMITS
     1 Constant     4.57135e+01  1.52625e+00     no limits
     2 Mean         2.76000e-02  3.47499e-02     no limits
     3 Sigma        1.03818e+00  2.88039e-02    0.00000e+00  1.03818e+01

As can be seen, fit2 is now starting with step-size equal to to the error from converged fit1.

My concerns are the following:

  • while this behavior may be legit, it is highly error prone in practice. Typically it did affect my results and it did take some work to trace this back to its source, so I figured that I would post it here;
  • the predefined functions may have a way to reset these values, but I haven’t found it;
  • this is my understanding that the purpose of the minuit2GausFit.C macro is partially defeated by having the results from the first fit influence the results of the remaining fits.

I couldn’t locate a previous discussion of this matter, so I hope this is relevant.

Thanks in advance!

Before every …->Fit(“gaus”, “…”); call, set “errors for all active parameters” to 0 (or to any values that you consider desirable) using something like:

Double_t InitialGausErrors[3] = {0, 0, 0}; TF1 *f = ((TF1 *)(gROOT->GetFunction("gaus"))); // [0]*exp(-0.5*((x-[1])/[2])**2) if (f) f->SetParErrors(InitialGausErrors); or: TF1 *f = ((TF1 *)(gROOT->GetFunction("gaus"))); // [0]*exp(-0.5*((x-[1])/[2])**2) if (f) {f->SetParError(0, 0); f->SetParError(1, 0); f->SetParError(2, 0);}

Thanks for the quick answer (beep beep)! But wow, this is just adding to my concerns :wink: