From 01e73513a1445cd5dfceff7217b4bcd533b5c655 Mon Sep 17 00:00:00 2001
From: Felix Riehn <felix@matilda>
Date: Thu, 23 Mar 2023 17:39:46 +0000
Subject: [PATCH] fixed threshold calculation in proposal interface (kinetic vs
 total energy)

---
 .../modules/proposal/ContinuousProcess.inl       | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/corsika/detail/modules/proposal/ContinuousProcess.inl b/corsika/detail/modules/proposal/ContinuousProcess.inl
index 6adf0b7f9..f35e1315a 100644
--- a/corsika/detail/modules/proposal/ContinuousProcess.inl
+++ b/corsika/detail/modules/proposal/ContinuousProcess.inl
@@ -137,14 +137,14 @@ namespace corsika::proposal {
     // a hyper parameter which must be adjusted.
     //
     auto const energy = vP.getEnergy();
-    auto const energy_lim =
-        std::max(energy * 0.9, // either 10% relative loss max., or
-                 get_kinetic_energy_propagation_threshold(
-                     code) // energy thresholds globally defined for individual particles
-                     * 0.9999 // need to go slightly below global e-cut to assure removal
-                              // in ParticleCut. This does not matter since at cut-time
-                              // the entire energy is removed.
-        );
+    auto const energy_lim = std::max(
+        energy * 0.9, // either 10% relative loss max., or
+        (get_kinetic_energy_propagation_threshold(code) +
+         get_mass(code)) // energy thresholds globally defined for individual particles
+            * 0.9999     // need to go slightly below global e-cut to assure removal
+                         // in ParticleCut. This does not matter since at cut-time
+                         // the entire energy is removed.
+    );
 
     // solving the track integral for giving energy lim
     auto c = getCalculator(vP, calc);
-- 
GitLab