evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
EvtGammaMatrix.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 
23 #include "EvtGenBase/EvtComplex.hh"
25 #include "EvtGenBase/EvtPatches.hh"
26 #include "EvtGenBase/EvtReport.hh"
29 
30 #include <assert.h>
31 #include <iostream>
32 #include <math.h>
33 #include <stdlib.h>
34 using std::endl;
35 using std::ostream;
36 
38 {
39  int i, j;
40 
41  static EvtComplex zero( 0.0, 0.0 );
42 
43  for ( i = 0; i < 4; i++ ) {
44  for ( j = 0; j < 4; j++ ) {
45  _gamma[i][j] = zero;
46  }
47  }
48 }
49 
51 {
52  return c * g;
53 }
54 
56 {
57  int i, j;
58 
59  EvtGammaMatrix temp;
60 
61  for ( i = 0; i < 4; i++ ) {
62  for ( j = 0; j < 4; j++ ) {
63  temp._gamma[i][j] = g._gamma[i][j] * c;
64  }
65  }
66 
67  return temp;
68 }
69 
70 ostream& operator<<( ostream& s, const EvtGammaMatrix& g )
71 {
72  s << "[" << g._gamma[0][0] << "," << g._gamma[0][1] << "," << g._gamma[0][2]
73  << "," << g._gamma[0][3] << "]" << endl;
74  s << "[" << g._gamma[1][0] << "," << g._gamma[1][1] << "," << g._gamma[1][2]
75  << "," << g._gamma[1][3] << "]" << endl;
76  s << "[" << g._gamma[2][0] << "," << g._gamma[2][1] << "," << g._gamma[2][2]
77  << "," << g._gamma[2][3] << "]" << endl;
78  s << "[" << g._gamma[3][0] << "," << g._gamma[3][1] << "," << g._gamma[3][2]
79  << "," << g._gamma[3][3] << "]" << endl;
80 
81  return s;
82 }
83 
85 {
86  int i, j;
87 
88  for ( i = 0; i < 4; i++ ) {
89  for ( j = 0; j < 4; j++ ) {
90  _gamma[i][j] = gm._gamma[i][j];
91  }
92  }
93 }
94 
96 {
97  int i, j;
98 
99  for ( i = 0; i < 4; i++ ) {
100  for ( j = 0; j < 4; j++ ) {
101  _gamma[i][j] = gm._gamma[i][j];
102  }
103  }
104  return *this;
105 }
106 
108 {
109  int i, j;
110 
111  static EvtComplex zero( 0.0, 0.0 );
112 
113  for ( i = 0; i < 4; i++ ) {
114  for ( j = 0; j < 4; j++ ) {
115  _gamma[i][j] = zero;
116  }
117  }
118 }
119 
121 {
122  static EvtGammaMatrix g;
123  static int first = 1;
124 
125  if ( first ) {
126  first = 0;
127  g._gamma[0][0] = EvtComplex( 1.0, 0.0 );
128  g._gamma[0][1] = EvtComplex( 0.0, 0.0 );
129  g._gamma[0][2] = EvtComplex( -1.0, 0.0 );
130  g._gamma[0][3] = EvtComplex( 0.0, 0.0 );
131  g._gamma[1][0] = EvtComplex( 0.0, 0.0 );
132  g._gamma[1][1] = EvtComplex( 1.0, 0.0 );
133  g._gamma[1][2] = EvtComplex( 0.0, 0.0 );
134  g._gamma[1][3] = EvtComplex( -1.0, 0.0 );
135  g._gamma[2][0] = EvtComplex( -1.0, 0.0 );
136  g._gamma[2][1] = EvtComplex( 0.0, 0.0 );
137  g._gamma[2][2] = EvtComplex( 1.0, 0.0 );
138  g._gamma[2][3] = EvtComplex( 0.0, 0.0 );
139  g._gamma[3][0] = EvtComplex( 0.0, 0.0 );
140  g._gamma[3][1] = EvtComplex( -1.0, 0.0 );
141  g._gamma[3][2] = EvtComplex( 0.0, 0.0 );
142  g._gamma[3][3] = EvtComplex( 1.0, 0.0 );
143  }
144 
145  return g;
146 }
147 
149 {
150  static EvtGammaMatrix g;
151  static int first = 1;
152 
153  if ( first ) {
154  first = 0;
155  g._gamma[0][0] = EvtComplex( 0.0, 0.0 );
156  g._gamma[0][1] = EvtComplex( -1.0, 0.0 );
157  g._gamma[0][2] = EvtComplex( 0.0, 0.0 );
158  g._gamma[0][3] = EvtComplex( 1.0, 0.0 );
159  g._gamma[1][0] = EvtComplex( -1.0, 0.0 );
160  g._gamma[1][1] = EvtComplex( 0.0, 0.0 );
161  g._gamma[1][2] = EvtComplex( 1.0, 0.0 );
162  g._gamma[1][3] = EvtComplex( 0.0, 0.0 );
163  g._gamma[2][0] = EvtComplex( 0.0, 0.0 );
164  g._gamma[2][1] = EvtComplex( 1.0, 0.0 );
165  g._gamma[2][2] = EvtComplex( 0.0, 0.0 );
166  g._gamma[2][3] = EvtComplex( -1.0, 0.0 );
167  g._gamma[3][0] = EvtComplex( 1.0, 0.0 );
168  g._gamma[3][1] = EvtComplex( 0.0, 0.0 );
169  g._gamma[3][2] = EvtComplex( -1.0, 0.0 );
170  g._gamma[3][3] = EvtComplex( 0.0, 0.0 );
171  }
172 
173  return g;
174 }
175 
177 {
178  static EvtGammaMatrix g;
179  static int first = 1;
180 
181  if ( first ) {
182  first = 0;
183  g._gamma[0][0] = EvtComplex( 0.0, 0.0 );
184  g._gamma[0][1] = EvtComplex( 0.0, 1.0 );
185  g._gamma[0][2] = EvtComplex( 0.0, 0.0 );
186  g._gamma[0][3] = EvtComplex( 0.0, -1.0 );
187  g._gamma[1][0] = EvtComplex( 0.0, -1.0 );
188  g._gamma[1][1] = EvtComplex( 0.0, 0.0 );
189  g._gamma[1][2] = EvtComplex( 0.0, 1.0 );
190  g._gamma[1][3] = EvtComplex( 0.0, 0.0 );
191  g._gamma[2][0] = EvtComplex( 0.0, 0.0 );
192  g._gamma[2][1] = EvtComplex( 0.0, -1.0 );
193  g._gamma[2][2] = EvtComplex( 0.0, 0.0 );
194  g._gamma[2][3] = EvtComplex( 0.0, 1.0 );
195  g._gamma[3][0] = EvtComplex( 0.0, 1.0 );
196  g._gamma[3][1] = EvtComplex( 0.0, 0.0 );
197  g._gamma[3][2] = EvtComplex( 0.0, -1.0 );
198  g._gamma[3][3] = EvtComplex( 0.0, 0.0 );
199  }
200 
201  return g;
202 }
203 
205 {
206  static EvtGammaMatrix g;
207  static int first = 1;
208 
209  if ( first ) {
210  first = 0;
211  g._gamma[0][0] = EvtComplex( -1.0, 0.0 );
212  g._gamma[0][1] = EvtComplex( 0.0, 0.0 );
213  g._gamma[0][2] = EvtComplex( 1.0, 0.0 );
214  g._gamma[0][3] = EvtComplex( 0.0, 0.0 );
215  g._gamma[1][0] = EvtComplex( 0.0, 0.0 );
216  g._gamma[1][1] = EvtComplex( 1.0, 0.0 );
217  g._gamma[1][2] = EvtComplex( 0.0, 0.0 );
218  g._gamma[1][3] = EvtComplex( -1.0, 0.0 );
219  g._gamma[2][0] = EvtComplex( 1.0, 0.0 );
220  g._gamma[2][1] = EvtComplex( 0.0, 0.0 );
221  g._gamma[2][2] = EvtComplex( -1.0, 0.0 );
222  g._gamma[2][3] = EvtComplex( 0.0, 0.0 );
223  g._gamma[3][0] = EvtComplex( 0.0, 0.0 );
224  g._gamma[3][1] = EvtComplex( -1.0, 0.0 );
225  g._gamma[3][2] = EvtComplex( 0.0, 0.0 );
226  g._gamma[3][3] = EvtComplex( 1.0, 0.0 );
227  }
228 
229  return g;
230 }
231 
233 {
234  static EvtGammaMatrix g;
235  static int first = 1;
236 
237  if ( first ) {
238  first = 0;
239 
240  int i, j;
241 
242  for ( i = 0; i < 4; i++ ) {
243  for ( j = 0; j < 4; j++ ) {
244  g._gamma[i][j] = EvtComplex( 0.0, 0.0 );
245  }
246  }
247 
248  g._gamma[0][0] = EvtComplex( 1.0, 0.0 );
249  g._gamma[1][1] = EvtComplex( 1.0, 0.0 );
250  g._gamma[2][2] = EvtComplex( -1.0, 0.0 );
251  g._gamma[3][3] = EvtComplex( -1.0, 0.0 );
252  }
253 
254  return g;
255 }
256 
258 {
259  static EvtGammaMatrix g;
260  static int first = 1;
261 
262  if ( first ) {
263  first = 0;
264  int i, j;
265 
266  for ( i = 0; i < 4; i++ ) {
267  for ( j = 0; j < 4; j++ ) {
268  g._gamma[i][j] = EvtComplex( 0.0, 0.0 );
269  }
270  }
271 
272  g._gamma[0][3] = EvtComplex( 1.0, 0.0 );
273  g._gamma[1][2] = EvtComplex( 1.0, 0.0 );
274  g._gamma[2][1] = EvtComplex( -1.0, 0.0 );
275  g._gamma[3][0] = EvtComplex( -1.0, 0.0 );
276  }
277 
278  return g;
279 }
280 
282 {
283  static EvtGammaMatrix g;
284  static int first = 1;
285 
286  if ( first ) {
287  first = 0;
288  int i, j;
289 
290  for ( i = 0; i < 4; i++ ) {
291  for ( j = 0; j < 4; j++ ) {
292  g._gamma[i][j] = EvtComplex( 0.0, 0.0 );
293  }
294  }
295 
296  g._gamma[0][3] = EvtComplex( 0.0, -1.0 );
297  g._gamma[1][2] = EvtComplex( 0.0, 1.0 );
298  g._gamma[2][1] = EvtComplex( 0.0, 1.0 );
299  g._gamma[3][0] = EvtComplex( 0.0, -1.0 );
300  }
301 
302  return g;
303 }
304 
306 {
307  static EvtGammaMatrix g;
308  static int first = 1;
309 
310  if ( first ) {
311  first = 0;
312  int i, j;
313 
314  for ( i = 0; i < 4; i++ ) {
315  for ( j = 0; j < 4; j++ ) {
316  g._gamma[i][j] = EvtComplex( 0.0, 0.0 );
317  }
318  }
319 
320  g._gamma[0][2] = EvtComplex( 1.0, 0.0 );
321  g._gamma[1][3] = EvtComplex( -1.0, 0.0 );
322  g._gamma[2][0] = EvtComplex( -1.0, 0.0 );
323  g._gamma[3][1] = EvtComplex( 1.0, 0.0 );
324  }
325 
326  return g;
327 }
328 
330 {
331  static EvtGammaMatrix g;
332  static int first = 1;
333 
334  if ( first ) {
335  first = 0;
336  int i, j;
337 
338  for ( i = 0; i < 4; i++ ) {
339  for ( j = 0; j < 4; j++ ) {
340  g._gamma[i][j] = EvtComplex( 0.0, 0.0 );
341  }
342  }
343 
344  g._gamma[0][2] = EvtComplex( 1.0, 0.0 );
345  g._gamma[1][3] = EvtComplex( 1.0, 0.0 );
346  g._gamma[2][0] = EvtComplex( 1.0, 0.0 );
347  g._gamma[3][1] = EvtComplex( 1.0, 0.0 );
348  }
349 
350  return g;
351 }
352 
354 {
355  switch ( index ) {
356  case 0:
357  return g0();
358  case 1:
359  return g1();
360  case 2:
361  return g2();
362  case 3:
363  return g3();
364  case 5:
365  return g5();
366  default:
367  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
368  << "Invalid index for four vector: " << index << endl;
369  exit( -2 );
370  }
371 }
372 
374 {
375  static EvtGammaMatrix g;
376  static int first = 1;
377 
378  if ( first ) {
379  first = 0;
380  int i, j;
381 
382  for ( i = 0; i < 4; i++ ) {
383  for ( j = 0; j < 4; j++ ) {
384  g._gamma[i][j] = EvtComplex( 0.0, 0.0 );
385  }
386  }
387 
388  g._gamma[0][0] = EvtComplex( 1.0, 0.0 );
389  g._gamma[1][1] = EvtComplex( 1.0, 0.0 );
390  g._gamma[2][2] = EvtComplex( 1.0, 0.0 );
391  g._gamma[3][3] = EvtComplex( 1.0, 0.0 );
392  }
393 
394  return g;
395 }
396 
398 {
399  static EvtGammaMatrix g;
400  static int first = 1;
401 
402  if ( first ) {
403  first = 0;
404  int i, j;
405 
406  for ( i = 0; i < 4; i++ ) {
407  for ( j = 0; j < 4; j++ ) {
408  g._gamma[i][j] = EvtComplex( 0.0, 0.0 );
409  }
410  }
411 
412  g._gamma[0][3] = EvtComplex( 1.0, 0.0 );
413  g._gamma[1][2] = EvtComplex( 1.0, 0.0 );
414  g._gamma[2][1] = EvtComplex( 1.0, 0.0 );
415  g._gamma[3][0] = EvtComplex( 1.0, 0.0 );
416  }
417 
418  return g;
419 }
420 
422 {
423  static EvtGammaMatrix g;
424  static int first = 1;
425 
426  if ( first ) {
427  first = 0;
428  int i, j;
429 
430  for ( i = 0; i < 4; i++ ) {
431  for ( j = 0; j < 4; j++ ) {
432  g._gamma[i][j] = EvtComplex( 0.0, 0.0 );
433  }
434  }
435 
436  g._gamma[0][3] = EvtComplex( 0.0, -1.0 );
437  g._gamma[1][2] = EvtComplex( 0.0, 1.0 );
438  g._gamma[2][1] = EvtComplex( 0.0, -1.0 );
439  g._gamma[3][0] = EvtComplex( 0.0, 1.0 );
440  }
441 
442  return g;
443 }
444 
446 {
447  static EvtGammaMatrix g;
448  static int first = 1;
449 
450  if ( first ) {
451  first = 0;
452  int i, j;
453 
454  for ( i = 0; i < 4; i++ ) {
455  for ( j = 0; j < 4; j++ ) {
456  g._gamma[i][j] = EvtComplex( 0.0, 0.0 );
457  }
458  }
459 
460  g._gamma[0][2] = EvtComplex( 1.0, 0.0 );
461  g._gamma[1][3] = EvtComplex( -1.0, 0.0 );
462  g._gamma[2][0] = EvtComplex( 1.0, 0.0 );
463  g._gamma[3][1] = EvtComplex( -1.0, 0.0 );
464  }
465 
466  return g;
467 }
468 
470 {
471  static EvtGammaMatrix g;
472  static int first = 1;
473 
474  if ( first ) {
475  first = 0;
476  int i, j;
477 
478  for ( i = 0; i < 4; i++ ) {
479  for ( j = 0; j < 4; j++ ) {
480  g._gamma[i][j] = EvtComplex( 0.0, 0.0 );
481  }
482  }
483 
484  g._gamma[0][0] = EvtComplex( 1.0, 0.0 );
485  g._gamma[1][1] = EvtComplex( 1.0, 0.0 );
486  g._gamma[2][2] = EvtComplex( 1.0, 0.0 );
487  g._gamma[3][3] = EvtComplex( 1.0, 0.0 );
488  }
489 
490  return g;
491 }
492 
494 {
495  int i, j;
496 
497  for ( i = 0; i < 4; i++ ) {
498  for ( j = 0; j < 4; j++ ) {
499  _gamma[i][j] += g._gamma[i][j];
500  }
501  }
502  return *this;
503 }
504 
506 {
507  int i, j;
508 
509  for ( i = 0; i < 4; i++ ) {
510  for ( j = 0; j < 4; j++ ) {
511  _gamma[i][j] -= g._gamma[i][j];
512  }
513  }
514  return *this;
515 }
516 
518 {
519  int i, j, k;
520  EvtGammaMatrix temp;
521 
522  for ( i = 0; i < 4; i++ ) {
523  for ( j = 0; j < 4; j++ ) {
524  temp._gamma[i][j] = EvtComplex( 0.0, 0.0 );
525  for ( k = 0; k < 4; k++ ) {
526  temp._gamma[i][j] += _gamma[i][k] * g._gamma[k][j];
527  }
528  }
529  }
530 
531  for ( i = 0; i < 4; i++ ) {
532  for ( j = 0; j < 4; j++ ) {
533  _gamma[i][j] = temp._gamma[i][j];
534  }
535  }
536 
537  return *this;
538 }
539 
541 {
542  int i, j;
543  EvtDiracSpinor temp;
544 
545  for ( i = 0; i < 4; i++ ) {
546  temp.set_spinor( i, EvtComplex( 0.0, 0.0 ) );
547  for ( j = 0; j < 4; j++ ) {
548  temp.set_spinor( i, temp.get_spinor( i ) +
549  g._gamma[i][j] * d.get_spinor( j ) );
550  }
551  }
552 
553  return temp;
554 }
555 
556 // upper index
558  unsigned int nu )
559 {
560  static EvtGammaMatrix sigma[4][4];
561  static bool hasBeenCalled = false;
562  if ( !hasBeenCalled ) {
563  EvtComplex I( 0, 1 );
564  for ( int i = 0; i < 4; ++i )
565  sigma[i][i].init(); // set to 0
566 
567  EvtGammaMatrix s01 = I / 2 * ( g0() * g1() - g1() * g0() );
568  EvtGammaMatrix s02 = I / 2 * ( g0() * g2() - g2() * g0() );
569  EvtGammaMatrix s03 = I / 2 * ( g0() * g3() - g3() * g0() );
570  EvtGammaMatrix s12 = I / 2 * ( g1() * g2() - g2() * g1() );
571  EvtGammaMatrix s13 = I / 2 * ( g1() * g3() - g3() * g1() );
572  EvtGammaMatrix s23 = I / 2 * ( g2() * g3() - g3() * g2() );
573  sigma[0][1] = s01;
574  sigma[1][0] = -1 * s01;
575  sigma[0][2] = s02;
576  sigma[2][0] = -1 * s02;
577  sigma[0][3] = s03;
578  sigma[3][0] = -1 * s03;
579  sigma[1][2] = s12;
580  sigma[2][1] = -1 * s12;
581  sigma[1][3] = s13;
582  sigma[3][1] = -1 * s13;
583  sigma[2][3] = s23;
584  sigma[3][2] = -1 * s23;
585  }
586  hasBeenCalled = true;
587 
588  if ( mu > 3 || nu > 3 ) {
589  EvtGenReport( EVTGEN_ERROR, "EvtSigmaTensor" )
590  << "Expected index between 0 and 3, but found " << nu << "!" << endl;
591  assert( 0 );
592  }
593  return sigma[mu][nu];
594 }
595 
597  unsigned int nu )
598 {
599  const EvtComplex I( 0, 1 );
600  EvtGammaMatrix a, b;
601  static EvtGammaMatrix sigma[4][4];
602  static bool hasBeenCalled = false;
603  static const EvtTensor4C eta = EvtTensor4C::g();
604 
605  if ( !hasBeenCalled ) // has to be initialized only at the first call
606  {
607  // lower index
608  for ( int i = 0; i < 4; ++i ) {
609  a = eta.get( i, 0 ) * g0() + eta.get( i, 1 ) * g1() +
610  eta.get( i, 2 ) * g2() + eta.get( i, 3 ) * g3();
611  for ( int j = 0; j < 4; ++j ) {
612  b = eta.get( j, 0 ) * g0() + eta.get( j, 1 ) * g1() +
613  eta.get( j, 2 ) * g2() + eta.get( j, 3 ) * g3();
614  sigma[i][j] = I / 2 * ( a * b - b * a );
615  }
616  }
617  }
618  return sigma[mu][nu];
619 }
620 
622 {
623  return EvtGammaMatrix::g0() * p.get( 0 ) + EvtGammaMatrix::g1() * p.get( 1 ) +
624  EvtGammaMatrix::g2() * p.get( 2 ) + EvtGammaMatrix::g3() * p.get( 3 );
625 }
626 
628 {
629  return EvtGammaMatrix::g0() * p.get( 0 ) + EvtGammaMatrix::g1() * p.get( 1 ) +
630  EvtGammaMatrix::g2() * p.get( 2 ) + EvtGammaMatrix::g3() * p.get( 3 );
631 }
static const EvtGammaMatrix & va1()
EvtGammaMatrix & operator+=(const EvtGammaMatrix &g)
EvtGammaMatrix slash(const EvtVector4C &p)
EvtGammaMatrix & operator-=(const EvtGammaMatrix &g)
static const EvtTensor4C & g()
Definition: EvtTensor4C.cpp:44
static const EvtGammaMatrix & v3()
static const EvtGammaMatrix & g0()
static const EvtGammaMatrix & va2()
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=0)
Definition: EvtReport.cpp:33
static const EvtGammaMatrix & v2()
EvtGammaMatrix & operator *=(const EvtGammaMatrix &g)
static const EvtGammaMatrix & v0()
EvtComplex _gamma[4][4]
static const EvtGammaMatrix & sigmaLower(unsigned int mu, unsigned int nu)
void set_spinor(int i, const EvtComplex &sp)
static const EvtGammaMatrix & g(int)
static const EvtGammaMatrix & g1()
double get(int i) const
Definition: EvtVector4R.hh:162
static const EvtGammaMatrix & g2()
static const EvtGammaMatrix & va3()
EvtGammaMatrix & operator=(const EvtGammaMatrix &gm)
static const EvtGammaMatrix & g3()
EvtGammaMatrix operator *(const EvtGammaMatrix &g, const EvtComplex &c)
static const EvtGammaMatrix & va0()
const EvtComplex & get(int) const
Definition: EvtVector4C.hh:125
static const EvtGammaMatrix & id()
const EvtComplex & get_spinor(int i) const
static const EvtGammaMatrix & sigmaUpper(unsigned int mu, unsigned int nu)
static int first
Definition: EvtPDL.cpp:38
const EvtComplex I
Definition: EvtBsMuMuKK.cpp:38
static const EvtGammaMatrix & v1()
const EvtComplex & get(int i, int j) const
Definition: EvtTensor4C.hh:112
ostream & operator<<(ostream &s, const EvtGammaMatrix &g)
static const EvtGammaMatrix & g5()