From de5bfbc57dd34b67efc5ee5405f1a2ce6019da66 Mon Sep 17 00:00:00 2001 From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu> Date: Fri, 3 Jun 2022 16:30:54 +0200 Subject: [PATCH] return references in CoMBoost::getXYCS() --- corsika/detail/framework/utility/COMBoost.inl | 12 +++++++----- corsika/framework/utility/COMBoost.hpp | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/corsika/detail/framework/utility/COMBoost.inl b/corsika/detail/framework/utility/COMBoost.inl index 4905b940b..2664bfa7c 100644 --- a/corsika/detail/framework/utility/COMBoost.inl +++ b/corsika/detail/framework/utility/COMBoost.inl @@ -23,7 +23,7 @@ namespace corsika { HEPMassType const massTarget) : originalCS_{P4projectile.getSpaceLikeComponents().getCoordinateSystem()} , rotatedCS_{make_rotationToZ(originalCS_, P4projectile.getSpaceLikeComponents())} { - auto const pProjectile = P4projectile.getSpaceLikeComponents(); + auto const& pProjectile = P4projectile.getSpaceLikeComponents(); auto const pProjNormSquared = pProjectile.getSquaredNorm(); auto const pProjNorm = sqrt(pProjNormSquared); @@ -82,7 +82,7 @@ namespace corsika { template <typename FourVector> inline FourVector COMBoost::toCoM(FourVector const& p4) const { - auto pComponents = p4.getSpaceLikeComponents().getComponents(rotatedCS_); + auto const pComponents = p4.getSpaceLikeComponents().getComponents(rotatedCS_); Eigen::Vector3d eVecRotated = pComponents.getEigenVector(); Eigen::Vector2d lab; @@ -102,7 +102,7 @@ namespace corsika { template <typename FourVector> inline FourVector COMBoost::fromCoM(FourVector const& p4) const { - auto pCM = p4.getSpaceLikeComponents().getComponents(rotatedCS_); + auto const pCM = p4.getSpaceLikeComponents().getComponents(rotatedCS_); auto const Ecm = p4.getTimeLikeComponent(); Eigen::Vector2d com; @@ -134,8 +134,10 @@ namespace corsika { inverseBoost_ << coshEta, -sinhEta, -sinhEta, coshEta; } - inline CoordinateSystemPtr COMBoost::getRotatedCS() const { return rotatedCS_; } + inline CoordinateSystemPtr const& COMBoost::getRotatedCS() const { return rotatedCS_; } - inline CoordinateSystemPtr COMBoost::getOriginalCS() const { return originalCS_; } + inline CoordinateSystemPtr const& COMBoost::getOriginalCS() const { + return originalCS_; + } } // namespace corsika diff --git a/corsika/framework/utility/COMBoost.hpp b/corsika/framework/utility/COMBoost.hpp index 98be9fc07..508973602 100644 --- a/corsika/framework/utility/COMBoost.hpp +++ b/corsika/framework/utility/COMBoost.hpp @@ -76,10 +76,10 @@ namespace corsika { FourVector fromCoM(FourVector const& p4) const; //! returns the rotated coordinate system: +z is projectile direction - CoordinateSystemPtr getRotatedCS() const; + CoordinateSystemPtr const& getRotatedCS() const; //! returns the original coordinate system of the projectile (lab) - CoordinateSystemPtr getOriginalCS() const; + CoordinateSystemPtr const& getOriginalCS() const; protected: //! internal method @@ -88,7 +88,7 @@ namespace corsika { private: Eigen::Matrix2d boost_; Eigen::Matrix2d inverseBoost_; - CoordinateSystemPtr originalCS_; + CoordinateSystemPtr const originalCS_; CoordinateSystemPtr rotatedCS_; }; } // namespace corsika -- GitLab