herwig
is hosted by
Hepforge
,
IPPP Durham
Herwig
7.3.0
MatrixElement
Matchbox
Utility
SpinorHelicity.h
1
// -*- C++ -*-
2
//
3
// SpinorHelicity.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4
// Copyright (C) 2002-2019 The Herwig Collaboration
5
//
6
// Herwig 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 HERWIG_SpinorHelicity_H
10
#define HERWIG_SpinorHelicity_H
11
12
#include "ThePEG/Config/Complex.h"
13
#include "
ThePEG/Vectors/LorentzVector.h
"
14
15
#include <boost/operators.hpp>
16
17
namespace
Herwig
{
18
19
using namespace
ThePEG
;
20
21
namespace
SpinorHelicity {
22
30
struct
PlusSpinorTag
{};
31
39
struct
MinusSpinorTag
{};
40
48
struct
PlusConjugateSpinorTag
{};
49
57
struct
MinusConjugateSpinorTag
{};
58
66
template
<
class
Value>
67
struct
SpinorMultiplicationTraits
{
68
69
typedef
decltype
(
sqr
(std::declval<Value>())) ResultType;
70
typedef
complex<ResultType> ComplexResultType;
71
typedef
LorentzVector<ComplexResultType>
ComplexVectorResultType
;
72
73
};
74
82
template
<
class
Type>
83
struct
WeylSpinorTraits
;
84
85
// specialize for |p>
86
template
<>
87
struct
WeylSpinorTraits
<
PlusSpinorTag
> {
88
89
template
<
class
Value,
class
MValue>
90
static
pair<complex<Value>,complex<Value> >
91
components(
const
LorentzVector<MValue>
& p) {
92
if
( p.t() <
ZERO
) {
93
pair<complex<Value>,complex<Value> > res =
94
components<Value,MValue>(-p);
95
// do not revert to *=, breaks with XCode 5.1
96
res.first = res.first *
Complex
(0.,1.);
97
res.second = res.second *
Complex
(0.,1.);
98
return
res;
99
}
100
Energy pPlus = p.t() + p.x();
101
if
( abs(pPlus) < 1.e-10 * GeV ) {
102
return
make_pair(complex<Value>(
ZERO
),
103
complex<Value>(
sqrt
(2.*p.t())));
104
}
105
return
make_pair(complex<Value>(
sqrt
(pPlus)),
106
complex<Value>(p.z()/
sqrt
(pPlus),p.y()/
sqrt
(pPlus)));
107
}
108
109
};
110
111
// specialize for |p]
112
template
<>
113
struct
WeylSpinorTraits
<
MinusSpinorTag
> {
114
115
template
<
class
Value,
class
MValue>
116
static
pair<complex<Value>,complex<Value> >
117
components(
const
LorentzVector<MValue>
& p) {
118
if
( p.t() <
ZERO
) {
119
pair<complex<Value>,complex<Value> > res =
120
components<Value,MValue>(-p);
121
// do not revert to *=, breaks with XCode 5.1
122
res.first = res.first *
Complex
(0.,1.);
123
res.second = res.second *
Complex
(0.,1.);
124
return
res;
125
}
126
Energy pPlus = p.t() + p.x();
127
if
( abs(pPlus) < 1.e-10 * GeV ) {
128
return
make_pair(complex<Value>(
sqrt
(2.*p.t())),
129
complex<Value>(
ZERO
));
130
}
131
return
make_pair(complex<Value>(p.z()/
sqrt
(pPlus),-p.y()/
sqrt
(pPlus)),
132
-complex<Value>(
sqrt
(pPlus)));
133
}
134
135
};
136
137
// specialize for <p|
138
template
<>
139
struct
WeylSpinorTraits
<
PlusConjugateSpinorTag
> {
140
141
typedef
PlusSpinorTag
ConjugateSpinorTag
;
142
typedef
MinusSpinorTag
BarSpinorTag
;
143
144
template
<
class
Value,
class
MValue>
145
static
pair<complex<Value>,complex<Value> >
146
components(
const
LorentzVector<MValue>
& p) {
147
pair<complex<Value>,complex<Value> > res =
148
WeylSpinorTraits<PlusSpinorTag>::template
components<Value>(p);
149
res.first = -res.first;
150
swap(res.first,res.second);
151
return
res;
152
}
153
154
};
155
156
// specialize for [p|
157
template
<>
158
struct
WeylSpinorTraits
<
MinusConjugateSpinorTag
> {
159
160
typedef
MinusSpinorTag
ConjugateSpinorTag
;
161
typedef
PlusSpinorTag
BarSpinorTag
;
162
163
template
<
class
Value,
class
MValue>
164
static
pair<complex<Value>,complex<Value> >
165
components(
const
LorentzVector<MValue>
& p) {
166
pair<complex<Value>,complex<Value> > res =
167
WeylSpinorTraits<MinusSpinorTag>::template
components<Value>(p);
168
res.second = -res.second;
169
swap(res.first,res.second);
170
return
res;
171
}
172
173
};
174
182
template
<
class
Type,
class
Value>
183
class
WeylSpinor
{
184
185
public
:
186
187
typedef
complex<Value> ComplexType;
188
typedef
pair<ComplexType,ComplexType> ComponentsType;
189
typedef
Type Tag;
190
typedef
WeylSpinorTraits<Tag>
Traits
;
191
typedef
Value ValueType;
192
193
private
:
194
198
ComponentsType
theComponents
;
199
200
public
:
201
205
explicit
WeylSpinor
(
const
ComponentsType& c = ComponentsType())
206
:
theComponents
(c) {}
207
211
template
<
class
MValue>
212
explicit
WeylSpinor
(
const
LorentzVector<MValue>
& p)
213
:
theComponents
(
Traits
::template
components
<Value>(p)) {}
214
218
const
ComponentsType&
components
()
const
{
return
theComponents
; }
219
223
const
ComplexType&
s1
()
const
{
return
theComponents
.first; }
224
228
const
ComplexType&
s2
()
const
{
return
theComponents
.second; }
229
230
};
231
233
typedef
WeylSpinor<PlusSpinorTag,SqrtEnergy>
PlusSpinor
;
234
236
typedef
WeylSpinor<MinusSpinorTag,SqrtEnergy>
MinusSpinor
;
237
239
typedef
WeylSpinor<PlusConjugateSpinorTag,SqrtEnergy>
PlusConjugateSpinor
;
240
242
typedef
WeylSpinor<MinusConjugateSpinorTag,SqrtEnergy>
MinusConjugateSpinor
;
243
251
template
<
class
Type,
class
Value>
252
class
SpinorProduct
253
:
public
boost::addable<SpinorProduct<Type,Value> >,
254
public
boost::subtractable<SpinorProduct<Type,Value> >,
255
public
boost::multipliable<SpinorProduct<Type,Value>, double>,
256
public
boost::multipliable<SpinorProduct<Type,Value>, complex<double> > {
257
258
public
:
259
260
typedef
typename
SpinorMultiplicationTraits<Value>::ComplexResultType ResultType;
261
typedef
WeylSpinor<Type,Value>
LeftSpinorType
;
262
typedef
typename
WeylSpinorTraits<Type>::ConjugateSpinorTag
RightSpinorTag;
263
typedef
WeylSpinor<RightSpinorTag,Value>
RightSpinorType
;
264
265
private
:
266
270
ResultType
theResult
;
271
272
public
:
273
279
explicit
SpinorProduct
(
const
LeftSpinorType
&
left
,
280
const
RightSpinorType
&
right
)
281
:
theResult
(
left
.s1()*
right
.s1()+
left
.s2()*
right
.s2()) {}
282
286
operator
ResultType()
const
{
return
theResult
; }
287
291
ResultType
eval
()
const
{
return
theResult
; }
292
293
public
:
294
295
SpinorProduct
& operator+= (
const
SpinorProduct
& other) {
296
theResult
+= other.theResult;
297
return
*
this
;
298
}
299
300
SpinorProduct
& operator-= (
const
SpinorProduct
& other) {
301
theResult
-= other.theResult;
302
return
*
this
;
303
}
304
305
SpinorProduct& operator*= (
double
x) {
306
theResult
*= x;
307
return
*
this
;
308
}
309
310
SpinorProduct
& operator*= (complex<double> x) {
311
theResult
*= x;
312
return
*
this
;
313
}
314
315
};
316
318
typedef
SpinorProduct<PlusConjugateSpinorTag,SqrtEnergy> PlusSpinorProduct;
319
321
typedef
SpinorProduct<MinusConjugateSpinorTag,SqrtEnergy> MinusSpinorProduct;
322
330
template
<
class
Type,
class
Value>
331
class
SpinorCurrent
332
:
public
boost::addable<SpinorCurrent<Type,Value> >,
333
public
boost::subtractable<SpinorCurrent<Type,Value> >,
334
public
boost::multipliable<SpinorCurrent<Type,Value>, double>,
335
public
boost::multipliable<SpinorCurrent<Type,Value>, complex<double> > {
336
337
public
:
338
339
typedef
typename
SpinorMultiplicationTraits<Value>::ComplexVectorResultType
ResultType
;
340
typedef
WeylSpinor<Type,Value>
LeftSpinorType
;
341
typedef
typename
WeylSpinorTraits<Type>::BarSpinorTag
RightSpinorTag;
342
typedef
WeylSpinor<RightSpinorTag,Value>
RightSpinorType
;
343
344
private
:
345
346
ResultType
theResult;
347
351
ResultType
evaluate
(
const
WeylSpinor<MinusConjugateSpinorTag,Value>
&
left
,
352
const
WeylSpinor<PlusSpinorTag,Value>
&
right
) {
353
return
354
ResultType
(
right
.s1()*
left
.s1()-
right
.s2()*
left
.s2(),
355
complex<double>(0.,1.)*(
right
.s1()*
left
.s2()-
right
.s2()*
left
.s1()),
356
right
.s1()*
left
.s2()+
right
.s2()*
left
.s1(),
357
right
.s1()*
left
.s1()+
right
.s2()*
left
.s2());
358
}
359
363
ResultType
evaluate
(
const
WeylSpinor<PlusConjugateSpinorTag,Value>
&
left
,
364
const
WeylSpinor<MinusSpinorTag,Value>
&
right
) {
365
return
366
ResultType
(-
right
.s1()*
left
.s1()+
right
.s2()*
left
.s2(),
367
-complex<double>(0.,1.)*(
right
.s1()*
left
.s2()-
right
.s2()*
left
.s1()),
368
-
right
.s1()*
left
.s2()-
right
.s2()*
left
.s1(),
369
right
.s1()*
left
.s1()+
right
.s2()*
left
.s2());
370
}
371
372
public
:
373
378
explicit
SpinorCurrent
(
const
LeftSpinorType
&
left
,
379
const
RightSpinorType
&
right
)
380
: theResult(
evaluate
(
left
,
right
)) {}
381
385
operator
ResultType
()
const
{
return
theResult; }
386
390
ResultType
eval
()
const
{
return
theResult; }
391
392
public
:
393
394
SpinorCurrent
& operator+= (
const
SpinorCurrent
& other) {
395
theResult += other.theResult;
396
return
*
this
;
397
}
398
399
SpinorCurrent
& operator-= (
const
SpinorCurrent
& other) {
400
theResult -= other.theResult;
401
return
*
this
;
402
}
403
404
SpinorCurrent& operator*= (
double
x) {
405
theResult *= x;
406
return
*
this
;
407
}
408
409
SpinorCurrent
& operator*= (complex<double> x) {
410
theResult *= x;
411
return
*
this
;
412
}
413
414
};
415
417
typedef
SpinorCurrent<PlusConjugateSpinorTag,SqrtEnergy> PlusSpinorCurrent;
418
420
typedef
SpinorCurrent<MinusConjugateSpinorTag,SqrtEnergy> MinusSpinorCurrent;
421
425
template
<
class
T>
426
auto
abs2(
const
complex<T>& x) ->
decltype
((x*conj(x)).real())
427
{
428
return
(x*conj(x)).real();
429
}
430
431
}
432
433
}
434
435
#endif
// HERWIG_SpinorHelicity_H
LorentzVector.h
Herwig::SpinorHelicity::SpinorCurrent
Weyl spinor current.
Definition:
SpinorHelicity.h:335
Herwig::SpinorHelicity::SpinorCurrent::SpinorCurrent
SpinorCurrent(const LeftSpinorType &left, const RightSpinorType &right)
Construct from two spinors.
Definition:
SpinorHelicity.h:378
Herwig::SpinorHelicity::SpinorCurrent::evaluate
ResultType evaluate(const WeylSpinor< PlusConjugateSpinorTag, Value > &left, const WeylSpinor< MinusSpinorTag, Value > &right)
Calculate <p|\gamma^\mu|q].
Definition:
SpinorHelicity.h:363
Herwig::SpinorHelicity::SpinorCurrent::eval
ResultType eval() const
Return result.
Definition:
SpinorHelicity.h:390
Herwig::SpinorHelicity::SpinorCurrent::evaluate
ResultType evaluate(const WeylSpinor< MinusConjugateSpinorTag, Value > &left, const WeylSpinor< PlusSpinorTag, Value > &right)
Calculate [p|\gamma^\mu|q>
Definition:
SpinorHelicity.h:351
Herwig::SpinorHelicity::SpinorProduct
Weyl spinor product.
Definition:
SpinorHelicity.h:256
Herwig::SpinorHelicity::SpinorProduct::theResult
ResultType theResult
The result.
Definition:
SpinorHelicity.h:270
Herwig::SpinorHelicity::SpinorProduct::SpinorProduct
SpinorProduct(const LeftSpinorType &left, const RightSpinorType &right)
Construct from two spinors; note that the spinor metric is included, when constructing spinors.
Definition:
SpinorHelicity.h:279
Herwig::SpinorHelicity::SpinorProduct::eval
ResultType eval() const
Return result.
Definition:
SpinorHelicity.h:291
Herwig::SpinorHelicity::WeylSpinor
Base class for Weyl spinors.
Definition:
SpinorHelicity.h:183
Herwig::SpinorHelicity::WeylSpinor::theComponents
ComponentsType theComponents
The components.
Definition:
SpinorHelicity.h:198
Herwig::SpinorHelicity::WeylSpinor::WeylSpinor
WeylSpinor(const ComponentsType &c=ComponentsType())
Construct from components.
Definition:
SpinorHelicity.h:205
Herwig::SpinorHelicity::WeylSpinor::WeylSpinor
WeylSpinor(const LorentzVector< MValue > &p)
Construct from momentum.
Definition:
SpinorHelicity.h:212
Herwig::SpinorHelicity::WeylSpinor::s2
const ComplexType & s2() const
Return the second component.
Definition:
SpinorHelicity.h:228
Herwig::SpinorHelicity::WeylSpinor::s1
const ComplexType & s1() const
Return the first component.
Definition:
SpinorHelicity.h:223
Herwig::SpinorHelicity::WeylSpinor::components
const ComponentsType & components() const
Return the components.
Definition:
SpinorHelicity.h:218
ThePEG::LorentzVector
Herwig
-*- C++ -*-
Definition:
BasicConsistency.h:17
ThePEG
ThePEG::sqrt
double sqrt(int x)
ThePEG::Complex
std::complex< double > Complex
ThePEG::right
ostream & right(ostream &os)
ThePEG::ZERO
constexpr ZeroUnit ZERO
ThePEG::sqr
constexpr auto sqr(const T &x) -> decltype(x *x)
ThePEG::left
ostream & left(ostream &os)
Herwig::SpinorHelicity::MinusConjugateSpinorTag
Tag for [p|.
Definition:
SpinorHelicity.h:57
Herwig::SpinorHelicity::MinusSpinorTag
Tag for |p].
Definition:
SpinorHelicity.h:39
Herwig::SpinorHelicity::PlusConjugateSpinorTag
Tag for <p|.
Definition:
SpinorHelicity.h:48
Herwig::SpinorHelicity::PlusSpinorTag
Tag for |p>
Definition:
SpinorHelicity.h:30
Herwig::SpinorHelicity::SpinorMultiplicationTraits
Helpers for commonly encountered types.
Definition:
SpinorHelicity.h:67
Herwig::SpinorHelicity::WeylSpinorTraits
Helpers for Weyl spinors.
Definition:
SpinorHelicity.h:83
Generated on Thu Jun 20 2024 17:50:53 for Herwig by
1.9.6