TF1 from ROOT::Math::Interpolator

I am following the example here: http://root.cern.ch/drupal/content/function-interpolation with some modification. I made a function which returns a pointer to a new ROOT::Math::Interpolator object. These objects can be “called” like a function with p->Eval(x). I would like to turn these into TF1s or TGraphs for graphing, but very awkward to need to define double arrays and fill them in a manual loop. It seems that the TF1 constructors can almost do this already: http://root.cern.ch/root/html/TF1.html#F5

However if I try to do this, I run into the problem that the Eval() method’s signature is only (double x), not (double *, double *). Why is there this requirement on the functor call signature? Isn’t that what the “npars” constructor parameter for, to count how many extra variables are in the functor call signature?

Here is the constructor that I tried, with the error message.

TF1 * f = new TF1("f",p,&ROOT::Math::Interpolator::Eval,-0.6,0.6,0,"ROOT::Math::Interpolator","Eval"); Error in <TF1::TF1>: No function found in class ROOT::Math::Interpolator with the signature Eval(Double_t*,Double_t*)

I’m wondering if there is a simple workaround, or if it is possible to extend the TF1-from-functor constructor to allow a more simple call signature. I guess overloading the Interpolator::Eval method would also fix this, but it seems the wrong way to go about it.

Thanks,
Jean-François

I eventually worked around the problem myself by creating a derived class MyInterpolator which inherits from ROOT::Math::Interpolator. It overloads the Eval method with the signature Eval(double *, double *), allowing it to be used in the TF1 constructor.

Constructor inheritance question that was also resolved:
[url]Inheriting Constructors

Jean-François