From e49397d503c67a28c7a8cecf406475db4dddb045 Mon Sep 17 00:00:00 2001 From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu> Date: Thu, 9 Feb 2023 13:52:11 +0100 Subject: [PATCH] skip rotation if particle is already at rest --- corsika/detail/framework/geometry/CoordinateSystem.inl | 8 +++++++- corsika/framework/utility/COMBoost.hpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/corsika/detail/framework/geometry/CoordinateSystem.inl b/corsika/detail/framework/geometry/CoordinateSystem.inl index 12e914ba9..f82975855 100644 --- a/corsika/detail/framework/geometry/CoordinateSystem.inl +++ b/corsika/detail/framework/geometry/CoordinateSystem.inl @@ -81,7 +81,13 @@ namespace corsika { template <typename TDim> inline CoordinateSystemPtr make_rotationToZ(CoordinateSystemPtr const& cs, Vector<TDim> const& vVec) { - auto const a = vVec.normalized().getComponents(cs).getEigenVector(); + auto const vVecComp = vVec.getComponents(cs); + if (vVecComp.getX().magnitude() == 0 && vVecComp.getY().magnitude() == 0 && + vVecComp.getZ().magnitude() == 0) { + return cs; + } + + auto const a = vVecComp.normalized().getEigenVector(); auto const a1 = a(0), a2 = a(1), a3 = a(2); Eigen::Matrix3d A, B; diff --git a/corsika/framework/utility/COMBoost.hpp b/corsika/framework/utility/COMBoost.hpp index 76cbe20d7..f797debd2 100644 --- a/corsika/framework/utility/COMBoost.hpp +++ b/corsika/framework/utility/COMBoost.hpp @@ -86,7 +86,7 @@ namespace corsika { //! internal method void setBoost(double const coshEta, double const sinhEta); - private: + public: Eigen::Matrix2d boost_; Eigen::Matrix2d inverseBoost_; CoordinateSystemPtr const originalCS_; -- GitLab