#include #include #include "METOOLS/Main/Polarization_Tools.H" #include "ATOOLS/Org/Message.H" #include "ATOOLS/Org/Exception.H" #include "assert.h" #ifndef SQRT_05 #define SQRT_05 0.70710678118654757 #endif #ifndef sqrttwo #define sqrttwo 1.4142135623730950488 #endif using namespace METOOLS; using namespace ATOOLS; using namespace std; Polarization_Vector::Polarization_Vector(Vec4D p, bool anti, bool out) : std::vector() { Init(p); } Polarization_Vector::Polarization_Vector(Vec4D p, double m2, bool anti, bool out) : std::vector() { if(!IsZero((p.Abs2()-m2)/(fabs(p[0])+fabs(m2)), 1e-6)) { PRINT_INFO("Undefined for p.Abs2()="<() { Polarization_Vector eps(p,m2); CMatrix tensor(4); for(int mu = 0; mu < 4; mu++){ for(int nu = 0; nu < 4; nu++){ Complex eps_munu = (eps[0][mu]*eps[0][nu]); tensor[mu][nu] = eps_munu; } } push_back(tensor); for(int mu = 0; mu < 4; mu++){ for(int nu = 0; nu < 4; nu++){ Complex eps_munu = (eps[0][mu]*eps[2][nu]+eps[2][mu]* eps[0][nu])/sqrt(2.0); tensor[mu][nu] = eps_munu; } } push_back(tensor); for(int mu = 0; mu < 4; mu++){ for(int nu = 0; nu < 4; nu++){ Complex eps_munu = (eps[0][mu]*eps[1][nu]+eps[1][mu]* eps[0][nu] -2.0*eps[2][mu]*eps[2][nu])/sqrt(6.0); tensor[mu][nu] = eps_munu; } } push_back(tensor); for(int mu = 0; mu < 4; mu++){ for(int nu = 0; nu < 4; nu++){ Complex eps_munu = (eps[1][mu]*eps[2][nu]+eps[2][mu]* eps[1][nu])/sqrt(2.0); tensor[mu][nu] = eps_munu; } } push_back(tensor); for(int mu = 0; mu < 4; mu++){ for(int nu = 0; nu < 4; nu++){ Complex eps_munu = (eps[1][mu]*eps[1][nu]); tensor[mu][nu] = eps_munu; } } push_back(tensor); } double g(int mu, int nu) { if (mu<0 || mu>3 || nu<0 || nu>3) std::cout<<"wrong indices in g(mu, nu)."<0 && mu<4) return -1.0; return 0.0; } double S(int mu, int nu, Vec4D p) { return p[mu]*p[nu]/p.Abs2()-g(mu, nu); } void Polarization_Vector::Test(Vec4D p) { bool massless(IsZero(p.Mass(),1e-6)); std::cout<> Polarization_Vector::BasisTrafo(const Polarization_Vector& old_basis, bool pol_checks) const { // TODO: Generalization to other particles than massive spin 1 particles // TODO: Avoid matrix formulation int m_nhel = old_basis.size(); vector> coeff(m_nhel, vector(m_nhel, Complex(0, 0))); if (m_nhel != this->size()){ THROW(fatal_error, "polarisation vectors in new and old basis describes particles with different helicity " "degrees of freedom!") } if (m_nhel != 3){ THROW(not_implemented, "basis trafo not implemented for others then massive vector bosons") } std::array, 3> array_old_basis; std::array, 3> array_old_basis_inv; std::array, 3> array_new_basis; // Inverse of matrix of old basis, using explizit form for 3x3 matrix inverse (polarisation components as rows) // determinante of 3*3 matrix (Sarrus rule) Complex det = old_basis[0][1] * old_basis[1][2] * old_basis[2][3] + old_basis[0][2] * old_basis[1][3] * old_basis[2][1] + old_basis[0][3] * old_basis[1][1] * old_basis[2][2] - old_basis[0][3] * old_basis[1][2] * old_basis[2][1] - old_basis[0][1] * old_basis[1][3] * old_basis[2][2] - old_basis[0][2] * old_basis[1][1] * old_basis[2][3]; if (abs(det.real()) < 1e-8 && abs(det.imag()) < 1e-8){ std::cout << "determinante is" << det << std::endl; THROW(fatal_error, "matrix of polarisation vectors in old spin basis is not invertible") } // inverse array_old_basis_inv[0][0]= (Complex(1, 0) / det)*(old_basis[1][2]*old_basis[2][3]-old_basis[1][3]*old_basis[2][2]); array_old_basis_inv[0][1]= (Complex(1, 0) / det)*(old_basis[0][3]*old_basis[2][2]-old_basis[0][2]*old_basis[2][3]); array_old_basis_inv[0][2]= (Complex(1, 0) / det)*(old_basis[0][2]*old_basis[1][3]-old_basis[0][3]*old_basis[1][2]); array_old_basis_inv[1][0]= (Complex(1, 0) / det)*(old_basis[1][3]*old_basis[2][1]-old_basis[1][1]*old_basis[2][3]); array_old_basis_inv[1][1]= (Complex(1, 0) / det)*(old_basis[0][1]*old_basis[2][3]-old_basis[0][3]*old_basis[2][1]); array_old_basis_inv[1][2]= (Complex(1, 0) / det)*(old_basis[0][3]*old_basis[1][1]-old_basis[0][1]*old_basis[1][3]); array_old_basis_inv[2][0]= (Complex(1, 0) / det)*(old_basis[1][1]*old_basis[2][2]-old_basis[1][2]*old_basis[2][1]); array_old_basis_inv[2][1]= (Complex(1, 0) / det)*(old_basis[0][2]*old_basis[2][1]-old_basis[0][1]*old_basis[2][2]); array_old_basis_inv[2][2]= (Complex(1, 0) / det)*(old_basis[0][1]*old_basis[1][2]-old_basis[0][2]*old_basis[1][1]); // formulate polarisation vector in new and old basis as array for easier matrix multiplikation afterwards for (size_t i(0); i1e-8 || abs(test.imag())>1e-8)) || (i!=j && (abs(test.real())>1e-8 || abs(test.imag())>1e-8))){ THROW(fatal_error, "multiplication of matrix and its inverse does not result in identity matrix") } // test, whether transformation also works for the zeroth component of the polarisation vectors zero_comp += coeff[i][j] * old_basis[j][0]; // test system of equation's solution one_comp += coeff[i][j] * old_basis[j][1]; two_comp += coeff[i][j] * old_basis[j][2]; three_comp += coeff[i][j] * old_basis[j][3]; } if (pol_checks) { if (((fabs(zero_comp.real()) > 1e-8 || fabs((*this)[i][0].real()) > 1e-8) && (((*this)[i][0] - zero_comp).real() > fabs(zero_comp.real()) * 1e-8)) || ((fabs(zero_comp.imag()) > 1e-8 || fabs((*this)[i][0].imag()) > 1e-8) && (((*this)[i][0] - zero_comp).imag() > fabs(zero_comp.imag()) * 1e-8))) { std::cout << "Polarization_Warning in " << METHOD << ": Testing polarisation vector transformation's system of equations - " "zeroth component of polarization vector failed..." << std::endl; msg_Out() << "zeroth component of the new polarization vector calculated from linear superposition " << std::setprecision(20) << (*this)[i][0] << std::endl; msg_Out() << "has to be the same as the zeroth component in new " "polarization vector" << std::setprecision(20) << zero_comp << std::endl; } if (((fabs(one_comp.real()) > 1e-8 || fabs((*this)[i][1].real()) > 1e-8) && (((*this)[i][1] - one_comp).real() > fabs(one_comp.real()) * 1e-8)) || ((fabs(one_comp.imag()) > 1e-8 || fabs((*this)[i][1].imag()) > 1e-8) && (((*this)[i][1] - one_comp).imag() > fabs(one_comp.imag()) * 1e-8))) { std::cout << "Polarization_Warning in " << METHOD << ": Testing polarisation vector transformation's system of equations - " "first component of polarization vector failed..." << std::endl; msg_Out() << "first component of the new polarization vector calculated from linear superposition " << std::setprecision(20) << (*this)[i][1] << std::endl; msg_Out() << "has to be the same as the first component in new polarization vector" << std::setprecision(20) << one_comp << std::endl; } if (((fabs(two_comp.real()) > 1e-8 || fabs((*this)[i][2].real()) > 1e-8) && (((*this)[i][2] - two_comp).real() > fabs(two_comp.real()) * 1e-8)) || ((fabs(two_comp.imag()) > 1e-8 || fabs((*this)[i][2].imag()) > 1e-8) && (((*this)[i][2] - two_comp).imag() > fabs(two_comp.imag()) * 1e-8))) { std::cout << "Polarization_Warning in " << METHOD << ": Testing polarisation vector transformation's system of equations - " "second component of polarization vector failed..." << std::endl; msg_Out() << "second component of the new polarization vector calculated from linear superposition " << std::setprecision(20) << (*this)[i][2] << std::endl; msg_Out() << "has to be the same as the second component in new polarization vector" << std::setprecision(20) << two_comp << std::endl; } if (((fabs(three_comp.real()) > 1e-8 || fabs((*this)[i][3].real()) > 1e-8) && (((*this)[i][3] - three_comp).real() > fabs(three_comp.real()) * 1e-8)) || ((fabs(three_comp.imag()) > 1e-8 || fabs((*this)[i][3].imag()) > 1e-8) && (((*this)[i][3] - three_comp).imag() > fabs(three_comp.imag()) * 1e-8))) { std::cout << "Polarization_Warning in " << METHOD << ": Testing polarisation vector transformation's system of equations - " "third component of polarization vector failed... " << std::endl; msg_Out() << "third component of the new polarization vector calculated from linear superposition " << std::setprecision(20) << (*this)[i][3] << std::endl; msg_Out() << "has to be the same as the third component in new polarization vector" << std::setprecision(20) << three_comp << std::endl; } } } // test, whether transformation matrix is unitary if (pol_checks){ for (size_t i(0); i 1e-8 || abs(tmp.imag()) > 1e-8)) || (i!=j && (abs(tmp.real()) > 1e-8 || abs(tmp.imag()) > 1e-8))) { std::cout<<"Polarization_Warning in "<< METHOD << ": Testing unitarity of transformation matrix failed..." << std::endl; msg_Out() << "failed for matrix entry" << i << j << "of unit matrix" << std::endl; msg_Out() << std::setprecision(20) << "actual value of this entry is " << tmp << std::endl; } } } } return coeff; } void Polarization_Tensor::Test(Vec4D p) { bool massless(IsZero(p.Mass(),1e-6)); if (massless) { THROW(not_implemented, "Massless polarisation tensors not implemented."); } bool success = true; std::cout<