]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/CLHEP/Vector/LorentzVector.h
This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / PHOS / CLHEP / Vector / LorentzVector.h
1 // -*- C++ -*-
2 // CLASSDOC OFF
3 // $Id$
4 // ---------------------------------------------------------------------------
5 // CLASSDOC ON
6 //
7 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
8 //
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.
13 //
14 // .SS See Also
15 // ThreeVector.h, Rotation.h, LorentzRotation.h
16 //
17 // .SS Authors
18 // Leif Lonnblad and Anders Nilsson. Modified by Evgueni Tcherniaev.
19 //
20
21 #ifndef HEP_LORENTZVECTOR_H
22 #define HEP_LORENTZVECTOR_H
23
24 #ifdef GNUPRAGMA
25 #pragma interface
26 #endif
27
28 #include "CLHEP/config/CLHEP.h"
29 #include "CLHEP/Vector/ThreeVector.h"
30 #include "CLHEP/Vector/Rotation.h"
31
32 #ifdef HEP_NO_INLINE_IN_DECLARATION
33 #define inline
34 #endif
35
36 #include <iostream.h>
37 class HepLorentzRotation;
38
39 class HepLorentzVector {
40
41 public:
42
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.
46
47   inline HepLorentzVector(const Hep3Vector &, HepDouble);
48   // Constructor giving a 3-Vector and a time component.
49
50   inline HepLorentzVector(const HepLorentzVector &);
51   // Copy constructor.
52
53   inline ~HepLorentzVector();
54   // The destructor.
55
56   inline operator Hep3Vector () const;
57   inline operator Hep3Vector & ();
58   // Conversion (cast) to Hep3Vector.
59
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.
65
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.
71
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.
77
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.
83
84   inline Hep3Vector vect() const;
85   // Get spatial component. 
86
87   inline void setVect(const Hep3Vector &);
88   // Set spatial component. 
89
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.
95
96   inline void setTheta(HepDouble);
97   inline void setPhi(HepDouble);
98   inline void setRho(HepDouble);
99   // Set spatial vector components in spherical coordinate system.
100
101   inline HepDouble operator () (int) const;
102   // Get components by index.
103
104   inline HepLorentzVector & operator = (const HepLorentzVector &);
105   // Assignment. 
106
107   inline HepLorentzVector   operator +  (const HepLorentzVector &) const;
108   inline HepLorentzVector & operator += (const HepLorentzVector &);
109   // Additions.
110
111   inline HepLorentzVector   operator -  (const HepLorentzVector &) const;
112   inline HepLorentzVector & operator -= (const HepLorentzVector &);
113   // Subtractions.
114
115   inline HepLorentzVector operator - () const;
116   // Unary minus.
117
118   inline HepBoolean operator == (const HepLorentzVector &) const;
119   inline HepBoolean operator != (const HepLorentzVector &) const;
120   // Comparisons.
121
122   inline HepDouble perp2() const;
123   // Transverse component of the spatial vector squared.
124
125   inline HepDouble perp() const;
126   // Transverse component of the spatial vector (R in cylindrical system).
127
128   inline HepDouble perp2(const Hep3Vector &) const;
129   // Transverse component of the spatial vector w.r.t. given axis squared.
130
131   inline HepDouble perp(const Hep3Vector &) const;
132   // Transverse component of the spatial vector w.r.t. given axis.
133
134   inline HepDouble angle(const Hep3Vector &) const;
135   // Angle wrt. another vector.
136
137   inline HepDouble mag2() const;
138   inline HepDouble m2() const;
139   // Invariant mass squared.
140
141   inline HepDouble mag() const;
142   inline HepDouble m() const;
143   // Invariant mass. If mag2() is negative then -sqrt(-mag2()) is returned.
144
145   inline HepDouble dot(const HepLorentzVector &) const;
146   inline HepDouble operator * (const HepLorentzVector &) const;
147   // Scalar product.
148
149   inline HepDouble plus() const;
150   inline HepDouble minus() const;
151   // Returns the positive/negative light-cone component t +/- z.
152
153
154   inline Hep3Vector boostVector() const ;
155   // Returns the spatial components divided by the time component.
156
157   void boost(HepDouble, HepDouble, HepDouble);
158   inline void boost(const Hep3Vector &);
159   // Lorentz boost.
160
161   inline void rotateX(HepDouble);
162   // Rotate the spatial component around the x-axis.
163
164   inline void rotateY(HepDouble);
165   // Rotate the spatial component around the y-axis.
166
167   inline void rotateZ(HepDouble);
168   // Rotate the spatial component around the z-axis.
169
170   inline void rotateUz(Hep3Vector &);
171   // Rotates the reference frame from Uz to newUz (unit vector).
172
173   inline void rotate(HepDouble, const Hep3Vector &);
174   // Rotate the spatial component around specified axis.
175
176   inline HepLorentzVector & operator *= (const HepRotation &);
177   inline HepLorentzVector & transform(const HepRotation &);
178   // Transformation with HepRotation.
179
180   HepLorentzVector & operator *= (const HepLorentzRotation &);
181   HepLorentzVector & transform(const HepLorentzRotation &);
182   // Transformation with HepLorenzRotation.
183
184 private:
185
186   Hep3Vector pp;
187   HepDouble  ee;
188
189 };
190
191 ostream & operator << (ostream &, const HepLorentzVector &);
192 // Output to a stream.
193
194 #ifdef HEP_NO_INLINE_IN_DECLARATION
195 #undef inline
196 #endif
197
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;
205 #endif
206
207 typedef HepLorentzVector HepLorentzVectorD;
208 typedef HepLorentzVector HepLorentzVectorF;
209
210 #ifndef HEP_DEBUG_INLINE
211 #include "CLHEP/Vector/LorentzVector.icc"
212 #endif
213
214 #endif /* HEP_LORENTZVECTOR_H */