EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
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
22
26
27#include <iostream>
28#include <math.h>
29using std::endl;
30using std::ostream;
31
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
43EvtTensor3C::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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
323{
324 static const EvtTensor3C identity( 1.0, 1.0, 1.0 );
325
326 return identity;
327}
328
329ostream& 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
343 double beta, double gamma )
344{
345 EvtTensor3C tmp( v );
346 tmp.applyRotateEuler( alpha, beta, gamma );
347 return tmp;
348}
349
350void 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}
EvtTensor3C conj(const EvtTensor3C &t2)
EvtTensor3C cont22(const EvtTensor3C &t1, const EvtTensor3C &t2)
ostream & operator<<(ostream &s, const EvtTensor3C &v)
EvtTensor3C cont11(const EvtTensor3C &t1, const EvtTensor3C &t2)
const EvtComplex & get(int i, int j) const
friend EvtTensor3C conj(const EvtTensor3C &t2)
EvtVector3C cont1(const EvtVector3C &v) const
void set(int i, int j, const EvtComplex &c)
EvtComplex m_t[3][3]
void applyRotateEuler(double phi, double theta, double ksi)
EvtVector3C cont2(const EvtVector3C &v) const
EvtTensor3C operator-=(const EvtTensor3C &t2)
static const EvtTensor3C & id()
EvtTensor3C conj() const
EvtTensor3C & operator=(const EvtTensor3C &t1)
EvtTensor3C operator*=(const double d)
EvtTensor3C operator+=(const EvtTensor3C &t2)
const EvtComplex & get(int) const
void set(const int, const EvtComplex &)
double get(int i) const
EvtTensor3C rotateEuler(const EvtTensor3C &v, double phi, double theta, double ksi)
EvtTensor3C eps(const EvtVector3R &v)
EvtTensor3C directProd(const EvtVector3C &c1, const EvtVector3C &c2)