Interpolator class

Hi,

Can anyone tell me why this macro doesn’t work?:

[code]{
#include “Math/Interpolator.h”

const vector E;
const vector R;

E.push_back(1);
R.push_back(1);
E.push_back(2);
R.push_back(2);
ROOT::Math::Interpolator EtoR(E,R);
} [/code]

I get the error message:

Error: Can’t call Interpolator::Interpolator(E,R) in current scope FILE:test.cc LINE:11
Possible candidates are…
Error: class,struct,union or type Interpolator not defined FILE:test.cc LINE:11

I use ROOT version 5.06 on Mac OS X.

regards,

Solveig

Replace

const vector<double> E; const vector<double> R; by

vector<double> E; vector<double> R;

Rene

I replaced the code as you requested, but I still get the same message. Is it the installation of ROOT? I used Fink Commander for this.

Solveig

Hi,

Most likely you forgot to build the optional plug-in MathMore (add --enable-mathmore to your configure line) (i.e. to you have a $ROOTSYS/lib/libMathMore.so ? )

If everything is done right (including running gmake map or gmake install after build the plugin) the #include line is not needed.

Cheers,
Philippe.

Hi,

I tried the example in root 5.10/00 on Mac OS X 10.4 installed with Fink. Root is built with --enable-mathmore and the library libMathMore exists (as does the map file).

However, cint behaves strange in my eyes:

root [3] ROOT::Math::Integrat
Integrator
Integration
root [3] ROOT::Math::Integrator
Error: Symbol Integrator is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***
root [4]

Thus the CINT knows about the Integrator in the tab completion, but not once called.

Cheers,
Remi

Hi,

The error message is a little misleading. Any it should be working.
You could try:

Cheers,
Philippe

Hi,

Here we go:

root [0] vector E;
root [1] vector R;
root [2] E.push_back(1);
root [3] R.push_back(1);
root [4] E.push_back(2);
root [5] R.push_back(2);
root [6] ROOT::Math::Interpolator r(
ROOT::Math::Interpolator Interpolator(const vector& x, const vector& y, ROOT::Math::Interpolation::Type type = Interpolation::POLYNOMIAL)
root [6] ROOT::Math::Interpolator r(E,R)
Error: Can’t call Interpolator::Interpolator(E,R) in current scope (tmpfile):1:
Possible candidates are…
Error: class,struct,union or type Interpolator not defined (tmpfile):1:
filename line:size busy function type and name
*** Interpreter error recovered ***
root [7]

Remi

The following script works perfectly for me on MacOS:

{ vector<double> R; vector<double> E; for(int i=0; i<100; ++i) { R.push_back(i); E.push_back(i*20); } ROOT::Math::Interpolator r(E,R) ; }

Philippe

Hi Philippe,

I cannot get it to run on Mac OS X 10.4 with Xcode 2.2 (gcc version 4.0.1 (Apple Computer, Inc. build 5250)).
I did the following:

  • checked out the latest version yesterday of ROOT from CVS
  • setup environment (ROOTSYS, DYLD_LIBRARY_PATH, PATH)
  • configure macosx --enable-mathmore
  • make
  • make map

The error is still the same. Can you elaborate how you compiled ROOT to get it working?

TIA,
Remi

Remi,

Did you run
make cintdlls ?

Rene

The problem is that you have not build the cintdlls
(or at least a dictionary for vector).

Do gmake cintdlls
In addition the error message is not very clear (but
if CINT was to let you pass the interpreted vector to
the compile code, you would get a crash).

Cheers,
Philippe.

Hi Philippe and Rene,

Thanks for the hint. That did it.

I new Fink package will be out soon which will include the cintdlls. It seems nobody having root installed from Fink needed them so far.

Cheers,
Remi