XYZPoint

Hello,

ROOT 5.34/09 (v5-34-09@v5-34-09, Jun 26 2013, 17:10:36 on linux) Arch Linux.

I’m trying to use XYZPoint in a macro but when I compile it using ACLiC:

Info in TUnixSystem::ACLiC: creating shared library /home/rmason/test/root/./lattex_C.so
In file included from /home/rmason/test/root/lattex_C_ACLiC_dict.h:34:0,
from /home/rmason/test/root/lattex_C_ACLiC_dict.cxx:17:
/home/rmason/test/root/./lattex.C: In function ‘void lattex()’:
/home/rmason/test/root/./lattex.C:40:3: error: ‘XYZPoint’ is not a member of ‘ROOT::Math’
ROOT::Math::XYZPoint v(0.0,0.0,0.0);

Trying this in CINT:

root [0] XYZPoint p(1,2,3)
Error: Invalid type ‘XYZPoint’ in declaration of ‘p’ (tmpfile):1:
Error: Function XYZPoint p(1,2,3) is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***

Can someone please tell me what I’m doing wrong?

Thanks,
Roger

Hm, this works for me (with CINT):

root[0] ROOT::Math::XYZPoint p(0., 0., 0.); root[1] p.x() root[2] (const ROOT::Math::PositionVector3D<ROOT::Math::Cartesian3D<double>,ROOT::Math::DefaultCoordinateSystemTag>::Scalar)0.00000000000000000e+00

With ACLiC you have to include the appropriate header file - Math/Point3D.h:

[code]#include

#include “Math/Point3D.h”

void a()
{
ROOT::Math::XYZPoint p;
std::cout<<p.x()<<std::endl;
}[/code]

I have ROOT 5.34.11, but think this should also work with the version you have.
I believe, XYZPoint is a part of ‘genvector’ library (I’m not sure, may be it’s always enabled by default) so you probably have to check if it was built at all - have a look at config.log, for example or check that you have libGenVector in your lib directory.

Thanks for your help.

Heres what happens with 5.34.10:

root [0] XYZPoint p(1,2,3)
Error: Invalid type ‘XYZPoint’ in declaration of ‘p’ (tmpfile):1:
Error: Function XYZPoint p(1,2,3) is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***
root [1] ROOT::Math::XYZPoint p(1,2,3)
Error: Syntax error (tmpfile):1:
*** Interpreter error recovered ***
root [2] ROOT::Math::XYZPoint p(0., 0., 0.);
root [3] ROOT::Math::XYZPoint p(1.0,2.0,3.0)
root [4] using namespace ROOT::Math
root [5] XYZPoint p(1,2,3)

So, using XYZPoint with integers does not work unless the namespace is declared. Here’s what happens if the namespace is declared and a constructor with floats is used:

root [1] using namespace ROOT::Math
root [2] XYZPoint p(1.0,2.0,3.0)
Error: Syntax error (tmpfile):1:
*** Interpreter error recovered ***

I have no idea what is going on or if I should trust XYZPoint.

Roger

[quote=“Roger Mason”]Thanks for your help.

Heres what happens with 5.34.10:

root [0] XYZPoint p(1,2,3)
Error: Invalid type ‘XYZPoint’ in declaration of ‘p’ (tmpfile):1:
Error: Function XYZPoint p(1,2,3) is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***
root [1] ROOT::Math::XYZPoint p(1,2,3)
Error: Syntax error (tmpfile):1:
*** Interpreter error recovered ***
root [2] ROOT::Math::XYZPoint p(0., 0., 0.);
root [3] ROOT::Math::XYZPoint p(1.0,2.0,3.0)
root [4] using namespace ROOT::Math
root [5] XYZPoint p(1,2,3)

So, using XYZPoint with integers does not work unless the namespace is declared. Here’s what happens if the namespace is declared and a constructor with floats is used:

root [1] using namespace ROOT::Math
root [2] XYZPoint p(1.0,2.0,3.0)
Error: Syntax error (tmpfile):1:
*** Interpreter error recovered ***

I have no idea what is going on or if I should trust XYZPoint.

Roger[/quote]

You can trust ACLiC’ed version of your code for sure.
Also, as I’ve just noticed, you can do gSystem->Load(“libGenVector.so”) and everything works - default ctors, using directives, ints as ctor arguments instead of doubles etc.