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