CLHEP/Vector/BoostY.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 HepBoostY class for performing specialized
00006 // Lorentz transformations which are pure boosts in the Y direction, on 
00007 // objects of the HepLorentzVector class.
00008 //
00009 // HepLorentzRotation is a concrete implementation of Hep4RotationInterface.
00010 //
00011 // .SS See Also
00012 // RotationInterfaces.h
00013 // LorentzVector.h LorentzRotation.h 
00014 // Boost.h 
00015 //
00016 // .SS Author
00017 // Mark Fischler
00018 
00019 #ifndef HEP_BOOSTY_H
00020 #define HEP_BOOSTY_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/LorentzVector.h"
00032 
00033 // Declarations of classes and global methods
00034 class HepBoostY;               
00035 inline HepBoostY inverseOf ( const HepBoostY & b ); 
00036 class HepBoost;
00037 class HepRotation;
00038 
00043 class HepBoostY {
00044 
00045 public:
00046 
00047   // ----------  Constructors and Assignment:
00048 
00049   inline HepBoostY();
00050   // Default constructor. Gives a boost of 0.  
00051 
00052   inline HepBoostY(const HepBoostY & b);
00053   // Copy constructor.
00054 
00055   inline HepBoostY & operator = (const HepBoostY & m);
00056   // Assignment.
00057 
00058          HepBoostY & set (double beta);
00059   inline HepBoostY       (double beta);
00060   // Constructor from beta 
00061 
00062   // ----------  Accessors:
00063 
00064   inline double  beta()  const;
00065   inline double  gamma() const;
00066   inline Hep3Vector boostVector() const;
00067   inline Hep3Vector getDirection() const;
00068 
00069   inline double xx() const;
00070   inline double xy() const;
00071   inline double xz() const;
00072   inline double xt() const;
00073   inline double yx() const;
00074   inline double yy() const;
00075   inline double yz() const;
00076   inline double yt() const;
00077   inline double zx() const;
00078   inline double zy() const;
00079   inline double zz() const;
00080   inline double zt() const;
00081   inline double tx() const;
00082   inline double ty() const;
00083   inline double tz() const;
00084   inline double tt() const;
00085   // Elements of the matrix.
00086 
00087   inline HepLorentzVector col1() const;
00088   inline HepLorentzVector col2() const;
00089   inline HepLorentzVector col3() const;
00090   inline HepLorentzVector col4() const;
00091   // orthosymplectic column vectors
00092 
00093   inline HepLorentzVector row1() const;
00094   inline HepLorentzVector row2() const;
00095   inline HepLorentzVector row3() const;
00096   inline HepLorentzVector row4() const;
00097   // orthosymplectic row vectors
00098 
00099   HepRep4x4 rep4x4() const;
00100   //   4x4 representation:
00101 
00102   HepRep4x4Symmetric rep4x4Symmetric() const;
00103   //   Symmetric 4x4 representation.
00104 
00105 
00106   // ----------  Decomposition:
00107 
00108   void decompose (HepRotation  & rotation, HepBoost   & boost) const;
00109   void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
00110   // Find R and B such that L = R*B -- trivial, since R is identity
00111 
00112   void decompose (HepBoost  & boost, HepRotation   & rotation) const;
00113   void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
00114   // Find R and B such that L = B*R -- trivial, since R is identity
00115 
00116   // ----------  Comparisons:
00117 
00118   inline int compare( const HepBoostY & b  ) const;
00119   // Dictionary-order comparison, in order of beta. 
00120   // Used in operator<, >, <=, >=
00121 
00122   inline bool operator == (const HepBoostY & b) const;
00123   inline bool operator != (const HepBoostY & b) const;
00124   inline bool operator <= (const HepBoostY & b) const;
00125   inline bool operator >= (const HepBoostY & b) const;
00126   inline bool operator <  (const HepBoostY & b) const;
00127   inline bool operator >  (const HepBoostY & b) const;
00128   // Comparisons.
00129 
00130   inline bool isIdentity() const;
00131   // Returns true if a null boost.
00132 
00133   inline  double distance2( const HepBoostY & b ) const;
00134           double distance2( const HepBoost & b ) const;
00135   // Defined as the distance2 between the vectors (gamma*betaVector)
00136 
00137   double distance2( const HepRotation & r  ) const;
00138   double distance2( const HepLorentzRotation & lt  ) const;
00139   // Decompose lt = B*R; add norm2 to distance2 to between boosts.
00140 
00141   inline double howNear(   const HepBoostY & b ) const;
00142   inline double howNear(   const HepBoost  & b ) const;
00143   inline double howNear(   const HepRotation & r ) const;
00144   inline double howNear(   const HepLorentzRotation & lt ) const;
00145 
00146   inline bool isNear(   const HepBoostY & b,
00147              double epsilon=Hep4RotationInterface::tolerance) const;
00148   inline bool isNear(   const HepBoost & b,
00149              double epsilon=Hep4RotationInterface::tolerance) const;
00150   bool isNear(   const HepRotation & r,
00151              double epsilon=Hep4RotationInterface::tolerance) const;
00152   bool isNear(   const HepLorentzRotation & lt,
00153              double epsilon=Hep4RotationInterface::tolerance) const;
00154 
00155   // ----------  Properties:
00156 
00157   inline double norm2() const;
00158   // distance2 (IDENTITY), which is beta^2 * gamma^2
00159 
00160   void rectify();
00161   // sets according to the stored beta
00162 
00163   // ---------- Application:
00164 
00165   inline HepLorentzVector operator()( const HepLorentzVector & w ) const;
00166   // Transform a Lorentz Vector.             
00167 
00168   inline HepLorentzVector operator* ( const HepLorentzVector & w ) const;
00169   // Multiplication with a Lorentz Vector.
00170 
00171   // ---------- Operations in the group of 4-Rotations
00172 
00173   HepBoostY   operator * (const HepBoostY & b) const;
00174   HepLorentzRotation operator * (const HepBoost & b) const;
00175   HepLorentzRotation operator * (const HepRotation & r) const;
00176   HepLorentzRotation operator * (const HepLorentzRotation & lt) const;
00177   // Product of two Lorentz Rotations (this) * lt - matrix multiplication
00178   // Notice that the product of two pure boosts in different directions
00179   // is no longer a pure boost.
00180 
00181   inline HepBoostY inverse() const;
00182   // Return the inverse.
00183 
00184   inline friend HepBoostY inverseOf ( const HepBoostY & b );
00185   // global methods to invert.
00186 
00187   inline HepBoostY & invert();
00188   // Inverts the Boost matrix.
00189 
00190   // ---------- I/O:
00191 
00192   HepStd::ostream & print( HepStd::ostream & os ) const;
00193   // Output form is BOOSTY (beta=..., gamma=...);  
00194 
00195   // ---------- Tolerance
00196 
00197   static inline double getTolerance();
00198   static inline double setTolerance(double tol);
00199 
00200 protected:
00201 
00202   inline HepLorentzVector vectorMultiplication
00203                                         ( const HepLorentzVector & w ) const;
00204   // Multiplication with a Lorentz Vector.
00205 
00206   HepLorentzRotation matrixMultiplication (const HepRep4x4 & m) const;
00207   HepLorentzRotation matrixMultiplication (const HepRep4x4Symmetric & m) const;
00208                    
00209   inline HepBoostY (double beta, double gamma);
00210 
00211   double  beta_;
00212   double  gamma_;
00213 
00214 };
00215 
00216 inline   
00217 HepStd::ostream & operator << 
00218         ( HepStd::ostream & os, const HepBoostY& b ) {return b.print(os);}
00219 
00220 #
00221 #ifdef HEP_NO_INLINE_IN_DECLARATION
00222 #undef inline
00223 #endif
00224 
00225 #ifdef HEP_SHORT_NAMES
00226 typedef HepBoostY LBoostY;
00227 #endif
00228 
00229 #ifndef HEP_DEBUG_INLINE
00230 #include "CLHEP/Vector/BoostY.icc"
00231 #endif
00232 
00233 #endif /* HEP_BOOSTY_H */

Class Library for High Energy Physics (version 1.8)