Calling FORTRAN executable from ROOT to minimize a function using TMinuit

Sorry for my lame question as I am not so familiar with Minuit and FORTRAN. I have a FORTRAN code that calculates elastic scattering angular distribution. The input is through a .txt file in a particular format. The calculated elastic scattering has to be a fit of the experimental data through the minimization process. I am using TMinuit for that. I am using the parameters that have to be used for the minimization process, as variables in the fcn function as x[]. And then I am calling the FORTRAN executable to calculate the cross-section through system command. After that, I am obtaining the residual to be minimized.

While running the program I can see the initial value given for those parameters are changing but when the program ends it always returns back to the starting values and not showing the new values of the parameters.

Code is attached. Any leads would be very much appreciated as I could not figure out myself where things are going wrong. I have searched in the ROOT forum but no luck on this particular issue. optical_potential_parameter.C (3.0 KB)

Hi,

Does minuit tell you it succeded in finding a minimum? There is a potential problem of precision with your program. Minuit works in double precision but you seem to give the parameters with only a few digits and the output is probably also with only a few digits. This causes problems for minuit.

Cheers

Joa

Hi Joa,
Thank you for your reply and yes, you are right; the minuit is having problem in finding the minimum. In the Fortran code that I am using, the set of parameters should take definite spaces for the calculations. For example, the first parameter (x[0]) should be within 8 digits including the decimal point. Can you please give an example how to set the double precision for the parameters within the Fortran limitation mentioned above so that the Minuit works?

Thank you.

Regards,
Soumya Bagchi

Hi,
8 digits sounds liken single precision “float”. Minuit works with about 15 digits “double”. This might still be a reason for headaches…

Joa