00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef HEP_LORENTZROTATION_H
00024 #define HEP_LORENTZROTATION_H
00025
00026 #ifdef GNUPRAGMA
00027 #pragma interface
00028 #endif
00029
00030 #ifdef HEP_NO_INLINE_IN_DECLARATION
00031 #define inline
00032 #endif
00033
00034 #include "CLHEP/Vector/RotationInterfaces.h"
00035 #include "CLHEP/Vector/Rotation.h"
00036 #include "CLHEP/Vector/Boost.h"
00037 #include "CLHEP/Vector/LorentzVector.h"
00038
00039
00040
00041 inline HepLorentzRotation inverseOf ( const HepLorentzRotation & lt );
00042 HepLorentzRotation operator * (const HepRotation & r,
00043 const HepLorentzRotation & lt);
00044 HepLorentzRotation operator * (const HepRotationX & r,
00045 const HepLorentzRotation & lt);
00046 HepLorentzRotation operator * (const HepRotationY & r,
00047 const HepLorentzRotation & lt);
00048 HepLorentzRotation operator * (const HepRotationZ & r,
00049 const HepLorentzRotation & lt);
00050
00055 class HepLorentzRotation {
00056
00057 public:
00058
00059
00060 static const HepLorentzRotation IDENTITY;
00061
00062
00063
00064 inline HepLorentzRotation();
00065
00066
00067 inline HepLorentzRotation (const HepLorentzRotation & r);
00068
00069
00070 inline HepLorentzRotation (const HepRotation & r);
00071 inline explicit HepLorentzRotation (const HepRotationX & r);
00072 inline explicit HepLorentzRotation (const HepRotationY & r);
00073 inline explicit HepLorentzRotation (const HepRotationZ & r);
00074 inline HepLorentzRotation (const HepBoost & b);
00075 inline explicit HepLorentzRotation (const HepBoostX & b);
00076 inline explicit HepLorentzRotation (const HepBoostY & b);
00077 inline explicit HepLorentzRotation (const HepBoostZ & b);
00078
00079
00080 inline HepLorentzRotation & operator = (const HepLorentzRotation & m);
00081 inline HepLorentzRotation & operator = (const HepRotation & m);
00082 inline HepLorentzRotation & operator = (const HepBoost & m);
00083
00084
00085 HepLorentzRotation & set (double bx, double by, double bz);
00086 inline HepLorentzRotation & set (const Hep3Vector & p);
00087 inline HepLorentzRotation & set (const HepRotation & r);
00088 inline HepLorentzRotation & set (const HepRotationX & r);
00089 inline HepLorentzRotation & set (const HepRotationY & r);
00090 inline HepLorentzRotation & set (const HepRotationZ & r);
00091 inline HepLorentzRotation & set (const HepBoost & boost);
00092 inline HepLorentzRotation & set (const HepBoostX & boost);
00093 inline HepLorentzRotation & set (const HepBoostY & boost);
00094 inline HepLorentzRotation & set (const HepBoostZ & boost);
00095 inline HepLorentzRotation (double bx, double by, double bz);
00096 inline HepLorentzRotation (const Hep3Vector & p);
00097
00098
00099 HepLorentzRotation & set( const HepBoost & B, const HepRotation & R );
00100 inline HepLorentzRotation ( const HepBoost & B, const HepRotation & R );
00101
00102
00103 HepLorentzRotation & set( const HepRotation & R, const HepBoost & B );
00104 inline HepLorentzRotation ( const HepRotation & R, const HepBoost & B );
00105
00106
00107 HepLorentzRotation ( const HepLorentzVector & col1,
00108 const HepLorentzVector & col2,
00109 const HepLorentzVector & col3,
00110 const HepLorentzVector & col4 );
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 HepLorentzRotation & set( const HepLorentzVector & col1,
00122 const HepLorentzVector & col2,
00123 const HepLorentzVector & col3,
00124 const HepLorentzVector & col4 );
00125
00126
00127 HepLorentzRotation & setRows( const HepLorentzVector & row1,
00128 const HepLorentzVector & row2,
00129 const HepLorentzVector & row3,
00130 const HepLorentzVector & row4 );
00131
00132
00133 inline HepLorentzRotation & set( const HepRep4x4 & rep );
00134 inline HepLorentzRotation ( const HepRep4x4 & rep );
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 inline double xx() const;
00147 inline double xy() const;
00148 inline double xz() const;
00149 inline double xt() const;
00150 inline double yx() const;
00151 inline double yy() const;
00152 inline double yz() const;
00153 inline double yt() const;
00154 inline double zx() const;
00155 inline double zy() const;
00156 inline double zz() const;
00157 inline double zt() const;
00158 inline double tx() const;
00159 inline double ty() const;
00160 inline double tz() const;
00161 inline double tt() const;
00162
00163
00164 inline HepLorentzVector col1() const;
00165 inline HepLorentzVector col2() const;
00166 inline HepLorentzVector col3() const;
00167 inline HepLorentzVector col4() const;
00168
00169
00170 inline HepLorentzVector row1() const;
00171 inline HepLorentzVector row2() const;
00172 inline HepLorentzVector row3() const;
00173 inline HepLorentzVector row4() const;
00174
00175
00176 inline HepRep4x4 rep4x4() const;
00177
00178
00179
00180
00181 class HepLorentzRotation_row {
00182 public:
00183 inline HepLorentzRotation_row(const HepLorentzRotation &, int);
00184 inline double operator [] (int) const;
00185 private:
00186 const HepLorentzRotation & rr;
00187 int ii;
00188 };
00189
00190
00191 inline const HepLorentzRotation_row operator [] (int) const;
00192
00193
00194 double operator () (int, int) const;
00195
00196
00197
00198
00199 void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
00200 void decompose (HepBoost & boost, HepRotation & rotation) const;
00201
00202
00203 void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
00204 void decompose (HepRotation & rotation, HepBoost & boost) const;
00205
00206
00207
00208
00209 int compare( const HepLorentzRotation & m ) const;
00210
00211
00212
00213 inline bool operator == (const HepLorentzRotation &) const;
00214 inline bool operator != (const HepLorentzRotation &) const;
00215 inline bool operator <= (const HepLorentzRotation &) const;
00216 inline bool operator >= (const HepLorentzRotation &) const;
00217 inline bool operator < (const HepLorentzRotation &) const;
00218 inline bool operator > (const HepLorentzRotation &) const;
00219
00220 inline bool isIdentity() const;
00221
00222
00223 double distance2( const HepBoost & b ) const;
00224 double distance2( const HepRotation & r ) const;
00225 double distance2( const HepLorentzRotation & lt ) const;
00226
00227
00228 double howNear( const HepBoost & b ) const;
00229 double howNear( const HepRotation & r) const;
00230 double howNear( const HepLorentzRotation & lt ) const;
00231
00232 bool isNear(const HepBoost & b,
00233 double epsilon=Hep4RotationInterface::tolerance) const;
00234 bool isNear(const HepRotation & r,
00235 double epsilon=Hep4RotationInterface::tolerance) const;
00236 bool isNear(const HepLorentzRotation & lt,
00237 double epsilon=Hep4RotationInterface::tolerance) const;
00238
00239
00240
00241 double norm2() const;
00242
00243
00244
00245 void rectify();
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257 inline HepLorentzVector vectorMultiplication(const HepLorentzVector&) const;
00258 inline HepLorentzVector operator()( const HepLorentzVector & w ) const;
00259 inline HepLorentzVector operator* ( const HepLorentzVector & p ) const;
00260
00261
00262
00263
00264 HepLorentzRotation matrixMultiplication(const HepRep4x4 & m) const;
00265
00266 inline HepLorentzRotation operator * (const HepBoost & b) const;
00267 inline HepLorentzRotation operator * (const HepRotation & r) const;
00268 inline HepLorentzRotation operator * (const HepLorentzRotation & lt) const;
00269
00270
00271 inline HepLorentzRotation & operator *= (const HepBoost & b);
00272 inline HepLorentzRotation & operator *= (const HepRotation & r);
00273 inline HepLorentzRotation & operator *= (const HepLorentzRotation & lt);
00274 inline HepLorentzRotation & transform (const HepBoost & b);
00275 inline HepLorentzRotation & transform (const HepRotation & r);
00276 inline HepLorentzRotation & transform (const HepLorentzRotation & lt);
00277
00278
00279
00280
00281
00282
00283
00284 HepLorentzRotation & rotateX(double delta);
00285
00286
00287 HepLorentzRotation & rotateY(double delta);
00288
00289
00290 HepLorentzRotation & rotateZ(double delta);
00291
00292
00293 inline HepLorentzRotation & rotate(double delta, const Hep3Vector& axis);
00294 inline HepLorentzRotation & rotate(double delta, const Hep3Vector *axis);
00295
00296
00297 HepLorentzRotation & boostX(double beta);
00298
00299
00300 HepLorentzRotation & boostY(double beta);
00301
00302
00303 HepLorentzRotation & boostZ(double beta);
00304
00305
00306 inline HepLorentzRotation & boost(double, double, double);
00307 inline HepLorentzRotation & boost(const Hep3Vector &);
00308
00309
00310 inline HepLorentzRotation inverse() const;
00311
00312
00313 inline HepLorentzRotation & invert();
00314
00315
00316
00317
00318 HepStd::ostream & print( HepStd::ostream & os ) const;
00319
00320
00321
00322
00323 static inline double getTolerance();
00324 static inline double setTolerance(double tol);
00325
00326 friend HepLorentzRotation inverseOf ( const HepLorentzRotation & lt );
00327
00328 protected:
00329
00330 inline HepLorentzRotation
00331 (double mxx, double mxy, double mxz, double mxt,
00332 double myx, double myy, double myz, double myt,
00333 double mzx, double mzy, double mzz, double mzt,
00334 double mtx, double mty, double mtz, double mtt);
00335
00336
00337
00338 inline void setBoost(double, double, double);
00339
00340
00341 double mxx, mxy, mxz, mxt,
00342 myx, myy, myz, myt,
00343 mzx, mzy, mzz, mzt,
00344 mtx, mty, mtz, mtt;
00345
00346
00347 };
00348
00349 inline HepStd::ostream & operator<<
00350 ( HepStd::ostream & os, const HepLorentzRotation& lt )
00351 {return lt.print(os);}
00352
00353 inline bool operator==(const HepRotation &r, const HepLorentzRotation & lt)
00354 { return lt==r; }
00355 inline bool operator!=(const HepRotation &r, const HepLorentzRotation & lt)
00356 { return lt!=r; }
00357 inline bool operator<=(const HepRotation &r, const HepLorentzRotation & lt)
00358 { return lt<=r; }
00359 inline bool operator>=(const HepRotation &r, const HepLorentzRotation & lt)
00360 { return lt>=r; }
00361 inline bool operator<(const HepRotation &r, const HepLorentzRotation & lt)
00362 { return lt<r; }
00363 inline bool operator>(const HepRotation &r, const HepLorentzRotation & lt)
00364 { return lt>r; }
00365
00366 inline bool operator==(const HepBoost &b, const HepLorentzRotation & lt)
00367 { return lt==b; }
00368 inline bool operator!=(const HepBoost &b, const HepLorentzRotation & lt)
00369 { return lt!=b; }
00370 inline bool operator<=(const HepBoost &b, const HepLorentzRotation & lt)
00371 { return lt<=b; }
00372 inline bool operator>=(const HepBoost &b, const HepLorentzRotation & lt)
00373 { return lt>=b; }
00374 inline bool operator<(const HepBoost &b, const HepLorentzRotation & lt)
00375 { return lt<b; }
00376 inline bool operator>(const HepBoost &b, const HepLorentzRotation & lt)
00377 { return lt>b; }
00378
00379 #ifdef HEP_NO_INLINE_IN_DECLARATION
00380 #undef inline
00381 #endif
00382
00383 #ifdef HEP_SHORT_NAMES
00384 typedef HepLorentzRotation LRotation;
00385 #endif
00386
00387 #ifndef HEP_DEBUG_INLINE
00388 #include "CLHEP/Vector/LorentzRotation.icc"
00389 #endif
00390
00391 #endif
00392