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