thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
Variables
Typedefs
a
b
c
d
e
f
h
i
l
m
p
q
r
s
t
v
x
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
v
w
x
z
Enumerations
Enumerator
a
b
c
d
e
f
i
m
n
p
r
s
t
u
v
w
Related Functions
a
b
c
d
e
h
i
l
m
o
p
r
s
x
Files
File List
File Members
All
Macros
EventRecord
RhoDMatrix.h
1
// -*- C++ -*-
2
//
3
// RhoDMatrix.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_RhoDMatrix_H
10
#define ThePEG_RhoDMatrix_H
11
// This is the declaration of the RhoDMatrix class.
12
13
#include "ThePEG/PDT/PDT.h"
14
#include "
ThePEG/Helicity/HelicityDefinitions.h
"
15
#include <cassert>
16
#include <array>
17
18
namespace
ThePEG
{
19
28
class
RhoDMatrix
{
29
30
public
:
31
37
RhoDMatrix
() =
default
;
38
43
RhoDMatrix
(
PDT::Spin
inspin,
bool
average =
true
)
44
:
_spin
(inspin),
_ispin
(abs(int(inspin))) {
45
assert(
_ispin
<= MAXSPIN);
46
// initialize to average
47
if
( average )
48
for
(
size_t
ix=0; ix<
_ispin
; ++ix)
49
_matrix
[ix][ix] = 1./
_ispin
;
50
}
52
53
public
:
54
60
Complex
operator()
(
size_t
ix,
size_t
iy)
const
{
61
assert(ix <
_ispin
);
62
assert(iy <
_ispin
);
63
return
_matrix
[ix][iy];
64
}
65
69
Complex
&
operator()
(
size_t
ix,
size_t
iy) {
70
assert(ix <
_ispin
);
71
assert(iy <
_ispin
);
72
return
_matrix
[ix][iy];
73
}
74
78
void
normalize
() {
79
#ifndef NDEBUG
80
static
const
double
epsa=1e-40, epsb=1e-10;
81
#endif
82
Complex
norm = 0.;
83
for
(
size_t
ix=0; ix<
_ispin
; ++ix)
84
norm +=
_matrix
[ix][ix];
85
assert(norm.real() > epsa);
86
assert(norm.imag()/norm.real() < epsb);
87
double
invnorm = 1./norm.real();
88
for
(
size_t
ix=0; ix<
_ispin
; ++ix)
89
for
(
size_t
iy=0; iy<
_ispin
; ++iy)
90
_matrix
[ix][iy]*=invnorm;
91
}
93
97
void
reset
(
bool
average =
true
) {
98
for
(
size_t
ix=0; ix<
_ispin
; ++ix)
99
for
(
size_t
iy=0; iy<
_ispin
; ++iy)
100
_matrix
[ix][iy]=0.;
101
if
( average )
102
for
(
size_t
ix=0; ix<
_ispin
; ++ix)
103
_matrix
[ix][ix] = 1./
_ispin
;
104
}
105
108
112
PDT::Spin
iSpin
()
const
{
return
_spin
; }
114
118
friend
ostream &
operator<<
(ostream & os,
const
RhoDMatrix
& rd);
119
120
private
:
121
125
PDT::Spin
_spin
;
126
130
size_t
_ispin
;
131
135
enum
{ MAXSPIN = 7 };
136
140
// Deliberately not using vector<> to avoid calls to 'new'
141
// from this commonly used class.
142
std::array<std::array<Complex,MAXSPIN>,MAXSPIN>
_matrix
;
143
144
};
145
147
inline
ostream &
operator<<
(ostream & os,
const
RhoDMatrix
& rd) {
148
for
(
size_t
ix = 0; ix < rd.
_ispin
; ++ix) {
149
for
(
size_t
iy = 0; iy < rd.
_ispin
; ++iy)
150
os << rd.
_matrix
[ix][iy] <<
" "
;
151
os <<
'\n'
;
152
}
153
return
os;
154
}
155
156
}
157
158
#endif
/* ThePEG_RhoDMatrix_H */
HelicityDefinitions.h
This file contains enumerations used by LorentzSpinor and LorentzSpinorBar classes.
ThePEG::PDT::Spin
Spin
Definition of enumerated values used for spin information.
Definition:
PDT.h:32
ThePEG::RhoDMatrix
The RhoDMatrix class is designed to implement the storage of the rho and D matrices which are require...
Definition:
RhoDMatrix.h:28
ThePEG::RhoDMatrix::operator()
Complex operator()(size_t ix, size_t iy) const
Return an element of the matrix.
Definition:
RhoDMatrix.h:60
ThePEG::RhoDMatrix::RhoDMatrix
RhoDMatrix(PDT::Spin inspin, bool average=true)
Standard constructor giving the spin as 2s+1.
Definition:
RhoDMatrix.h:43
ThePEG::RhoDMatrix::_ispin
size_t _ispin
Storage of 2s+1 for speed.
Definition:
RhoDMatrix.h:130
ThePEG::RhoDMatrix::reset
void reset(bool average=true)
Reset.
Definition:
RhoDMatrix.h:97
ThePEG::RhoDMatrix::normalize
void normalize()
renormalise the matrix so it has unit trace
Definition:
RhoDMatrix.h:78
ThePEG::RhoDMatrix::iSpin
PDT::Spin iSpin() const
Get the spin.
Definition:
RhoDMatrix.h:112
ThePEG::RhoDMatrix::operator<<
friend ostream & operator<<(ostream &os, const RhoDMatrix &rd)
Output the spin density matrix for debugging purposes.
Definition:
RhoDMatrix.h:147
ThePEG::RhoDMatrix::_spin
PDT::Spin _spin
2s+1 for the particle.
Definition:
RhoDMatrix.h:125
ThePEG::RhoDMatrix::_matrix
std::array< std::array< Complex, MAXSPIN >, MAXSPIN > _matrix
Storage for the matrix allowing up to spin 2 particles.
Definition:
RhoDMatrix.h:142
ThePEG::RhoDMatrix::RhoDMatrix
RhoDMatrix()=default
Default constructor with undefined spin.
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::Complex
std::complex< double > Complex
ThePEG code should use Complex for all complex scalars.
Definition:
Complex.h:23
ThePEG::operator<<
vector< T > & operator<<(vector< T > &tv, const U &u)
Overload the left shift operator for vector to push_back objects to a vector.
Definition:
Containers.h:179
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6