diff --git a/corsika/detail/framework/geometry/LeapFrogTrajectory.inl b/corsika/detail/framework/geometry/LeapFrogTrajectory.inl index 48ec83a24ee18b7ed51aa26809011be9a600197c..97340351e6b027dc17a8175c2e6337de6691ae79 100644 --- a/corsika/detail/framework/geometry/LeapFrogTrajectory.inl +++ b/corsika/detail/framework/geometry/LeapFrogTrajectory.inl @@ -55,7 +55,7 @@ namespace corsika { } template <typename Particle> - inline TimeType LeapFrogTrajectory::getTime(Particle& particle, double const u) const { + inline TimeType LeapFrogTrajectory::getTime(Particle const& particle, double const u) const { return particle.getTime() + getDuration(u); } diff --git a/corsika/detail/framework/geometry/StraightTrajectory.inl b/corsika/detail/framework/geometry/StraightTrajectory.inl index 9e54467b5aa92588371aa427751dc3405c3a9e1e..55ddbf9e0847450f21f0b5b9178322c7314710f3 100644 --- a/corsika/detail/framework/geometry/StraightTrajectory.inl +++ b/corsika/detail/framework/geometry/StraightTrajectory.inl @@ -24,7 +24,7 @@ namespace corsika { } template <typename Particle> - inline TimeType StraightTrajectory::getTime(Particle& particle, double const u) const { + inline TimeType StraightTrajectory::getTime(Particle const& particle, double const u) const { return particle.getTime() + getDuration(u);//timeStep_ * u; } diff --git a/corsika/framework/geometry/LeapFrogTrajectory.hpp b/corsika/framework/geometry/LeapFrogTrajectory.hpp index 2db3233b8c60a91e9a1e5e29c8e626134476a7b9..984097ac3ab764d3398ae144a7cfd3fccddfe170 100644 --- a/corsika/framework/geometry/LeapFrogTrajectory.hpp +++ b/corsika/framework/geometry/LeapFrogTrajectory.hpp @@ -74,7 +74,7 @@ namespace corsika { ///! time at the start (u=0) or at the end (u=1) of the track of a particle template <typename Particle> - TimeType getTime(Particle& particle, double const u) const; + TimeType getTime(Particle const& particle, double const u) const; ///! total length along potentially bend trajectory LengthType getLength(double const u = 1) const; diff --git a/corsika/framework/geometry/StraightTrajectory.hpp b/corsika/framework/geometry/StraightTrajectory.hpp index 40057258853b1809e6450c196d78cc39c2e826b2..a47da0db5b7adc82281dbd473678c27f38be31b4 100644 --- a/corsika/framework/geometry/StraightTrajectory.hpp +++ b/corsika/framework/geometry/StraightTrajectory.hpp @@ -86,7 +86,7 @@ namespace corsika { ///! time at the start (u=0) or at the end (u=1) of the track of a particle template <typename Particle> - TimeType getTime(Particle& particle, double const u) const; + TimeType getTime(Particle const& particle, double const u) const; ///! total length along potentially bend trajectory LengthType getLength(double const u = 1) const; diff --git a/tests/framework/testGeometry.cpp b/tests/framework/testGeometry.cpp index d688e8d749ce47e0180c61d9c2c56c6f77c86b3f..e78ac878bd8f66b2f15a9f2c9f13b204b5a4badf 100644 --- a/tests/framework/testGeometry.cpp +++ b/tests/framework/testGeometry.cpp @@ -375,7 +375,7 @@ TEST_CASE("Geometry Trajectories") { StraightTrajectory base(line, t); CHECK(line.getPosition(t).getCoordinates() == base.getPosition(1.).getCoordinates()); // test the getTime() method for straight trajectory - CHECK( base.getTime(particle1, 1) / 1_s == Approx(1)); + CHECK(base.getTime(particle1, 1) / 1_s == Approx(1)); CHECK((base.getDirection(0).getComponents(rootCS) - QuantityVector<dimensionless_d>{1, 0, 0}) @@ -442,9 +442,9 @@ TEST_CASE("Geometry Trajectories") { LeapFrogTrajectory base(pos, v0, B0, k, t); // test the getTime() method for trajectories - CHECK( (base.getTime(particle1,1) - t) / 1_s == 0 ); - CHECK( base.getTime(particle1,0) / 1_s == Approx(0) ); - CHECK( (base.getTime(particle1,0) + t) / 1_s == Approx(1e-12) ); + CHECK((base.getTime(particle1,1) - t) / 1_s == Approx(0)); + CHECK(base.getTime(particle1,0) / 1_s == Approx(0)); + CHECK((base.getTime(particle1,0) + t) / 1_s == Approx(1e-12)); } }