Fit 1D function using option M

Hi everyone,

I ran into this fitting problem today. I am using ROOT 5.22, and trying to fit a Gaussian to a data distribution. I found that by adding the option M in the Fit function, i.e.

TF1 *f1 = new TF1("f1", "gaus",xMin, xMax); f1->SetParameter(1,1); f1->SetParameter(2,0.3); f1->SetParameter(0,5000); Int_t fitStatus1= h3->Fit(f1,"MR");

then fitStatus1 = 4000 and I have the following output:

[code] FCN=4.10816 FROM IMProve STATUS=RESET 16 CALLS 115 TOTAL
EDM=5.17398e-10 STRATEGY= 1 ERROR MATRIX UNCERTAINTY 50.0 per cent
EXT PARAMETER APPROXIMATE STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 Constant 7.17478e+01 4.45681e+00 4.45681e-02 -2.42411e-01
2 Mean 9.37711e-01 2.47538e-02 2.47538e-04 5.10127e+01
3 Sigma 2.02001e-01 3.47116e-02 3.47116e-04 -3.56969e+00

[/code]

But if I don’t add the M option, then fitStatus1 = 0 (according to the reference this means the fit is OK) and I get an output like:

 FCN=3.45335 FROM MIGRAD    STATUS=CONVERGED      77 CALLS          78 TOTAL
                     EDM=9.06247e-10    STRATEGY= 1  ERROR MATRIX UNCERTAINTY   1.9 per cent
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  Constant     7.45107e+01   5.02489e+00  -1.20113e-03  -7.85228e-06
   2  Mean         9.40173e-01   1.44652e-02   9.12124e-06   1.51980e-03
   3  Sigma        1.64264e-01   2.47823e-02  -1.05923e-04   1.77035e-04

But the problem is, the M option actually give me a gaussian mean close to what I’d expect for some of the distributions, whereas the no-M option gives a mean that’s slightly different. The attached graph shows the difference between the two fitting methods.

Can I trust the result given by the M option?
c1.ps (13.4 KB)

Hi,

It looks to me that when using Improve (option “M”) you are getting a worse minimum (large FCN value).
Are you sure you are fitting the same function with the same range in both cases ?
If the fit data is the same, I would take the first result, (without “M”) since it is giving a better chi2

Lorenzo