EvtGen
2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Toggle main menu visibility
Loading...
Searching...
No Matches
src
EvtGenBase
EvtRaritaSchwinger.cpp
Go to the documentation of this file.
1
2
/***********************************************************************
3
* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4
* *
5
* This file is part of EvtGen. *
6
* *
7
* EvtGen is free software: you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation, either version 3 of the License, or *
10
* (at your option) any later version. *
11
* *
12
* EvtGen is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19
***********************************************************************/
20
21
#include "
EvtGenBase/EvtRaritaSchwinger.hh
"
22
23
using
std::endl;
24
using
std::ostream;
25
26
EvtRaritaSchwinger
rotateEuler
(
const
EvtRaritaSchwinger
& rs,
double
alpha,
27
double
beta,
double
gamma )
28
{
29
EvtRaritaSchwinger
tmp( rs );
30
tmp.
applyRotateEuler
( alpha, beta, gamma );
31
return
tmp;
32
}
33
34
EvtRaritaSchwinger
boostTo
(
const
EvtRaritaSchwinger
& rs,
const
EvtVector4R
p4 )
35
{
36
EvtRaritaSchwinger
tmp( rs );
37
tmp.
applyBoostTo
( p4 );
38
return
tmp;
39
}
40
41
EvtRaritaSchwinger
boostTo
(
const
EvtRaritaSchwinger
& rs,
const
EvtVector3R
boost )
42
{
43
EvtRaritaSchwinger
tmp( rs );
44
tmp.
applyBoostTo
( boost );
45
return
tmp;
46
}
47
48
void
EvtRaritaSchwinger::set
(
int
i,
int
j,
const
EvtComplex
& sp )
49
{
50
m_rs
[i][j] = sp;
51
}
52
53
EvtComplex
EvtRaritaSchwinger::get
(
int
i,
int
j )
const
54
{
55
return
m_rs
[i][j];
56
}
57
58
void
EvtRaritaSchwinger::applyRotateEuler
(
double
alpha,
double
beta,
59
double
gamma )
60
{
61
//inefficient but simple to code...
62
EvtVector4C
v0 =
getVector
( 0 );
63
EvtVector4C
v1 =
getVector
( 1 );
64
EvtVector4C
v2 =
getVector
( 2 );
65
EvtVector4C
v3 =
getVector
( 3 );
66
v0.
applyRotateEuler
( alpha, beta, gamma );
67
v1.
applyRotateEuler
( alpha, beta, gamma );
68
v2.
applyRotateEuler
( alpha, beta, gamma );
69
v3.
applyRotateEuler
( alpha, beta, gamma );
70
setVector
( 0, v0 );
71
setVector
( 1, v1 );
72
setVector
( 2, v2 );
73
setVector
( 3, v3 );
74
EvtDiracSpinor
sp0 =
getSpinor
( 0 );
75
EvtDiracSpinor
sp1 =
getSpinor
( 1 );
76
EvtDiracSpinor
sp2 =
getSpinor
( 2 );
77
EvtDiracSpinor
sp3 =
getSpinor
( 3 );
78
sp0.
applyRotateEuler
( alpha, beta, gamma );
79
sp1.
applyRotateEuler
( alpha, beta, gamma );
80
sp2.
applyRotateEuler
( alpha, beta, gamma );
81
sp3.
applyRotateEuler
( alpha, beta, gamma );
82
setSpinor
( 0, sp0 );
83
setSpinor
( 1, sp1 );
84
setSpinor
( 2, sp2 );
85
setSpinor
( 3, sp3 );
86
}
87
88
void
EvtRaritaSchwinger::applyBoostTo
(
const
EvtVector4R
p4 )
89
{
90
double
e = p4.
get
( 0 );
91
92
EvtVector3R
boost( p4.
get
( 1 ) / e, p4.
get
( 2 ) / e, p4.
get
( 3 ) / e );
93
94
applyBoostTo
( boost );
95
96
return
;
97
}
98
99
void
EvtRaritaSchwinger::applyBoostTo
(
const
EvtVector3R
boost )
100
{
101
//inefficient but simple to code...
102
EvtVector4C
v0 =
getVector
( 0 );
103
EvtVector4C
v1 =
getVector
( 1 );
104
EvtVector4C
v2 =
getVector
( 2 );
105
EvtVector4C
v3 =
getVector
( 3 );
106
v0.
applyBoostTo
( boost );
107
v1.
applyBoostTo
( boost );
108
v2.
applyBoostTo
( boost );
109
v3.
applyBoostTo
( boost );
110
setVector
( 0, v0 );
111
setVector
( 1, v1 );
112
setVector
( 2, v2 );
113
setVector
( 3, v3 );
114
EvtDiracSpinor
sp0 =
getSpinor
( 0 );
115
EvtDiracSpinor
sp1 =
getSpinor
( 1 );
116
EvtDiracSpinor
sp2 =
getSpinor
( 2 );
117
EvtDiracSpinor
sp3 =
getSpinor
( 3 );
118
sp0.
applyBoostTo
( boost );
119
sp1.
applyBoostTo
( boost );
120
sp2.
applyBoostTo
( boost );
121
sp3.
applyBoostTo
( boost );
122
setSpinor
( 0, sp0 );
123
setSpinor
( 1, sp1 );
124
setSpinor
( 2, sp2 );
125
setSpinor
( 3, sp3 );
126
}
127
128
ostream&
operator<<
( ostream& s,
const
EvtRaritaSchwinger
& rs )
129
{
130
int
i, j;
131
s << endl;
132
for
( i = 0; i < 4; i++ ) {
133
for
( j = 0; j < 4; j++ ) {
134
s << rs.
m_rs
[i][j];
135
}
136
s << endl;
137
}
138
return
s;
139
}
140
141
EvtVector4C
EvtRaritaSchwinger::getVector
(
int
i )
const
142
{
143
EvtVector4C
tmp(
m_rs
[i][0],
m_rs
[i][1],
m_rs
[i][2],
m_rs
[i][3] );
144
return
tmp;
145
}
146
147
EvtDiracSpinor
EvtRaritaSchwinger::getSpinor
(
int
i )
const
148
{
149
EvtDiracSpinor
tmp;
150
tmp.
set
(
m_rs
[0][i],
m_rs
[1][i],
m_rs
[2][i],
m_rs
[3][i] );
151
return
tmp;
152
}
153
154
void
EvtRaritaSchwinger::setVector
(
int
i,
const
EvtVector4C
& v )
155
{
156
m_rs
[i][0] = v.
get
( 0 );
157
m_rs
[i][1] = v.
get
( 1 );
158
m_rs
[i][2] = v.
get
( 2 );
159
m_rs
[i][3] = v.
get
( 3 );
160
}
161
162
void
EvtRaritaSchwinger::setSpinor
(
int
i,
const
EvtDiracSpinor
& sp )
163
{
164
m_rs
[0][i] = sp.
get_spinor
( 0 );
165
m_rs
[1][i] = sp.
get_spinor
( 1 );
166
m_rs
[2][i] = sp.
get_spinor
( 2 );
167
m_rs
[3][i] = sp.
get_spinor
( 3 );
168
}
169
170
EvtRaritaSchwinger
dirProd
(
EvtVector4R
v,
EvtDiracSpinor
u )
171
{
172
int
i, j;
173
174
EvtRaritaSchwinger
tmp;
175
176
for
( i = 0; i < 4; i++ ) {
177
for
( j = 0; j < 4; j++ ) {
178
tmp.
m_rs
[i][j] = u.
get_spinor
( i ) * v.
get
( j );
179
}
180
}
181
182
return
tmp;
183
}
184
185
EvtRaritaSchwinger
dirProd
(
EvtVector4C
v,
EvtDiracSpinor
u )
186
{
187
int
i, j;
188
189
EvtRaritaSchwinger
tmp;
190
191
for
( i = 0; i < 4; i++ ) {
192
for
( j = 0; j < 4; j++ ) {
193
tmp.
m_rs
[i][j] = u.
get_spinor
( i ) * v.
get
( j );
194
}
195
}
196
197
return
tmp;
198
}
199
200
EvtComplex
operator*
(
const
EvtRaritaSchwinger
& u1,
const
EvtRaritaSchwinger
& u2 )
201
{
202
int
i, j;
203
EvtComplex
tmp = 0.0;
204
205
for
( i = 0; i < 4; i++ ) {
206
for
( j = 0; j < 4; j++ ) {
207
tmp +=
conj
( u1.
m_rs
[i][j] ) * u2.
m_rs
[i][j];
208
}
209
}
210
211
return
tmp;
212
}
213
214
EvtRaritaSchwinger
&
EvtRaritaSchwinger::operator+=
(
const
EvtRaritaSchwinger
& u2 )
215
{
216
int
i, j;
217
218
for
( i = 0; i < 4; i++ ) {
219
for
( j = 0; j < 4; j++ ) {
220
m_rs
[i][j] += u2.
m_rs
[i][j];
221
}
222
}
223
224
return
*
this
;
225
}
226
227
EvtRaritaSchwinger
operator+
(
const
EvtRaritaSchwinger
& u1,
228
const
EvtRaritaSchwinger
& u2 )
229
{
230
return
EvtRaritaSchwinger
( u1 ) += u2;
231
}
232
233
EvtRaritaSchwinger
&
EvtRaritaSchwinger::operator-=
(
const
EvtRaritaSchwinger
& u2 )
234
{
235
int
i, j;
236
237
for
( i = 0; i < 4; i++ ) {
238
for
( j = 0; j < 4; j++ ) {
239
m_rs
[i][j] += u2.
m_rs
[i][j];
240
}
241
}
242
243
return
*
this
;
244
}
245
246
EvtRaritaSchwinger
operator-
(
const
EvtRaritaSchwinger
& u1,
247
const
EvtRaritaSchwinger
& u2 )
248
{
249
return
EvtRaritaSchwinger
( u1 ) -= u2;
250
}
conj
EvtComplex conj(const EvtComplex &c)
Definition
EvtComplex.hh:198
operator+
EvtRaritaSchwinger operator+(const EvtRaritaSchwinger &u1, const EvtRaritaSchwinger &u2)
Definition
EvtRaritaSchwinger.cpp:227
boostTo
EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger &rs, const EvtVector4R p4)
Definition
EvtRaritaSchwinger.cpp:34
rotateEuler
EvtRaritaSchwinger rotateEuler(const EvtRaritaSchwinger &rs, double alpha, double beta, double gamma)
Definition
EvtRaritaSchwinger.cpp:26
operator-
EvtRaritaSchwinger operator-(const EvtRaritaSchwinger &u1, const EvtRaritaSchwinger &u2)
Definition
EvtRaritaSchwinger.cpp:246
operator*
EvtComplex operator*(const EvtRaritaSchwinger &u1, const EvtRaritaSchwinger &u2)
Definition
EvtRaritaSchwinger.cpp:200
operator<<
ostream & operator<<(ostream &s, const EvtRaritaSchwinger &rs)
Definition
EvtRaritaSchwinger.cpp:128
dirProd
EvtRaritaSchwinger dirProd(EvtVector4R v, EvtDiracSpinor u)
Definition
EvtRaritaSchwinger.cpp:170
EvtRaritaSchwinger.hh
EvtComplex
Definition
EvtComplex.hh:29
EvtDiracSpinor
Definition
EvtDiracSpinor.hh:32
EvtDiracSpinor::get_spinor
const EvtComplex & get_spinor(int i) const
Definition
EvtDiracSpinor.cpp:60
EvtDiracSpinor::set
void set(const EvtComplex &sp0, const EvtComplex &sp1, const EvtComplex &sp2, const EvtComplex &sp3)
Definition
EvtDiracSpinor.cpp:39
EvtDiracSpinor::applyRotateEuler
void applyRotateEuler(double alpha, double beta, double gamma)
Definition
EvtDiracSpinor.cpp:139
EvtDiracSpinor::applyBoostTo
void applyBoostTo(const EvtVector4R &p4)
Definition
EvtDiracSpinor.cpp:87
EvtRaritaSchwinger
Definition
EvtRaritaSchwinger.hh:43
EvtRaritaSchwinger::getSpinor
EvtDiracSpinor getSpinor(int i) const
Definition
EvtRaritaSchwinger.cpp:147
EvtRaritaSchwinger::applyRotateEuler
void applyRotateEuler(double alpha, double beta, double gamma)
Definition
EvtRaritaSchwinger.cpp:58
EvtRaritaSchwinger::setSpinor
void setSpinor(int i, const EvtDiracSpinor &sp)
Definition
EvtRaritaSchwinger.cpp:162
EvtRaritaSchwinger::set
void set(int i, int j, const EvtComplex &sp)
Definition
EvtRaritaSchwinger.cpp:48
EvtRaritaSchwinger::get
EvtComplex get(int i, int j) const
Definition
EvtRaritaSchwinger.cpp:53
EvtRaritaSchwinger::operator+=
EvtRaritaSchwinger & operator+=(const EvtRaritaSchwinger &u2)
Definition
EvtRaritaSchwinger.cpp:214
EvtRaritaSchwinger::operator-=
EvtRaritaSchwinger & operator-=(const EvtRaritaSchwinger &u2)
Definition
EvtRaritaSchwinger.cpp:233
EvtRaritaSchwinger::setVector
void setVector(int i, const EvtVector4C &v)
Definition
EvtRaritaSchwinger.cpp:154
EvtRaritaSchwinger::m_rs
EvtComplex m_rs[4][4]
Definition
EvtRaritaSchwinger.hh:89
EvtRaritaSchwinger::EvtRaritaSchwinger
EvtRaritaSchwinger()
Definition
EvtRaritaSchwinger.hh:92
EvtRaritaSchwinger::applyBoostTo
void applyBoostTo(const EvtVector4R p4)
Definition
EvtRaritaSchwinger.cpp:88
EvtRaritaSchwinger::getVector
EvtVector4C getVector(int i) const
Definition
EvtRaritaSchwinger.cpp:141
EvtVector3R
Definition
EvtVector3R.hh:26
EvtVector4C
Definition
EvtVector4C.hh:30
EvtVector4C::applyRotateEuler
void applyRotateEuler(double alpha, double beta, double gamma)
Definition
EvtVector4C.cpp:128
EvtVector4C::get
const EvtComplex & get(int) const
Definition
EvtVector4C.hh:125
EvtVector4C::applyBoostTo
void applyBoostTo(const EvtVector4R &p4)
Definition
EvtVector4C.cpp:69
EvtVector4R
Definition
EvtVector4R.hh:29
EvtVector4R::get
double get(int i) const
Definition
EvtVector4R.hh:163
Generated by
1.17.0