source: trunk/CLHEP/Vector/Boost.h@ 8

Last change on this file since 8 was 4, checked in by Pavel Demin, 16 years ago

first commit

File size: 7.6 KB
Line 
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
33namespace CLHEP {
34
35// Declarations of classes and global methods
36class HepBoost;
37inline HepBoost inverseOf ( const HepBoost & lt );
38
39/**
40 * @author
41 * @ingroup vector
42 */
43class HepBoost {
44
45public:
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;
194 HepLorentzRotation operator * (const HepLorentzRotation & lt) 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
217protected:
218
219 inline HepLorentzVector vectorMultiplication
220 ( const HepLorentzVector & w ) const;
221 // Multiplication with a Lorentz Vector.
222
223 HepLorentzRotation matrixMultiplication (const HepRep4x4 & m) const;
224 HepLorentzRotation matrixMultiplication (const HepRep4x4Symmetric & m) const;
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
236 HepRep4x4Symmetric rep_;
237
238}; // HepBoost
239
240inline
241std::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
250using namespace CLHEP;
251#endif
252
253#endif /* HEP_BOOST_H */
Note: See TracBrowser for help on using the repository browser.