CLHEP/Vector/Boost.h

00001 // -*- C++ -*-
00002 //
00003 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
00004 //
00005 // This is the definition of the HepBoost class for performing specialized
00006 // Lorentz transformations which are pure boosts on objects of the
00007 // HepLorentzVector class.
00008 //
00009 // HepBoost is a concrete implementation of Hep4RotationInterface.
00010 //
00011 // .SS See Also
00012 // RotationInterfaces.h
00013 // LorentzVector.h LorentzRotation.h 
00014 //  BoostX.h BoostY.h BoostZ.h 
00015 //
00016 // .SS Author
00017 // Mark Fischler
00018 
00019 #ifndef HEP_BOOST_H
00020 #define HEP_BOOST_H
00021 
00022 #ifdef GNUPRAGMA
00023 #pragma interface
00024 #endif
00025 
00026 #ifdef HEP_NO_INLINE_IN_DECLARATION
00027 #define inline
00028 #endif
00029 
00030 #include "CLHEP/Vector/RotationInterfaces.h"
00031 #include "CLHEP/Vector/BoostX.h"
00032 #include "CLHEP/Vector/BoostY.h"
00033 #include "CLHEP/Vector/BoostZ.h"
00034 #include "CLHEP/Vector/LorentzVector.h"
00035 
00036 // Declarations of classes and global methods
00037 class HepBoost;
00038 inline HepBoost inverseOf ( const HepBoost & lt );
00039 
00044 class HepBoost {
00045 
00046 public:
00047 
00048   // ----------  Constructors and Assignment:
00049 
00050   inline HepBoost();
00051   // Default constructor. Gives a boost of 0.  
00052 
00053   inline HepBoost(const HepBoost & m);
00054   // Copy constructor.
00055 
00056   inline HepBoost & operator = (const HepBoost & m);
00057   // Assignment.
00058 
00059          HepBoost & set (double betaX, double betaY, double betaZ);
00060   inline HepBoost       (double betaX, double betaY, double betaZ);
00061   // Constructor from three components of beta vector
00062 
00063          HepBoost & set (const HepRep4x4Symmetric & m);
00064   inline HepBoost       (const HepRep4x4Symmetric & m);
00065   // Constructor from symmetric HepRep4x4
00066 
00067          HepBoost & set (Hep3Vector direction, double beta);
00068   inline HepBoost       (Hep3Vector direction, double beta);
00069   // Constructor from a three vector direction and the magnitude of beta
00070 
00071          HepBoost & set (const Hep3Vector & boost);
00072   inline HepBoost       (const Hep3Vector & boost);
00073   // Constructor from a 3-vector of less than unit length
00074 
00075   // ----------  Accessors:
00076 
00077   inline double  beta()  const;
00078   inline double  gamma() const;
00079   inline Hep3Vector boostVector() const;
00080   inline Hep3Vector getDirection() const;
00081   inline Hep3Vector direction() const;
00082 
00083   inline double xx() const;
00084   inline double xy() const;
00085   inline double xz() const;
00086   inline double xt() const;
00087   inline double yx() const;
00088   inline double yy() const;
00089   inline double yz() const;
00090   inline double yt() const;
00091   inline double zx() const;
00092   inline double zy() const;
00093   inline double zz() const;
00094   inline double zt() const;
00095   inline double tx() const;
00096   inline double ty() const;
00097   inline double tz() const;
00098   inline double tt() const;
00099   // Elements of the matrix.
00100 
00101   inline HepLorentzVector col1() const;
00102   inline HepLorentzVector col2() const;
00103   inline HepLorentzVector col3() const;
00104   inline HepLorentzVector col4() const;
00105   // orthosymplectic column vectors
00106 
00107   inline HepLorentzVector row1() const;
00108   inline HepLorentzVector row2() const;
00109   inline HepLorentzVector row3() const;
00110   inline HepLorentzVector row4() const;
00111   // orthosymplectic row vectors
00112 
00113   inline HepRep4x4 rep4x4() const;
00114   //   4x4 representation.
00115 
00116   inline HepRep4x4Symmetric rep4x4Symmetric() const;
00117   //   Symmetric 4x4 representation.
00118 
00119   // ----------  Decomposition:
00120 
00121   void decompose (HepRotation  & rotation, HepBoost   & boost) const;
00122   void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
00123   // Find R and B such that L = R*B -- trivial, since R is identity
00124 
00125   void decompose (HepBoost   & boost, HepRotation  & rotation) const;
00126   void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
00127   // Find R and B such that L = B*R -- trivial, since R is identity
00128 
00129   // ----------  Comparisons:
00130 
00131   inline int compare( const HepBoost & b  ) const;
00132   // Dictionary-order comparison, in order tt,zt,zz,yt,yz,yy,xt,xz,xy,xx
00133   // Used in operator<, >, <=, >=
00134 
00135   inline bool operator == (const HepBoost & b) const;
00136   inline bool operator != (const HepBoost & b) const;
00137   inline bool operator <= (const HepBoost & b) const;
00138   inline bool operator >= (const HepBoost & b) const;
00139   inline bool operator <  (const HepBoost & b) const;
00140   inline bool operator >  (const HepBoost & b) const;
00141   // Comparisons.
00142 
00143   inline bool isIdentity() const;
00144   // Returns true if a null boost.
00145 
00146   inline  double distance2( const HepBoost  & b  ) const;
00147   inline  double distance2( const HepBoostX & bx ) const;
00148   inline  double distance2( const HepBoostY & by ) const;
00149   inline  double distance2( const HepBoostZ & bz ) const;
00150   // Defined as the distance2 between the vectors (gamma*betaVector)
00151 
00152   double distance2( const HepRotation & r  ) const;
00153   double distance2( const HepLorentzRotation & lt  ) const;
00154   // Distance between this and other sorts of transformations
00155 
00156   inline double howNear(   const HepBoost & b ) const;
00157   inline bool isNear(   const HepBoost & b,
00158              double epsilon=Hep4RotationInterface::tolerance) const;
00159 
00160   double howNear( const HepRotation & r  ) const;
00161   double howNear( const HepLorentzRotation & lt  ) const;
00162 
00163   bool isNear( const HepRotation & r, 
00164              double epsilon=Hep4RotationInterface::tolerance) const;
00165   bool isNear( const HepLorentzRotation & lt, 
00166              double epsilon=Hep4RotationInterface::tolerance) const;
00167 
00168   // ----------  Properties:
00169 
00170   double norm2() const;
00171   // (beta*gamma)^2
00172 
00173   void rectify();
00174   // set as an exact boost, based on the timelike part of the boost matrix.
00175 
00176   // ---------- Application:
00177 
00178   inline HepLorentzVector operator()( const HepLorentzVector & p ) const;
00179   // Transform a Lorentz Vector.             
00180 
00181   inline HepLorentzVector operator* ( const HepLorentzVector & p ) const;
00182   // Multiplication with a Lorentz Vector.
00183 
00184   // ---------- Operations in the group of 4-Rotations
00185 
00186   HepLorentzRotation operator * (const HepBoost & b) const;
00187   HepLorentzRotation operator * (const HepRotation & r) const;
00188   HepLorentzRotation operator * (const HepLorentzRotation & lt) const;
00189   // Product of two Lorentz Rotations (this) * lt - matrix multiplication  
00190   // Notice that the product of two pure boosts is no longer a pure boost
00191 
00192   inline HepBoost inverse() const;
00193   // Return the inverse.
00194 
00195   inline friend HepBoost inverseOf ( const HepBoost & lt );
00196   // global methods to invert.
00197 
00198   inline HepBoost & invert();
00199   // Inverts the Boost matrix.
00200 
00201   // ---------- I/O:
00202 
00203   HepStd::ostream & print( HepStd::ostream & os ) const;
00204   // Output form is (bx, by, bz) 
00205 
00206   // ---------- Tolerance              
00207 
00208   static inline double getTolerance();
00209   static inline double setTolerance(double tol);
00210 
00211 protected:
00212 
00213   inline HepLorentzVector vectorMultiplication 
00214                                         ( const HepLorentzVector & w ) const;
00215   // Multiplication with a Lorentz Vector.
00216 
00217   HepLorentzRotation matrixMultiplication (const HepRep4x4 & m) const;
00218   HepLorentzRotation matrixMultiplication (const HepRep4x4Symmetric & m) const;
00219 
00220   inline HepBoost
00221        (double xx, double xy, double xz, double xt,
00222                       double yy, double yz, double yt,
00223                                     double zz, double zt,
00224                                                   double tt);
00225   // Protected constructor.
00226   // DOES NOT CHECK FOR VALIDITY AS A LORENTZ BOOST.
00227 
00228   inline void setBoost(double bx, double by, double bz);
00229 
00230   HepRep4x4Symmetric rep_;
00231 
00232 };
00233 
00234 #ifdef HEP_NO_INLINE_IN_DECLARATION
00235 #undef inline
00236 #endif
00237 
00238 #ifdef HEP_SHORT_NAMES
00239 typedef HepBoost LBoost;
00240 #endif
00241 
00242 #ifndef HEP_DEBUG_INLINE
00243 #include "CLHEP/Vector/Boost.icc"
00244 #endif
00245 
00246 #endif /* HEP_BOOST_H */

Class Library for High Energy Physics (version 1.8)