Can't Obtain Fit Result When Using Option "E"

Dear experts,
The problem is as stated…
Relative codes are here:

M_Plot[i]->Fit(myf, " E ", "", LMdata, HMdata);
double partmp[6] = {0.};
myf->GetParameters(partmp);
cout<<Form("(mu, sig, alpha, mid) = (%e, %e, %e, %e)", partmp[1], partmp[2], partmp[3], partmp[1]-partmp[2]*partmp[3] )<<endl;

We expect the terminal will cout the same values of parameter 1 to 3, as they showed up in the fit result. However,

 NEW MINIMUM FOUND.  GO BACK TO MINIMIZATION STEP.
 =================================================
                                                  V
                                                  V
                                                  V
                                               VVVVVVV
                                                VVVVV
                                                 VVV
                                                  V

 FCN=42.4077 FROM MINOS     STATUS=SUCCESSFUL    184 CALLS        3601 TOTAL
                     EDM=2.90446e-08    STRATEGY= 1      ERROR MATRIX ACCURATE 
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  p0           1.75221e+01   3.24523e+00  -2.14388e-05   2.78000e-04
   2  p1           3.06457e+00   1.64275e-02   1.81737e-04  -1.69543e-04
   3  p2           8.59115e-02   1.71557e-02   2.37420e-05  -9.19882e-04
   4  p3           1.09486e+00   6.01211e-01   2.96190e-04   1.23849e-04
   5  p4           6.33231e+00   3.97441e+00  -8.28563e-06   2.02861e-03
   6  p5           3.17584e-01   2.12216e-01   2.12216e-01  -1.65803e-01
(mu, sig, alpha, mid) = (3.100000e+00, 4.752677e-02, 3.894074e-01, 3.081493e+00)

So obviously something is not working properly.
Ps: In case this information is needed, for p1, 3.1e0 is set to be the upper limit.


Please read tips for efficient and successful posting and posting code

ROOT Version: 5.34/38
Platform: Fedora 30
Compiler: gcc 4.4.7


https://root.cern/root/htmldoc/guides/users-guide/FittingHistograms.html#result-of-the-fit

@dastudillo Do you suggest that @zyzhang improperly uses the TF1::GetParameters method?

@zyzhang @moneta It looks like a bug to me. You are using an old ROOT 5.34/38 version, which is no longer maintained. Can you try with the latest release? If the problem is still there, can you prepare and post here a “reproducer”?

Just suggesting to try (and print) GetParameter(i) directly. Without seeing the rest of the code it’s mostly guesswork; e.g. are we sure the code zyzhang wrote above are consecutive lines in the actual macro? and so on…

@dastudillo These are indeed consecutive lines in the actual macro, and all other irrelevant parts are disabled therefore I’ve posted all the print here (except that huge box after opening up ROOT)
@Wile_E_Coyote I’m also suspicious that the outdated version causes this problem. I’ll try with the latest release but it will take some time to install it and make the code compatible.

Hi @zyzhang,

As @Wile_E_Coyote mentioned, ROOT 5.34 is not maintained anymore -actually, a lot of things changed since then-. Could you try with a recent ROOT version, e.g. 6.24, and see if the problem is there?

Cheers,
J.

@jalopezg @Wile_E_Coyote I tried with pre-compiled 6.24/00 version and this problem does not show up with the same code. Guess it’s better to stick with updated version.
Cheers

As of today (2021.07.13) the latest release is 6.24/02.

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