CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

Geometry/CLHEP/Vector/Boost.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
4 //
5 // This is the definition of the HepBoost class for performing specialized
6 // Lorentz transformations which are pure boosts on objects of the
7 // HepLorentzVector class.
8 //
9 // HepBoost is a concrete implementation of Hep4RotationInterface.
10 //
11 // .SS See Also
12 // RotationInterfaces.h
13 // LorentzVector.h LorentzRotation.h
14 // BoostX.h BoostY.h BoostZ.h
15 //
16 // .SS Author
17 // Mark Fischler
18 
19 #ifndef HEP_BOOST_H
20 #define HEP_BOOST_H
21 
22 #ifdef GNUPRAGMA
23 #pragma interface
24 #endif
25 
26 #include "CLHEP/Vector/defs.h"
27 #include "CLHEP/Vector/RotationInterfaces.h"
28 #include "CLHEP/Vector/BoostX.h"
29 #include "CLHEP/Vector/BoostY.h"
30 #include "CLHEP/Vector/BoostZ.h"
31 #include "CLHEP/Vector/LorentzVector.h"
32 
33 namespace CLHEP {
34 
35 // Declarations of classes and global methods
36 class HepBoost;
37 inline HepBoost inverseOf ( const HepBoost & lt );
38 
43 class HepBoost {
44 
45 public:
46 
47  // ---------- Constructors and Assignment:
48 
49  inline HepBoost();
50  // Default constructor. Gives a boost of 0.
51 
52  inline HepBoost(const HepBoost & m);
53  // Copy constructor.
54 
55  inline HepBoost & operator = (const HepBoost & m);
56  // Assignment.
57 
58  HepBoost & set (double betaX, double betaY, double betaZ);
59  inline HepBoost (double betaX, double betaY, double betaZ);
60  // Constructor from three components of beta vector
61 
62  HepBoost & set (const HepRep4x4Symmetric & m);
63  inline HepBoost (const HepRep4x4Symmetric & m);
64  // Constructor from symmetric HepRep4x4
65 
66  HepBoost & set (Hep3Vector direction, double beta);
67  inline HepBoost (Hep3Vector direction, double beta);
68  // Constructor from a three vector direction and the magnitude of beta
69 
70  HepBoost & set (const Hep3Vector & boost);
71  inline HepBoost (const Hep3Vector & boost);
72  // Constructor from a 3-vector of less than unit length
73 
74  inline HepBoost & set (const HepBoostX & boost);
75  inline HepBoost & set (const HepBoostY & boost);
76  inline HepBoost & set (const HepBoostZ & boost);
77  inline HepBoost (const HepBoostX & boost);
78  inline HepBoost (const HepBoostY & boost);
79  inline HepBoost (const HepBoostZ & boost);
80 
81  // ---------- Accessors:
82 
83  inline double beta() const;
84  inline double gamma() const;
85  inline Hep3Vector boostVector() const;
86  inline Hep3Vector getDirection() const;
87  inline Hep3Vector direction() const;
88 
89  inline double xx() const;
90  inline double xy() const;
91  inline double xz() const;
92  inline double xt() const;
93  inline double yx() const;
94  inline double yy() const;
95  inline double yz() const;
96  inline double yt() const;
97  inline double zx() const;
98  inline double zy() const;
99  inline double zz() const;
100  inline double zt() const;
101  inline double tx() const;
102  inline double ty() const;
103  inline double tz() const;
104  inline double tt() const;
105  // Elements of the matrix.
106 
107  inline HepLorentzVector col1() const;
108  inline HepLorentzVector col2() const;
109  inline HepLorentzVector col3() const;
110  inline HepLorentzVector col4() const;
111  // orthosymplectic column vectors
112 
113  inline HepLorentzVector row1() const;
114  inline HepLorentzVector row2() const;
115  inline HepLorentzVector row3() const;
116  inline HepLorentzVector row4() const;
117  // orthosymplectic row vectors
118 
119  inline HepRep4x4 rep4x4() const;
120  // 4x4 representation.
121 
122  inline HepRep4x4Symmetric rep4x4Symmetric() const;
123  // Symmetric 4x4 representation.
124 
125  // ---------- Decomposition:
126 
127  void decompose (HepRotation & rotation, HepBoost & boost) const;
128  void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
129  // Find R and B such that L = R*B -- trivial, since R is identity
130 
131  void decompose (HepBoost & boost, HepRotation & rotation) const;
132  void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
133  // Find R and B such that L = B*R -- trivial, since R is identity
134 
135  // ---------- Comparisons:
136 
137  inline int compare( const HepBoost & b ) const;
138  // Dictionary-order comparison, in order tt,zt,zz,yt,yz,yy,xt,xz,xy,xx
139  // Used in operator<, >, <=, >=
140 
141  inline bool operator == (const HepBoost & b) const;
142  inline bool operator != (const HepBoost & b) const;
143  inline bool operator <= (const HepBoost & b) const;
144  inline bool operator >= (const HepBoost & b) const;
145  inline bool operator < (const HepBoost & b) const;
146  inline bool operator > (const HepBoost & b) const;
147  // Comparisons.
148 
149  inline bool isIdentity() const;
150  // Returns true if a null boost.
151 
152  inline double distance2( const HepBoost & b ) const;
153  inline double distance2( const HepBoostX & bx ) const;
154  inline double distance2( const HepBoostY & by ) const;
155  inline double distance2( const HepBoostZ & bz ) const;
156  // Defined as the distance2 between the vectors (gamma*betaVector)
157 
158  double distance2( const HepRotation & r ) const;
159  double distance2( const HepLorentzRotation & lt ) const;
160  // Distance between this and other sorts of transformations
161 
162  inline double howNear( const HepBoost & b ) const;
163  inline bool isNear( const HepBoost & b,
164  double epsilon=Hep4RotationInterface::tolerance) const;
165 
166  double howNear( const HepRotation & r ) const;
167  double howNear( const HepLorentzRotation & lt ) const;
168 
169  bool isNear( const HepRotation & r,
170  double epsilon=Hep4RotationInterface::tolerance) const;
171  bool isNear( const HepLorentzRotation & lt,
172  double epsilon=Hep4RotationInterface::tolerance) const;
173 
174  // ---------- Properties:
175 
176  double norm2() const;
177  // (beta*gamma)^2
178 
179  void rectify();
180  // set as an exact boost, based on the timelike part of the boost matrix.
181 
182  // ---------- Application:
183 
184  inline HepLorentzVector operator()( const HepLorentzVector & p ) const;
185  // Transform a Lorentz Vector.
186 
187  inline HepLorentzVector operator* ( const HepLorentzVector & p ) const;
188  // Multiplication with a Lorentz Vector.
189 
190  // ---------- Operations in the group of 4-Rotations
191 
192  HepLorentzRotation operator * (const HepBoost & b) const;
193  HepLorentzRotation operator * (const HepRotation & r) const;
195  // Product of two Lorentz Rotations (this) * lt - matrix multiplication
196  // Notice that the product of two pure boosts is no longer a pure boost
197 
198  inline HepBoost inverse() const;
199  // Return the inverse.
200 
201  inline friend HepBoost inverseOf ( const HepBoost & lt );
202  // global methods to invert.
203 
204  inline HepBoost & invert();
205  // Inverts the Boost matrix.
206 
207  // ---------- I/O:
208 
209  std::ostream & print( std::ostream & os ) const;
210  // Output form is (bx, by, bz)
211 
212  // ---------- Tolerance
213 
214  static inline double getTolerance();
215  static inline double setTolerance(double tol);
216 
217 protected:
218 
220  ( const HepLorentzVector & w ) const;
221  // Multiplication with a Lorentz Vector.
222 
225 
226  inline HepBoost
227  (double xx, double xy, double xz, double xt,
228  double yy, double yz, double yt,
229  double zz, double zt,
230  double tt);
231  // Protected constructor.
232  // DOES NOT CHECK FOR VALIDITY AS A LORENTZ BOOST.
233 
234  inline void setBoost(double bx, double by, double bz);
235 
237 
238 }; // HepBoost
239 
240 inline
241 std::ostream & operator <<
242  ( std::ostream & os, const HepBoost& b ) {return b.print(os);}
243 
244 } // namespace CLHEP
245 
246 #include "CLHEP/Vector/Boost.icc"
247 
248 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
249 // backwards compatibility will be enabled ONLY in CLHEP 1.9
250 using namespace CLHEP;
251 #endif
252 
253 #endif /* HEP_BOOST_H */
double tx() const
int compare(const HepBoost &b) const
double norm2() const
Definition: Boost.cc:140
Hep3Vector boostVector() const
double yz() const
HepLorentzVector row4() const
double yx() const
bool operator<=(const HepBoost &b) const
HepLorentzVector row2() const
void decompose(HepRotation &rotation, HepBoost &boost) const
Definition: Boost.cc:71
HepBoost & set(double betaX, double betaY, double betaZ)
Definition: Boost.cc:23
HepLorentzVector col2() const
bool operator>=(const HepBoost &b) const
double tz() const
static double setTolerance(double tol)
HepLorentzVector operator()(const HepLorentzVector &p) const
double xt() const
double yy() const
bool operator>(const HepBoost &b) const
HepLorentzVector col3() const
friend HepBoost inverseOf(const HepBoost &lt)
double zt() const
bool operator!=(const HepBoost &b) const
bool operator==(const HepBoost &b) const
std::ostream & print(std::ostream &os) const
Definition: Boost.cc:249
double zz() const
double xy() const
bool isNear(const HepBoost &b, double epsilon=Hep4RotationInterface::tolerance) const
double xz() const
HepBoost inverse() const
bool isIdentity() const
HepLorentzVector operator*(const HepLorentzVector &p) const
HepBoost inverseOf(const HepBoost &lt)
bool operator<(const HepBoost &b) const
double distance2(const HepBoost &b) const
HepRep4x4Symmetric rep4x4Symmetric() const
HepLorentzVector row3() const
HepBoost & invert()
double beta() const
HepLorentzVector col1() const
HepLorentzVector col4() const
double zy() const
void setBoost(double bx, double by, double bz)
HepRep4x4 rep4x4() const
double yt() const
HepLorentzVector row1() const
double xx() const
Hep3Vector getDirection() const
void rectify()
Definition: Boost.cc:147
HepBoost & operator=(const HepBoost &m)
double howNear(const HepBoost &b) const
Hep3Vector direction() const
HepLorentzVector vectorMultiplication(const HepLorentzVector &w) const
double ty() const
double zx() const
HepLorentzRotation matrixMultiplication(const HepRep4x4 &m) const
Definition: Boost.cc:183
double tt() const
static double getTolerance()
double gamma() const