thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
LorentzRSSpinor.h
1 // -*- C++ -*-
2 //
3 // LorentzRSSpinor.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 2003-2019 Peter Richardson, Leif Lonnblad
5 //
6 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_LorentzRSSpinor_H
10 #define ThePEG_LorentzRSSpinor_H
11 
12 #include "ThePEG/Config/ThePEG.h"
14 #include "HelicityDefinitions.h"
15 #include "LorentzRSSpinor.fh"
16 #include "LorentzRSSpinorBar.h"
17 #include "LorentzSpinorBar.h"
18 #include "LorentzSpinor.h"
19 #include "LorentzPolarizationVector.h"
20 
21 namespace ThePEG{
22 namespace Helicity{
23 
72 template<typename Value>
74 
75 public:
76 
83 
88  LorentzRSSpinor(complex<Value> a1, complex<Value> b1,
89  complex<Value> c1, complex<Value> d1,
90  complex<Value> a2, complex<Value> b2,
91  complex<Value> c2, complex<Value> d2,
92  complex<Value> a3, complex<Value> b3,
93  complex<Value> c3, complex<Value> d3,
94  complex<Value> a4, complex<Value> b4,
95  complex<Value> c4, complex<Value> d4,
97  : _type(t), _spin{{ {{a1,b1,c1,d1}},
98  {{a2,b2,c2,d2}},
99  {{a3,b3,c3,d3}},
100  {{a4,b4,c4,d4}}
101  }} {}
102 
103  template <typename U>
104  LorentzRSSpinor(const LorentzRSSpinor<U> & other)
105  : _type(other._type), _spin(other._spin) {}
107 
113  complex<Value> operator()(int i, int j) const {
114  assert( i >= 0 && i <= 3 && j>=0 && j<=3);
115  return _spin[i][j];
116  }
117 
121  complex<Value> & operator () (int i, int j) {
122  assert( i >= 0 && i <= 3 && j>=0 && j<=3);
123  return _spin[i][j];
124  }
125 
129  complex<Value> xs1() const {return _spin[0][0];}
130 
134  complex<Value> xs2() const {return _spin[0][1];}
135 
139  complex<Value> xs3() const {return _spin[0][2];}
140 
144  complex<Value> xs4() const {return _spin[0][3];}
145 
149  complex<Value> ys1() const {return _spin[1][0];}
150 
154  complex<Value> ys2() const {return _spin[1][1];}
155 
159  complex<Value> ys3() const {return _spin[1][2];}
160 
164  complex<Value> ys4() const {return _spin[1][3];}
165 
169  complex<Value> zs1() const {return _spin[2][0];}
170 
174  complex<Value> zs2() const {return _spin[2][1];}
175 
179  complex<Value> zs3() const {return _spin[2][2];}
180 
184  complex<Value> zs4() const {return _spin[2][3];}
185 
189  complex<Value> ts1() const {return _spin[3][0];}
190 
194  complex<Value> ts2() const {return _spin[3][1];}
195 
199  complex<Value> ts3() const {return _spin[3][2];}
200 
204  complex<Value> ts4() const {return _spin[3][3];}
205 
209  void setXS1(complex<Value> in) {_spin[0][0]=in;}
210 
214  void setXS2(complex<Value> in) {_spin[0][1]=in;}
215 
219  void setXS3(complex<Value> in) {_spin[0][2]=in;}
220 
224  void setXS4(complex<Value> in) {_spin[0][3]=in;}
225 
229  void setYS1(complex<Value> in) {_spin[1][0]=in;}
230 
234  void setYS2(complex<Value> in) {_spin[1][1]=in;}
235 
239  void setYS3(complex<Value> in) {_spin[1][2]=in;}
240 
244  void setYS4(complex<Value> in) {_spin[1][3]=in;}
245 
249  void setZS1(complex<Value> in) {_spin[2][0]=in;}
250 
254  void setZS2(complex<Value> in) {_spin[2][1]=in;}
255 
259  void setZS3(complex<Value> in) {_spin[2][2]=in;}
260 
264  void setZS4(complex<Value> in) {_spin[2][3]=in;}
265 
269  void setTS1(complex<Value> in) {_spin[3][0]=in;}
270 
274  void setTS2(complex<Value> in) {_spin[3][1]=in;}
275 
279  void setTS3(complex<Value> in) {_spin[3][2]=in;}
280 
284  void setTS4(complex<Value> in) {_spin[3][3]=in;}
286 
288 
289  template <typename ValueB>
290  LorentzRSSpinor<Value> & operator+=(const LorentzRSSpinor<ValueB> & a) {
291  for(unsigned int ix=0;ix<4;++ix)
292  for(unsigned int iy=0;iy<4;++iy)
293  _spin[ix][iy] += a._spin[ix][iy];
294  return *this;
295  }
296 
297  template <typename ValueB>
298  LorentzRSSpinor<Value> & operator-=(const LorentzRSSpinor<ValueB> & a) {
299  for(unsigned int ix=0;ix<4;++ix)
300  for(unsigned int iy=0;iy<4;++iy)
301  _spin[ix][iy] -= a._spin[ix][iy];
302  return *this;
303  }
304 
305  LorentzRSSpinor<Value> & operator*=(double a) {
306  for(unsigned int ix=0;ix<4;++ix)
307  for(unsigned int iy=0;iy<4;++iy)
308  _spin[ix][iy] *=a;
309  return *this;
310  }
311 
312  LorentzRSSpinor<Value> & operator/=(double a) {
313  for(unsigned int ix=0;ix<4;++ix)
314  for(unsigned int iy=0;iy<4;++iy)
315  _spin[ix][iy] /=a;
316  return *this;
317  }
319 
326  LorentzSpinor<Value> output(_type);
327  complex<Value> temp;
328  unsigned int ix;
329  for(ix=0;ix<4;++ix) {
330  temp = _spin[3][ix]*vec.t();
331  temp -= _spin[0][ix]*vec.x();
332  temp -= _spin[1][ix]*vec.y();
333  temp -= _spin[2][ix]*vec.z();
334  output[ix]=temp;
335  }
336  return output;
337  }
338 
342  LorentzSpinor<Value> dot(const LorentzMomentum & invec) const {
343  LorentzSpinor<Value> output(_type);
344  complex<Value> temp;
345  LorentzVector<double> vec = UnitRemoval::InvE * invec;
346  unsigned int ix;
347  for(ix=0;ix<4;++ix) {
348  temp = - ( _spin[0][ix]*vec.x() + _spin[1][ix]*vec.y()+
349  _spin[2][ix]*vec.z() ) + _spin[3][ix]*vec.t();
350  output[ix]=temp;
351  }
352  return output;
353  }
355 
362 
366  LorentzRSSpinor & boost(double,double,double);
367 
371  LorentzRSSpinor & boost(const Boost &);
372 
378 
381 
385  SpinorType Type() const {return _type;}
387 
394  template <typename ValueB>
397  -> decltype(left*fbar(3,0)*this->ts1())
398  {
399  decltype(left*fbar(3,0)*ts1()) output;
400  unsigned int iz;
401  output =
402  left*(fbar(3,0)*_spin[3][0]+fbar(3,1)*_spin[3][1])
403  +right*(fbar(3,2)*_spin[3][2]+fbar(3,3)*_spin[3][3]);
404  for(iz=0;iz<3;++iz) {
405  output -=
406  left*(fbar(iz,0)*_spin[iz][0]+fbar(iz,1)*_spin[iz][1])
407  +right*(fbar(iz,2)*_spin[iz][2]+fbar(iz,3)*_spin[iz][3]);
408  }
409  return output;
410  }
411 
418  template <typename ValueB>
421  -> LorentzVector<decltype(left*fbar.s1()*this->ts1())>
422  {
423  typedef decltype(left*fbar.s1()*ts1()) ResultT;
424  ResultT output[4];
425  for(size_t iz=0;iz<4;++iz)
426  output[iz]= left*(fbar.s1()*_spin[iz][0]+fbar.s2()*_spin[iz][1])
427  +right*(fbar.s3()*_spin[iz][2]+fbar.s4()*_spin[iz][3]);
428  return LorentzVector<ResultT>(output[0],output[1],output[2],output[3]);
429  }
430 
431 private:
432 
437 
441  std::array<std::array<complex<Value>,4>,4> _spin;
442 };
443 
445 
446 template <typename Value>
448 operator/(const LorentzRSSpinor<Value> & v, Value a) {
449  return LorentzRSSpinor<double>(v.xs1()/a, v.xs2()/a, v.xs3()/a, v.xs4()/a,
450  v.ys1()/a, v.ys2()/a, v.ys3()/a, v.ys4()/a,
451  v.zs1()/a, v.zs2()/a, v.zs3()/a, v.zs4()/a,
452  v.ts1()/a, v.ts2()/a, v.ts3()/a, v.ts4()/a,
453  v.Type());
454 }
455 
457 operator/(const LorentzRSSpinor<double> & v, Complex a) {
458  return LorentzRSSpinor<double>(v.xs1()/a, v.xs2()/a, v.xs3()/a, v.xs4()/a,
459  v.ys1()/a, v.ys2()/a, v.ys3()/a, v.ys4()/a,
460  v.zs1()/a, v.zs2()/a, v.zs3()/a, v.zs4()/a,
461  v.ts1()/a, v.ts2()/a, v.ts3()/a, v.ts4()/a,
462  v.Type());
463 }
464 
465 template <typename Value>
466 inline LorentzRSSpinor<Value> operator-(const LorentzRSSpinor<Value> & v) {
467  return LorentzRSSpinor<Value>(-v.xs1(),-v.xs2(),-v.xs3(),-v.xs4(),
468  -v.ys1(),-v.ys2(),-v.ys3(),-v.ys4(),
469  -v.zs1(),-v.zs2(),-v.zs3(),-v.zs4(),
470  -v.ts1(),-v.ts2(),-v.ts3(),-v.ts4(),
471  v.Type());
472 }
473 
474 template <typename ValueA, typename ValueB>
476 operator+(LorentzRSSpinor<ValueA> a, const LorentzRSSpinor<ValueB> & b) {
477  return a += b;
478 }
479 
480 template <typename ValueA, typename ValueB>
482 operator-(LorentzRSSpinor<ValueA> a, const LorentzRSSpinor<ValueB> & b) {
483  return a -= b;
484 }
485 
486 template <typename Value>
488 operator*(const LorentzRSSpinor<Value> & a, double b) {
489  return LorentzRSSpinor<Value>(a.xs1()*b, a.xs2()*b, a.xs3()*b, a.xs4()*b,
490  a.ys1()*b, a.ys2()*b, a.ys3()*b, a.ys4()*b,
491  a.zs1()*b, a.zs2()*b, a.zs3()*b, a.zs4()*b,
492  a.ts1()*b, a.ts2()*b, a.ts3()*b, a.ts4()*b,a.Type());
493 }
494 
495 template <typename Value>
497 operator*(double b, LorentzRSSpinor<Value> a) {
498  return a *= b;
499 }
500 
501 template <typename Value>
503 operator*(const LorentzRSSpinor<Value> & a, Complex b) {
504  return LorentzRSSpinor<Value>(a.xs1()*b, a.xs2()*b, a.xs3()*b, a.xs4()*b,
505  a.ys1()*b, a.ys2()*b, a.ys3()*b, a.ys4()*b,
506  a.zs1()*b, a.zs2()*b, a.zs3()*b, a.zs4()*b,
507  a.ts1()*b, a.ts2()*b, a.ts3()*b, a.ts4()*b,a.Type());
508 }
509 
510 template <typename ValueA, typename ValueB>
511 inline auto operator*(complex<ValueB> a, const LorentzRSSpinor<ValueA> & v)
512  -> LorentzRSSpinor<decltype(a.real()*v.xs1().real())>
513 {
514  return {a*v.xs1(), a*v.xs2(), a*v.xs3(), a*v.xs4(),
515  a*v.ys1(), a*v.ys2(), a*v.ys3(), a*v.ys4(),
516  a*v.zs1(), a*v.zs2(), a*v.zs3(), a*v.zs4(),
517  a*v.ts1(), a*v.ts2(), a*v.ts3(), a*v.ts4(),v.Type()};
518 }
519 
520 template <typename ValueA, typename ValueB>
521 inline auto operator*(const LorentzRSSpinor<ValueA> & v, complex<ValueB> b)
522  -> LorentzRSSpinor<decltype(b.real()*v.xs1().real())>
523 {
524  return b*v;
525 }
526 
527 template <typename ValueA, typename ValueB>
528 inline auto operator/(const LorentzRSSpinor<ValueA> & v, complex<ValueB> b)
529  -> LorentzRSSpinor<decltype(v.xs1().real()/b.real())>
530 {
531  return {v.xs1()/b, v.xs2()/b, v.xs3()/b, v.xs4()/b,
532  v.ys1()/b, v.ys2()/b, v.ys3()/b, v.ys4()/b,
533  v.zs1()/b, v.zs2()/b, v.zs3()/b, v.zs4()/b,
534  v.ts1()/b, v.ts2()/b, v.ts3()/b, v.ts4()/b,v.Type()};
535 }
536 
537 template <typename ValueA, typename ValueB>
538 inline auto operator*(ValueB a, const LorentzRSSpinor<ValueA> & v)
539  -> LorentzRSSpinor<decltype(a*v.xs1().real())>
540 {
541  return {a*v.xs1(), a*v.xs2(), a*v.xs3(), a*v.xs4(),
542  a*v.ys1(), a*v.ys2(), a*v.ys3(), a*v.ys4(),
543  a*v.zs1(), a*v.zs2(), a*v.zs3(), a*v.zs4(),
544  a*v.ts1(), a*v.ts2(), a*v.ts3(), a*v.ts4(),v.Type()};
545 }
546 
547 template <typename ValueA, typename ValueB>
548 inline auto operator*(const LorentzRSSpinor<ValueA> & v, ValueB b)
549  -> LorentzRSSpinor<decltype(b*v.xs1().real())>
550 {
551  return b*v;
552 }
553 
554 template <typename ValueA, typename ValueB>
555 inline auto operator/(const LorentzRSSpinor<ValueA> & v, ValueB b)
556  -> LorentzRSSpinor<decltype(v.xs1().real()/b)>
557 {
558  return {v.xs1()/b, v.xs2()/b, v.xs3()/b, v.xs4()/b,
559  v.ys1()/b, v.ys2()/b, v.ys3()/b, v.ys4()/b,
560  v.zs1()/b, v.zs2()/b, v.zs3()/b, v.zs4()/b,
561  v.ts1()/b, v.ts2()/b, v.ts3()/b, v.ts4()/b,v.Type()};
562 }
564 
565 }
566 }
567 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
568 #include "LorentzRSSpinor.tcc"
569 #endif
570 
571 #endif
void setTS1(complex< Value > in)
Set first spinor component for the t vector.
std::array< std::array< complex< Value >, 4 >, 4 > _spin
Storage of the components.
std::complex< double > Complex
ThePEG code should use Complex for all complex scalars.
Definition: Complex.h:23
void setYS2(complex< Value > in)
Set second spinor component for the y vector.
void setYS4(complex< Value > in)
Set fourth spinor component for the y vector.
LorentzRSSpinor(complex< Value > a1, complex< Value > b1, complex< Value > c1, complex< Value > d1, complex< Value > a2, complex< Value > b2, complex< Value > c2, complex< Value > d2, complex< Value > a3, complex< Value > b3, complex< Value > c3, complex< Value > d3, complex< Value > a4, complex< Value > b4, complex< Value > c4, complex< Value > d4, SpinorType t=SpinorType::unknown)
Constructor with complex numbers specifying the components, optionally specifying t...
complex< Value > zs1() const
Get first spinor component for the z vector.
complex< Value > xs4() const
Get fourth spinor component for the x vector.
void setYS1(complex< Value > in)
Set first spinor component for the y vector.
This file contains enumerations used by LorentzSpinor and LorentzSpinorBar classes.
A 3-component vector.
Definition: ThreeVector.h:34
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
void setXS4(complex< Value > in)
Set fourth spinor component for the x vector.
complex< Value > xs1() const
Get first spinor component for the x vector.
SpinorType _type
Type of spinor.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
SpinorType Type() const
Return the type of the spinor.
auto generalCurrent(LorentzSpinorBar< ValueB > &fbar, Complex left, Complex right) -> LorentzVector< decltype(left *fbar.s1() *this->ts1())>
Current for general couplings.
ostream & left(ostream &os)
Stream manipulator setting an ostream to left-adjust its ouput.
Definition: std.h:160
This is the main config header file for ThePEG.
The LorentzSpinor class is designed to store a spinor.
Definition: LorentzSpinor.h:71
complex< Value > xs2() const
Get second spinor component for the x vector.
The LorentzRSSpinor class is designed to store a Rarita-Schwinger spinor for a spin-3/2 particle...
complex< Value > ts1() const
Get first spinor component for the t vector.
complex< Value > ys2() const
Get second spinor component for the y vector.
void setTS4(complex< Value > in)
Set fourth spinor component for the t vector.
void setXS1(complex< Value > in)
Set first spinor component for the x vector.
void setXS3(complex< Value > in)
Set third spinor component for the x vector.
contains the ThreeVector class.
LorentzSpinor< Value > dot(const LorentzMomentum &invec) const
dot product with a 4-vector
SpinorType
Enumeration to specify spinor type.
void setZS1(complex< Value > in)
Set first spinor component for the z vector.
void setZS4(complex< Value > in)
Set fourth spinor component for the z vector.
void setYS3(complex< Value > in)
Set third spinor component for the y vector.
complex< Value > zs4() const
Get fourth spinor component for the z vector.
void setXS2(complex< Value > in)
Set second spinor component for the x vector.
void setTS2(complex< Value > in)
Set second spinor component for the t vector.
LorentzRSSpinor & transform(const LorentzRotation &)
General transform.
complex< Value > xs3() const
Get third spinor component for the x vector.
LorentzRSSpinor(SpinorType t=SpinorType::unknown)
Default zero constructor, optionally specifying t, the type.
ostream & right(ostream &os)
Stream manipulator setting an ostream to right-adjust its ouput.
Definition: std.h:166
complex< Value > ts2() const
Get second spinor component for the t vector.
complex< Value > ts4() const
Get fourth spinor component for the t vector.
The LorentzRSSpinorBar class implements the storage of a barred Lorentz Rarita-Schwinger Spinor for a...
complex< Value > operator()(int i, int j) const
Subscript operator to return spinor components.
complex< Value > ts3() const
Get third spinor component for the t vector.
LorentzRSSpinor & boost(double, double, double)
Standard Lorentz boost specifying the components of the beta vector.
complex< Value > ys1() const
Get first spinor component for the y vector.
complex< Value > ys3() const
Get third spinor component for the y vector.
auto generalScalar(LorentzRSSpinorBar< ValueB > &fbar, Complex left, Complex right) -> decltype(left *fbar(3, 0) *this->ts1())
Scalar product for general couplings.
LorentzRSSpinorBar< Value > bar() const
return the barred spinor
void setZS3(complex< Value > in)
Set third spinor component for the z vector.
The LorentzSpinorBar class implements the storage of a barred LorentzSpinor.
complex< Value > zs2() const
Get second spinor component for the z vector.
complex< Value > ys4() const
Get fourth spinor component for the y vector.
complex< Value > zs3() const
Get third spinor component for the z vector.
LorentzSpinor< Value > dot(const LorentzPolarizationVector &vec) const
dot product with a polarization vector
void setTS3(complex< Value > in)
Set third spinor component for the t vector.
void setZS2(complex< Value > in)
Set second spinor component for the z vector.