when running my Python/PyROOT version of
math/minuit2/test/testMinimize.cxx
(from the source tree of ROOT-5.20) - see attached file - I get the following message:
The actual function to be minimized is not even called by the minimizer (at least there was no output when I inserted a print statement into the call method of the MyFCN class).
So I assume I made a mistake regarding the definition of MyFCN.
this isn’t going to work: the C++ vtable, as used to call derived class functions does not know anything about python dictionary look-ups, which that language uses for overriding functions in derived classes.
For TMinuit, there is a replacement of SetFCN() that makes it possible to forward calls from C++ into the python class. I wasn’t aware of the existence of TFitterMinuit (in fact, it doesn’t appear to be built by default on my system), and so there’s no corresponding function for it, since I never wrote one.
What would be needed, is a derived class written in C++ that would forward to the python class that subsequently derives from that class (see pyroot/src/TPySelector.h/.cxx for an example).
I put it on my TODO list, but I’m not going to be able to do any work on it until at least late September. Feel free to file a savannah feature request also.
I would suggest you to to the python wrapper for the ROOT::Math::OOT::Math::IBaseFunctionMultiDim which is used by the ROOT::Math::Minimizer class. This is now the recommended entry point for using all the minimization algorithm in ROOT, including TMinuit.
See root.cern.ch/drupal/content/how- … -framework