Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:39

0001 // -*- C++ -*-
0002 //
0003 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
0004 //
0005 // This is the definition of the HepBoost class for performing specialized
0006 // Lorentz transformations which are pure boosts on objects of the
0007 // HepLorentzVector class.
0008 //
0009 // HepBoost is a concrete implementation of Hep4RotationInterface.
0010 //
0011 // .SS See Also
0012 // RotationInterfaces.h
0013 // LorentzVector.h LorentzRotation.h 
0014 //  BoostX.h BoostY.h BoostZ.h 
0015 //
0016 // .SS Author
0017 // Mark Fischler
0018 
0019 #ifndef HEP_BOOST_H
0020 #define HEP_BOOST_H
0021 
0022 #include "CLHEP/Vector/defs.h" 
0023 #include "CLHEP/Vector/RotationInterfaces.h"
0024 #include "CLHEP/Vector/BoostX.h"
0025 #include "CLHEP/Vector/BoostY.h"
0026 #include "CLHEP/Vector/BoostZ.h"
0027 #include "CLHEP/Vector/LorentzVector.h"
0028 
0029 namespace CLHEP {
0030 
0031 // Declarations of classes and global methods
0032 class HepBoost;
0033 inline HepBoost inverseOf ( const HepBoost & lt );
0034 
0035 /**
0036  * @author
0037  * @ingroup vector
0038  */
0039 class HepBoost {
0040 
0041 public:
0042 
0043   // ----------  Constructors and Assignment:
0044 
0045   inline HepBoost();
0046   // Default constructor. Gives a boost of 0.  
0047 
0048   inline HepBoost(const HepBoost & m);
0049   inline HepBoost(HepBoost && m) = default;
0050   // Copy and move constructors.
0051 
0052   inline HepBoost & operator = (const HepBoost & m);
0053   inline HepBoost & operator = (HepBoost && m) = default;
0054   // Copy and move assignment operators.
0055 
0056          HepBoost & set (double betaX, double betaY, double betaZ);
0057   inline HepBoost       (double betaX, double betaY, double betaZ);
0058   // Constructor from three components of beta vector
0059 
0060          HepBoost & set (const HepRep4x4Symmetric & m);
0061   inline HepBoost       (const HepRep4x4Symmetric & m);
0062   // Constructor from symmetric HepRep4x4
0063 
0064          HepBoost & set (Hep3Vector direction, double beta);
0065   inline HepBoost       (Hep3Vector direction, double beta);
0066   // Constructor from a three vector direction and the magnitude of beta
0067 
0068          HepBoost & set (const Hep3Vector & boost);
0069   inline HepBoost       (const Hep3Vector & boost);
0070   // Constructor from a 3-vector of less than unit length
0071 
0072   inline HepBoost & set (const HepBoostX & boost);
0073   inline HepBoost & set (const HepBoostY & boost);
0074   inline HepBoost & set (const HepBoostZ & boost);
0075   inline HepBoost       (const HepBoostX & boost);
0076   inline HepBoost       (const HepBoostY & boost);
0077   inline HepBoost       (const HepBoostZ & boost);
0078 
0079   // ----------  Accessors:
0080 
0081   inline double  beta()  const;
0082   inline double  gamma() const;
0083   inline Hep3Vector boostVector() const;
0084   inline Hep3Vector getDirection() const;
0085   inline Hep3Vector direction() const;
0086 
0087   inline double xx() const;
0088   inline double xy() const;
0089   inline double xz() const;
0090   inline double xt() const;
0091   inline double yx() const;
0092   inline double yy() const;
0093   inline double yz() const;
0094   inline double yt() const;
0095   inline double zx() const;
0096   inline double zy() const;
0097   inline double zz() const;
0098   inline double zt() const;
0099   inline double tx() const;
0100   inline double ty() const;
0101   inline double tz() const;
0102   inline double tt() const;
0103   // Elements of the matrix.
0104 
0105   inline HepLorentzVector col1() const;
0106   inline HepLorentzVector col2() const;
0107   inline HepLorentzVector col3() const;
0108   inline HepLorentzVector col4() const;
0109   // orthosymplectic column vectors
0110 
0111   inline HepLorentzVector row1() const;
0112   inline HepLorentzVector row2() const;
0113   inline HepLorentzVector row3() const;
0114   inline HepLorentzVector row4() const;
0115   // orthosymplectic row vectors
0116 
0117   inline HepRep4x4 rep4x4() const;
0118   //   4x4 representation.
0119 
0120   inline HepRep4x4Symmetric rep4x4Symmetric() const;
0121   //   Symmetric 4x4 representation.
0122 
0123   // ----------  Decomposition:
0124 
0125   void decompose (HepRotation  & rotation, HepBoost   & boost) const;
0126   void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
0127   // Find R and B such that L = R*B -- trivial, since R is identity
0128 
0129   void decompose (HepBoost   & boost, HepRotation  & rotation) const;
0130   void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
0131   // Find R and B such that L = B*R -- trivial, since R is identity
0132 
0133   // ----------  Comparisons:
0134 
0135   inline int compare( const HepBoost & b  ) const;
0136   // Dictionary-order comparison, in order tt,zt,zz,yt,yz,yy,xt,xz,xy,xx
0137   // Used in operator<, >, <=, >=
0138 
0139   inline bool operator == (const HepBoost & b) const;
0140   inline bool operator != (const HepBoost & b) const;
0141   inline bool operator <= (const HepBoost & b) const;
0142   inline bool operator >= (const HepBoost & b) const;
0143   inline bool operator <  (const HepBoost & b) const;
0144   inline bool operator >  (const HepBoost & b) const;
0145   // Comparisons.
0146 
0147   inline bool isIdentity() const;
0148   // Returns true if a null boost.
0149 
0150   inline  double distance2( const HepBoost  & b  ) const;
0151   inline  double distance2( const HepBoostX & bx ) const;
0152   inline  double distance2( const HepBoostY & by ) const;
0153   inline  double distance2( const HepBoostZ & bz ) const;
0154   // Defined as the distance2 between the vectors (gamma*betaVector)
0155 
0156   double distance2( const HepRotation & r  ) const;
0157   double distance2( const HepLorentzRotation & lt  ) const;
0158   // Distance between this and other sorts of transformations
0159 
0160   inline double howNear(   const HepBoost & b ) const;
0161   inline bool isNear(   const HepBoost & b,
0162              double epsilon=Hep4RotationInterface::tolerance) const;
0163 
0164   double howNear( const HepRotation & r  ) const;
0165   double howNear( const HepLorentzRotation & lt  ) const;
0166 
0167   bool isNear( const HepRotation & r, 
0168              double epsilon=Hep4RotationInterface::tolerance) const;
0169   bool isNear( const HepLorentzRotation & lt, 
0170              double epsilon=Hep4RotationInterface::tolerance) const;
0171 
0172   // ----------  Properties:
0173 
0174   double norm2() const;
0175   // (beta*gamma)^2
0176 
0177   void rectify();
0178   // set as an exact boost, based on the timelike part of the boost matrix.
0179 
0180   // ---------- Application:
0181 
0182   inline HepLorentzVector operator()( const HepLorentzVector & p ) const;
0183   // Transform a Lorentz Vector.             
0184 
0185   inline HepLorentzVector operator* ( const HepLorentzVector & p ) const;
0186   // Multiplication with a Lorentz Vector.
0187 
0188   // ---------- Operations in the group of 4-Rotations
0189 
0190   HepLorentzRotation operator * (const HepBoost & b) const;
0191   HepLorentzRotation operator * (const HepRotation & r) const;
0192   HepLorentzRotation operator * (const HepLorentzRotation & lt) const;
0193   // Product of two Lorentz Rotations (this) * lt - matrix multiplication  
0194   // Notice that the product of two pure boosts is no longer a pure boost
0195 
0196   inline HepBoost inverse() const;
0197   // Return the inverse.
0198 
0199   inline friend HepBoost inverseOf ( const HepBoost & lt );
0200   // global methods to invert.
0201 
0202   inline HepBoost & invert();
0203   // Inverts the Boost matrix.
0204 
0205   // ---------- I/O:
0206 
0207   std::ostream & print( std::ostream & os ) const;
0208   // Output form is (bx, by, bz) 
0209 
0210   // ---------- Tolerance              
0211 
0212   static inline double getTolerance();
0213   static inline double setTolerance(double tol);
0214 
0215 protected:
0216 
0217   inline HepLorentzVector vectorMultiplication 
0218                     ( const HepLorentzVector & w ) const;
0219   // Multiplication with a Lorentz Vector.
0220 
0221   HepLorentzRotation matrixMultiplication (const HepRep4x4 & m) const;
0222   HepLorentzRotation matrixMultiplication (const HepRep4x4Symmetric & m) const;
0223 
0224   inline HepBoost
0225        (double xx, double xy, double xz, double xt,
0226            double yy, double yz, double yt,
0227                   double zz, double zt,
0228                      double tt);
0229   // Protected constructor.
0230   // DOES NOT CHECK FOR VALIDITY AS A LORENTZ BOOST.
0231 
0232   inline void setBoost(double bx, double by, double bz);
0233 
0234   HepRep4x4Symmetric rep_;
0235 
0236 };  // HepBoost
0237 
0238 inline   
0239 std::ostream & operator << 
0240     ( std::ostream & os, const HepBoost& b ) {return b.print(os);}
0241 
0242 }  // namespace CLHEP
0243 
0244 #include "CLHEP/Vector/Boost.icc"
0245 
0246 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
0247 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
0248 using namespace CLHEP;
0249 #endif
0250 
0251 #endif /* HEP_BOOST_H */