(*********************)
(* Basic QFT Objects *)
(* author: M.Gintner *)
   version2 = "Sep 22, 2004";
(*********************)

(* ...Pauli Matrices:                                                *)

     Unit2  = IdentityMatrix[2];
     Sigma1 = {{0,1}, {1,0}};
     Sigma2 = {{0,-I},{I,0}};
     Sigma3 = {{1,0}, {0,-1}};
     SigmaVector = {Sigma1,Sigma2,Sigma3};
     SigmaP = 1/2 (Sigma1 + I Sigma2);
     SigmaM = 1/2 (Sigma1 - I Sigma2);

(* ...3x3 Matrixes:                                                  *)

     Unit3 = IdentityMatrix[3];

(* ...Levi-Civita Totally Antisymmetric Tensor:                      *)

     Epsilon3 = {{{0,0,0},{0,0,1},{0,-1,0}},
	         {{0,0,-1},{0,0,0},{1,0,0}},
		 {{0,1,0},{-1,0,0},{0,0,0}}};

(* ...Dirac Matrices "gamma^mu" (Peskin - Chiral Basis):             *)

     Unit4  = IdentityMatrix[4];
     Gamma0 = {{0,0,1,0}, {0,0,0,1}, {1,0,0,0}, {0,1,0,0}};
     Gamma1 = {{0,0,0,1}, {0,0,1,0}, {0,-1,0,0},{-1,0,0,0}};
     Gamma2 = {{0,0,0,-I},{0,0,I,0}, {0,I,0,0}, {-I,0,0,0}};
     Gamma3 = {{0,0,1,0}, {0,0,0,-1},{-1,0,0,0},{0,1,0,0}};
     Gamma5 = {{-1,0,0,0},{0,-1,0,0},{0,0,1,0}, {0,0,0,1}};

(* ...Projection operators:                                          *)

     PR = 1/2 ( Unit4 + Gamma5 );
     PL = 1/2 ( Unit4 - Gamma5 );

(* ...metric tensor:                                                 *)

     Gmunu  = {{1,0,0,0}, {0,-1,0,0}, {0,0,-1,0}, {0,0,0,-1}};

(* ...Definition of "p-slash = p_mu gamma^mu" as a function:         *)

     Slash[fourvector_] := fourvector.Gmunu.{Gamma0,Gamma1,Gamma2,Gamma3};

(* ...Scalar product of fourvectors:                                 *)

     SP4[fourvector1_,fourvector2_] := fourvector1.Gmunu.fourvector2;

(* ...Definition of (Anti)Commutator:                                *)

     Cmt[matrixA_,matrixB_] := matrixA.matrixB - matrixB.matrixA;
     ACmt[matrixA_,matrixB_] := matrixA.matrixB + matrixB.matrixA;

(* ...unit vector:                                                   *)

     UnitVector[vector_] := Simplify[vector/Sqrt[vector.vector]]

(* ...unit vector defined by spherical coordinates:   *)

     UnitVectorSC[Theta_, Phi_] :=
     {Sin[Theta] Cos[Phi], Sin[Theta] Sin[Phi], Cos[Theta]};

(* ...eigenvectors of "unitvector.SigmaVector" in spherical coordinates:  *)

     Spinor[Theta_, Phi_, spin_] :=
      Which[spin == 1/2,
            {Cos[Theta/2] Exp[-I Phi/2], Sin[Theta/2] Exp[I Phi/2]},
            spin ==-1/2,
            {-Sin[Theta/2] Exp[-I Phi/2],Cos[Theta/2] Exp[I Phi/2]}];

(* ... fermion bispinor in spherical coordinates: *)

     USpinor[energy_, p_, Theta_, Phi_, helicity_] := Module[
     {momunitvector, ksi},
     momunitvector = UnitVectorSC[Theta,Phi];
     Which[helicity == 1/2, ksi = Spinor[Theta, Phi, 1/2],
	   helicity ==-1/2, ksi = Spinor[Theta, Phi,-1/2]];
     Join[(1/2 Sqrt[energy+p](Unit2-momunitvector.SigmaVector) +
           1/2 Sqrt[energy-p](Unit2+momunitvector.SigmaVector)).ksi,
          (1/2 Sqrt[energy+p](Unit2+momunitvector.SigmaVector) +
           1/2 Sqrt[energy-p](Unit2-momunitvector.SigmaVector)).ksi] ];

(* ... antifermion bispinor in spherical coordinates: *)

     VSpinor[energy_, p_, Theta_, Phi_, helicity_] := Module[
     {momunitvector, eta},
     momunitvector = UnitVectorSC[Theta,Phi];
     Which[helicity == 1/2, eta = Spinor[Theta, Phi,-1/2],
	   helicity ==-1/2, eta = Spinor[Theta, Phi, 1/2]];
     Join[(1/2 Sqrt[energy+p](Unit2-momunitvector.SigmaVector) +
           1/2 Sqrt[energy-p](Unit2+momunitvector.SigmaVector)).eta,
         -(1/2 Sqrt[energy+p](Unit2+momunitvector.SigmaVector) +
           1/2 Sqrt[energy-p](Unit2-momunitvector.SigmaVector)).eta] ];

(***********************************)
(* Complex-conjugated expression:  *)

     Star[z_] := ReplaceAll[z,Complex[z1_,z2_]->Complex[z1,-z2]];

(* ...Dirac-conjugated spinor: *)

     Bar[bispinor_] := Star[bispinor].Gamma0;

(* ...a product string of matrices of the form 'A.gamma_mu.B', etc.: *)

     Jmu[x_,y_] := {x.Gamma0.y,x.Gamma1.y,x.Gamma2.y,x.Gamma3.y};
     
     Jmu5[x_,y_] := {x.Gamma0.Gamma5.y,x.Gamma1.Gamma5.y,
                     x.Gamma2.Gamma5.y,x.Gamma3.Gamma5.y};
     
     JmuL[x_,y_] := {x.Gamma0.PL.y,x.Gamma1.PL.y,
                     x.Gamma2.PL.y,x.Gamma3.PL.y};
		    
     JmuR[x_,y_] := {x.Gamma0.PR.y,x.Gamma1.PR.y,
                     x.Gamma2.PR.y,x.Gamma3.PR.y};


(* ...Transverse polarization vectors of photon if                 *)
(* ...momentum of the photon is (-p Sin[Theta], 0, p Cos[Theta])   *)

     EPhoton[Theta_,helicity_] :=
     Which[helicity == 1,
           1/Sqrt[2] {0, Cos[Theta], I, Sin[Theta]},
           helicity ==-1,
           1/Sqrt[2] {0, Cos[Theta],-I, Sin[Theta]}];

(*****************************************)
(* Messages:                             *)

help2 = StringForm["The functions and objects defined in this code:
Unitm, Sigmai, SigmaVector, SigmaP, SigmaM, Epsilon3,
Gammai, PR, PL, Gmunu,
Slash, SP4, Cmt, ACmt, UnitVector, UnitVectorSC,
Spinor, USpinor, VSpinor, Bar, Star, Jmu, Jmu5, JmuL, JmuR, 
EPhoton. To get more information on
a specific function type 'help***' where the stars should be
replaced by the name of the given function."];

helpUnitm = StringForm["Unitm - mxm unit matrix (m=2,3,4)"];

helpSigmai = StringForm["Sigmai - Pauli matrix (i=1,2,3)"];

helpSigmaVector = StringForm["SigmaVector = {Sigma1,Sigma2,Sigma3}"];

helpSigmaP = StringForm["SigmaP - raising matrix"];

helpSigmaM = StringForm["SigmaM - lowering matrix"];

helpEpsilon3 = StringForm["Epsilon3 - 3dim Levi-Civita totally antisymmetric tensor"];

helpGammai = StringForm["Gammai - Dirac matrix (i=0,1,2,3,5)"];

helpPR = StringForm["PR,PL - projection matrices (right,left)"];

helpPL = StringForm["PR,PL - projection matrices (right,left)"];

helpGmunu = StringForm["Gmunu - metric tensor diag(1,-1,-1,-1)"];

helpSlash = StringForm["Slash[fourvector] = fourvector^mu gamma_mu"];

helpSP4 = StringForm["SP4[fourvector1,fourvector2] = fourvector1^mu fourvector2_mu"];

helpCmt = StringForm["Cmt[matrix1,matrix2] - commutator"];

helpACmt = StringForm["ACmt[matrix1,matrix2] - anticommutator"];

helpUnitVector = StringForm["UnitVector[vector] - unit vector of the vector"];

helpUnitVectorSC = StringForm["UnitVectorSC[Theta,Phi] - unit vector in
the direction given by spherical angles 'Theta' and 'Phi'"];

helpSpinor = StringForm["Spinor[Theta,Phi,spin] - spinor corresponding to
the 'spin' (+-1/2) projected to the direction given by the spherical
angles 'Theta' and 'Phi'"];

helpUSpinor = StringForm["USpinor[energy,momentum,Theta,Phi,helicity] - bispinor of
a fermion with 'helicity' (+-1/2) moving in the direction of spherical
coordinates ('Theta','Phi') with 'energy' and 'momentum'"];

helpVSpinor = StringForm["VSpinor[energy,momentum,Theta,Phi,helicity] - bispinor of
an antifermion with 'helicity' (+-1/2) moving in the direction of
spherical coordinates ('Theta','Phi') with 'energy' and 'momentum'"];

helpBar = StringForm["Bar[bispinor] - Dirac conjugated 'bispinor'"];

helpStar = StringForm["Star[z]; gives complex conjugated of z"];

helpJmu = StringForm["Jmu[A,B] - a product string of matrices of the form 'A.gamma_mu.B'"];

helpJmu5 = StringForm["Jmu5[A,B] - a product string of matrices of the form 'A.gamma_mu.gamma5.B'"];

helpJmuL = StringForm["JmuL[A,B] - a product string of matrices of the form 'A.gamma_mu.PL.B'"];

helpJmuR = StringForm["JmuR[A,B] - a product string of matrices of the form 'A.gamma_mu.PR.B'"];

helpEPhoton = StringForm["EPhoton[Theta,helicity] - transverse polarization vector of photon of
a given helicity (+-1) if its momentum is (-p Sin[Theta], 0, p Cos[Theta])"];

StringForm["The 'dirac.m' is a code for the helicity amplitudes
calculation. It enables to construct bispinors and evaluate
the 'sandwich' chains of bispinors and other Dirac algebra objects.
To get a basic information about the usage of the code type 'help2'.
(Version: ``)",version2]


