LCOV - code coverage report
Current view: top level - TEvtGen/EvtGen/EvtGenBase - EvtGammaMatrix.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 338 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 37 0.0 %

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

Generated by: LCOV version 1.11