Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // LorentzRotation.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_LorentzRotation_H
0010 #define THEPEG_LorentzRotation_H
0011 //
0012 // This is the declaration of the LorentzRotation class.
0013 //
0014 #include "SpinOneLorentzRotation.h"
0015 #include "SpinHalfLorentzRotation.h"
0016 #include "LorentzRotation.fh"
0017 
0018 namespace ThePEG {
0019 
0020 /**
0021  * The LorentzRotation class combine a SpinOneLorentzRotation and a 
0022  * spin SpinHalfLorentzRotation to provide members which can perform the
0023  * Lorentz transformation of any object. The class ensures that the 
0024  * two transformations are consistent by only allowing transformations
0025  * to be made to both the spin-1 and spin-\f$\frac12\f$ members. 
0026  */
0027 class LorentzRotation {
0028 
0029   /**
0030    * The external inverseOf needs to be a friend
0031    */
0032   friend LorentzRotation inverseOf ( const LorentzRotation & lt );
0033 
0034 public:
0035 
0036   /** @name Constructors and destructor. */
0037   //@{
0038 
0039   /**
0040    * Default constructor. Gives a unit matrix.
0041    */
0042   LorentzRotation() : _half(), _one() {}
0043 
0044   /**
0045    * Constructor giving the components of a Lorentz boost.
0046    * @param bx The x-component of the boost
0047    * @param by The y-component of the boost
0048    * @param bz The z-component of the boost
0049    * @param gamma The \f$\gamma\f$ factor (optional)
0050    */
0051   LorentzRotation (double bx, double by, double bz, double gamma=-1.) 
0052     : _half(bx,by,bz,gamma), _one(bx,by,bz,gamma) {}
0053 
0054   /**
0055    * Constructor giving the vector for a Lorentz boost.
0056    * @param b The boost vector 
0057    * @param gamma The \f$\gamma\f$ factor (optional)
0058    */
0059   LorentzRotation (const Boost & b, double gamma=-1.)
0060     : _half(b,gamma), _one(b,gamma) {}
0061   //@}
0062 
0063   /**
0064    * Returns true if the Identity matrix.
0065    */
0066   bool isIdentity() const { 
0067     return _half.isIdentity() && _one.isIdentity(); 
0068   } 
0069 
0070   /**
0071    * Return the inverse.
0072    */
0073   LorentzRotation inverse() const {
0074     LorentzRotation output;
0075     output._half = _half.inverse();
0076     output._one  =  _one.inverse();
0077     return output;
0078   }
0079 
0080   /**
0081    * Inverts the LorentzRotation matrix.
0082    */
0083   LorentzRotation & invert() {
0084     return *this=inverse();
0085   }
0086 
0087   /**
0088    *  output operator
0089    */
0090   std::ostream & print( std::ostream & os ) const;
0091 
0092   /** @name Set methods for speical cases of simple rotations and boosts */
0093   //@{
0094 
0095   /**
0096    * Specify the components of a Lorentz Boost
0097    * @param bx The x-component of the boost
0098    * @param by The y-component of the boost
0099    * @param bz The z-component of the boost
0100    * @param gamma The \f$\gamma\f$ factor (optional)
0101    */
0102   LorentzRotation & setBoost (double bx, double by, double bz, double gamma=-1.) {
0103     _half.setBoost(bx,by,bz,gamma);
0104     _one.setBoost(bx,by,bz,gamma);
0105     return *this;
0106   }
0107 
0108   /**
0109    * Specify a Lorentz Boost as a vector
0110    * @param b The boost vector
0111    * @param gamma The \f$\gamma\f$ factor (optional)
0112    */
0113   LorentzRotation & setBoost (const Boost & b, double gamma=-1.) {
0114     _half.setBoost(b,gamma);
0115     _one.setBoost(b,gamma);
0116     return *this;
0117   }
0118 
0119   /**
0120    * Specify a boost by the given factor along the x-axis
0121    * @param boost The Lorentz boost  
0122    */
0123   LorentzRotation & setBoostX (double boost) {
0124     _half.setBoostX(boost);
0125     _one.setBoost(boost,0,0);
0126     return *this;
0127   }
0128 
0129   /**
0130    * Specify a boost by the given factor along the y-axis
0131    * @param boost The Lorentz boost  
0132    */
0133   LorentzRotation & setBoostY (double boost) {
0134     _half.setBoostY(boost);
0135     _one.setBoost(0,boost,0);
0136     return *this;
0137   }
0138 
0139   /**
0140    * Specify a boost by the given factor along the z-axis
0141    * @param boost The Lorentz boost  
0142    */
0143   LorentzRotation & setBoostZ (double boost) {
0144     _half.setBoostZ(boost);
0145     _one.setBoost(0,0,boost);
0146     return *this;
0147   }
0148 
0149   /**
0150    * Specify a rotation about a general axis by the angle given.
0151    * @param delta The angle
0152    * @param axis The axis
0153    */
0154   LorentzRotation & setRotate(double delta, const Axis & axis) {
0155     _half.setRotate(delta,axis);
0156     _one.setRotate(delta,axis);
0157     return *this;
0158   }
0159 
0160   /**
0161    * Specify a rotation by the given angle about the x-axis
0162    * @param angle The rotation angle 
0163    */
0164   LorentzRotation & setRotateX (double angle) {
0165     _half.setRotateX(angle);
0166     _one.setRotateX(angle);
0167     return *this;
0168   }
0169 
0170   /**
0171    * Specify a rotation by the given angle about the y-axis
0172    * @param angle The rotation angle 
0173    */
0174   LorentzRotation & setRotateY (double angle) {
0175     _half.setRotateZ(angle);
0176     _one.setRotateZ(angle);
0177     return *this;
0178   }
0179 
0180   /**
0181    * Specify a rotation by the given angle about the z-axis
0182    * @param angle The rotation angle 
0183    */
0184   LorentzRotation & setRotateZ (double angle) {
0185     _half.setRotateZ(angle);
0186     _one.setRotateZ(angle);
0187     return *this;
0188   }
0189   //@}
0190 
0191   /** @name Methods to return the spin-\f$\frac12\f$ and spin-1 transformations */
0192   //@{
0193 
0194   /**
0195    * The spin-\f$\frac12\f$ transformation
0196    */
0197   const SpinHalfLorentzRotation & half() const { return _half; }
0198 
0199   /**
0200    * The spin-1 transformation
0201    */
0202   const SpinOneLorentzRotation & one() const { return _one; }
0203 
0204   /**
0205    * Automatically cast to the spin-1 transformation
0206    */
0207   operator const SpinOneLorentzRotation & () const { return _one; }
0208   //@}
0209 
0210   /** @name Access methods for the components of the spin-1 rotation */
0211   //@{
0212 
0213   /**
0214    *   The xx component
0215    */
0216   double xx() const { return _one.xx(); }
0217 
0218   /**
0219    *   The xy component
0220    */
0221   double xy() const { return _one.xy(); }
0222 
0223   /**
0224    *   The xz component
0225    */
0226   double xz() const { return _one.xz(); }
0227 
0228   /**
0229    *   The xt component
0230    */
0231   double xt() const { return _one.xt(); }
0232 
0233   /**
0234    *   The yx component
0235    */
0236   double yx() const { return _one.yx(); }
0237 
0238   /**
0239    *   The yy component
0240    */
0241   double yy() const { return _one.yy(); }
0242 
0243   /**
0244    *   The yz component
0245    */
0246   double yz() const { return _one.yz(); }
0247 
0248   /**
0249    *   The yt component
0250    */
0251   double yt() const { return _one.yt(); }
0252 
0253   /**
0254    *   The zx component
0255    */
0256   double zx() const { return _one.zx(); }
0257 
0258   /**
0259    *   The zy component
0260    */
0261   double zy() const { return _one.zy(); }
0262 
0263   /**
0264    *   The zz component
0265    */
0266   double zz() const { return _one.zz(); }
0267 
0268   /**
0269    *   The zt component
0270    */
0271   double zt() const { return _one.zt(); }
0272 
0273   /**
0274    *   The tx component
0275    */
0276   double tx() const { return _one.tx(); }
0277 
0278   /**
0279    *   The ty component
0280    */
0281   double ty() const { return _one.ty(); }
0282 
0283   /**
0284    *   The tz component
0285    */
0286   double tz() const { return _one.tz(); }
0287 
0288   /**
0289    *   The tt component
0290    */
0291   double tt() const { return _one.tt(); }
0292   //@}
0293 
0294   /** @name Access methods for the components of the spin-\f$\frac12\f$ rotation */
0295   //@{
0296   /**
0297    *   The \f$(1,1)\f$ component
0298    */
0299   Complex s1s1() const { return _half.s1s1(); }
0300 
0301   /**
0302    *   The \f$(1,2)\f$ component
0303    */
0304   Complex s1s2() const { return _half.s1s2(); }
0305 
0306   /**
0307    *   The \f$(1,3)\f$ component
0308    */
0309   Complex s1s3() const { return _half.s1s3(); }
0310 
0311   /**
0312    *   The \f$(1,4)\f$ component
0313    */
0314   Complex s1s4() const { return _half.s1s4(); }
0315 
0316   /**
0317    *   The \f$(1,1)\f$ component
0318    */
0319   Complex s2s1() const { return _half.s2s1(); }
0320 
0321   /**
0322    *   The \f$(1,1)\f$ component
0323    */
0324   Complex s2s2() const { return _half.s2s2(); }
0325 
0326   /**
0327    *   The \f$(1,1)\f$ component
0328    */
0329   Complex s2s3() const { return _half.s2s3(); }
0330 
0331   /**
0332    *   The \f$(1,1)\f$ component
0333    */
0334   Complex s2s4() const { return _half.s2s4(); }
0335 
0336   /**
0337    *   The \f$(1,1)\f$ component
0338    */
0339   Complex s3s1() const { return _half.s3s1(); }
0340 
0341   /**
0342    *   The \f$(1,1)\f$ component
0343    */
0344   Complex s3s2() const { return _half.s3s2(); }
0345 
0346   /**
0347    *   The \f$(1,1)\f$ component
0348    */
0349   Complex s3s3() const { return _half.s3s3(); }
0350 
0351   /**
0352    *   The \f$(1,1)\f$ component
0353    */
0354   Complex s3s4() const { return _half.s3s4(); }
0355 
0356   /**
0357    *   The \f$(1,1)\f$ component
0358    */
0359   Complex s4s1() const { return _half.s4s1(); }
0360 
0361   /**
0362    *   The \f$(1,1)\f$ component
0363    */
0364   Complex s4s2() const { return _half.s4s2(); }
0365 
0366   /**
0367    *   The \f$(1,1)\f$ component
0368    */
0369   Complex s4s3() const { return _half.s4s3(); }
0370 
0371   /**
0372    *   The \f$(1,1)\f$ component
0373    */
0374   Complex s4s4() const { return _half.s4s4(); }
0375   //@}
0376 
0377 
0378   /** @name Transformation and product members */
0379   //@{
0380 
0381   /**
0382    * Product with a LorentzVector simply returns the rotated vector.
0383    */
0384   template <typename Value>
0385   LorentzVector<Value>
0386   operator*(const LorentzVector<Value> & lv) const { return one()*lv; }
0387 
0388   /**
0389    * Product with a Lorentz5Vector simply returns the rotated vector.
0390    */
0391   template <typename Value>
0392   Lorentz5Vector<Value>
0393   operator*(const Lorentz5Vector<Value> & lv) const { return one()*lv; }
0394 
0395   /**
0396    * Product of two LorentzRotations (this) * lt - matrix multiplication  
0397    * @param lt The LorentzRotation we are multiplying
0398    */
0399   LorentzRotation operator * (const LorentzRotation & lt) const {
0400     LorentzRotation output;
0401     output._half = _half * lt._half;
0402     output._one  = _one * lt._one; 
0403     return output;
0404   }
0405 
0406   /**
0407    * Multiply by and assign a*=b becomes a= a*b
0408    */
0409   LorentzRotation & operator *= (const LorentzRotation & lt) {
0410     _one *=lt._one;
0411     _half*=lt._half;
0412     return *this;
0413   }
0414 
0415   /**
0416    *  Transform  (similar to *= but a.transform(b) becomes a = b*a
0417    */
0418   LorentzRotation & transform(const LorentzRotation & lt) {
0419     _half.transform(lt._half);
0420     _one.transform(lt._one);
0421     return *this;
0422   }
0423 
0424   /**
0425    * Rotation around the x-axis; equivalent to LT = RotationX(delta) * LT
0426    */
0427   LorentzRotation & rotateX(double delta) {
0428     _half.rotateX(delta);
0429     _one.rotateX(delta);
0430     return *this;
0431   }
0432 
0433   /**
0434    * Rotation around the y-axis; equivalent to LT = RotationY(delta) * LT
0435    */
0436   LorentzRotation & rotateY(double delta) {
0437     _half.rotateY(delta);
0438     _one.rotateY(delta);
0439     return *this;
0440   }
0441 
0442   /**
0443    * Rotation around the z-axis; equivalent to LT = RotationZ(delta) * LT
0444    */
0445   LorentzRotation & rotateZ(double delta) {
0446     _half.rotateZ(delta);
0447     _one.rotateZ(delta);
0448     return *this;
0449   }
0450   
0451   /**
0452    *  Rotation around specified vector - LT = Rotation(delta,axis)*LT
0453    */
0454   LorentzRotation & rotate(double delta, const Axis & axis) {
0455     _half.rotate(delta,axis);
0456     _one.rotate(delta,axis);
0457     return *this;
0458   }
0459 
0460   /**
0461    * Pure boost along the x-axis; equivalent to LT = BoostX(beta) * LT
0462    */
0463   LorentzRotation & boostX(double beta) {
0464     _half.boostX(beta);
0465     _one.boostX(beta);
0466     return *this;
0467   }
0468 
0469   /**
0470    * Pure boost along the y-axis; equivalent to LT = BoostX(beta) * LT
0471    */
0472   LorentzRotation & boostY(double beta) {
0473     _half.boostY(beta);
0474     _one.boostY(beta);
0475     return *this;
0476   }
0477 
0478   /**
0479    * Pure boost along the z-axis; equivalent to LT = BoostX(beta) * LT
0480    */
0481   LorentzRotation & boostZ(double beta) {
0482     _half.boostZ(beta);
0483     _one.boostZ(beta);
0484     return *this;
0485   }
0486 
0487   /**
0488    *  boost equivalent to LT = Boost(bx,by,bz) * LT
0489    * @param bx The x-component of the boost
0490    * @param by The y-component of the boost
0491    * @param bz The z-component of the boost
0492    * @param gamma The \f$\gamma\f$ factor (optional)
0493    */
0494   LorentzRotation & boost(double bx, double by, double bz, double gamma=-1.) {
0495     _half.boost(bx,by,bz,gamma);
0496     _one.boost(bx,by,bz,gamma);
0497     return *this;
0498   }
0499 
0500   /**
0501    *  boost equivalent to LT = Boost(bv) * LT
0502    * @param bv The boost
0503    * @param gamma The \f$\gamma\f$ factor (optional)
0504    */
0505   LorentzRotation & boost(const Boost & bv, double gamma=-1.) {
0506     _half.boost(bv,gamma);
0507     _one.boost(bv,gamma);
0508     return *this;
0509   }
0510   //@}
0511 
0512 private:
0513 
0514   /**
0515    *  The spin-\f$\frac12\f$ rotation
0516    */
0517   SpinHalfLorentzRotation _half;
0518 
0519   /**
0520    *  The spin-1 rotation
0521    */
0522   SpinOneLorentzRotation _one;
0523 
0524 };
0525 
0526 /**
0527  *  Global method to get the inverse
0528  */
0529 inline LorentzRotation inverseOf ( const LorentzRotation & lt ) {
0530   return lt.inverse();
0531 }
0532 
0533 /**
0534  *  output operator
0535  */
0536 inline std::ostream & operator<< ( std::ostream & os,
0537                    const  LorentzRotation& lt ) {
0538   return lt.print(os);
0539 }
0540 
0541 }
0542 
0543 #endif /* THEPEG_LorentzRotation_H */
0544