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

Vector/Vector/LorentzRotation.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // CLASSDOC OFF
3 // $Id: LorentzRotation.h,v 1.3 2003/10/23 21:29:52 garren Exp $
4 // ---------------------------------------------------------------------------
5 // CLASSDOC ON
6 //
7 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
8 //
9 // This is the definition of the HepLorentzRotation class for performing
10 // Lorentz transformations (rotations and boosts) on objects of the
11 // HepLorentzVector class.
12 //
13 // HepLorentzRotation is a concrete implementation of Hep4RotationInterface.
14 //
15 // .SS See Also
16 // RotationInterfaces.h
17 // ThreeVector.h, LorentzVector.h
18 // Rotation.h, Boost.h
19 //
20 // .SS Author
21 // Leif Lonnblad, Mark Fischler
22 
23 #ifndef HEP_LORENTZROTATION_H
24 #define HEP_LORENTZROTATION_H
25 
26 #ifdef GNUPRAGMA
27 #pragma interface
28 #endif
29 
30 #include "CLHEP/Vector/defs.h"
31 #include "CLHEP/Vector/RotationInterfaces.h"
32 #include "CLHEP/Vector/Rotation.h"
33 #include "CLHEP/Vector/Boost.h"
34 #include "CLHEP/Vector/LorentzVector.h"
35 
36 namespace CLHEP {
37 
38 // Global methods
39 
40 inline HepLorentzRotation inverseOf ( const HepLorentzRotation & lt );
41 HepLorentzRotation operator * (const HepRotation & r,
42  const HepLorentzRotation & lt);
43 HepLorentzRotation operator * (const HepRotationX & r,
44  const HepLorentzRotation & lt);
45 HepLorentzRotation operator * (const HepRotationY & r,
46  const HepLorentzRotation & lt);
47 HepLorentzRotation operator * (const HepRotationZ & r,
48  const HepLorentzRotation & lt);
49 
54 class HepLorentzRotation {
55 
56 public:
57  // ---------- Identity HepLorentzRotation:
58 
59  static const HepLorentzRotation IDENTITY;
60 
61  // ---------- Constructors and Assignment:
62 
63  inline HepLorentzRotation();
64  // Default constructor. Gives a unit matrix.
65 
66  inline HepLorentzRotation (const HepLorentzRotation & r);
67  // Copy constructor.
68 
69  inline HepLorentzRotation (const HepRotation & r);
70  inline explicit HepLorentzRotation (const HepRotationX & r);
71  inline explicit HepLorentzRotation (const HepRotationY & r);
72  inline explicit HepLorentzRotation (const HepRotationZ & r);
73  inline HepLorentzRotation (const HepBoost & b);
74  inline explicit HepLorentzRotation (const HepBoostX & b);
75  inline explicit HepLorentzRotation (const HepBoostY & b);
76  inline explicit HepLorentzRotation (const HepBoostZ & b);
77  // Constructors from special cases.
78 
80  inline HepLorentzRotation & operator = (const HepRotation & m);
81  inline HepLorentzRotation & operator = (const HepBoost & m);
82  // Assignment.
83 
84  HepLorentzRotation & set (double bx, double by, double bz);
85  inline HepLorentzRotation & set (const Hep3Vector & p);
86  inline HepLorentzRotation & set (const HepRotation & r);
87  inline HepLorentzRotation & set (const HepRotationX & r);
88  inline HepLorentzRotation & set (const HepRotationY & r);
89  inline HepLorentzRotation & set (const HepRotationZ & r);
90  inline HepLorentzRotation & set (const HepBoost & boost);
91  inline HepLorentzRotation & set (const HepBoostX & boost);
92  inline HepLorentzRotation & set (const HepBoostY & boost);
93  inline HepLorentzRotation & set (const HepBoostZ & boost);
94  inline HepLorentzRotation (double bx, double by, double bz);
95  inline HepLorentzRotation (const Hep3Vector & p);
96  // Other Constructors giving a Lorentz-boost.
97 
98  HepLorentzRotation & set( const HepBoost & B, const HepRotation & R );
99  inline HepLorentzRotation ( const HepBoost & B, const HepRotation & R );
100  // supply B and R: T = B R:
101 
102  HepLorentzRotation & set( const HepRotation & R, const HepBoost & B );
103  inline HepLorentzRotation ( const HepRotation & R, const HepBoost & B );
104  // supply R and B: T = R B:
105 
106  HepLorentzRotation ( const HepLorentzVector & col1,
107  const HepLorentzVector & col2,
108  const HepLorentzVector & col3,
109  const HepLorentzVector & col4 );
110  // Construct from four *orthosymplectic* LorentzVectors for the columns:
111  // NOTE:
112  // This constructor, and the two set methods below,
113  // will check that the columns (or rows) form an orthosymplectic
114  // matrix, and will adjust values so that this relation is
115  // as exact as possible.
116  // Orthosymplectic means the dot product USING THE METRIC
117  // of two different coumns will be 0, and of a column with
118  // itself will be one.
119 
120  HepLorentzRotation & set( const HepLorentzVector & col1,
121  const HepLorentzVector & col2,
122  const HepLorentzVector & col3,
123  const HepLorentzVector & col4 );
124  // supply four *orthosymplectic* HepLorentzVectors for the columns
125 
126  HepLorentzRotation & setRows( const HepLorentzVector & row1,
127  const HepLorentzVector & row2,
128  const HepLorentzVector & row3,
129  const HepLorentzVector & row4 );
130  // supply four *orthosymplectic* HepLorentzVectors for the columns
131 
132  inline HepLorentzRotation & set( const HepRep4x4 & rep );
133  inline HepLorentzRotation ( const HepRep4x4 & rep );
134  // supply a HepRep4x4 structure (16 numbers)
135  // WARNING:
136  // This constructor and set method will assume the
137  // HepRep4x4 supplied is in fact an orthosymplectic matrix.
138  // No checking or correction is done. If you are
139  // not certain the matrix is orthosymplectic, break it
140  // into four HepLorentzVector columns and use the form
141  // HepLorentzRotation (col1, col2, col3, col4)
142 
143  // ---------- Accessors:
144 
145  inline double xx() const;
146  inline double xy() const;
147  inline double xz() const;
148  inline double xt() const;
149  inline double yx() const;
150  inline double yy() const;
151  inline double yz() const;
152  inline double yt() const;
153  inline double zx() const;
154  inline double zy() const;
155  inline double zz() const;
156  inline double zt() const;
157  inline double tx() const;
158  inline double ty() const;
159  inline double tz() const;
160  inline double tt() const;
161  // Elements of the matrix.
162 
163  inline HepLorentzVector col1() const;
164  inline HepLorentzVector col2() const;
165  inline HepLorentzVector col3() const;
166  inline HepLorentzVector col4() const;
167  // orthosymplectic column vectors
168 
169  inline HepLorentzVector row1() const;
170  inline HepLorentzVector row2() const;
171  inline HepLorentzVector row3() const;
172  inline HepLorentzVector row4() const;
173  // orthosymplectic row vectors
174 
175  inline HepRep4x4 rep4x4() const;
176  // 4x4 representation:
177 
178  // ------------ Subscripting:
179 
180  class HepLorentzRotation_row {
181  public:
182  inline HepLorentzRotation_row(const HepLorentzRotation &, int);
183  inline double operator [] (int) const;
184  private:
185  const HepLorentzRotation & rr;
186  int ii;
187  };
188  // Helper class for implemention of C-style subscripting r[i][j]
189 
190  inline const HepLorentzRotation_row operator [] (int) const;
191  // Returns object of the helper class for C-style subscripting r[i][j]
192 
193  double operator () (int, int) const;
194  // Fortran-style subscripting: returns (i,j) element of the matrix.
195 
196  // ---------- Decomposition:
197 
198  void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
199  void decompose (HepBoost & boost, HepRotation & rotation) const;
200  // Find B and R such that L = B*R
201 
202  void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
203  void decompose (HepRotation & rotation, HepBoost & boost) const;
204  // Find R and B such that L = R*B
205 
206  // ---------- Comparisons:
207 
208  int compare( const HepLorentzRotation & m ) const;
209  // Dictionary-order comparison, in order tt,tz,...zt,zz,zy,zx,yt,yz,...,xx
210  // Used in operator<, >, <=, >=
211 
212  inline bool operator == (const HepLorentzRotation &) const;
213  inline bool operator != (const HepLorentzRotation &) const;
214  inline bool operator <= (const HepLorentzRotation &) const;
215  inline bool operator >= (const HepLorentzRotation &) const;
216  inline bool operator < (const HepLorentzRotation &) const;
217  inline bool operator > (const HepLorentzRotation &) const;
218 
219  inline bool isIdentity() const;
220  // Returns true if the Identity matrix.
221 
222  double distance2( const HepBoost & b ) const;
223  double distance2( const HepRotation & r ) const;
224  double distance2( const HepLorentzRotation & lt ) const;
225  // Decomposes L = B*R, returns the sum of distance2 for B and R.
226 
227  double howNear( const HepBoost & b ) const;
228  double howNear( const HepRotation & r) const;
229  double howNear( const HepLorentzRotation & lt ) const;
230 
231  bool isNear(const HepBoost & b,
232  double epsilon=Hep4RotationInterface::tolerance) const;
233  bool isNear(const HepRotation & r,
234  double epsilon=Hep4RotationInterface::tolerance) const;
235  bool isNear(const HepLorentzRotation & lt,
236  double epsilon=Hep4RotationInterface::tolerance) const;
237 
238  // --------ineno"> 155 
html,a477a5870f7dede657ffdbe3a9d76b331">Hep47otationInterface::tolerance) const;7ddiv> tolerance) const;7ddiv> tolerance) const isNear(const isNear(constisNear(HepLorentzRotation &amass="keyword">const;
Hep4RotationInterface::tolerance) constconstconstconstconstconstconstconstconstconstconstconstconstconstGenfun::Et">constconstconstconstconstconst:onstconstconstconstconstconstconstconstpoisson(double ad.html#af3ad.html#af3ad.html#af3ad.html#af3ad.html#af3ad.hta> 47  Clockwork *c;
48 
href="testCateg returns the sum of distance2 for B and R.
double psi() const
Definition: ml#a023764bd511eff550bed8bf4ca8e0853">HepGeom::BasicVector3D::unit
459 bn> #include "HepGeom::Transform3D _arg2;
& rr;
44 a>constconst 236&e">bool 236&e">bool 236 459 bn> & rr; & rr;/a> & rr;
236   > a>constconstfizAdaptor.html" alkeyword">const;
60;
198  void #include t
constconstconst:onst & rr; 236 459
 bn> & rr;) const;7ddiv> tolerance) const;7ddiv> tolerance) const   47 #endif
108  class="line">  6b967">
47 #endif
47  13 namespace Genfun {
14 class namespace Genfun {
236 47�(const HepRotationZ & r,
48  const HepLoro"> 48 
47  44  const HepLoro"> 48  HepLoro"> 48& 47 epLoro"> 48 
47 108  class="lin5c0ef473a0ea832ef20103036c">an> namespace Genfun {
14 class pure virtual
13 namespace Genfun {
rr;) const;7ddiv> tolerance) const;7ddiv> tolerance<666666666666666666 b03el#a372ce5ce23ea0t572990 Fw,48e157ss="keyword"