How to execute macros? Please put it in the Users Guide

It seems to me that the ROOT documentation doesn’t tell much how to execute macros, at least I couldn’t find it.
Here is a simple macro: TLV_test.C
{
#include “TLorentzVector.h”
#include "TVector3.h"
TLorentzVector A(1,1,1,2);
TLorentzVector B;
TVector3 V;
Float_t mA = A.M();
V = A.BoostVector();
B = A;
B.Boost(-V);
cout << endl << endl << “Test of Lorentz Vector algorithms” << endl;
cout << "Original 4 components of A: " << A.Px() << " " << A.Py() << " " << A.Pz()
<< " " << A.E() << endl;
cout << "Boost vector components of A: " << V.Px() << " " << V.Py() << " " << V.Pz() << endl;
cout << "4 components of A are boosted to its proper system B: " << B.Px() << " "
<< B.Py() << " " << B.Pz() << " " << B.E() << endl;
cout << "E(A): " << A.E() << " M(A): " << mA << " E(B): " << B.E() << endl << endl;
}

When in a ROOT session I type either
.L TLV_test.C++
or
.x TLV_test.C
in both cases I get error messages.

Please tell me how to excute this macro and if it is indeed not in the Users Guide please put it in. If it is in the Users Guide please indicate me where I can find it.

Thanks and regards,

                            Elemer

Hi Elemer,

What you need is written on the first page of the chapter 15 “Physics Vectors” (page 283):

In order to use the physics vector classes you will have to load the Physisc library, e.g.
you need gSystem->Load(“libPhysics.so”) before to run your macro.

Cheers, Ilka

Hi Elemer,

Note that since you are not specifying neither the error message nor your ROOT version, we are guessing what can really be wrong.

Adding

gSystem->Load("libPhysics"); should solve your problem.
However note that this should not be needed in ROOT 4.00/08 and above.
(when properly built)

Cheers,
Philippe