diff --git a/Helicity/LorentzRank3Tensor.h b/Helicity/LorentzRank3Tensor.h --- a/Helicity/LorentzRank3Tensor.h +++ b/Helicity/LorentzRank3Tensor.h @@ -1,278 +1,278 @@ // -*- C++ -*- // // LorentzRank3Tensor.h is a part of ThePEG - Toolkit for HEP Event Generation // Copyright (C) 2003-2019 Peter Richardson, Leif Lonnblad // // ThePEG is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef ThePEG_LorentzRank3Tensor_H #define ThePEG_LorentzRank3Tensor_H // This is the declaration of the LorentzRank3Tensor class. #include "ThePEG/Config/PhysicalQtyComplex.h" #include "ThePEG/Config/ThePEG.h" #include "LorentzTensor.h" namespace ThePEG { namespace Helicity { // compiler magic needs these pre-declarations to make friend templates work template class LorentzRank3Tensor; /** * The LorentzRank3Tensor class is designed to implement the storage of a * complex tensor to be used to representation the wavefunction of a * spin-2 particle. * * At the moment it only implements the storage of the tensor * components but it is envisaged that it will be extended to include * boost methods etc. * * @author Peter Richardson * */ template class LorentzRank3Tensor { public: /** * Default zero constructor. */ LorentzRank3Tensor() = default; /** * Get components by indices. */ complex operator () (int i, int j, int k) const { assert( i>=0 && i<=3 && j>=0 && j<=3 && k>=0 && k<=3); return _tensor[i][j][k]; } /** * Set components by indices. */ complex & operator () (int i, int j, int k) { assert( i>=0 && i<=3 && j>=0 && j<=3 && k>=0 && k<=3); return _tensor[i][j][k]; } //@} /** @name Transformations. */ //@{ /** * Standard Lorentz boost specifying the components of the beta vector. */ LorentzRank3Tensor & boost(double,double,double); /** * Standard Lorentz boost specifying the beta vector. */ LorentzRank3Tensor & boost(const Boost & b) { return boost(b.x(), b.y(), b.z()); } /** * General Lorentz transformation */ LorentzRank3Tensor & transform(const SpinOneLorentzRotation & r){ unsigned int ix,iy,iz,ixa,iya,iza; LorentzRank3Tensor output; complex temp; for(ix=0;ix<4;++ix) { for(iy=0;iy<4;++iy) { for(iz=0;iz<4;++iz) { output(ix,iy,iz) = complex(); for(ixa=0;ixa<4;++ixa) { for(iya=0;iya<4;++iya) { for(iza=0;iza<4;++iza) output(ix,iy,iz) += r(ix,ixa)*r(iy,iya)*r(iz,iza)*(*this)(ixa,iya,iza); } } } } } *this=output; return *this; } /** * Return the complex conjugate. */ LorentzRank3Tensor conjugate() { LorentzRank3Tensor output; for(unsigned int ix=0;ix<4;++ix) { for(unsigned int iy=0;iy<4;++iy) { for(unsigned int iz=0;iz<4;++iz) { - output(ix,iy,iz) = conj(output(ix,iy,iz)); + output(ix,iy,iz) = conj(_tensor[ix][iy][iz]); } } } return output; } //@} /** @name Arithmetic operators. */ //@{ /** * Scaling with a complex number */ LorentzRank3Tensor operator*=(Complex a) { for(int ix=0;ix<4;++ix) for(int iy=0;iy<4;++iy) for(int iz=0;iz<4;++iz) _tensor[ix][iy][iz]*=a; return *this; } /** * Scalar product with other tensor */ template friend auto operator*(const LorentzRank3Tensor & t, const LorentzRank3Tensor & u) -> decltype(t.xx()*u.xx()); /** * Addition. */ LorentzRank3Tensor operator+(const LorentzRank3Tensor & in) const { LorentzRank3Tensor output; for(int ix=0;ix<4;++ix) for(int iy=0;iy<4;++iy) for(int iz=0;iz<4;++iz) output(ix,iy,iz) = _tensor[ix][iy][iz] + in(ix,iy,iz); } /** * Subtraction. */ LorentzRank3Tensor operator-(const LorentzRank3Tensor & in) const { LorentzRank3Tensor output; for(int ix=0;ix<4;++ix) for(int iy=0;iy<4;++iy) for(int iz=0;iz<4;++iz) output(ix,iy,iz) = _tensor[ix][iy][iz] - in(ix,iy,iz); } /** * Dot product with the ith index */ template auto dot(const LorentzVector > & vec, unsigned int iloc) const -> LorentzTensor { LorentzTensor output; if(iloc==0) { for(unsigned int iy=0;iy<4;++iy) { for(unsigned int iz=0;iz<4;++iz) { output(iy,iz) = vec.t()*_tensor[3][iy][iz] - vec.x()*_tensor[0][iy][iz] - vec.y()*_tensor[1][iy][iz] - vec.z()*_tensor[2][iy][iz]; } } } else if(iloc==1) { for(unsigned int iy=0;iy<4;++iy) { for(unsigned int iz=0;iz<4;++iz) { output(iy,iz) = vec.t()*_tensor[iy][3][iz] - vec.x()*_tensor[iy][0][iz] - vec.y()*_tensor[iy][1][iz] - vec.z()*_tensor[iy][2][iz]; } } } else if(iloc==2) { for(unsigned int iy=0;iy<4;++iy) { for(unsigned int iz=0;iz<4;++iz) { output(iy,iz) = vec.t()*_tensor[iy][iz][3] - vec.x()*_tensor[iy][iz][0] - vec.y()*_tensor[iy][iz][1] - vec.z()*_tensor[iy][iz][2]; } } } else assert(false); return output; } /** * dot product with momentum */ auto dot (const Lorentz5Momentum & vec,unsigned int iloc) const -> LorentzTensor { LorentzTensor output; if(iloc==0) { for(unsigned int iy=0;iy<4;++iy) { for(unsigned int iz=0;iz<4;++iz) { output(iy,iz) = vec.t()*_tensor[3][iy][iz] - vec.x()*_tensor[0][iy][iz] - vec.y()*_tensor[1][iy][iz] - vec.z()*_tensor[2][iy][iz]; } } } else if(iloc==1) { for(unsigned int iy=0;iy<4;++iy) { for(unsigned int iz=0;iz<4;++iz) { output(iy,iz) = vec.t()*_tensor[iy][3][iz] - vec.x()*_tensor[iy][0][iz] - vec.y()*_tensor[iy][1][iz] - vec.z()*_tensor[iy][2][iz]; } } } else if(iloc==2) { for(unsigned int iy=0;iy<4;++iy) { for(unsigned int iz=0;iz<4;++iz) { output(iy,iz) = vec.t()*_tensor[iy][iz][3] - vec.x()*_tensor[iy][iz][0] - vec.y()*_tensor[iy][iz][1] - vec.z()*_tensor[iy][iz][2]; } } } else assert(false); return output; } //@} private: /** * The components. */ std::array,4>,4>,4> _tensor; }; /** * Multiplication by a complex number. */ template inline auto operator*(complex a, const LorentzRank3Tensor & t) -> LorentzRank3Tensor { LorentzRank3Tensor output; for(int ix=0;ix<4;++ix) for(int iy=0;iy<4;++iy) for(int iz=0;iz<4;++iz) output(ix,iy,iz) = a*t(ix,iy,iz); return output; } /** * Multiplication by a complex number. */ template inline auto operator*(const LorentzRank3Tensor & t,complex a) -> LorentzRank3Tensor { LorentzRank3Tensor output; for(int ix=0;ix<4;++ix) for(int iy=0;iy<4;++iy) for(int iz=0;iz<4;++iz) output(ix,iy,iz) = a*t(ix,iy,iz); return output; } } } #ifndef ThePEG_TEMPLATES_IN_CC_FILE #include "LorentzRank3Tensor.tcc" #endif #endif