Fitting with gMinuit routines

ROOT Version: 6.08
Platform: Dell Latitude E6540
Compiler: Oracle Virtual Box


This is about a problem with errors estimated by gMINUIT, using a stand-alone C++ code compiled against ROOT and MINUIT

I have ported a FORTRAN code used to fit thermal, epi-thermal and fast neutron fluxes at a research reactor using tabulated cross sections, known elemental amounts (a NIST reference material is used) and measured activities.
The code has been, more or less, translated from FORTRAN to C++. The same MINUIT routines are being called in the same order. I found that the neutron flux values come back more or less the same from the FORTAN and C++ codes. However, the estimated uncertainties are very different. I am using the same delta chi^2 condition of 1 in both codes. I find the ratio of errors (C++/FORTRAN) for thermal, epi-thermal and fast fluxes to be on average 0.82, 0.32 and 0.38. 16 different data set have been re-evaluated with consistent results. While the flux fit values reported by the FORTRAN and C++ codes are very similar the best fit chi^2 values are not.
To find out what’s right and what’s wrong I calculate the chi^2 value using the mnstat routine of ROOT and calculate chi^2 “by hand” using the fit results and data. In this exercise the “by-hand” chi^2 values agree with those obtained with the FORTRAN code. Furthermore, I scanned Delta chi^2 for the thermal flux component, also by-hand (re-minimizing the other fit components at every step) and find that the error obtained that way in the C++ code agrees with those reported by the FORTAN code but disagrees with those reported by either MIGRAD or MINOS.
I am puzzled. Is this a known problem? I have carefully checked my “by-hand” chi^2 routing against the function being minimized by MINUIT and find them equivalent. The delta chi^2 curve is found to be approximately parabolic in the example I did. I would greatly appreciate any input people could give to this.

Thanks

Andreas Piepke
University of Alabama

Hi,

I have not understood exactly how you are doing the fit in ROOT. You can in ROOT either fit a set of points directly (e.g. an histogram or a graph) or by computing the chi2 and using MINUIT to minimise it.
Which one are you using in ROOT/C++ and in Fortran ?
If you fit a Graph (without errors) some normalisation of the chi2 is applied automatically in ROOT and this could explain the difference.
I would need however to see at least your code to understand better the cause

Best Regards

Lorenzo

Hi Lorenzo,

Thanks for your reply. I am not fitting any TGraph or histogram in ROOT. I am using MINUIT directly to minimize a chi^2 function I have formulated as an external function. This takes the form of a stand-alone C++ code I can compare against a stand-alone FORTRAN code doing the same thing. This code is compiled against the ROOT and MINUIT libraries. I am only using ROOT to visualize the fit results. When I am running the code it opens a canvas and plots various graphs. The data does come with errors which are utilized by the function being minimized. This procedure gives consistent fit values when comparing the original FORTRAN with the new C++ code but different chi^2 values and different error estimates for the fit values. That’s what puzzles me. Does this make things clearer? The FORTRAN and C++ codes have about 900 lines each, plus a long header file with the cross section, life time, isotopical abundance data etc. Posting this here would be impractical.

Best regards

Andreas

Hi,

Are you 100% sure that your Fortran code and the equivalent C++, implementing the chi^2 function, compute numerically the same thing ? Given the same input they should produce identical results. If not,
even a some small differences, will result ini different results after the minimisation using MIINUIT.

Lorenzo

Hi Lorenzo,

Thanks for your cautionary remark. I compared the two codes again and indeed found a small but important difference. The ordering of an “endif” and “}” statement were different. Fixing this issue solved the problem.

Thanks again

Andreas

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