BOSS 7.0.1
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//
22#include <iostream>
23#include <math.h>
24#include <assert.h>
31using std::endl;
32using std::ostream;
33
35 int i,j;
36
37 for(i=0;i<4;i++){
38 for(j=0;j<4;j++){
39 gamma[i][j]=EvtComplex(0.0,0.0);
40 }
41 }
42}
43
46 return c*g;
47}
51 int i,j;
52
53 EvtGammaMatrix temp;
54
55 for(i=0;i<4;i++){
56 for(j=0;j<4;j++){
57 temp.gamma[i][j]=g.gamma[i][j]*c;
58 }
59 }
60
61 return temp;
62
63}
64
65
66ostream& operator<<(ostream& s, const EvtGammaMatrix& g){
67
68
69 s<<"["<<g.gamma[0][0]<<","<<g.gamma[0][1]<<","<<g.gamma[0][2]<<","<<g.gamma[0][3]<<"]"<<endl;
70 s<<"["<<g.gamma[1][0]<<","<<g.gamma[1][1]<<","<<g.gamma[1][2]<<","<<g.gamma[1][3]<<"]"<<endl;
71 s<<"["<<g.gamma[2][0]<<","<<g.gamma[2][1]<<","<<g.gamma[2][2]<<","<<g.gamma[2][3]<<"]"<<endl;
72 s<<"["<<g.gamma[3][0]<<","<<g.gamma[3][1]<<","<<g.gamma[3][2]<<","<<g.gamma[3][3]<<"]"<<endl;
73
74 return s;
75
76}
77
78
79
81 int i,j;
82
83 for(i=0;i<4;i++){
84 for(j=0;j<4;j++){
85 gamma[i][j]=gm.gamma[i][j];
86 }
87 }
88}
89
91
93 int i,j;
94
95 for(i=0;i<4;i++){
96 for(j=0;j<4;j++){
97 gamma[i][j]=gm.gamma[i][j];
98 }
99 }
100 return *this;
101}
102
104 int i,j;
105
106 for(i=0;i<4;i++){
107 for(j=0;j<4;j++){
108 gamma[i][j]=EvtComplex(0.0,0.0);
109 }
110 }
111}
112
114
115 static EvtGammaMatrix g;
116 static int first=1;
117
118 if (first){
119 g.gamma[0][0]=EvtComplex(1.0,0.0);
120 g.gamma[0][1]=EvtComplex(0.0,0.0);
121 g.gamma[0][2]=EvtComplex(-1.0,0.0);
122 g.gamma[0][3]=EvtComplex(0.0,0.0);
123 g.gamma[1][0]=EvtComplex(0.0,0.0);
124 g.gamma[1][1]=EvtComplex(1.0,0.0);
125 g.gamma[1][2]=EvtComplex(0.0,0.0);
126 g.gamma[1][3]=EvtComplex(-1.0,0.0);
127 g.gamma[2][0]=EvtComplex(-1.0,0.0);
128 g.gamma[2][1]=EvtComplex(0.0,0.0);
129 g.gamma[2][2]=EvtComplex(1.0,0.0);
130 g.gamma[2][3]=EvtComplex(0.0,0.0);
131 g.gamma[3][0]=EvtComplex(0.0,0.0);
132 g.gamma[3][1]=EvtComplex(-1.0,0.0);
133 g.gamma[3][2]=EvtComplex(0.0,0.0);
134 g.gamma[3][3]=EvtComplex(1.0,0.0);
135 }
136
137 return g;
138
139}
140
141
143
144 static EvtGammaMatrix g;
145 static int first=1;
146
147 if (first){
148 g.gamma[0][0]=EvtComplex(0.0,0.0);
149 g.gamma[0][1]=EvtComplex(-1.0,0.0);
150 g.gamma[0][2]=EvtComplex(0.0,0.0);
151 g.gamma[0][3]=EvtComplex(1.0,0.0);
152 g.gamma[1][0]=EvtComplex(-1.0,0.0);
153 g.gamma[1][1]=EvtComplex(0.0,0.0);
154 g.gamma[1][2]=EvtComplex(1.0,0.0);
155 g.gamma[1][3]=EvtComplex(0.0,0.0);
156 g.gamma[2][0]=EvtComplex(0.0,0.0);
157 g.gamma[2][1]=EvtComplex(1.0,0.0);
158 g.gamma[2][2]=EvtComplex(0.0,0.0);
159 g.gamma[2][3]=EvtComplex(-1.0,0.0);
160 g.gamma[3][0]=EvtComplex(1.0,0.0);
161 g.gamma[3][1]=EvtComplex(0.0,0.0);
162 g.gamma[3][2]=EvtComplex(-1.0,0.0);
163 g.gamma[3][3]=EvtComplex(0.0,0.0);
164 }
165
166 return g;
167
168}
169
170
171
173
174 static EvtGammaMatrix g;
175 static int first=1;
176
177 if (first){
178 g.gamma[0][0]=EvtComplex(0.0,0.0);
179 g.gamma[0][1]=EvtComplex(0.0,1.0);
180 g.gamma[0][2]=EvtComplex(0.0,0.0);
181 g.gamma[0][3]=EvtComplex(0.0,-1.0);
182 g.gamma[1][0]=EvtComplex(0.0,-1.0);
183 g.gamma[1][1]=EvtComplex(0.0,0.0);
184 g.gamma[1][2]=EvtComplex(0.0,1.0);
185 g.gamma[1][3]=EvtComplex(0.0,0.0);
186 g.gamma[2][0]=EvtComplex(0.0,0.0);
187 g.gamma[2][1]=EvtComplex(0.0,-1.0);
188 g.gamma[2][2]=EvtComplex(0.0,0.0);
189 g.gamma[2][3]=EvtComplex(0.0,1.0);
190 g.gamma[3][0]=EvtComplex(0.0,1.0);
191 g.gamma[3][1]=EvtComplex(0.0,0.0);
192 g.gamma[3][2]=EvtComplex(0.0,-1.0);
193 g.gamma[3][3]=EvtComplex(0.0,0.0);
194 }
195
196 return g;
197
198}
199
200
201
202
204
205 static EvtGammaMatrix g;
206 static int first=1;
207
208 if (first){
209 g.gamma[0][0]=EvtComplex(-1.0,0.0);
210 g.gamma[0][1]=EvtComplex(0.0,0.0);
211 g.gamma[0][2]=EvtComplex(1.0,0.0);
212 g.gamma[0][3]=EvtComplex(0.0,0.0);
213 g.gamma[1][0]=EvtComplex(0.0,0.0);
214 g.gamma[1][1]=EvtComplex(1.0,0.0);
215 g.gamma[1][2]=EvtComplex(0.0,0.0);
216 g.gamma[1][3]=EvtComplex(-1.0,0.0);
217 g.gamma[2][0]=EvtComplex(1.0,0.0);
218 g.gamma[2][1]=EvtComplex(0.0,0.0);
219 g.gamma[2][2]=EvtComplex(-1.0,0.0);
220 g.gamma[2][3]=EvtComplex(0.0,0.0);
221 g.gamma[3][0]=EvtComplex(0.0,0.0);
222 g.gamma[3][1]=EvtComplex(-1.0,0.0);
223 g.gamma[3][2]=EvtComplex(0.0,0.0);
224 g.gamma[3][3]=EvtComplex(1.0,0.0);
225 }
226
227 return g;
228
229}
230
231
232
233
234
236
237 static EvtGammaMatrix g;
238 static int first=1;
239
240 if (first){
241
242 first=0;
243
244 int i,j;
245
246 for(i=0;i<4;i++){
247 for(j=0;j<4;j++){
248 g.gamma[i][j]=EvtComplex(0.0,0.0);
249 }
250 }
251
252 g.gamma[0][0]=EvtComplex(1.0,0.0);
253 g.gamma[1][1]=EvtComplex(1.0,0.0);
254 g.gamma[2][2]=EvtComplex(-1.0,0.0);
255 g.gamma[3][3]=EvtComplex(-1.0,0.0);
256 }
257
258 return g;
259
260}
261
262
263
264
266
267 static EvtGammaMatrix g;
268 static int first=1;
269
270 if (first){
271 first=0;
272 int i,j;
273
274 for(i=0;i<4;i++){
275 for(j=0;j<4;j++){
276 g.gamma[i][j]=EvtComplex(0.0,0.0);
277 }
278 }
279
280 g.gamma[0][3]=EvtComplex(1.0,0.0);
281 g.gamma[1][2]=EvtComplex(1.0,0.0);
282 g.gamma[2][1]=EvtComplex(-1.0,0.0);
283 g.gamma[3][0]=EvtComplex(-1.0,0.0);
284 }
285
286 return g;
287
288}
289
290
291
292
294
295 static EvtGammaMatrix g;
296 static int first=1;
297
298 if (first){
299 first=0;
300 int i,j;
301
302 for(i=0;i<4;i++){
303 for(j=0;j<4;j++){
304 g.gamma[i][j]=EvtComplex(0.0,0.0);
305 }
306 }
307
308 g.gamma[0][3]=EvtComplex(0.0,-1.0);
309 g.gamma[1][2]=EvtComplex(0.0,1.0);
310 g.gamma[2][1]=EvtComplex(0.0,1.0);
311 g.gamma[3][0]=EvtComplex(0.0,-1.0);
312 }
313
314 return g;
315
316}
317
318
319
320
321
323
324 static EvtGammaMatrix g;
325 static int first=1;
326
327 if (first){
328 first=0;
329 int i,j;
330
331 for(i=0;i<4;i++){
332 for(j=0;j<4;j++){
333 g.gamma[i][j]=EvtComplex(0.0,0.0);
334 }
335 }
336
337 g.gamma[0][2]=EvtComplex(1.0,0.0);
338 g.gamma[1][3]=EvtComplex(-1.0,0.0);
339 g.gamma[2][0]=EvtComplex(-1.0,0.0);
340 g.gamma[3][1]=EvtComplex(1.0,0.0);
341 }
342
343 return g;
344
345}
346
347
348
349
351
352 static EvtGammaMatrix g;
353 static int first=1;
354
355 if (first){
356
357 int i,j;
358
359 for(i=0;i<4;i++){
360 for(j=0;j<4;j++){
361 g.gamma[i][j]=EvtComplex(0.0,0.0);
362 }
363 }
364
365 g.gamma[0][2]=EvtComplex(1.0,0.0);
366 g.gamma[1][3]=EvtComplex(1.0,0.0);
367 g.gamma[2][0]=EvtComplex(1.0,0.0);
368 g.gamma[3][1]=EvtComplex(1.0,0.0);
369 }
370
371 return g;
372
373}
374
375
376
378
379 static EvtGammaMatrix g;
380 static int first=1;
381
382 if (first){
383
384 int i,j;
385
386 for(i=0;i<4;i++){
387 for(j=0;j<4;j++){
388 g.gamma[i][j]=EvtComplex(0.0,0.0);
389 }
390 }
391
392 g.gamma[0][0]=EvtComplex(1.0,0.0);
393 g.gamma[1][1]=EvtComplex(1.0,0.0);
394 g.gamma[2][2]=EvtComplex(1.0,0.0);
395 g.gamma[3][3]=EvtComplex(1.0,0.0);
396 }
397
398 return g;
399
400}
401
402
403
404
405
407
408 static EvtGammaMatrix g;
409 static int first=1;
410
411 if (first){
412
413 int i,j;
414
415 for(i=0;i<4;i++){
416 for(j=0;j<4;j++){
417 g.gamma[i][j]=EvtComplex(0.0,0.0);
418 }
419 }
420
421 g.gamma[0][3]=EvtComplex(1.0,0.0);
422 g.gamma[1][2]=EvtComplex(1.0,0.0);
423 g.gamma[2][1]=EvtComplex(1.0,0.0);
424 g.gamma[3][0]=EvtComplex(1.0,0.0);
425 }
426
427 return g;
428
429}
430
431
432
433
435
436 static EvtGammaMatrix g;
437 static int first=1;
438
439 if (first){
440
441 int i,j;
442
443 for(i=0;i<4;i++){
444 for(j=0;j<4;j++){
445 g.gamma[i][j]=EvtComplex(0.0,0.0);
446 }
447 }
448
449 g.gamma[0][3]=EvtComplex(0.0,-1.0);
450 g.gamma[1][2]=EvtComplex(0.0,1.0);
451 g.gamma[2][1]=EvtComplex(0.0,-1.0);
452 g.gamma[3][0]=EvtComplex(0.0,1.0);
453 }
454
455 return g;
456
457}
458
459
460
461
463
464 static EvtGammaMatrix g;
465 static int first=1;
466
467 if (first){
468
469 int i,j;
470
471 for(i=0;i<4;i++){
472 for(j=0;j<4;j++){
473 g.gamma[i][j]=EvtComplex(0.0,0.0);
474 }
475 }
476
477 g.gamma[0][2]=EvtComplex(1.0,0.0);
478 g.gamma[1][3]=EvtComplex(-1.0,0.0);
479 g.gamma[2][0]=EvtComplex(1.0,0.0);
480 g.gamma[3][1]=EvtComplex(-1.0,0.0);
481 }
482
483 return g;
484
485}
486
487
488
489
490
492
493 static EvtGammaMatrix g;
494 static int first=1;
495
496 if (first){
497
498 int i,j;
499
500 for(i=0;i<4;i++){
501 for(j=0;j<4;j++){
502 g.gamma[i][j]=EvtComplex(0.0,0.0);
503 }
504 }
505
506 g.gamma[0][0]=EvtComplex(1.0,0.0);
507 g.gamma[1][1]=EvtComplex(1.0,0.0);
508 g.gamma[2][2]=EvtComplex(1.0,0.0);
509 g.gamma[3][3]=EvtComplex(1.0,0.0);
510 }
511
512 return g;
513
514}
515
516
517
518
520
521 int i,j;
522
523 for(i=0;i<4;i++){
524 for(j=0;j<4;j++){
525 gamma[i][j]+=g.gamma[i][j];
526 }
527 }
528 return *this;
529}
530
531
532
533
534
536
537 int i,j;
538
539 for(i=0;i<4;i++){
540 for(j=0;j<4;j++){
541 gamma[i][j]-=g.gamma[i][j];
542 }
543 }
544 return *this;
545}
546
547
548
550
551 int i,j,k;
552 EvtGammaMatrix temp;
553
554 for(i=0;i<4;i++){
555 for(j=0;j<4;j++){
556 temp.gamma[i][j]=EvtComplex(0.0,0.0);
557 for(k=0;k<4;k++){
558 temp.gamma[i][j]+=gamma[i][k]*g.gamma[k][j];
559 }
560 }
561 }
562
563 for(i=0;i<4;i++){
564 for(j=0;j<4;j++){
565 gamma[i][j]=temp.gamma[i][j];
566 }
567 }
568
569 return *this;
570}
571
572
574
575 int i,j;
576 EvtDiracSpinor temp;
577
578 for(i=0;i<4;i++){
579 temp.set_spinor(i,EvtComplex(0.0,0.0));
580 for(j=0;j<4;j++){
581 temp.set_spinor(i,temp.get_spinor(i)+g.gamma[i][j]*d.get_spinor(j));
582 }
583 }
584
585 return temp;
586}
587
588
590
591 int i;
592 EvtComplex temp;
593
594 temp=EvtComplex(0.0,0.0);
595
596 for(i=0;i<4;i++){
597 temp+=::conj(d.get_spinor(i))*dp.get_spinor(i);
598 }
599 return temp;
600}
601
602
603// upper index
604const EvtGammaMatrix& EvtGammaMatrix::sigmaUpper(unsigned int mu, unsigned int nu)
605{
606 EvtGammaMatrix a, b;
607 static const EvtTensor4C eta = EvtTensor4C::g(); //metric
608 static EvtGammaMatrix sigma[4][4];
609 static bool hasBeenCalled = false;
610 if (!hasBeenCalled)
611 {
612 EvtComplex I(0, 1);
613 for (int i=0; i<4; ++i)
614 sigma[i][i].init(); // set to 0
615
616 EvtGammaMatrix s01 = I/2 * (g0()*g1() - g1()*g0());
617 EvtGammaMatrix s02 = I/2 * (g0()*g2() - g2()*g0());
618 EvtGammaMatrix s03 = I/2 * (g0()*g3() - g3()*g0());
619 EvtGammaMatrix s12 = I/2 * (g1()*g2() - g2()*g1());
620 EvtGammaMatrix s13 = I/2 * (g1()*g3() - g3()*g1());
621 EvtGammaMatrix s23 = I/2 * (g2()*g3() - g3()*g2());
622 sigma[0][1] = s01;
623 sigma[1][0] = -1*s01;
624 sigma[0][2] = s02;
625 sigma[2][0] = -1*s02;
626 sigma[0][3] = s03;
627 sigma[3][0] = -1*s03;
628 sigma[1][2] = s12;
629 sigma[2][1] = -1*s12;
630 sigma[1][3] = s13;
631 sigma[3][1] = -1*s13;
632 sigma[2][3] = s23;
633 sigma[3][2] = -1*s23;
634 }
635 hasBeenCalled = true;
636
637 if (mu > 3 || nu > 3)
638 {
639 report(ERROR, "EvtSigmaTensor") << "Expected index between 0 and 3, but found " << nu << "!" << endl;
640 assert(0);
641 }
642 return sigma[mu][nu];
643
644}
645
646const EvtGammaMatrix& EvtGammaMatrix::sigmaLower(unsigned int mu, unsigned int nu)
647{
648 const EvtComplex I(0, 1);
649 EvtGammaMatrix a, b;
650 static EvtGammaMatrix sigma[4][4];
651 static bool hasBeenCalled = false;
652 static const EvtTensor4C eta = EvtTensor4C::g();
653
654 if (!hasBeenCalled) // has to be initialized only at the first call
655 {
656 // lower index
657 for (int i=0; i<4; ++i)
658 {
659 a = eta.get(i, 0)*g0() + eta.get(i, 1)*g1() + eta.get(i, 2)*g2() + eta.get(i, 3)*g3();
660 for (int j=0; j<4; ++j)
661 {
662 b = eta.get(j, 0)*g0() + eta.get(j, 1)*g1() + eta.get(j, 2)*g2() + eta.get(j, 3)*g3();
663 sigma[i][j] = I/2 * (a*b - b*a);
664 }
665 }
666 }
667 return sigma[mu][nu];
668}
669
670
672{
674}
Evt3Rank3C conj(const Evt3Rank3C &t2)
Definition: Evt3Rank3C.cc:175
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:36
@ ERROR
Definition: EvtReport.hh:49
XmlRpcServer s
Definition: HelloServer.cpp:11
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)
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
Definition: EvtTensor4C.hh:126
static const EvtTensor4C & g()
Definition: EvtTensor4C.cc:47
const EvtComplex & get(int) const
Definition: EvtVector4C.hh:131