BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtGammaMatrix.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/COPYRIGHT
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Module: EvtGammaMatrix.cc
12//
13// Description: Make gamma matrices availible for the calc. of amplitudes, etc.
14//
15// Modification history:
16//
17// DJL/RYD September 25, 1996 Module created
18//
19//------------------------------------------------------------------------
20//
21#include "EvtGammaMatrix.hh"
22#include "EvtComplex.hh"
23#include "EvtDiracSpinor.hh"
24#include "EvtPatches.hh"
25#include "EvtReport.hh"
26#include "EvtTensor4C.hh"
27#include "EvtVector4C.hh"
28#include <assert.h>
29#include <iostream>
30#include <math.h>
31using std::endl;
32using std::ostream;
33
35 int i, j;
36
37 for ( i = 0; i < 4; i++ )
38 {
39 for ( j = 0; j < 4; j++ ) { gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
40 }
41}
42
43EvtGammaMatrix operator*( const EvtGammaMatrix& g, const EvtComplex& c ) { return c * g; }
44
46 int i, j;
47
50 for ( i = 0; i < 4; i++ )
51 {
52 for ( j = 0; j < 4; j++ ) { temp.gamma[i][j] = g.gamma[i][j] * c; }
53 }
54
55 return temp;
56}
57
58ostream& operator<<( ostream& s, const EvtGammaMatrix& g ) {
59
60 s << "[" << g.gamma[0][0] << "," << g.gamma[0][1] << "," << g.gamma[0][2] << ","
61 << g.gamma[0][3] << "]" << endl;
62 s << "[" << g.gamma[1][0] << "," << g.gamma[1][1] << "," << g.gamma[1][2] << ","
63 << g.gamma[1][3] << "]" << endl;
64 s << "[" << g.gamma[2][0] << "," << g.gamma[2][1] << "," << g.gamma[2][2] << ","
65 << g.gamma[2][3] << "]" << endl;
66 s << "[" << g.gamma[3][0] << "," << g.gamma[3][1] << "," << g.gamma[3][2] << ","
67 << g.gamma[3][3] << "]" << endl;
68
69 return s;
70}
71
73 int i, j;
74
75 for ( i = 0; i < 4; i++ )
76 {
77 for ( j = 0; j < 4; j++ ) { gamma[i][j] = gm.gamma[i][j]; }
78 }
79}
80
82
84 int i, j;
85
86 for ( i = 0; i < 4; i++ )
87 {
88 for ( j = 0; j < 4; j++ ) { gamma[i][j] = gm.gamma[i][j]; }
89 }
90 return *this;
91}
92
94 int i, j;
95
96 for ( i = 0; i < 4; i++ )
97 {
98 for ( j = 0; j < 4; j++ ) { gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
99 }
100}
101
103
104 static EvtGammaMatrix g;
105 static int first = 1;
106
107 if ( first )
108 {
109 g.gamma[0][0] = EvtComplex( 1.0, 0.0 );
110 g.gamma[0][1] = EvtComplex( 0.0, 0.0 );
111 g.gamma[0][2] = EvtComplex( -1.0, 0.0 );
112 g.gamma[0][3] = EvtComplex( 0.0, 0.0 );
113 g.gamma[1][0] = EvtComplex( 0.0, 0.0 );
114 g.gamma[1][1] = EvtComplex( 1.0, 0.0 );
115 g.gamma[1][2] = EvtComplex( 0.0, 0.0 );
116 g.gamma[1][3] = EvtComplex( -1.0, 0.0 );
117 g.gamma[2][0] = EvtComplex( -1.0, 0.0 );
118 g.gamma[2][1] = EvtComplex( 0.0, 0.0 );
119 g.gamma[2][2] = EvtComplex( 1.0, 0.0 );
120 g.gamma[2][3] = EvtComplex( 0.0, 0.0 );
121 g.gamma[3][0] = EvtComplex( 0.0, 0.0 );
122 g.gamma[3][1] = EvtComplex( -1.0, 0.0 );
123 g.gamma[3][2] = EvtComplex( 0.0, 0.0 );
124 g.gamma[3][3] = EvtComplex( 1.0, 0.0 );
125 }
126
127 return g;
128}
129
131
132 static EvtGammaMatrix g;
133 static int first = 1;
134
135 if ( first )
136 {
137 g.gamma[0][0] = EvtComplex( 0.0, 0.0 );
138 g.gamma[0][1] = EvtComplex( -1.0, 0.0 );
139 g.gamma[0][2] = EvtComplex( 0.0, 0.0 );
140 g.gamma[0][3] = EvtComplex( 1.0, 0.0 );
141 g.gamma[1][0] = EvtComplex( -1.0, 0.0 );
142 g.gamma[1][1] = EvtComplex( 0.0, 0.0 );
143 g.gamma[1][2] = EvtComplex( 1.0, 0.0 );
144 g.gamma[1][3] = EvtComplex( 0.0, 0.0 );
145 g.gamma[2][0] = EvtComplex( 0.0, 0.0 );
146 g.gamma[2][1] = EvtComplex( 1.0, 0.0 );
147 g.gamma[2][2] = EvtComplex( 0.0, 0.0 );
148 g.gamma[2][3] = EvtComplex( -1.0, 0.0 );
149 g.gamma[3][0] = EvtComplex( 1.0, 0.0 );
150 g.gamma[3][1] = EvtComplex( 0.0, 0.0 );
151 g.gamma[3][2] = EvtComplex( -1.0, 0.0 );
152 g.gamma[3][3] = EvtComplex( 0.0, 0.0 );
153 }
154
155 return g;
156}
157
159
160 static EvtGammaMatrix g;
161 static int first = 1;
162
163 if ( first )
164 {
165 g.gamma[0][0] = EvtComplex( 0.0, 0.0 );
166 g.gamma[0][1] = EvtComplex( 0.0, 1.0 );
167 g.gamma[0][2] = EvtComplex( 0.0, 0.0 );
168 g.gamma[0][3] = EvtComplex( 0.0, -1.0 );
169 g.gamma[1][0] = EvtComplex( 0.0, -1.0 );
170 g.gamma[1][1] = EvtComplex( 0.0, 0.0 );
171 g.gamma[1][2] = EvtComplex( 0.0, 1.0 );
172 g.gamma[1][3] = EvtComplex( 0.0, 0.0 );
173 g.gamma[2][0] = EvtComplex( 0.0, 0.0 );
174 g.gamma[2][1] = EvtComplex( 0.0, -1.0 );
175 g.gamma[2][2] = EvtComplex( 0.0, 0.0 );
176 g.gamma[2][3] = EvtComplex( 0.0, 1.0 );
177 g.gamma[3][0] = EvtComplex( 0.0, 1.0 );
178 g.gamma[3][1] = EvtComplex( 0.0, 0.0 );
179 g.gamma[3][2] = EvtComplex( 0.0, -1.0 );
180 g.gamma[3][3] = EvtComplex( 0.0, 0.0 );
181 }
182
183 return g;
184}
185
187
188 static EvtGammaMatrix g;
189 static int first = 1;
190
191 if ( first )
192 {
193 g.gamma[0][0] = EvtComplex( -1.0, 0.0 );
194 g.gamma[0][1] = EvtComplex( 0.0, 0.0 );
195 g.gamma[0][2] = EvtComplex( 1.0, 0.0 );
196 g.gamma[0][3] = EvtComplex( 0.0, 0.0 );
197 g.gamma[1][0] = EvtComplex( 0.0, 0.0 );
198 g.gamma[1][1] = EvtComplex( 1.0, 0.0 );
199 g.gamma[1][2] = EvtComplex( 0.0, 0.0 );
200 g.gamma[1][3] = EvtComplex( -1.0, 0.0 );
201 g.gamma[2][0] = EvtComplex( 1.0, 0.0 );
202 g.gamma[2][1] = EvtComplex( 0.0, 0.0 );
203 g.gamma[2][2] = EvtComplex( -1.0, 0.0 );
204 g.gamma[2][3] = EvtComplex( 0.0, 0.0 );
205 g.gamma[3][0] = EvtComplex( 0.0, 0.0 );
206 g.gamma[3][1] = EvtComplex( -1.0, 0.0 );
207 g.gamma[3][2] = EvtComplex( 0.0, 0.0 );
208 g.gamma[3][3] = EvtComplex( 1.0, 0.0 );
209 }
210
211 return g;
212}
213
215
216 static EvtGammaMatrix g;
217 static int first = 1;
218
219 if ( first )
220 {
221
222 first = 0;
223
224 int i, j;
225
226 for ( i = 0; i < 4; i++ )
227 {
228 for ( j = 0; j < 4; j++ ) { g.gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
229 }
230
231 g.gamma[0][0] = EvtComplex( 1.0, 0.0 );
232 g.gamma[1][1] = EvtComplex( 1.0, 0.0 );
233 g.gamma[2][2] = EvtComplex( -1.0, 0.0 );
234 g.gamma[3][3] = EvtComplex( -1.0, 0.0 );
235 }
236
237 return g;
238}
239
241
242 static EvtGammaMatrix g;
243 static int first = 1;
244
245 if ( first )
246 {
247 first = 0;
248 int i, j;
249
250 for ( i = 0; i < 4; i++ )
251 {
252 for ( j = 0; j < 4; j++ ) { g.gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
253 }
254
255 g.gamma[0][3] = EvtComplex( 1.0, 0.0 );
256 g.gamma[1][2] = EvtComplex( 1.0, 0.0 );
257 g.gamma[2][1] = EvtComplex( -1.0, 0.0 );
258 g.gamma[3][0] = EvtComplex( -1.0, 0.0 );
259 }
260
261 return g;
262}
263
265
266 static EvtGammaMatrix g;
267 static int first = 1;
268
269 if ( first )
270 {
271 first = 0;
272 int i, j;
273
274 for ( i = 0; i < 4; i++ )
275 {
276 for ( j = 0; j < 4; j++ ) { g.gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
277 }
278
279 g.gamma[0][3] = EvtComplex( 0.0, -1.0 );
280 g.gamma[1][2] = EvtComplex( 0.0, 1.0 );
281 g.gamma[2][1] = EvtComplex( 0.0, 1.0 );
282 g.gamma[3][0] = EvtComplex( 0.0, -1.0 );
283 }
284
285 return g;
286}
287
289
290 static EvtGammaMatrix g;
291 static int first = 1;
292
293 if ( first )
294 {
295 first = 0;
296 int i, j;
297
298 for ( i = 0; i < 4; i++ )
299 {
300 for ( j = 0; j < 4; j++ ) { g.gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
301 }
302
303 g.gamma[0][2] = EvtComplex( 1.0, 0.0 );
304 g.gamma[1][3] = EvtComplex( -1.0, 0.0 );
305 g.gamma[2][0] = EvtComplex( -1.0, 0.0 );
306 g.gamma[3][1] = EvtComplex( 1.0, 0.0 );
307 }
308
309 return g;
310}
311
313
314 static EvtGammaMatrix g;
315 static int first = 1;
316
317 if ( first )
318 {
319
320 int i, j;
321
322 for ( i = 0; i < 4; i++ )
323 {
324 for ( j = 0; j < 4; j++ ) { g.gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
325 }
326
327 g.gamma[0][2] = EvtComplex( 1.0, 0.0 );
328 g.gamma[1][3] = EvtComplex( 1.0, 0.0 );
329 g.gamma[2][0] = EvtComplex( 1.0, 0.0 );
330 g.gamma[3][1] = EvtComplex( 1.0, 0.0 );
331 }
332
333 return g;
334}
335
337
338 static EvtGammaMatrix g;
339 static int first = 1;
340
341 if ( first )
342 {
343
344 int i, j;
345
346 for ( i = 0; i < 4; i++ )
347 {
348 for ( j = 0; j < 4; j++ ) { g.gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
349 }
350
351 g.gamma[0][0] = EvtComplex( 1.0, 0.0 );
352 g.gamma[1][1] = EvtComplex( 1.0, 0.0 );
353 g.gamma[2][2] = EvtComplex( 1.0, 0.0 );
354 g.gamma[3][3] = EvtComplex( 1.0, 0.0 );
355 }
356
357 return g;
358}
359
361
362 static EvtGammaMatrix g;
363 static int first = 1;
364
365 if ( first )
366 {
367
368 int i, j;
369
370 for ( i = 0; i < 4; i++ )
371 {
372 for ( j = 0; j < 4; j++ ) { g.gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
373 }
374
375 g.gamma[0][3] = EvtComplex( 1.0, 0.0 );
376 g.gamma[1][2] = EvtComplex( 1.0, 0.0 );
377 g.gamma[2][1] = EvtComplex( 1.0, 0.0 );
378 g.gamma[3][0] = EvtComplex( 1.0, 0.0 );
379 }
380
381 return g;
382}
383
385
386 static EvtGammaMatrix g;
387 static int first = 1;
388
389 if ( first )
390 {
391
392 int i, j;
393
394 for ( i = 0; i < 4; i++ )
395 {
396 for ( j = 0; j < 4; j++ ) { g.gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
397 }
398
399 g.gamma[0][3] = EvtComplex( 0.0, -1.0 );
400 g.gamma[1][2] = EvtComplex( 0.0, 1.0 );
401 g.gamma[2][1] = EvtComplex( 0.0, -1.0 );
402 g.gamma[3][0] = EvtComplex( 0.0, 1.0 );
403 }
404
405 return g;
406}
407
409
410 static EvtGammaMatrix g;
411 static int first = 1;
412
413 if ( first )
414 {
415
416 int i, j;
417
418 for ( i = 0; i < 4; i++ )
419 {
420 for ( j = 0; j < 4; j++ ) { g.gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
421 }
422
423 g.gamma[0][2] = EvtComplex( 1.0, 0.0 );
424 g.gamma[1][3] = EvtComplex( -1.0, 0.0 );
425 g.gamma[2][0] = EvtComplex( 1.0, 0.0 );
426 g.gamma[3][1] = EvtComplex( -1.0, 0.0 );
427 }
428
429 return g;
430}
431
433
434 static EvtGammaMatrix g;
435 static int first = 1;
436
437 if ( first )
438 {
439
440 int i, j;
441
442 for ( i = 0; i < 4; i++ )
443 {
444 for ( j = 0; j < 4; j++ ) { g.gamma[i][j] = EvtComplex( 0.0, 0.0 ); }
445 }
446
447 g.gamma[0][0] = EvtComplex( 1.0, 0.0 );
448 g.gamma[1][1] = EvtComplex( 1.0, 0.0 );
449 g.gamma[2][2] = EvtComplex( 1.0, 0.0 );
450 g.gamma[3][3] = EvtComplex( 1.0, 0.0 );
451 }
452
453 return g;
454}
455
457
458 int i, j;
459
460 for ( i = 0; i < 4; i++ )
461 {
462 for ( j = 0; j < 4; j++ ) { gamma[i][j] += g.gamma[i][j]; }
463 }
464 return *this;
465}
466
468
469 int i, j;
470
471 for ( i = 0; i < 4; i++ )
472 {
473 for ( j = 0; j < 4; j++ ) { gamma[i][j] -= g.gamma[i][j]; }
474 }
475 return *this;
476}
477
479
480 int i, j, k;
481 EvtGammaMatrix temp;
482
483 for ( i = 0; i < 4; i++ )
484 {
485 for ( j = 0; j < 4; j++ )
486 {
487 temp.gamma[i][j] = EvtComplex( 0.0, 0.0 );
488 for ( k = 0; k < 4; k++ ) { temp.gamma[i][j] += gamma[i][k] * g.gamma[k][j]; }
489 }
490 }
491
492 for ( i = 0; i < 4; i++ )
493 {
494 for ( j = 0; j < 4; j++ ) { gamma[i][j] = temp.gamma[i][j]; }
495 }
496
497 return *this;
498}
499
501
502 int i, j;
503 EvtDiracSpinor temp;
504
505 for ( i = 0; i < 4; i++ )
506 {
507 temp.set_spinor( i, EvtComplex( 0.0, 0.0 ) );
508 for ( j = 0; j < 4; j++ )
509 { temp.set_spinor( i, temp.get_spinor( i ) + g.gamma[i][j] * d.get_spinor( j ) ); }
510 }
511
512 return temp;
513}
514
516
517 int i;
518 EvtComplex temp;
519
520 temp = EvtComplex( 0.0, 0.0 );
521
522 for ( i = 0; i < 4; i++ ) { temp += ::conj( d.get_spinor( i ) ) * dp.get_spinor( i ); }
523 return temp;
524}
525
526// upper index
527const EvtGammaMatrix& EvtGammaMatrix::sigmaUpper( unsigned int mu, unsigned int nu ) {
528 EvtGammaMatrix a, b;
529 static const EvtTensor4C eta = EvtTensor4C::g(); // metric
530 static EvtGammaMatrix sigma[4][4];
531 static bool hasBeenCalled = false;
532 if ( !hasBeenCalled )
533 {
534 EvtComplex I( 0, 1 );
535 for ( int i = 0; i < 4; ++i ) sigma[i][i].init(); // set to 0
536
537 EvtGammaMatrix s01 = I / 2 * ( g0() * g1() - g1() * g0() );
538 EvtGammaMatrix s02 = I / 2 * ( g0() * g2() - g2() * g0() );
539 EvtGammaMatrix s03 = I / 2 * ( g0() * g3() - g3() * g0() );
540 EvtGammaMatrix s12 = I / 2 * ( g1() * g2() - g2() * g1() );
541 EvtGammaMatrix s13 = I / 2 * ( g1() * g3() - g3() * g1() );
542 EvtGammaMatrix s23 = I / 2 * ( g2() * g3() - g3() * g2() );
543 sigma[0][1] = s01;
544 sigma[1][0] = -1 * s01;
545 sigma[0][2] = s02;
546 sigma[2][0] = -1 * s02;
547 sigma[0][3] = s03;
548 sigma[3][0] = -1 * s03;
549 sigma[1][2] = s12;
550 sigma[2][1] = -1 * s12;
551 sigma[1][3] = s13;
552 sigma[3][1] = -1 * s13;
553 sigma[2][3] = s23;
554 sigma[3][2] = -1 * s23;
555 }
556 hasBeenCalled = true;
557
558 if ( mu > 3 || nu > 3 )
559 {
560 report( ERROR, "EvtSigmaTensor" )
561 << "Expected index between 0 and 3, but found " << nu << "!" << endl;
562 assert( 0 );
563 }
564 return sigma[mu][nu];
565}
566
567const EvtGammaMatrix& EvtGammaMatrix::sigmaLower( unsigned int mu, unsigned int nu ) {
568 const EvtComplex I( 0, 1 );
569 EvtGammaMatrix a, b;
570 static EvtGammaMatrix sigma[4][4];
571 static bool hasBeenCalled = false;
572 static const EvtTensor4C eta = EvtTensor4C::g();
573
574 if ( !hasBeenCalled ) // has to be initialized only at the first call
575 {
576 // lower index
577 for ( int i = 0; i < 4; ++i )
578 {
579 a = eta.get( i, 0 ) * g0() + eta.get( i, 1 ) * g1() + eta.get( i, 2 ) * g2() +
580 eta.get( i, 3 ) * g3();
581 for ( int j = 0; j < 4; ++j )
582 {
583 b = eta.get( j, 0 ) * g0() + eta.get( j, 1 ) * g1() + eta.get( j, 2 ) * g2() +
584 eta.get( j, 3 ) * g3();
585 sigma[i][j] = I / 2 * ( a * b - b * a );
586 }
587 }
588 }
589 return sigma[mu][nu];
590}
591
593 return EvtGammaMatrix::g0() * p.get( 0 ) + EvtGammaMatrix::g1() * p.get( 1 ) +
594 EvtGammaMatrix::g2() * p.get( 2 ) + EvtGammaMatrix::g3() * p.get( 3 );
595}
Evt3Rank3C conj(const Evt3Rank3C &t2)
ostream & operator<<(ostream &s, const EvtGammaMatrix &g)
EvtGammaMatrix operator*(const EvtGammaMatrix &g, const EvtComplex &c)
EvtGammaMatrix slash(const EvtVector4C &p)
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49
XmlRpcServer s
const DifComplex I
const EvtComplex & get_spinor(int i) const
void set_spinor(int i, const EvtComplex &sp)
virtual ~EvtGammaMatrix()
static const EvtGammaMatrix & sigmaLower(unsigned int mu, unsigned int nu)
friend EvtGammaMatrix operator*(const EvtComplex &c, const EvtGammaMatrix &g)
static const EvtGammaMatrix & va1()
static const EvtGammaMatrix & v0()
static const EvtGammaMatrix & id()
static const EvtGammaMatrix & sigmaUpper(unsigned int mu, unsigned int nu)
static const EvtGammaMatrix & g0()
static const EvtGammaMatrix & g2()
EvtGammaMatrix & operator-=(const EvtGammaMatrix &g)
static const EvtGammaMatrix & g1()
static const EvtGammaMatrix & va3()
static const EvtGammaMatrix & g3()
static const EvtGammaMatrix & v2()
static const EvtGammaMatrix & va0()
static const EvtGammaMatrix & va2()
static const EvtGammaMatrix & g5()
static const EvtGammaMatrix & v1()
static const EvtGammaMatrix & v3()
EvtGammaMatrix & operator*=(const EvtGammaMatrix &g)
EvtGammaMatrix & operator=(const EvtGammaMatrix &gm)
EvtGammaMatrix & operator+=(const EvtGammaMatrix &g)
const EvtComplex & get(int i, int j) const
static const EvtTensor4C & g()
const EvtComplex & get(int) const