thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
LorentzSpinorBar.h
1 // -*- C++ -*-
2 //
3 // LorentzSpinorBar.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_LorentzSpinorBar_H
10 #define ThePEG_LorentzSpinorBar_H
11 // This is the declaration of the LorentzSpinorBar class.
12 
13 #include "ThePEG/Config/ThePEG.h"
14 #include "ThePEG/Vectors/LorentzRotation.h"
16 #include "HelicityDefinitions.h"
17 #include "LorentzSpinor.fh"
18 #include "LorentzSpinorBar.fh"
19 
20 namespace ThePEG {
21 namespace Helicity {
22 
34 template<typename Value>
36 public:
37 
44 
49  LorentzSpinorBar(complex<Value> a, complex<Value> b,
50  complex<Value> c, complex<Value> d,
52  : _type(t), _spin{{a,b,c,d}} {}
53 
54  template <typename U>
56  : _type(other._type), _spin(other._spin) {}
57 
59 
65  complex<Value> operator[](int i) const {
66  assert( i>= 0 && i <= 3 );
67  return _spin[i];
68  }
69 
73  complex<Value> operator()(int i) const {
74  assert( i>= 0 && i <= 3 );
75  return _spin[i];
76  }
77 
81  complex<Value> & operator()(int i) {
82  assert( i>= 0 && i <= 3 );
83  return _spin[i];
84  }
85 
89  complex<Value> & operator[](int i) {
90  assert( i>= 0 && i <= 3 );
91  return _spin[i];
92  }
93 
97  complex<Value> s1() const {return _spin[0];}
98 
102  complex<Value> s2() const {return _spin[1];}
103 
107  complex<Value> s3() const {return _spin[2];}
108 
112  complex<Value> s4() const {return _spin[3];}
113 
117  void setS1(complex<Value> in) {_spin[0]=in;}
118 
122  void setS2(complex<Value> in) {_spin[1]=in;}
123 
127  void setS3(complex<Value> in) {_spin[2]=in;}
128 
132  void setS4(complex<Value> in) {_spin[3]=in;}
134 
136 
137  template <typename ValueB>
138  LorentzSpinorBar<Value> & operator+=(const LorentzSpinorBar<ValueB> & a) {
139  for(unsigned int ix=0;ix<4;++ix) _spin[ix] += a._spin[ix];
140  return *this;
141  }
142 
143  template <typename ValueB>
144  LorentzSpinorBar<Value> & operator-=(const LorentzSpinorBar<ValueB> & a) {
145  for(unsigned int ix=0;ix<4;++ix) _spin[ix] -= a._spin[ix];
146  return *this;
147  }
148 
149  LorentzSpinorBar<Value> & operator*=(double a) {
150  for(unsigned int ix=0;ix<4;++ix) _spin[ix] *=a;
151  return *this;
152  }
153 
154  LorentzSpinorBar<Value> & operator/=(double a) {
155  for(unsigned int ix=0;ix<4;++ix) _spin[ix] /=a;
156  return *this;
157  }
159 
165  LorentzSpinor<Value> bar() const;
166 
172  LorentzSpinorBar conjugate() const;
173 
177  LorentzSpinorBar & boost(double,double,double);
178 
182  LorentzSpinorBar & boost(const Boost &);
183 
188 
193  transform(r.half());
194  return *this;
195  }
197 
203  SpinorType Type() const {return _type;}
205 
213  template<typename ValueB>
215  const ValueB & m) const
217  {
218  typedef decltype(m*Value()) ResultT;
220  static const Complex ii(0.,1.);
221  complex<ValueB> p0pp3=p.t()+p.z();
222  complex<ValueB> p0mp3=p.t()-p.z();
223  complex<ValueB> p1pp2=p.x()+ii*p.y();
224  complex<ValueB> p1mp2=p.x()-ii*p.y();
225  spin.setS1(m*s1()+p0pp3*s3()+p1pp2*s4());
226  spin.setS2(m*s2()+p0mp3*s4()+p1mp2*s3());
227  spin.setS3(m*s3()+p0mp3*s1()-p1pp2*s2());
228  spin.setS4(m*s4()+p0pp3*s2()-p1mp2*s1());
229  return spin;
230  }
231 
236  helicityProjectionOperator(const Complex & gL, const Complex & gR) const {
237  LorentzSpinorBar spin;
238  spin.setS1(gL*s1());
239  spin.setS2(gL*s2());
240  spin.setS3(gR*s3());
241  spin.setS4(gR*s4());
242  return spin;
243  }
245 
246 private:
251 
255  std::array<complex<Value>,4> _spin;
256 };
257 
259 
260 template <typename Value>
262 operator/(const LorentzSpinorBar<Value> & v, Value a) {
263  return LorentzSpinorBar<double>(v.s1()/a, v.s2()/a, v.s3()/a, v.s4()/a,v.Type());
264 }
265 
267 operator/(const LorentzSpinorBar<double> & v, Complex a) {
268  return LorentzSpinorBar<double>(v.s1()/a, v.s2()/a, v.s3()/a, v.s4()/a,v.Type());
269 }
270 
271 template <typename Value>
272 inline LorentzSpinorBar<Value> operator-(const LorentzSpinorBar<Value> & v) {
273  return LorentzSpinorBar<Value>(-v.s1(),-v.s2(),-v.s3(),-v.s4(),v.Type());
274 }
275 
276 template <typename ValueA, typename ValueB>
278 operator+(LorentzSpinorBar<ValueA> a, const LorentzSpinorBar<ValueB> & b) {
279  return a += b;
280 }
281 
282 template <typename ValueA, typename ValueB>
284 operator-(LorentzSpinorBar<ValueA> a, const LorentzSpinorBar<ValueB> & b) {
285  return a -= b;
286 }
287 
288 template <typename Value>
290 operator*(const LorentzSpinorBar<Value> & a, double b) {
291  return LorentzSpinorBar<Value>(a.s1()*b, a.s2()*b, a.s3()*b, a.s4()*b,a.Type());
292 }
293 
294 template <typename Value>
296 operator*(double b, LorentzSpinorBar<Value> a) {
297  return a *= b;
298 }
299 
300 template <typename Value>
302 operator*(const LorentzSpinorBar<Value> & a, Complex b) {
303  return LorentzSpinorBar<Value>(a.s1()*b, a.s2()*b, a.s3()*b, a.s4()*b,a.Type());
304 }
305 
306 template <typename ValueA, typename ValueB>
307 inline auto operator*(complex<ValueB> a, const LorentzSpinorBar<ValueA> & v)
308  -> LorentzSpinorBar<decltype(a.real()*v.s1().real())>
309 {
310  return {a*v.s1(), a*v.s2(), a*v.s3(), a*v.s4(),v.Type()};
311 }
312 
313 template <typename ValueA, typename ValueB>
314 inline auto operator*(const LorentzSpinorBar<ValueA> & v, complex<ValueB> b)
315  -> LorentzSpinorBar<decltype(b.real()*v.s1().real())>
316 {
317  return b*v;
318 }
319 
320 template <typename ValueA, typename ValueB>
321 inline auto operator/(const LorentzSpinorBar<ValueA> & v, complex<ValueB> b)
322  -> LorentzSpinorBar<decltype(v.s1().real()/b.real())>
323 {
324  return {v.s1()/b, v.s2()/b, v.s3()/b, v.s4()/b,v.Type()};
325 }
326 
327 template <typename ValueA, typename ValueB>
328 inline auto operator*(ValueB a, const LorentzSpinorBar<ValueA> & v)
329  -> LorentzSpinorBar<decltype(a*v.s1().real())>
330 {
331  return {a*v.s1(), a*v.s2(), a*v.s3(), a*v.s4(),v.Type()};
332 }
333 
334 template <typename ValueA, typename ValueB>
335 inline auto operator*(const LorentzSpinorBar<ValueA> & v, ValueB b)
336  -> LorentzSpinorBar<decltype(b*v.s1().real())>
337 {
338  return b*v;
339 }
340 
341 template <typename ValueA, typename ValueB>
342 inline auto operator/(const LorentzSpinorBar<ValueA> & v, ValueB b)
343  -> LorentzSpinorBar<decltype(v.s1().real()/b)>
344 {
345  return {v.s1()/b, v.s2()/b, v.s3()/b, v.s4()/b,v.Type()};
346 }
347 
348 }
349 }
350 
351 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
352 #include "LorentzSpinorBar.tcc"
353 #endif
354 
355 #endif
A 4-component Lorentz vector.
Definition: LorentzVector.h:35
std::complex< double > Complex
ThePEG code should use Complex for all complex scalars.
Definition: Complex.h:23
LorentzSpinorBar & boost(double, double, double)
Standard Lorentz boost specifying the components of the beta vector.
LorentzSpinorBar & transform(const SpinHalfLorentzRotation &)
General Lorentz transformation.
This file contains enumerations used by LorentzSpinor and LorentzSpinorBar classes.
A 3-component vector.
Definition: ThreeVector.h:34
LorentzSpinorBar helicityProjectionOperator(const Complex &gL, const Complex &gR) const
Apply .
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
complex< Value > s3() const
Get third component.
complex< Value > & operator[](int i)
Set components by index.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
void setS4(complex< Value > in)
Set fourth component.
This is the main config header file for ThePEG.
LorentzSpinor< Value > bar() const
Return the barred spinor.
The LorentzSpinor class is designed to store a spinor.
Definition: LorentzSpinor.h:71
const SpinHalfLorentzRotation & half() const
The spin- transformation.
complex< Value > & operator()(int i)
Set components by index.
complex< Value > operator()(int i) const
Subscript operator to return spinor components.
complex< Value > s1() const
Get first component.
void setS3(complex< Value > in)
Set third component.
complex< Value > s2() const
Get second component.
void setS2(complex< Value > in)
Set second component.
LorentzSpinorBar(SpinorType t=SpinorType::unknown)
Default zero constructor, optionally specifying t, the type.
SpinorType Type() const
Return the type of the spinor.
complex< Value > operator[](int i) const
Subscript operator to return spinor components.
auto projectionOperator(const LorentzVector< ValueB > &p, const ValueB &m) const -> LorentzSpinorBar< decltype(m *Value())>
Apply .
contains the ThreeVector class.
SpinorType
Enumeration to specify spinor type.
void setS1(complex< Value > in)
Set first component.
complex< Value > s4() const
Get fourth component.
LorentzSpinorBar conjugate() const
Return the conjugated spinor .
The SpinHalfLorentzRotation class is designed to offer the same features as the HepLorentzRotation cl...
LorentzSpinorBar(complex< Value > a, complex< Value > b, complex< Value > c, complex< Value > d, SpinorType t=SpinorType::unknown)
Constructor with complex numbers specifying the components, optionally specifying t...
SpinorType _type
Type of spinor.
LorentzSpinorBar & transform(const LorentzRotation &r)
General Lorentz transformation.
The LorentzSpinorBar class implements the storage of a barred LorentzSpinor.
std::array< complex< Value >, 4 > _spin
Storage of the components.