ThePEG  1.8.0
LorentzSpinor.h
1 // -*- C++ -*-
2 //
3 // LorentzSpinor.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 2003-2011 Peter Richardson, Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_LorentzSpinor_H
10 #define ThePEG_LorentzSpinor_H
11 // This is the declaration of the LorentzSpinor class.
12 #include "ThePEG/Config/ThePEG.h"
13 #include "ThePEG/Vectors/LorentzRotation.h"
14 #include "ThePEG/Vectors/ThreeVector.h"
15 #include "HelicityDefinitions.h"
16 #include "LorentzSpinor.fh"
17 #include "LorentzSpinorBar.h"
18 #include "LorentzPolarizationVector.h"
19 
20 namespace ThePEG{
21 namespace Helicity{
22 
68 template<typename Value>
70 public:
71 
78  for(unsigned int ix=0;ix<4;++ix) _spin[ix]=Value();
79  }
80 
85  LorentzSpinor(complex<Value> a,complex<Value> b,
86  complex<Value> c,complex<Value> d,
88  _spin[0]=a;
89  _spin[1]=b;
90  _spin[2]=c;
91  _spin[3]=d;
92  }
94 
100  complex<Value> operator[](int i) const {
101  assert( i >= 0 && i <= 3 );
102  return _spin[i];
103  }
104 
108  complex<Value> operator()(int i) const {
109  assert( i >= 0 && i <= 3 );
110  return _spin[i];
111  }
112 
116  complex<Value> & operator()(int i) {
117  assert( i >= 0 && i <= 3 );
118  return _spin[i];
119  }
120 
124  complex<Value> & operator[](int i) {
125  assert( i >= 0 && i <= 3 );
126  return _spin[i];
127  }
128 
132  complex<Value> s1() const {return _spin[0];}
133 
137  complex<Value> s2() const {return _spin[1];}
138 
142  complex<Value> s3() const {return _spin[2];}
143 
147  complex<Value> s4() const {return _spin[3];}
148 
152  void setS1(complex<Value> in) {_spin[0]=in;}
153 
157  void setS2(complex<Value> in) {_spin[1]=in;}
158 
162  void setS3(complex<Value> in) {_spin[2]=in;}
163 
167  void setS4(complex<Value> in) {_spin[3]=in;}
169 
176 
182  LorentzSpinor conjugate() const;
183 
187  LorentzSpinor & boost(double,double,double);
188 
192  LorentzSpinor & boost(const Boost &);
193 
198 
203  transform(r.half());
204  return *this;
205  }
207 
213  SpinorType Type() const {return _type;}
215 
216 
223  template<typename ValueB>
226  typedef complex<typename BinaryOpTraits<Value,ValueB>::MulT> ResultT;
228  Complex ii(0.,1.);
229  ResultT p1(fb.s3()*s2()),p2(fb.s4()*s1());
230  vec.setX( -(p1+p2) );
231  vec.setY( ii*(p1-p2) );
232  p1 = fb.s3()*s1();p2 = fb.s4()*s2();
233  vec.setZ( -(p1-p2) );
234  vec.setT( (p1+p2) );
235  return vec;
236  }
237 
242  template<typename ValueB>
245  typedef complex<typename BinaryOpTraits<Value,ValueB>::MulT> ResultT;
247  Complex ii(0.,1.);
248  ResultT p1(fb.s1()*s4()),p2(fb.s2()*s3());
249  vec.setX( (p1+p2));
250  vec.setY( -ii*(p1-p2));
251  p1 = fb.s1()*s3();p2 = fb.s2()*s4();
252  vec.setZ( (p1-p2));
253  vec.setT( (p1+p2));
254  return vec;
255  }
256 
261  template<typename ValueB>
264  typedef complex<typename BinaryOpTraits<Value,ValueB>::MulT> ResultT;
266  Complex ii(0.,1.);
267  ResultT s1s4(fb.s1()*s4()),s2s3(fb.s2()*s3()),
268  s3s2(fb.s3()*s2()),s4s1(fb.s4()*s1()),
269  s1s3(fb.s1()*s3()),s2s4(fb.s2()*s4()),
270  s3s1(fb.s3()*s1()),s4s2(fb.s4()*s2());
271  vec.setX( s1s4+s2s3-s3s2-s4s1 );
272  vec.setY( -ii*(s1s4-s2s3-s3s2+s4s1));
273  vec.setZ( s1s3-s2s4-s3s1+s4s2 );
274  vec.setT( s1s3+s2s4+s3s1+s4s2);
275  return vec;
276  }
277 
285  template<typename ValueB>
288  Complex left, Complex right) const {
289  typedef complex<typename BinaryOpTraits<Value,ValueB>::MulT> ResultT;
291  Complex ii(0.,1.);
292  ResultT p1(fb.s3()*s2()),p2(fb.s4()*s1());
293  vec.setX( -left*(p1+p2));
294  vec.setY( ii*left*(p1-p2));
295  p1 = fb.s3()*s1();p2 = fb.s4()*s2();
296  vec.setZ( -left*(p1-p2));
297  vec.setT( left*(p1+p2));
298  p1=fb.s1()*s4();p2=fb.s2()*s3();
299  vec.setX(vec.x()+right*(p1+p2));
300  vec.setY(vec.y()-ii*right*(p1-p2));
301  p1 = fb.s1()*s3();p2 = fb.s2()*s4();
302  vec.setZ(vec.z()+right*(p1-p2));
303  vec.setT(vec.t()+right*(p1+p2));
304  return vec;
305  }
307 
314  template<typename ValueB>
315  complex<typename BinaryOpTraits<Value,ValueB>::MulT>
317  return fb.s1()*s1()+fb.s2()*s2();
318  }
319 
324  template<typename ValueB>
325  complex<typename BinaryOpTraits<Value,ValueB>::MulT>
327  return fb.s3()*s3()+fb.s4()*s4();
328  }
329 
334  template<typename ValueB>
335  complex<typename BinaryOpTraits<Value,ValueB>::MulT>
336  scalar(const LorentzSpinorBar<ValueB>& fb) const {
337  return fb.s1()*s1()+fb.s2()*s2()+fb.s3()*s3()+fb.s4()*s4();
338  }
339 
344  template<typename ValueB>
345  complex<typename BinaryOpTraits<Value,ValueB>::MulT>
347  return -fb.s1()*s1()-fb.s2()*s2()+fb.s3()*s3()+fb.s4()*s4();
348  }
349 
357  template<typename ValueB>
358  complex<typename BinaryOpTraits<Value,ValueB>::MulT>
360  Complex left, Complex right) const {
361  return left*(fb.s1()*s1()+fb.s2()*s2())
362  + right*(fb.s3()*s3()+fb.s4()*s4());
363  }
365 
366 private:
371 
375  complex<Value> _spin[4];
376 };
377 
378 }
379 }
380 
381 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
382 #include "LorentzSpinor.tcc"
383 #endif
384 
385 #endif
386 
complex< Value > s2() const
Get second component.
LorentzSpinor conjugate() const
Return the conjugated spinor .
A 4-component Lorentz vector.
Definition: LorentzVector.h:35
complex< Value > operator[](int i) const
Subscript operator to return spinor components.
complex< typename BinaryOpTraits< Value, ValueB >::MulT > generalScalar(const LorentzSpinorBar< ValueB > &fb, Complex left, Complex right) const
Calculate a general scalar product with arbitary left and right couplings, i.e.
LorentzSpinor(complex< Value > a, complex< Value > b, complex< Value > c, complex< Value > d, SpinorType s=unknown_spinortype)
Constructor with complex numbers specifying the components, optionally specifying s...
Definition: LorentzSpinor.h:85
LorentzSpinor(SpinorType t=unknown_spinortype)
Default zero constructor, optionally specifying t, the type.
Definition: LorentzSpinor.h:77
std::complex< double > Complex
ThePEG code should use Complex for all complex scalars.
Definition: Complex.h:23
complex< typename BinaryOpTraits< Value, ValueB >::MulT > scalar(const LorentzSpinorBar< ValueB > &fb) const
Calculate the scalar .
complex< Value > & operator[](int i)
Set components by index.
This file contains enumerations used by LorentzSpinor and LorentzSpinorBar classes.
A 3-component vector.
Definition: ThreeVector.h:33
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
complex< Value > s3() const
Get third component.
LorentzVector< complex< typename BinaryOpTraits< Value, ValueB >::MulT > > rightCurrent(const LorentzSpinorBar< ValueB > &fb) const
Calculate the right-handed current .
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
complex< typename BinaryOpTraits< Value, ValueB >::MulT > pseudoScalar(const LorentzSpinorBar< ValueB > &fb) const
Calculate the pseudoscalar .
ostream & left(ostream &os)
Stream manipulator setting an ostream to left-adjust its ouput.
Definition: std.h:152
The LorentzSpinor class is designed to store a spinor.
Definition: LorentzSpinor.h:69
complex< typename BinaryOpTraits< Value, ValueB >::MulT > leftScalar(const LorentzSpinorBar< ValueB > &fb) const
Calculate the left-handed scalar .
const SpinHalfLorentzRotation & half() const
The spin- transformation.
complex< Value > s4() const
Get fourth component.
complex< Value > s3() const
Get third component.
complex< Value > s1() const
Get first component.
LorentzSpinor & boost(double, double, double)
Standard Lorentz boost specifying the components of the beta vector.
complex< Value > s1() const
Get first component.
complex< Value > s2() const
Get second component.
LorentzVector< complex< typename BinaryOpTraits< Value, ValueB >::MulT > > vectorCurrent(const LorentzSpinorBar< ValueB > &fb) const
Calculate the vector current .
LorentzSpinor & transform(const LorentzRotation &r)
General Lorentz transformation.
LorentzSpinorBar< Value > bar() const
Return the barred spinor.
void setS1(complex< Value > in)
Set first component.
LorentzSpinor & transform(const SpinHalfLorentzRotation &)
General Lorentz transformation.
void setS3(complex< Value > in)
Set third component.
SpinorType
Enumeration to specify spinor type.
complex< Value > s4() const
Get fourth component.
complex< Value > & operator()(int i)
Set components by index.
SpinorType _type
Type of spinor.
complex< Value > operator()(int i) const
Subscript operator to return spinor components.
void setS2(complex< Value > in)
Set second component.
LorentzVector< complex< typename BinaryOpTraits< Value, ValueB >::MulT > > generalCurrent(const LorentzSpinorBar< ValueB > &fb, Complex left, Complex right) const
Calculate a general current with arbitary left and right couplings, i.e.
ostream & right(ostream &os)
Stream manipulator setting an ostream to right-adjust its ouput.
Definition: std.h:158
void setS4(complex< Value > in)
Set fourth component.
LorentzVector< complex< typename BinaryOpTraits< Value, ValueB >::MulT > > leftCurrent(const LorentzSpinorBar< ValueB > &fb) const
Calculate the left-handed current .
The SpinHalfLorentzRotation class is designed to offer the same features as the HepLorentzRotation cl...
SpinorType Type() const
Return the type of the spinor.
The LorentzSpinorBar class implements the storage of a barred LorentzSpinor.
complex< Value > _spin[4]
Storage of the components.
complex< typename BinaryOpTraits< Value, ValueB >::MulT > rightScalar(const LorentzSpinorBar< ValueB > &fb) const
Calculate the right-handed scalar .