diff --git a/BeamFormer.cc b/BeamFormer.cc index 36defdce188db14ee3b43e09e20e1fcf788308c9..f9280888f20040e55133f861dc75e8869904e8cc 100644 --- a/BeamFormer.cc +++ b/BeamFormer.cc @@ -1,10 +1,10 @@ #include "BeamFormer.h" #include "MathUtil.h" +#include "Constants.h" #include <cmath> -constexpr double speed_of_light = 299792458.0; namespace LOFAR { namespace StationResponse { @@ -49,7 +49,7 @@ std::vector<std::complex<double>> BeamFormer::compute_geometric_response(double direction[1] * (antenna->m_phase_reference_position[1] - m_local_phase_reference_position[1]) + direction[2] * (antenna->m_phase_reference_position[2] - m_local_phase_reference_position[2]); - double phase = -2 * M_PI * dl / (speed_of_light / freq); + double phase = -2 * M_PI * dl / (Constants::c / freq); result.push_back({std::sin(phase), std::cos(phase)}); } return result; diff --git a/Constants.h b/Constants.h index 2b086bec246daa585c54758d19277b74e9fae856..738444c6c7853f89bbeaa8ed2fc3e8deba46712b 100644 --- a/Constants.h +++ b/Constants.h @@ -35,15 +35,6 @@ namespace StationResponse /** %Constants used in this library. */ namespace Constants { -/** 2.0 * pi */ -const real_t _2pi = 6.283185307179586476925286; - -/** pi / 2.0 */ -const real_t pi_2 = 1.570796326794896619231322; - -/** pi / 4.0 */ -const real_t pi_4 = 0.7853981633974483096156608; - /** Speed of light (m/s) */ const real_t c = 2.99792458e+08; } //# namespace Constants diff --git a/MathUtil.h b/MathUtil.h index 61db6c2ab459fb49c8b365faf01ecf707b6adedb..1a1e2e318c8e5a02be8cf76debe7e9a39c95b3d2 100644 --- a/MathUtil.h +++ b/MathUtil.h @@ -26,7 +26,6 @@ // \file // Various mathematical operations on vectors and matrices. -#include "Constants.h" #include "Types.h" namespace LOFAR { @@ -57,7 +56,7 @@ inline vector3r_t normalize(const vector3r_t &arg0) inline vector2r_t cart2thetaphi(const vector3r_t &cart) { real_t r = sqrt(cart[0] * cart[0] + cart[1] * cart[1]); - vector2r_t thetaphi = {{Constants::pi_2 - atan2(cart[2], r), atan2(cart[1], + vector2r_t thetaphi = {{M_PI_2 - atan2(cart[2], r), atan2(cart[1], cart[0])}}; return thetaphi; } diff --git a/hamaker/HamakerElementResponse.cc b/hamaker/HamakerElementResponse.cc index 4722517bdc808a210bc2fc065d80d8b7ed9f91a6..eb47fd59e9785c000f50b6e0fab20960de3e2043 100644 --- a/hamaker/HamakerElementResponse.cc +++ b/hamaker/HamakerElementResponse.cc @@ -13,8 +13,6 @@ namespace LOFAR { namespace StationResponse { -// PI / 2.0 -const double pi_2 = 1.570796326794896619231322; std::shared_ptr<HamakerElementResponse> HamakerElementResponse::getInstance(const std::string &name) { @@ -48,9 +46,9 @@ void HamakerElementResponse::response( response[0][1] = 0.0; response[1][0] = 0.0; response[1][1] = 0.0; - + // Clip directions below the horizon. - if(theta >= pi_2) + if(theta >= M_PI_2) { return; } diff --git a/lobes/ElementResponse.cc b/lobes/ElementResponse.cc index a4e4dda3034ef71390a63e66abb54de89feace3e..b2ff653464059aaf4e19a8d5b3b9e8003fa6af18 100644 --- a/lobes/ElementResponse.cc +++ b/lobes/ElementResponse.cc @@ -29,9 +29,6 @@ // them invisible outside this translation unit. namespace { -// PI / 2.0 -const double pi_2 = 1.570796326794896619231322; - #include "DefaultCoeffLBA.cc" #include "DefaultCoeffHBA.cc" } @@ -65,7 +62,7 @@ void element_response(double freq, double theta, double phi, response[1][1] = 0.0; // Clip directions below the horizon. - if(theta >= pi_2) + if(theta >= M_PI_2) { return; }