I stumbled upon this while implementing a minimization following these instructions. In my case the function to minimize is a method of a class, since it needs the values of some class members for computation. When I try to compile my code I get this error:
/home/mori/software/install/ROOT_6.14.02/include/Math/Functor.h:120:21: error: must use ‘.*’ or ‘->*’ to call pointer-to-member function in ‘((const ROOT::Math::FunctorHandler<ROOT::Math::Functor, double (TIC::GlobalAlignmentAlgo::*)(const double*)>*)this)->ROOT::Math::FunctorHandler<ROOT::Math::Functor, double (TIC::GlobalAlignmentAlgo::*)(const double*)>::fFunc (...)’, e.g. ‘(... ->* ((const ROOT::Math::FunctorHandler<ROOT::Math::Functor, double (TIC::GlobalAlignmentAlgo::*)(const double*)>*)this)->ROOT::Math::FunctorHandler<ROOT::Math::Functor, double (TIC::GlobalAlignmentAlgo::*)(const double*)>::fFunc) (...)’
return fFunc(x);
This is a simple demonstrator code for better understanding (compile it with: g++ -I`root-config --incdir` `root-config --libs` testFunctor.cpp):
#include "Math/Functor.h"
class TestFunctor{
public:
double ToCall(float x){
return x;
}
void Caller(){
ROOT::Math::Functor functor(&TestFunctor::ToCall,1);
}
};
int main(){
TestFunctor f;
return 0;
}
From what I understand the minimizer interface does not work when the function to minimize is a class method. Am I right or maybe I am overlooking something? Thanks.