Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:33

0001 // -*- C++ -*-
0002 //
0003 // SpinHalfLorentzRotation.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef THEPEG_SpinHalfLorentzRotation_H
0010 #define THEPEG_SpinHalfLorentzRotation_H
0011 //
0012 // This is the declaration of the SpinHalfLorentzRotation class.
0013 //
0014 #include "ThePEG/Helicity/HelicityDefinitions.h"
0015 #include "ThreeVector.h"
0016 
0017 namespace ThePEG {
0018 
0019 /**
0020  * The SpinHalfLorentzRotation class is designed to offer the same
0021  * features as the HepLorentzRotation class of CLHEP but for the spin-\f$\frac12\f$
0022  * Lorentz transformation. This is then combined into the general LorentzRotation
0023  * class of ThePEG to provide the Lorentz transformation for any object as the
0024  * transformations for higher spin objects can be built from the spin-\f$\frac12\f$
0025  * and spin-1 transformations.
0026  *
0027  * The boost matrix is calculated using the default Dirac matrix representation.
0028  * Any conversion to other Dirac matrix representations must be handled when the
0029  * transformation is used.
0030  */
0031 class SpinHalfLorentzRotation {
0032 
0033   /**
0034    * The external inverseOf needs to be a friend
0035    */
0036   friend SpinHalfLorentzRotation inverseOf ( const SpinHalfLorentzRotation & lt );
0037 
0038 public:
0039 
0040   /** @name Constructors and destructor. */
0041   //@{
0042 
0043   /**
0044    * Default constructor. Gives a unit matrix.
0045    */
0046   SpinHalfLorentzRotation();
0047 
0048   /**
0049    * Constructor giving the components of a Lorentz boost.
0050    * @param bx The x-component of the boost
0051    * @param by The y-component of the boost
0052    * @param bz The z-component of the boost
0053    * @param gamma The \f$\gamma\f$ factor (optional)
0054    */
0055   SpinHalfLorentzRotation (double bx, double by, double bz, double gamma=-1.);
0056 
0057   /**
0058    * Constructor giving the vector for a Lorentz boost.
0059    * @param b The boost vector
0060    * @param gamma The \f$\gamma\f$ factor (optional)
0061    */
0062   SpinHalfLorentzRotation (const Boost & b,double gamma=-1.);
0063   //@}
0064 
0065   /**
0066    * Returns true if the Identity matrix.
0067    */
0068   bool isIdentity() const;
0069 
0070   /**
0071    * Return the inverse.
0072    */
0073   SpinHalfLorentzRotation inverse() const;
0074 
0075   /**
0076    * Inverts the SpinHalfLorentzRotation matrix.
0077    */
0078   SpinHalfLorentzRotation & invert() { return *this = inverse(); }
0079 
0080   /**
0081    *  output operator
0082    */
0083   std::ostream & print( std::ostream & os ) const;
0084 
0085   /** @name Set methods for speical cases of simple rotations and boosts */
0086   //@{
0087 
0088   /**
0089    * Specify the components of a Lorentz Boost
0090    * @param bx The x-component of the boost
0091    * @param by The y-component of the boost
0092    * @param bz The z-component of the boost
0093    * @param gamma The \f$\gamma\f$ factor (optional)
0094    */
0095   SpinHalfLorentzRotation & setBoost (double bx, double by, double bz,double gamma=-1.);
0096 
0097   /**
0098    * Specify a Lorentz Boost as a vector
0099    * @param b The boost vector
0100    * @param gamma The \f$\gamma\f$ factor (optional)
0101    */
0102   SpinHalfLorentzRotation & setBoost (const Boost & b,double gamma=-1.);
0103 
0104   /**
0105    * Specify a boost by the given factor along the x-axis
0106    * @param boost The Lorentz boost  
0107    */
0108   SpinHalfLorentzRotation & setBoostX (double & boost);
0109 
0110   /**
0111    * Specify a boost by the given factor along the y-axis
0112    * @param boost The Lorentz boost  
0113    */
0114   SpinHalfLorentzRotation & setBoostY (double & boost);
0115 
0116   /**
0117    * Specify a boost by the given factor along the z-axis
0118    * @param boost The Lorentz boost  
0119    */
0120   SpinHalfLorentzRotation & setBoostZ (double & boost);
0121 
0122   /**
0123    * Specify a rotation about a general axis by the angle given.
0124    * @param delta The angle
0125    * @param axis The axis
0126    */
0127   SpinHalfLorentzRotation & setRotate(double delta, const Axis & axis);
0128 
0129   /**
0130    * Specify a rotation by the given angle about the x-axis
0131    * @param angle The rotation angle 
0132    */
0133   SpinHalfLorentzRotation & setRotateX (double & angle);
0134 
0135   /**
0136    * Specify a rotation by the given angle about the y-axis
0137    * @param angle The rotation angle 
0138    */
0139   SpinHalfLorentzRotation & setRotateY (double & angle);
0140 
0141   /**
0142    * Specify a rotation by the given angle about the z-axis
0143    * @param angle The rotation angle 
0144    */
0145   SpinHalfLorentzRotation & setRotateZ (double & angle);
0146   
0147   //@}
0148 
0149 
0150   /** @name Access methods for the components */
0151   //@{
0152   /**
0153    *   The \f$(1,1)\f$ component
0154    */
0155   Complex s1s1() const { return _mx[0][0]; }
0156 
0157   /**
0158    *   The \f$(1,2)\f$ component
0159    */
0160   Complex s1s2() const { return _mx[0][1]; }
0161 
0162   /**
0163    *   The \f$(1,3)\f$ component
0164    */
0165   Complex s1s3() const { return _mx[0][2]; }
0166 
0167   /**
0168    *   The \f$(1,4)\f$ component
0169    */
0170   Complex s1s4() const { return _mx[0][3]; }
0171 
0172   /**
0173    *   The \f$(1,1)\f$ component
0174    */
0175   Complex s2s1() const { return _mx[1][0]; }
0176 
0177   /**
0178    *   The \f$(1,1)\f$ component
0179    */
0180   Complex s2s2() const { return _mx[1][1]; }
0181 
0182   /**
0183    *   The \f$(1,1)\f$ component
0184    */
0185   Complex s2s3() const { return _mx[1][2]; }
0186 
0187   /**
0188    *   The \f$(1,1)\f$ component
0189    */
0190   Complex s2s4() const { return _mx[1][3]; }
0191 
0192   /**
0193    *   The \f$(1,1)\f$ component
0194    */
0195   Complex s3s1() const { return _mx[2][0]; }
0196 
0197   /**
0198    *   The \f$(1,1)\f$ component
0199    */
0200   Complex s3s2() const { return _mx[2][1]; }
0201 
0202   /**
0203    *   The \f$(1,1)\f$ component
0204    */
0205   Complex s3s3() const { return _mx[2][2]; }
0206 
0207   /**
0208    *   The \f$(1,1)\f$ component
0209    */
0210   Complex s3s4() const { return _mx[2][3]; }
0211 
0212   /**
0213    *   The \f$(1,1)\f$ component
0214    */
0215   Complex s4s1() const { return _mx[3][0]; }
0216 
0217   /**
0218    *   The \f$(1,1)\f$ component
0219    */
0220   Complex s4s2() const { return _mx[3][1]; }
0221 
0222   /**
0223    *   The \f$(1,1)\f$ component
0224    */
0225   Complex s4s3() const { return _mx[3][2]; }
0226 
0227   /**
0228    *   The \f$(1,1)\f$ component
0229    */
0230   Complex s4s4() const { return _mx[3][3]; }
0231 
0232   /**
0233    *  Fortran style subscript operator
0234    */
0235   Complex operator()(unsigned int i, unsigned int j) const {
0236     assert(i<=3 && j<=3);
0237     return _mx[i][j];
0238   }
0239   //@}
0240 
0241 
0242   /** @name Transformation and product members */
0243   //@{
0244 
0245   /**
0246    * Product of two SpinHalfLorentzRotations (this) * lt - matrix multiplication  
0247    * @param lt The SpinHalfLorentzRotation we are multiplying
0248    */
0249   SpinHalfLorentzRotation operator * (const SpinHalfLorentzRotation & lt) const;
0250 
0251   /**
0252    * Multiply by and assign a*=b becomes a= a*b
0253    */
0254    SpinHalfLorentzRotation & operator *= (const SpinHalfLorentzRotation & );
0255 
0256   /**
0257    *  Transform  (similar to *= but a.transform(b) becomes a = b*a
0258    */
0259    SpinHalfLorentzRotation & transform   (const SpinHalfLorentzRotation & );
0260 
0261   /**
0262    * Rotation around the x-axis; equivalent to LT = RotationX(delta) * LT
0263    */
0264   SpinHalfLorentzRotation & rotateX(double delta);
0265 
0266   /**
0267    * Rotation around the y-axis; equivalent to LT = RotationY(delta) * LT
0268    */
0269   SpinHalfLorentzRotation & rotateY(double delta);
0270 
0271   /**
0272    * Rotation around the z-axis; equivalent to LT = RotationZ(delta) * LT
0273    */
0274   SpinHalfLorentzRotation & rotateZ(double delta);
0275   
0276   /**
0277    *  Rotation around specified vector - LT = Rotation(delta,axis)*LT
0278    */
0279   SpinHalfLorentzRotation & rotate(double delta, const Axis & axis);
0280 
0281   /**
0282    * Pure boost along the x-axis; equivalent to LT = BoostX(beta) * LT
0283    */
0284   SpinHalfLorentzRotation & boostX(double beta);
0285 
0286   /**
0287    * Pure boost along the y-axis; equivalent to LT = BoostX(beta) * LT
0288    */
0289   SpinHalfLorentzRotation & boostY(double beta);
0290 
0291   /**
0292    * Pure boost along the z-axis; equivalent to LT = BoostX(beta) * LT
0293    */
0294   SpinHalfLorentzRotation & boostZ(double beta);
0295 
0296   /**
0297    * General boost equivalent to LT = Boost(bx,by,bz) * LT
0298    * @param bx The x-component of the boost
0299    * @param by The y-component of the boost
0300    * @param bz The z-component of the boost
0301    * @param gamma The \f$\gamma\f$ factor (optional)
0302    */
0303   SpinHalfLorentzRotation & boost(double bx, double by, double bz, double gamma=-1.);
0304 
0305   /**
0306    * General boost equivalent to LT = Boost(bv) * LT
0307    * @param bv The boost vector
0308    * @param gamma The \f$\gamma\f$ factor (optional)
0309    */
0310   SpinHalfLorentzRotation & boost(const Boost & bv, double gamma=-1.);
0311   //@}
0312 
0313 protected:
0314 
0315   /**
0316    *  Protected constructor giving all the members, no check it is a valid
0317    *  transformation
0318    */
0319   SpinHalfLorentzRotation(Complex s1s1,Complex s1s2,Complex s1s3,Complex s1s4,
0320                  Complex s2s1,Complex s2s2,Complex s2s3,Complex s2s4,
0321                  Complex s3s1,Complex s3s2,Complex s3s3,Complex s3s4,
0322                  Complex s4s1,Complex s4s2,Complex s4s3,Complex s4s4);
0323 
0324 private:
0325 
0326   using MatrixT = array<array<Complex,4>,4>;
0327 
0328   SpinHalfLorentzRotation(const MatrixT & m) : _mx(m) {}
0329 
0330   /**
0331    * The members of the transformation matrix.
0332    */
0333   MatrixT _mx;
0334 };
0335 
0336 /**
0337  *  Global method to get the inverse
0338  */
0339 inline SpinHalfLorentzRotation inverseOf ( const SpinHalfLorentzRotation & lt ) {
0340   return lt.inverse();
0341 }
0342 
0343 /**
0344  *  output operator
0345  */
0346 inline std::ostream & operator<< ( std::ostream & os,
0347                    const  SpinHalfLorentzRotation& lt ) {
0348   return lt.print(os);
0349 }
0350 
0351 }
0352 
0353 #endif /* THEPEG_SpinHalfLorentzRotation_H */