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
EvtTensor3C.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/EvtTensor3C.hh
"
22
23
#include "
EvtGenBase/EvtComplex.hh
"
24
#include "
EvtGenBase/EvtReport.hh
"
25
#include "
EvtGenBase/EvtVector3C.hh
"
26
27
#include <iostream>
28
#include <math.h>
29
using
std::endl;
30
using
std::ostream;
31
32
EvtTensor3C::EvtTensor3C
(
const
EvtTensor3C
& t1 )
33
{
34
int
i, j;
35
36
for
( i = 0; i < 3; i++ ) {
37
for
( j = 0; j < 3; j++ ) {
38
m_t
[i][j] = t1.
m_t
[i][j];
39
}
40
}
41
}
42
43
EvtTensor3C::EvtTensor3C
(
double
d11,
double
d22,
double
d33 )
44
{
45
int
i, j;
46
47
for
( i = 0; i < 3; i++ ) {
48
for
( j = 0; j < 3; j++ ) {
49
m_t
[i][j] = 0.0;
50
}
51
}
52
53
m_t
[0][0] = d11;
54
m_t
[1][1] = d22;
55
m_t
[2][2] = d33;
56
}
57
58
EvtTensor3C
&
EvtTensor3C::operator=
(
const
EvtTensor3C
& t1 )
59
{
60
int
i, j;
61
62
for
( i = 0; i < 3; i++ ) {
63
for
( j = 0; j < 3; j++ ) {
64
m_t
[i][j] = t1.
m_t
[i][j];
65
}
66
}
67
return
*
this
;
68
}
69
70
EvtTensor3C
EvtTensor3C::conj
()
const
71
{
72
EvtTensor3C
temp;
73
74
int
i, j;
75
76
for
( i = 0; i < 3; i++ ) {
77
for
( j = 0; j < 3; j++ ) {
78
temp.
set
( j, i,
::conj
(
m_t
[i][j] ) );
79
}
80
}
81
return
temp;
82
}
83
84
void
EvtTensor3C::zero
()
85
{
86
int
i, j;
87
for
( i = 0; i < 3; i++ ) {
88
for
( j = 0; j < 3; j++ ) {
89
m_t
[i][j] =
EvtComplex
( 0.0, 0.0 );
90
}
91
}
92
}
93
94
EvtTensor3C::EvtTensor3C
()
95
{
96
int
i, j;
97
98
for
( i = 0; i < 3; i++ ) {
99
for
( j = 0; j < 3; j++ ) {
100
m_t
[i][j] =
EvtComplex
( 0.0, 0.0 );
101
}
102
}
103
}
104
105
EvtTensor3C
EvtTensor3C::operator+=
(
const
EvtTensor3C
& t2 )
106
{
107
int
i, j;
108
109
for
( i = 0; i < 3; i++ ) {
110
for
( j = 0; j < 3; j++ ) {
111
m_t
[i][j] += t2.
m_t
[i][j];
112
}
113
}
114
return
*
this
;
115
}
116
117
EvtTensor3C
EvtTensor3C::operator-=
(
const
EvtTensor3C
& t2 )
118
{
119
int
i, j;
120
121
for
( i = 0; i < 3; i++ ) {
122
for
( j = 0; j < 3; j++ ) {
123
m_t
[i][j] -= t2.
m_t
[i][j];
124
}
125
}
126
return
*
this
;
127
}
128
129
EvtTensor3C
EvtTensor3C::operator*=
(
const
EvtComplex
& c )
130
{
131
int
i, j;
132
133
for
( i = 0; i < 3; i++ ) {
134
for
( j = 0; j < 3; j++ ) {
135
m_t
[i][j] *= c;
136
}
137
}
138
return
*
this
;
139
}
140
141
EvtTensor3C
EvtTensor3C::operator*=
(
const
double
c )
142
{
143
int
i, j;
144
145
for
( i = 0; i < 3; i++ ) {
146
for
( j = 0; j < 3; j++ ) {
147
m_t
[i][j] *=
EvtComplex
( c );
148
}
149
}
150
return
*
this
;
151
}
152
153
EvtTensor3C
EvtGenFunctions::directProd
(
const
EvtVector3C
& c1,
154
const
EvtVector3C
& c2 )
155
{
156
EvtTensor3C
temp;
157
int
i, j;
158
159
for
( i = 0; i < 3; i++ ) {
160
for
( j = 0; j < 3; j++ ) {
161
temp.
set
( i, j, c1.
get
( i ) * c2.
get
( j ) );
162
}
163
}
164
return
temp;
165
}
166
167
EvtTensor3C
EvtGenFunctions::directProd
(
const
EvtVector3C
& c1,
168
const
EvtVector3R
& c2 )
169
{
170
EvtTensor3C
temp;
171
int
i, j;
172
173
for
( i = 0; i < 3; i++ ) {
174
for
( j = 0; j < 3; j++ ) {
175
temp.
set
( i, j, c1.
get
( i ) * c2.
get
( j ) );
176
}
177
}
178
return
temp;
179
}
180
181
EvtTensor3C
EvtGenFunctions::directProd
(
const
EvtVector3R
& c1,
182
const
EvtVector3R
& c2 )
183
{
184
EvtTensor3C
temp;
185
int
i, j;
186
187
for
( i = 0; i < 3; i++ ) {
188
for
( j = 0; j < 3; j++ ) {
189
temp.
m_t
[i][j] =
EvtComplex
( c1.
get
( i ) * c2.
get
( j ), 0.0 );
190
}
191
}
192
return
temp;
193
}
194
195
EvtTensor3C
conj
(
const
EvtTensor3C
& t2 )
196
{
197
EvtTensor3C
temp;
198
199
int
i, j;
200
201
for
( i = 0; i < 3; i++ ) {
202
for
( j = 0; j < 3; j++ ) {
203
temp.
set
( i, j,
::conj
( ( t2.
get
( i, j ) ) ) );
204
}
205
}
206
207
return
temp;
208
}
209
210
EvtTensor3C
cont22
(
const
EvtTensor3C
& t1,
const
EvtTensor3C
& t2 )
211
{
212
EvtTensor3C
temp;
213
214
int
i, j;
215
EvtComplex
c;
216
217
for
( i = 0; i < 3; i++ ) {
218
for
( j = 0; j < 3; j++ ) {
219
c = t1.
get
( i, 0 ) * t2.
get
( j, 0 ) +
220
t1.
get
( i, 1 ) * t2.
get
( j, 1 ) + t1.
get
( i, 2 ) * t2.
get
( j, 2 );
221
temp.
set
( i, j, c );
222
}
223
}
224
225
return
temp;
226
}
227
228
EvtTensor3C
cont11
(
const
EvtTensor3C
& t1,
const
EvtTensor3C
& t2 )
229
{
230
EvtTensor3C
temp;
231
232
int
i, j;
233
EvtComplex
c;
234
235
for
( i = 0; i < 3; i++ ) {
236
for
( j = 0; j < 3; j++ ) {
237
c = t1.
get
( 0, i ) * t2.
get
( 0, j ) +
238
t1.
get
( 1, i ) * t2.
get
( 1, j ) + t1.
get
( 2, i ) * t2.
get
( 2, j );
239
temp.
set
( i, j, c );
240
}
241
}
242
243
return
temp;
244
}
245
246
EvtVector3C
EvtTensor3C::cont1
(
const
EvtVector3C
& v )
const
247
{
248
EvtVector3C
temp;
249
250
int
i;
251
252
for
( i = 0; i < 3; i++ ) {
253
temp.
set
( i,
m_t
[0][i] * v.
get
( 0 ) +
m_t
[1][i] * v.
get
( 1 ) +
254
m_t
[2][i] * v.
get
( 2 ) );
255
}
256
257
return
temp;
258
}
259
260
EvtVector3C
EvtTensor3C::cont2
(
const
EvtVector3C
& v )
const
261
{
262
EvtVector3C
temp;
263
264
int
i;
265
266
for
( i = 0; i < 3; i++ ) {
267
temp.
set
( i,
m_t
[i][0] * v.
get
( 0 ) +
m_t
[i][1] * v.
get
( 1 ) +
268
m_t
[i][2] * v.
get
( 2 ) );
269
}
270
271
return
temp;
272
}
273
274
EvtVector3C
EvtTensor3C::cont1
(
const
EvtVector3R
& v )
const
275
{
276
EvtVector3C
temp;
277
278
int
i;
279
280
for
( i = 0; i < 3; i++ ) {
281
temp.
set
( i,
m_t
[0][i] * v.
get
( 0 ) +
m_t
[1][i] * v.
get
( 1 ) +
282
m_t
[2][i] * v.
get
( 2 ) );
283
}
284
285
return
temp;
286
}
287
288
EvtVector3C
EvtTensor3C::cont2
(
const
EvtVector3R
& v )
const
289
{
290
EvtVector3C
temp;
291
292
int
i;
293
294
for
( i = 0; i < 3; i++ ) {
295
temp.
set
( i,
m_t
[i][0] * v.
get
( 0 ) +
m_t
[i][1] * v.
get
( 1 ) +
296
m_t
[i][2] * v.
get
( 2 ) );
297
}
298
299
return
temp;
300
}
301
302
EvtTensor3C
EvtGenFunctions::eps
(
const
EvtVector3R
& v )
303
{
304
EvtTensor3C
temp;
305
306
temp.
m_t
[0][0] = 0.0;
307
temp.
m_t
[1][1] = 0.0;
308
temp.
m_t
[2][2] = 0.0;
309
310
temp.
m_t
[0][1] = v.
get
( 2 );
311
temp.
m_t
[0][2] = -v.
get
( 1 );
312
313
temp.
m_t
[1][0] = -v.
get
( 2 );
314
temp.
m_t
[1][2] = v.
get
( 0 );
315
316
temp.
m_t
[2][0] = v.
get
( 1 );
317
temp.
m_t
[2][1] = -v.
get
( 0 );
318
319
return
temp;
320
}
321
322
const
EvtTensor3C
&
EvtTensor3C::id
()
323
{
324
static
const
EvtTensor3C
identity( 1.0, 1.0, 1.0 );
325
326
return
identity;
327
}
328
329
ostream&
operator<<
( ostream& s,
const
EvtTensor3C
& v )
330
{
331
s << endl
332
<<
"("
<< v.
m_t
[0][0] <<
","
<< v.
m_t
[0][1] <<
","
<< v.
m_t
[0][2] <<
")"
;
333
s << endl
334
<<
"("
<< v.
m_t
[1][0] <<
","
<< v.
m_t
[1][1] <<
","
<< v.
m_t
[1][2] <<
")"
;
335
s << endl
336
<<
"("
<< v.
m_t
[2][0] <<
","
<< v.
m_t
[2][1] <<
","
<< v.
m_t
[2][2] <<
")"
337
<< endl;
338
339
return
s;
340
}
341
342
EvtTensor3C
EvtGenFunctions::rotateEuler
(
const
EvtTensor3C
& v,
double
alpha,
343
double
beta,
double
gamma )
344
{
345
EvtTensor3C
tmp( v );
346
tmp.
applyRotateEuler
( alpha, beta, gamma );
347
return
tmp;
348
}
349
350
void
EvtTensor3C::applyRotateEuler
(
double
phi,
double
theta,
double
ksi )
351
{
352
EvtComplex
temp[3][3];
353
double
sp, st, sk, cp, ct, ck;
354
double
r[3][3];
355
int
i, j, k;
356
357
sp = sin( phi );
358
st = sin( theta );
359
sk = sin( ksi );
360
cp = cos( phi );
361
ct = cos( theta );
362
ck = cos( ksi );
363
364
r[0][0] = ck * ct * cp - sk * sp;
365
r[0][1] = ck * ct * sp + sk * cp;
366
r[0][2] = -ck * st;
367
368
r[1][0] = -sk * ct * cp - ck * sp;
369
r[1][1] = -sk * ct * sp + ck * cp;
370
r[1][2] = sk * st;
371
372
r[2][0] = st * cp;
373
r[2][1] = st * sp;
374
r[2][2] = ct;
375
376
for
( i = 0; i < 3; i++ ) {
377
for
( j = 0; j < 3; j++ ) {
378
temp[i][j] = 0.0;
379
for
( k = 0; k < 3; k++ ) {
380
temp[i][j] += r[i][k] *
m_t
[k][j];
381
}
382
}
383
}
384
385
for
( i = 0; i < 3; i++ ) {
386
for
( j = 0; j < 3; j++ ) {
387
m_t
[i][j] = 0.0;
388
for
( k = 0; k < 3; k++ ) {
389
m_t
[i][j] += r[i][k] * temp[j][k];
390
}
391
}
392
}
393
}
EvtComplex.hh
EvtReport.hh
conj
EvtTensor3C conj(const EvtTensor3C &t2)
Definition
EvtTensor3C.cpp:195
cont22
EvtTensor3C cont22(const EvtTensor3C &t1, const EvtTensor3C &t2)
Definition
EvtTensor3C.cpp:210
operator<<
ostream & operator<<(ostream &s, const EvtTensor3C &v)
Definition
EvtTensor3C.cpp:329
cont11
EvtTensor3C cont11(const EvtTensor3C &t1, const EvtTensor3C &t2)
Definition
EvtTensor3C.cpp:228
EvtTensor3C.hh
EvtVector3C.hh
EvtComplex
Definition
EvtComplex.hh:29
EvtTensor3C
Definition
EvtTensor3C.hh:42
EvtTensor3C::get
const EvtComplex & get(int i, int j) const
Definition
EvtTensor3C.hh:125
EvtTensor3C::conj
friend EvtTensor3C conj(const EvtTensor3C &t2)
Definition
EvtTensor3C.cpp:195
EvtTensor3C::zero
void zero()
Definition
EvtTensor3C.cpp:84
EvtTensor3C::cont1
EvtVector3C cont1(const EvtVector3C &v) const
Definition
EvtTensor3C.cpp:246
EvtTensor3C::set
void set(int i, int j, const EvtComplex &c)
Definition
EvtTensor3C.hh:120
EvtTensor3C::m_t
EvtComplex m_t[3][3]
Definition
EvtTensor3C.hh:87
EvtTensor3C::EvtTensor3C
EvtTensor3C()
Definition
EvtTensor3C.cpp:94
EvtTensor3C::applyRotateEuler
void applyRotateEuler(double phi, double theta, double ksi)
Definition
EvtTensor3C.cpp:350
EvtTensor3C::cont2
EvtVector3C cont2(const EvtVector3C &v) const
Definition
EvtTensor3C.cpp:260
EvtTensor3C::operator-=
EvtTensor3C operator-=(const EvtTensor3C &t2)
Definition
EvtTensor3C.cpp:117
EvtTensor3C::id
static const EvtTensor3C & id()
Definition
EvtTensor3C.cpp:322
EvtTensor3C::conj
EvtTensor3C conj() const
Definition
EvtTensor3C.cpp:70
EvtTensor3C::operator=
EvtTensor3C & operator=(const EvtTensor3C &t1)
Definition
EvtTensor3C.cpp:58
EvtTensor3C::operator*=
EvtTensor3C operator*=(const double d)
Definition
EvtTensor3C.cpp:141
EvtTensor3C::operator+=
EvtTensor3C operator+=(const EvtTensor3C &t2)
Definition
EvtTensor3C.cpp:105
EvtVector3C
Definition
EvtVector3C.hh:29
EvtVector3C::get
const EvtComplex & get(int) const
Definition
EvtVector3C.hh:99
EvtVector3C::set
void set(const int, const EvtComplex &)
Definition
EvtVector3C.hh:79
EvtVector3R
Definition
EvtVector3R.hh:26
EvtVector3R::get
double get(int i) const
Definition
EvtVector3R.hh:121
EvtGenFunctions::rotateEuler
EvtTensor3C rotateEuler(const EvtTensor3C &v, double phi, double theta, double ksi)
Definition
EvtTensor3C.cpp:342
EvtGenFunctions::eps
EvtTensor3C eps(const EvtVector3R &v)
Definition
EvtTensor3C.cpp:302
EvtGenFunctions::directProd
EvtTensor3C directProd(const EvtVector3C &c1, const EvtVector3C &c2)
Definition
EvtTensor3C.cpp:153
Generated by
1.17.0