How to use the 3D vector class

Hello All,
I am trying use the vector class. I was wondering if someone could point out how I read co-ordinates into the vector. Here is my attempt:

[code]#include "Math/Vector3D.h"
void test() {
#ifdef CINT
gSystem->Load(“libMathCore”);
using namespace ROOT::Math;
#endif

XYZVectorF p1,p2;
Float_t temp;
TFile f("2007-10-01.root");
TTree *Coincidences = (TTree*)gDirectory->Get("Coincidences");

Coincidences->SetBranchAddress("globalPosX1",&temp);
p1->SetX(temp);	

}[/code]

I get this error:


Error: Can’t call DisplacementVector3D<ROOT::Math::Cartesian3D,ROOT::Math::DefaultCoordinateSystemTag>::SetX(temp) in current scope test.C:22:
Possible candidates are…
*** Interpreter error recovered ***

Thanks

MT

Modify your script and run it with ACLIC
root > gSystem->Load(“libMathCore”);
root > .x m3d.C+

Rene

[code]#include “TFile.h”
#include “TTree.h”
#include "Math/Vector3D.h"
void m3d() {
using namespace ROOT::Math;
#ifdef CINT
gSystem->Load(“libMathCore”);
#endif

XYZVectorF p1,p2;
Float_t temp=0;
TFile f(“2007-10-01.root”);
TTree Coincidences = (TTree)gDirectory->Get(“Coincidences”);

if (Coincidences) Coincidences->SetBranchAddress(“globalPosX1”,&temp);
//you must read some entry,eg
//Coincidences->GetEntry(0);
p1.SetX(temp);
}
[/code]