thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
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
14#include "ThePEG/Vectors/LorentzRotation.h"
16#include "HelicityDefinitions.h"
17#include "LorentzSpinor.fh"
18#include "LorentzSpinorBar.fh"
19
20namespace ThePEG {
21namespace Helicity {
22
34template<typename Value>
36public:
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>
55 LorentzSpinorBar(const LorentzSpinorBar<U> & other)
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
166
173
177 LorentzSpinorBar & boost(double,double,double);
178
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
216 -> LorentzSpinorBar<decltype(m*Value())>
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
251 template<typename ValueB>
252 auto slash(const LorentzVector<ValueB> & p) const
253 -> LorentzSpinorBar<decltype(p.t()*Value())>
254 {
255 LorentzSpinorBar<decltype(p.t()*Value())> spin;
256 static const Complex ii(0.,1.);
257 complex<ValueB> p0pp3=p.t()+p.z();
258 complex<ValueB> p0mp3=p.t()-p.z();
259 complex<ValueB> p1pp2=p.x()+ii*p.y();
260 complex<ValueB> p1mp2=p.x()-ii*p.y();
261 spin.setS1(p0pp3*s3()+p1pp2*s4());
262 spin.setS2(p0mp3*s4()+p1mp2*s3());
263 spin.setS3(p0mp3*s1()-p1pp2*s2());
264 spin.setS4(p0pp3*s2()-p1mp2*s1());
265 return spin;
266 }
267
271 template<typename ValueB>
272 auto slash(const LorentzVector<complex<ValueB> > & p) const
273 -> LorentzSpinor<decltype(ValueB()*Value())>
274 {
275 LorentzSpinor<decltype(ValueB()*Value())> spin;
276 static const Complex ii(0.,1.);
277 complex<ValueB> p0pp3=p.t()+p.z();
278 complex<ValueB> p0mp3=p.t()-p.z();
279 complex<ValueB> p1pp2=p.x()+ii*p.y();
280 complex<ValueB> p1mp2=p.x()-ii*p.y();
281 spin.setS1(p0pp3*s3()+p1pp2*s4());
282 spin.setS2(p0mp3*s4()+p1mp2*s3());
283 spin.setS3(p0mp3*s1()-p1pp2*s2());
284 spin.setS4(p0pp3*s2()-p1mp2*s1());
285 return spin;
286 }
288
289private:
294
298 std::array<complex<Value>,4> _spin;
299};
300
302
303template <typename Value>
305operator/(const LorentzSpinorBar<Value> & v, Value a) {
306 return LorentzSpinorBar<double>(v.s1()/a, v.s2()/a, v.s3()/a, v.s4()/a,v.Type());
307}
308
309inline LorentzSpinorBar<double>
310operator/(const LorentzSpinorBar<double> & v, Complex a) {
311 return LorentzSpinorBar<double>(v.s1()/a, v.s2()/a, v.s3()/a, v.s4()/a,v.Type());
312}
313
314template <typename Value>
315inline LorentzSpinorBar<Value> operator-(const LorentzSpinorBar<Value> & v) {
316 return LorentzSpinorBar<Value>(-v.s1(),-v.s2(),-v.s3(),-v.s4(),v.Type());
317}
318
319template <typename ValueA, typename ValueB>
320inline LorentzSpinorBar<ValueA>
321operator+(LorentzSpinorBar<ValueA> a, const LorentzSpinorBar<ValueB> & b) {
322 return a += b;
323}
324
325template <typename ValueA, typename ValueB>
326inline LorentzSpinorBar<ValueA>
327operator-(LorentzSpinorBar<ValueA> a, const LorentzSpinorBar<ValueB> & b) {
328 return a -= b;
329}
330
331template <typename Value>
332inline LorentzSpinorBar<Value>
333operator*(const LorentzSpinorBar<Value> & a, double b) {
334 return LorentzSpinorBar<Value>(a.s1()*b, a.s2()*b, a.s3()*b, a.s4()*b,a.Type());
335}
336
337template <typename Value>
338inline LorentzSpinorBar<Value>
339operator*(double b, LorentzSpinorBar<Value> a) {
340 return a *= b;
341}
342
343template <typename Value>
344inline LorentzSpinorBar<Value>
345operator*(const LorentzSpinorBar<Value> & a, Complex b) {
346 return LorentzSpinorBar<Value>(a.s1()*b, a.s2()*b, a.s3()*b, a.s4()*b,a.Type());
347}
348
349template <typename ValueA, typename ValueB>
350inline auto operator*(complex<ValueB> a, const LorentzSpinorBar<ValueA> & v)
351 -> LorentzSpinorBar<decltype(a.real()*v.s1().real())>
352{
353 return {a*v.s1(), a*v.s2(), a*v.s3(), a*v.s4(),v.Type()};
354}
355
356template <typename ValueA, typename ValueB>
357inline auto operator*(const LorentzSpinorBar<ValueA> & v, complex<ValueB> b)
358 -> LorentzSpinorBar<decltype(b.real()*v.s1().real())>
359{
360 return b*v;
361}
362
363template <typename ValueA, typename ValueB>
364inline auto operator/(const LorentzSpinorBar<ValueA> & v, complex<ValueB> b)
365 -> LorentzSpinorBar<decltype(v.s1().real()/b.real())>
366{
367 return {v.s1()/b, v.s2()/b, v.s3()/b, v.s4()/b,v.Type()};
368}
369
370template <typename ValueA, typename ValueB>
371inline auto operator*(ValueB a, const LorentzSpinorBar<ValueA> & v)
372 -> LorentzSpinorBar<decltype(a*v.s1().real())>
373{
374 return {a*v.s1(), a*v.s2(), a*v.s3(), a*v.s4(),v.Type()};
375}
376
377template <typename ValueA, typename ValueB>
378inline auto operator*(const LorentzSpinorBar<ValueA> & v, ValueB b)
379 -> LorentzSpinorBar<decltype(b*v.s1().real())>
380{
381 return b*v;
382}
383
384template <typename ValueA, typename ValueB>
385inline auto operator/(const LorentzSpinorBar<ValueA> & v, ValueB b)
386 -> LorentzSpinorBar<decltype(v.s1().real()/b)>
387{
388 return {v.s1()/b, v.s2()/b, v.s3()/b, v.s4()/b,v.Type()};
389}
390
391}
392}
393
394#ifndef ThePEG_TEMPLATES_IN_CC_FILE
395#include "LorentzSpinorBar.tcc"
396#endif
397
398#endif
This file contains enumerations used by LorentzSpinor and LorentzSpinorBar classes.
This is the main config header file for ThePEG.
contains the ThreeVector class.
The LorentzSpinorBar class implements the storage of a barred LorentzSpinor.
LorentzSpinorBar conjugate() const
Return the conjugated spinor .
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,...
LorentzSpinorBar & boost(double, double, double)
Standard Lorentz boost specifying the components of the beta vector.
LorentzSpinorBar & boost(const Boost &)
Standard Lorentz boost specifying the beta vector.
complex< Value > & operator()(int i)
Set components by index.
complex< Value > s4() const
Get fourth component.
SpinorType Type() const
Return the type of the spinor.
LorentzSpinorBar(SpinorType t=SpinorType::unknown)
Default zero constructor, optionally specifying t, the type.
LorentzSpinorBar & transform(const SpinHalfLorentzRotation &)
General Lorentz transformation.
void setS4(complex< Value > in)
Set fourth component.
std::array< complex< Value >, 4 > _spin
Storage of the components.
complex< Value > s3() const
Get third component.
void setS3(complex< Value > in)
Set third component.
complex< Value > operator[](int i) const
Subscript operator to return spinor components.
complex< Value > s2() const
Get second component.
void setS1(complex< Value > in)
Set first component.
LorentzSpinorBar helicityProjectionOperator(const Complex &gL, const Complex &gR) const
Apply .
void setS2(complex< Value > in)
Set second component.
LorentzSpinor< Value > bar() const
Return the barred spinor.
complex< Value > & operator[](int i)
Set components by index.
auto projectionOperator(const LorentzVector< ValueB > &p, const ValueB &m) const -> LorentzSpinorBar< decltype(m *Value())>
Apply .
complex< Value > s1() const
Get first component.
auto slash(const LorentzVector< complex< ValueB > > &p) const -> LorentzSpinor< decltype(ValueB() *Value())>
Apply .
auto slash(const LorentzVector< ValueB > &p) const -> LorentzSpinorBar< decltype(p.t() *Value())>
Apply .
complex< Value > operator()(int i) const
Subscript operator to return spinor components.
LorentzSpinorBar & transform(const LorentzRotation &r)
General Lorentz transformation.
SpinorType _type
Type of spinor.
The LorentzSpinor class is designed to store a spinor.
Definition: LorentzSpinor.h:71
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
const SpinHalfLorentzRotation & half() const
The spin- transformation.
A 4-component Lorentz vector.
Definition: LorentzVector.h:44
The SpinHalfLorentzRotation class is designed to offer the same features as the HepLorentzRotation cl...
A 3-component vector.
Definition: ThreeVector.h:35
SpinorType
Enumeration to specify spinor type.
@ unknown
Undefined spinor type.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
std::complex< double > Complex
ThePEG code should use Complex for all complex scalars.
Definition: Complex.h:23