Hi,
I have defined my own interpolation classes and want to use them with TF1 (primarily for plotting). I followed the examples on the page: root.cern.ch/root/html/TF1.html as shown below.
Instead of having a member function called Evaluate, I overloaded the () operator. However, when I try the example example as shown below (simply replacing Evaluate with operator()) I am getting compile errors. I wanted to verify that this method is correct in order to user a member function with TF1.
Below, I copy the information from the ROOT web page:
E - A member function with parameters of a general C++ class
A TF1 can be created in this case from any member function of a class which has the signature of (double * , double *) and returning a double.
Example:
class MyFunction {
public:
…
double Evaluate() (double *x, double *p) {
// function implementation
}
};
{
…
MyFunction * fptr = new MyFunction(…); // create the user function class
TF1 * f = new TF1(“f”,fptr,&MyFunction::Evaluate,0,1,npar,“MyFunction”,“Evaluate”); // create TF1 class.
…
}