4 // ---------------------------------------------------------------------------
7 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
9 // HepLorentzVector is a Lorentz vector consisting of Hep3Vector and
10 // HepDouble components. Lorentz transformations (rotations and boosts)
11 // of these vectors are perfomed by multiplying with objects of
12 // the HepLorenzRotation class.
15 // ThreeVector.h, Rotation.h, LorentzRotation.h
18 // Leif Lonnblad and Anders Nilsson. Modified by Evgueni Tcherniaev.
21 #ifndef HEP_LORENTZVECTOR_H
22 #define HEP_LORENTZVECTOR_H
28 #include "CLHEP/config/CLHEP.h"
29 #include "CLHEP/Vector/ThreeVector.h"
30 #include "CLHEP/Vector/Rotation.h"
32 #ifdef HEP_NO_INLINE_IN_DECLARATION
37 class HepLorentzRotation;
39 class HepLorentzVector {
43 inline HepLorentzVector(HepDouble x = 0.0, HepDouble y = 0.0,
44 HepDouble z = 0.0, HepDouble t = 0.0);
45 // Constructor giving the components x, y, z, t.
47 inline HepLorentzVector(const Hep3Vector &, HepDouble);
48 // Constructor giving a 3-Vector and a time component.
50 inline HepLorentzVector(const HepLorentzVector &);
53 inline ~HepLorentzVector();
56 inline operator Hep3Vector () const;
57 inline operator Hep3Vector & ();
58 // Conversion (cast) to Hep3Vector.
60 inline HepDouble x() const;
61 inline HepDouble y() const;
62 inline HepDouble z() const;
63 inline HepDouble t() const;
64 // Get position and time.
66 inline void setX(HepDouble);
67 inline void setY(HepDouble);
68 inline void setZ(HepDouble);
69 inline void setT(HepDouble);
70 // Set position and time.
72 inline HepDouble px() const;
73 inline HepDouble py() const;
74 inline HepDouble pz() const;
75 inline HepDouble e() const;
76 // Get momentum and energy.
78 inline void setPx(HepDouble);
79 inline void setPy(HepDouble);
80 inline void setPz(HepDouble);
81 inline void setE(HepDouble);
82 // Set momentum and energy.
84 inline Hep3Vector vect() const;
85 // Get spatial component.
87 inline void setVect(const Hep3Vector &);
88 // Set spatial component.
90 inline HepDouble theta() const;
91 inline HepDouble cosTheta() const;
92 inline HepDouble phi() const;
93 inline HepDouble rho() const;
94 // Get spatial vector components in spherical coordinate system.
96 inline void setTheta(HepDouble);
97 inline void setPhi(HepDouble);
98 inline void setRho(HepDouble);
99 // Set spatial vector components in spherical coordinate system.
101 inline HepDouble operator () (int) const;
102 // Get components by index.
104 inline HepLorentzVector & operator = (const HepLorentzVector &);
107 inline HepLorentzVector operator + (const HepLorentzVector &) const;
108 inline HepLorentzVector & operator += (const HepLorentzVector &);
111 inline HepLorentzVector operator - (const HepLorentzVector &) const;
112 inline HepLorentzVector & operator -= (const HepLorentzVector &);
115 inline HepLorentzVector operator - () const;
118 inline HepBoolean operator == (const HepLorentzVector &) const;
119 inline HepBoolean operator != (const HepLorentzVector &) const;
122 inline HepDouble perp2() const;
123 // Transverse component of the spatial vector squared.
125 inline HepDouble perp() const;
126 // Transverse component of the spatial vector (R in cylindrical system).
128 inline HepDouble perp2(const Hep3Vector &) const;
129 // Transverse component of the spatial vector w.r.t. given axis squared.
131 inline HepDouble perp(const Hep3Vector &) const;
132 // Transverse component of the spatial vector w.r.t. given axis.
134 inline HepDouble angle(const Hep3Vector &) const;
135 // Angle wrt. another vector.
137 inline HepDouble mag2() const;
138 inline HepDouble m2() const;
139 // Invariant mass squared.
141 inline HepDouble mag() const;
142 inline HepDouble m() const;
143 // Invariant mass. If mag2() is negative then -sqrt(-mag2()) is returned.
145 inline HepDouble dot(const HepLorentzVector &) const;
146 inline HepDouble operator * (const HepLorentzVector &) const;
149 inline HepDouble plus() const;
150 inline HepDouble minus() const;
151 // Returns the positive/negative light-cone component t +/- z.
154 inline Hep3Vector boostVector() const ;
155 // Returns the spatial components divided by the time component.
157 void boost(HepDouble, HepDouble, HepDouble);
158 inline void boost(const Hep3Vector &);
161 inline void rotateX(HepDouble);
162 // Rotate the spatial component around the x-axis.
164 inline void rotateY(HepDouble);
165 // Rotate the spatial component around the y-axis.
167 inline void rotateZ(HepDouble);
168 // Rotate the spatial component around the z-axis.
170 inline void rotateUz(Hep3Vector &);
171 // Rotates the reference frame from Uz to newUz (unit vector).
173 inline void rotate(HepDouble, const Hep3Vector &);
174 // Rotate the spatial component around specified axis.
176 inline HepLorentzVector & operator *= (const HepRotation &);
177 inline HepLorentzVector & transform(const HepRotation &);
178 // Transformation with HepRotation.
180 HepLorentzVector & operator *= (const HepLorentzRotation &);
181 HepLorentzVector & transform(const HepLorentzRotation &);
182 // Transformation with HepLorenzRotation.
191 ostream & operator << (ostream &, const HepLorentzVector &);
192 // Output to a stream.
194 #ifdef HEP_NO_INLINE_IN_DECLARATION
198 #ifdef HEP_SHORT_NAMES
199 typedef HepLorentzVector VectorL;
200 typedef HepLorentzVector Vector4;
201 typedef HepLorentzVector DVectorL;
202 typedef HepLorentzVector DVector4;
203 typedef HepLorentzVector FVectorL;
204 typedef HepLorentzVector FVector4;
207 typedef HepLorentzVector HepLorentzVectorD;
208 typedef HepLorentzVector HepLorentzVectorF;
210 #ifndef HEP_DEBUG_INLINE
211 #include "CLHEP/Vector/LorentzVector.icc"
214 #endif /* HEP_LORENTZVECTOR_H */