1 // LorentzVector doxygen page
3 /** \page LorentzVectorPage LorentzVector Classes
5 To avoid exposing templated parameter to the users, typedefs are defined for all types of vectors based an double's and float's. To use them, one must include the header file _Math/Vector4D.h_. The following typedef's, defined in the header file _Math/Vector4Dfwd.h_, are available for the different instantiations of the template class ROOT::Math::LorentzVector:
7 * ROOT::Math::XYZTVector vector based on x,y,z,t coordinates (cartesian) in double precision
8 * ROOT::Math::XYZTVectorF vector based on x,y,z,t coordinates (cartesian) in float precision
9 * ROOT::Math::PtEtaPhiEVector vector based on pt (rho),eta,phi and E (t) coordinates in double precision
10 * ROOT::Math::PtEtaPhiMVector vector based on pt (rho),eta,phi and M (t) coordinates in double precision
11 * ROOT::Math::PxPyPzMVector vector based on px,py,pz and M (mass) coordinates in double precision
13 The metric used for all the LorentzVector's is (-,-,-,+)
15 #### Constructors and Assignment
17 The following declarations are available:
19 <pre>XYZTVector v1; // create an empty vector (x = 0, y = 0, z = 0, t = 0)
20 XYZTVector v2(1,2,3,4); // create a vector with x=1, y = 2, z = 3, t = 4
21 PtEtaPhiEVector v3(1,2,PI,5); // create a vector with pt = 1, eta = 2, phi = PI, E = 5
24 Note that each type of vector is constructed by passing its coordinates representations, so a XYZTVector(1,2,3,4) is different from a PtEtaPhiEVector(1,2,3,4).
26 In addition the Vector classes can be constructed by any vector, which implements the accessors x(), y() and z() and t(). This cann be another ROOT::Math::LorentzVector based on a different coordinate system or even any vector of a different package, like the CLHEP HepLorentzVector that implements the required signature.
28 <pre>XYZTVector v1(1,2,3,4);
29 PtEtaPhiEVector v2(v1);
31 CLHEP::HepLorentzVector q(1,2,3,4);
35 #### Coordinate Accessors
37 All the same coordinate accessors are available through the interface of the class ROOT::Math::LorentzVector. For example:
39 <pre>v1.X(); v1.X(); v1.Z(); v1.T() // returns cartesian components for the cartesian vector v1
40 v2.Px(); v2.Py(); v2.Pz(); v2.E() // returns cartesian components for the cylindrical vector v2
41 v1.Pt(); v1.Eta(); v1.Phi(); v1.M() // returns other components for the cartesian vector v1
44 In addition, all the 4 coordinates of the vector can be retrieved with the GetCoordinates method:
47 v1.GetCoordinates(d); // fill d array with (x,y,z,t) components of v1
48 v2.GetCoordinates(d); // fill d array with (pt,eta,phi,e) components of v2
49 std::vector <double>w(4);
50 v1.GetCoordinates(w.begin(),w.end()); // fill std::vector with (x,y,z,t) components of v1</double> </pre>
52 To get information on all the coordinate accessors see the reference documentation of ROOT::Math::LorentzVector
56 One can set only all the three coordinates via:
58 <pre>v1.SetCoordinates(c1,c2,c3,c4); // sets the (x,y,z,t) for a XYZTVector
59 v2.SetCoordinates(c1,c2,c3,c4); // sets pt,eta,phi,e for a PtEtaPhiEVector
60 v2.SetXYZ(x,y,z,t); // sets the 4 cartesian components for the PtEtaPhiEVector
63 Single coordinate setter methods are available for the basic vector coordinates, like SetX() for a XYZTVector or SetPt() for a PtEtaPhiEVector. Attempting to do a SetX() on a non cartesian vector will not compile.
65 <pre>XYZTVector v1; v1.SetX(1) // OK setting x for a cartesian vector
66 PtEtaPhiEVector v2; v2.SetX(1) // ERROR: cannot set X for a non-cartesian vector. Method will not compile
67 v2.SetR(1) // OK setting Pt for a PtEtaPhiEVector vector
70 In addition there are setter methods from C arrays or iterators.
72 <pre>double d[4] = {1.,2.,3.,4.};
74 v.SetCoordinates(d); // set (x,y,z,t) components of v using values from d
77 or for example from an std::vector using the iterators
79 <pre>std::vector <double>w(4);
80 v.SetCoordinates(w.begin(),w.end()); // set (x,y,z,t) components of v using values from w</double> </pre>
82 #### Arithmetic Operations
84 The following operations are possible between LorentzVectors classes, even of different coordinate system types: ( v and w are two LorentzVector of the same type, q is a generic LorentzVector implementing x(), y(), z() and t() and a is a generic scalar type: double, flot, int, etc.... )
106 <pre>a = v.Dot(q); // dot product in metric (+,+,+,-) of two LorentzVector's
107 XYZVector s = v.Vect() // return the spatial components (x,y,z)
108 v.Beta(); // return beta and gamma value
109 v.Gamma() // (vector must be time-like otherwise result is meaningless)
110 XYZVector b = v.BoostToCM() // return boost vector which will bring the Vector in its mas frame (P=0)