Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // LorentzRSSpinorBar.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 2003-2019 Peter Richardson, 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_LorentzRSSpinorBar_H
0010 #define ThePEG_LorentzRSSpinorBar_H
0011 // This is the declaration of the LorentzRSSpinorBar class.
0012 
0013 #include "ThePEG/Config/ThePEG.h"
0014 #include "ThePEG/Vectors/ThreeVector.h"
0015 #include "HelicityDefinitions.h"
0016 #include "LorentzRSSpinor.fh"
0017 #include "LorentzRSSpinorBar.fh"
0018 #include "LorentzSpinorBar.h"
0019 #include "LorentzSpinor.h"
0020 #include "LorentzPolarizationVector.h"
0021 
0022 namespace ThePEG {
0023 namespace Helicity {
0024 
0025 /**
0026  *  The <code>LorentzRSSpinorBar</code> class implements the storage of a
0027  *  barred Lorentz Rarita-Schwinger Spinor for a spin-3/2 particle.
0028  *  The design is based on that of the
0029  *  <code>LorentzRSSpinor</code> class and the details of the implemented
0030  *  are discussed in more detail in the header file for that class.
0031  *
0032  * @see LorentzRSSpinor
0033  *
0034  * \author Peter Richardson
0035  *
0036  */
0037 template <typename Value>
0038 class LorentzRSSpinorBar {
0039 
0040 public:
0041 
0042   /** @name Standard constructors. */
0043   //@{
0044   /**
0045    * Default zero constructor, optionally specifying \a t, the type.
0046    */
0047   LorentzRSSpinorBar(SpinorType t = SpinorType::unknown) : _type(t), _spin() {}
0048 
0049   /**
0050    * Constructor with complex numbers specifying the components,
0051    * optionally specifying \a t, the type.
0052    */
0053   LorentzRSSpinorBar(complex<Value> a1,complex<Value> b1,
0054              complex<Value> c1,complex<Value> d1,
0055              complex<Value> a2,complex<Value> b2,
0056              complex<Value> c2,complex<Value> d2,
0057              complex<Value> a3,complex<Value> b3,
0058              complex<Value> c3,complex<Value> d3,
0059              complex<Value> a4,complex<Value> b4,
0060              complex<Value> c4,complex<Value> d4,
0061              SpinorType t=SpinorType::unknown)
0062     : _type(t), _spin{{ {{a1,b1,c1,d1}},
0063                         {{a2,b2,c2,d2}},
0064                         {{a3,b3,c3,d3}},
0065                         {{a4,b4,c4,d4}}
0066                       }} {}
0067 
0068   template <typename U>
0069   LorentzRSSpinorBar(const LorentzRSSpinorBar<U> & other)
0070     : _type(other._type), _spin(other._spin) {}
0071   //@}
0072 
0073   /** @name Access the components. */
0074   //@{
0075   /**
0076    * Subscript operator to return spinor components
0077    */
0078   complex<Value> operator()(int i, int j) const {
0079     assert( i >= 0 && i <= 3 && j>=0 && j<=3 );
0080     return _spin[i][j];
0081   }
0082 
0083   /**
0084    * Set components by index
0085    */
0086   complex<Value> & operator () (int i, int j) {
0087     assert( i >= 0 && i <= 3 && j>=0 && j<=3 );
0088     return _spin[i][j];
0089   }
0090   
0091   /**
0092    * Get first spinor component for the x vector
0093    */
0094   complex<Value> xs1() const {return _spin[0][0];}
0095 
0096   /**
0097    * Get second spinor component for the x vector
0098    */
0099   complex<Value> xs2() const {return _spin[0][1];}
0100 
0101   /**
0102    * Get third  spinor component for the x vector
0103    */
0104   complex<Value> xs3() const {return _spin[0][2];}
0105 
0106   /**
0107    * Get fourth  spinor component for the x vector
0108    */
0109   complex<Value> xs4() const {return _spin[0][3];}
0110 
0111   /**
0112    * Get first spinor component for the y vector
0113    */
0114   complex<Value> ys1() const {return _spin[1][0];}
0115 
0116   /**
0117    * Get second spinor component for the y vector
0118    */
0119   complex<Value> ys2() const {return _spin[1][1];}
0120   
0121   /**
0122    * Get third spinor component for the y vector
0123    */
0124   complex<Value> ys3() const {return _spin[1][2];}
0125   
0126   /**
0127    * Get fourth spinor component for the y vector
0128    */
0129   complex<Value> ys4() const {return _spin[1][3];}
0130   
0131   /**
0132    * Get first spinor component for the z vector
0133    */
0134   complex<Value> zs1() const {return _spin[2][0];}
0135   
0136   /**
0137    * Get second spinor component for the z vector
0138    */
0139   complex<Value> zs2() const {return _spin[2][1];}
0140   
0141   /**
0142    * Get third spinor component for the z vector
0143    */
0144   complex<Value> zs3() const {return _spin[2][2];}
0145   
0146   /**
0147    * Get fourth spinor component for the z vector
0148    */
0149   complex<Value> zs4() const {return _spin[2][3];}
0150   
0151   /**
0152    * Get first spinor component for the t vector
0153    */
0154   complex<Value> ts1() const {return _spin[3][0];}
0155   
0156   /**
0157    * Get second spinor component for the t vector
0158    */
0159   complex<Value> ts2() const {return _spin[3][1];}
0160   
0161   /**
0162    * Get third spinor component for the t vector
0163    */
0164   complex<Value> ts3() const {return _spin[3][2];}
0165   
0166   /**
0167    * Get fourth spinor component for the t vector
0168    */
0169   complex<Value> ts4() const {return _spin[3][3];}
0170   
0171   /**
0172    * Set first spinor component for the x vector
0173    */
0174   void setXS1(complex<Value> in) {_spin[0][0]=in;}
0175   
0176   /**
0177    * Set second spinor component for the x vector
0178    */
0179   void setXS2(complex<Value> in) {_spin[0][1]=in;}
0180   
0181   /**
0182    * Set third spinor component for the x vector
0183    */
0184   void setXS3(complex<Value> in) {_spin[0][2]=in;}
0185   
0186   /**
0187    * Set fourth spinor component for the x vector
0188    */
0189   void setXS4(complex<Value> in) {_spin[0][3]=in;}
0190   
0191   /**
0192    * Set first spinor component for the y vector
0193    */
0194   void setYS1(complex<Value> in) {_spin[1][0]=in;}
0195   
0196   /**
0197    * Set second spinor component for the y vector
0198    */
0199   void setYS2(complex<Value> in) {_spin[1][1]=in;}
0200   
0201   /**
0202    * Set third spinor component for the y vector
0203    */
0204   void setYS3(complex<Value> in) {_spin[1][2]=in;}
0205   
0206   /**
0207    * Set fourth spinor component for the y vector
0208    */
0209   void setYS4(complex<Value> in) {_spin[1][3]=in;}
0210   
0211   /**
0212    * Set first spinor component for the z vector
0213    */
0214   void setZS1(complex<Value> in) {_spin[2][0]=in;}
0215   
0216   /**
0217    * Set second spinor component for the z vector
0218    */
0219   void setZS2(complex<Value> in) {_spin[2][1]=in;}
0220   
0221   /**
0222    * Set third spinor component for the z vector
0223    */
0224   void setZS3(complex<Value> in) {_spin[2][2]=in;}
0225   
0226   /**
0227    * Set fourth spinor component for the z vector
0228    */
0229   void setZS4(complex<Value> in) {_spin[2][3]=in;}
0230   
0231   /**
0232    * Set first spinor component for the t vector
0233    */
0234   void setTS1(complex<Value> in) {_spin[3][0]=in;}
0235   
0236   /**
0237    * Set second spinor component for the t vector
0238    */
0239   void setTS2(complex<Value> in) {_spin[3][1]=in;}
0240   
0241   /**
0242    * Set third spinor component for the t vector
0243    */
0244   void setTS3(complex<Value> in) {_spin[3][2]=in;}
0245   
0246   /**
0247    * Set fourth spinor component for the t vector
0248    */
0249   void setTS4(complex<Value> in ) {_spin[3][3]=in;}
0250   //@}
0251 
0252   /// @name Mathematical assignment operators.
0253   //@{
0254   template <typename ValueB>
0255   LorentzRSSpinorBar<Value> & operator+=(const LorentzRSSpinorBar<ValueB> & a) {
0256     for(unsigned int ix=0;ix<4;++ix)
0257       for(unsigned int iy=0;iy<4;++iy)
0258     _spin[ix][iy] += a._spin[ix][iy];
0259     return *this;
0260   }
0261   
0262   template <typename ValueB>
0263   LorentzRSSpinorBar<Value> & operator-=(const LorentzRSSpinorBar<ValueB> & a) {
0264     for(unsigned int ix=0;ix<4;++ix)
0265       for(unsigned int iy=0;iy<4;++iy)
0266     _spin[ix][iy] -= a._spin[ix][iy];
0267     return *this;
0268   }
0269   
0270   LorentzRSSpinorBar<Value> & operator*=(double a) {
0271     for(unsigned int ix=0;ix<4;++ix)
0272       for(unsigned int iy=0;iy<4;++iy)
0273     _spin[ix][iy] *=a;
0274     return *this;
0275   }
0276   
0277   LorentzRSSpinorBar<Value> & operator/=(double a) {
0278     for(unsigned int ix=0;ix<4;++ix)
0279       for(unsigned int iy=0;iy<4;++iy)
0280     _spin[ix][iy] /=a;
0281     return *this;
0282   }
0283   //@}
0284 
0285   /** @name Arithmetic operators. */
0286   //@{
0287   /**
0288    * dot product with a polarization vector
0289    */
0290   LorentzSpinorBar<Value> dot(const LorentzPolarizationVector & vec) const {
0291     LorentzSpinorBar<Value> output(_type);
0292     for(unsigned int ix=0;ix<4;++ix) {
0293       output[ix]=_spin[3][ix]*vec.t()-_spin[0][ix]*vec.x()
0294     -_spin[1][ix]*vec.y()-_spin[2][ix]*vec.z();
0295     }
0296     return output;
0297   }
0298 
0299   /**
0300    * dot product with a 4-momentum
0301    */
0302   LorentzSpinorBar<Value> dot(const LorentzMomentum & invec) const {
0303     LorentzSpinorBar<Value> output(_type);
0304     LorentzVector<double> vec = UnitRemoval::InvE * invec;
0305     unsigned int ix;
0306     for(ix=0;ix<4;++ix) {
0307       output[ix]=_spin[3][ix]*vec.t()-_spin[0][ix]*vec.x()
0308     -_spin[1][ix]*vec.y()-_spin[2][ix]*vec.z();
0309     }
0310     return output;
0311   }
0312   //@}
0313   
0314   /** @name Transformations. */
0315   //@{
0316   /**
0317    * return the barred spinor
0318    */
0319   LorentzRSSpinor<Value> bar() const;
0320 
0321   /**
0322    * Standard Lorentz boost specifying the components of the beta vector.
0323    */
0324   LorentzRSSpinorBar & boost(double,double,double);
0325 
0326   /**
0327    * Standard Lorentz boost specifying the beta vector.
0328    */
0329   LorentzRSSpinorBar & boost(const Boost &);
0330 
0331   /**
0332    * General transform
0333    */
0334   LorentzRSSpinorBar & transform(const LorentzRotation &);
0335   //@}
0336 
0337   /** @name Functions related to type. */
0338   //@{
0339   /**
0340    * Return the type of the spinor.
0341    */
0342   SpinorType Type() const {return _type;}
0343   //@}
0344 
0345   /**
0346    * Current \f$\bar{f}^\alpha(c_LP_L+c_RP_R)f\f$ for general couplings.
0347    * @param f The unbarred spinor
0348    * @param left The left-handed coupling, \f$c_L\f$.
0349    * @param right The right-handed coupling, \f$c_R\f$.
0350    */
0351   template <typename ValueB>
0352   auto generalCurrent(LorentzSpinor<ValueB>& f, 
0353                       Complex left, Complex right) 
0354   -> LorentzVector<decltype(left*this->ts1()*f.s1())>
0355   {
0356       typedef decltype(left*ts1()*f.s1()) ResultT;
0357       ResultT output[4];
0358       unsigned int iz;
0359       for(iz=0;iz<4;++iz){
0360     output[iz]=  left*(_spin[iz][0]*f.s1()+_spin[iz][1]*f.s2())
0361       +right*(_spin[iz][2]*f.s3()+_spin[iz][3]*f.s4());
0362       }
0363       return LorentzVector<ResultT>(output[0],output[1],
0364                     output[2],output[3]);
0365     }
0366   
0367 private:
0368   /**
0369    * Type of spinor.
0370    */
0371   SpinorType _type;
0372 
0373   /**
0374    * Storage of the components.
0375    */
0376   std::array<std::array<complex<Value>,4>,4> _spin;
0377 };
0378 
0379 /// @name Basic mathematical operations
0380 //@{
0381 template <typename Value>
0382 inline LorentzRSSpinorBar<double>
0383 operator/(const LorentzRSSpinorBar<Value> & v, Value a) {
0384   return LorentzRSSpinorBar<double>(v.xs1()/a, v.xs2()/a, v.xs3()/a, v.xs4()/a,
0385                    v.ys1()/a, v.ys2()/a, v.ys3()/a, v.ys4()/a,
0386                    v.zs1()/a, v.zs2()/a, v.zs3()/a, v.zs4()/a,
0387                    v.ts1()/a, v.ts2()/a, v.ts3()/a, v.ts4()/a,
0388                    v.Type());
0389 }
0390 
0391 inline LorentzRSSpinorBar<double>
0392 operator/(const LorentzRSSpinorBar<double> & v, Complex a) {
0393   return LorentzRSSpinorBar<double>(v.xs1()/a, v.xs2()/a, v.xs3()/a, v.xs4()/a,
0394                     v.ys1()/a, v.ys2()/a, v.ys3()/a, v.ys4()/a,
0395                     v.zs1()/a, v.zs2()/a, v.zs3()/a, v.zs4()/a,
0396                     v.ts1()/a, v.ts2()/a, v.ts3()/a, v.ts4()/a,
0397                     v.Type());
0398 }
0399 
0400 template <typename Value>
0401 inline LorentzRSSpinorBar<Value> operator-(const LorentzRSSpinorBar<Value> & v) {
0402   return LorentzRSSpinorBar<Value>(-v.xs1(),-v.xs2(),-v.xs3(),-v.xs4(),
0403                    -v.ys1(),-v.ys2(),-v.ys3(),-v.ys4(),
0404                    -v.zs1(),-v.zs2(),-v.zs3(),-v.zs4(),
0405                    -v.ts1(),-v.ts2(),-v.ts3(),-v.ts4(),
0406                    v.Type());
0407 }
0408 
0409 template <typename ValueA, typename ValueB>
0410 inline LorentzRSSpinorBar<ValueA>
0411 operator+(LorentzRSSpinorBar<ValueA> a, const LorentzRSSpinorBar<ValueB> & b) {
0412   return a += b;
0413 }
0414 
0415 template <typename ValueA, typename ValueB>
0416 inline LorentzRSSpinorBar<ValueA>
0417 operator-(LorentzRSSpinorBar<ValueA> a, const LorentzRSSpinorBar<ValueB> & b) {
0418   return a -= b;
0419 }
0420 
0421 template <typename Value>
0422 inline LorentzRSSpinorBar<Value>
0423 operator*(const LorentzRSSpinorBar<Value> & a, double b) {
0424   return LorentzRSSpinorBar<Value>(a.xs1()*b, a.xs2()*b, a.xs3()*b, a.xs4()*b,
0425                    a.ys1()*b, a.ys2()*b, a.ys3()*b, a.ys4()*b,
0426                    a.zs1()*b, a.zs2()*b, a.zs3()*b, a.zs4()*b,
0427                    a.ts1()*b, a.ts2()*b, a.ts3()*b, a.ts4()*b,a.Type());
0428 }
0429 
0430 template <typename Value>
0431 inline LorentzRSSpinorBar<Value>
0432 operator*(double b, LorentzRSSpinorBar<Value> a) {
0433   return a *= b;
0434 }
0435   
0436 template <typename Value>
0437 inline LorentzRSSpinorBar<Value>
0438 operator*(const LorentzRSSpinorBar<Value> & a, Complex b) {
0439   return LorentzRSSpinorBar<Value>(a.xs1()*b, a.xs2()*b, a.xs3()*b, a.xs4()*b,
0440                    a.ys1()*b, a.ys2()*b, a.ys3()*b, a.ys4()*b,
0441                    a.zs1()*b, a.zs2()*b, a.zs3()*b, a.zs4()*b,
0442                    a.ts1()*b, a.ts2()*b, a.ts3()*b, a.ts4()*b,a.Type());
0443 }
0444 
0445 template <typename ValueA, typename ValueB>
0446 inline auto operator*(complex<ValueB> a, const LorentzRSSpinorBar<ValueA> & v) 
0447   -> LorentzRSSpinorBar<decltype(a.real()*v.xs1().real())>
0448 {
0449   return {a*v.xs1(), a*v.xs2(), a*v.xs3(), a*v.xs4(),
0450           a*v.ys1(), a*v.ys2(), a*v.ys3(), a*v.ys4(),
0451           a*v.zs1(), a*v.zs2(), a*v.zs3(), a*v.zs4(),
0452           a*v.ts1(), a*v.ts2(), a*v.ts3(), a*v.ts4(),v.Type()};
0453 }
0454 
0455 template <typename ValueA, typename ValueB>
0456 inline auto operator*(const LorentzRSSpinorBar<ValueA> & v, complex<ValueB> b) 
0457   -> LorentzRSSpinorBar<decltype(b.real()*v.xs1().real())>
0458 {
0459   return b*v;
0460 }
0461 
0462 template <typename ValueA, typename ValueB>
0463 inline auto operator/(const LorentzRSSpinorBar<ValueA> & v, complex<ValueB> b) 
0464   -> LorentzRSSpinorBar<decltype(v.xs1().real()/b.real())>
0465 {
0466   return {v.xs1()/b, v.xs2()/b, v.xs3()/b, v.xs4()/b,
0467           v.ys1()/b, v.ys2()/b, v.ys3()/b, v.ys4()/b,
0468           v.zs1()/b, v.zs2()/b, v.zs3()/b, v.zs4()/b,
0469           v.ts1()/b, v.ts2()/b, v.ts3()/b, v.ts4()/b,v.Type()};
0470 }
0471   
0472 template <typename ValueA, typename ValueB>
0473 inline auto operator*(ValueB a, const LorentzRSSpinorBar<ValueA> & v) 
0474   -> LorentzRSSpinorBar<decltype(a*v.xs1().real())>
0475 {
0476   return {a*v.xs1(), a*v.xs2(), a*v.xs3(), a*v.xs4(),
0477           a*v.ys1(), a*v.ys2(), a*v.ys3(), a*v.ys4(),
0478           a*v.zs1(), a*v.zs2(), a*v.zs3(), a*v.zs4(),
0479           a*v.ts1(), a*v.ts2(), a*v.ts3(), a*v.ts4(),v.Type()};
0480 }
0481 
0482 template <typename ValueA, typename ValueB>
0483 inline auto operator*(const LorentzRSSpinorBar<ValueA> & v, ValueB b) 
0484   -> LorentzRSSpinorBar<decltype(b*v.xs1().real())>
0485 {
0486   return b*v;
0487 }
0488 
0489 template <typename ValueA, typename ValueB>
0490 inline auto operator/(const LorentzRSSpinorBar<ValueA> & v, ValueB b) 
0491   -> LorentzRSSpinorBar<decltype(v.xs1().real()/b)>
0492 {
0493   return {v.xs1()/b, v.xs2()/b, v.xs3()/b, v.xs4()/b,
0494           v.ys1()/b, v.ys2()/b, v.ys3()/b, v.ys4()/b,
0495           v.zs1()/b, v.zs2()/b, v.zs3()/b, v.zs4()/b,
0496           v.ts1()/b, v.ts2()/b, v.ts3()/b, v.ts4()/b,v.Type()};
0497 }
0498 //@}
0499 
0500 }
0501 }
0502 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
0503 #include "LorentzRSSpinorBar.tcc"
0504 #endif 
0505 
0506 #endif