From 039aaadd556765b1ea4444b1f42a845fdd2ec41f Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Fri, 21 Apr 2023 18:28:36 +0200
Subject: [PATCH] Geant4InputHandling: protect propertime against negative
 masses

---
 DDG4/src/Geant4InputHandling.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/DDG4/src/Geant4InputHandling.cpp b/DDG4/src/Geant4InputHandling.cpp
index 48e9ceaa0..fdc1468f5 100644
--- a/DDG4/src/Geant4InputHandling.cpp
+++ b/DDG4/src/Geant4InputHandling.cpp
@@ -385,8 +385,8 @@ getRelevant(set<int>& visited,
     double me = en > std::numeric_limits<double>::epsilon() ? p->mass / en : 0.0;
     //  fix by S.Morozov for real != 0
     double proper_time = fabs(dp->time-p->time) * me;
-    double proper_time_Precision = pow(10.,-DBL_DIG)*me*fmax(fabs(p->time),fabs(dp->time));
-    bool isProperTimeZero = (proper_time <= proper_time_Precision);
+    double proper_time_Precision = pow(10.,-DBL_DIG)*fabs(me)*fmax(fabs(p->time),fabs(dp->time));
+    bool isProperTimeZero = (fabs(proper_time) <= fabs(proper_time_Precision));
 
     // -- remove original if ---
     bool rejectParticle = not p.definition()                    // completely unknown to geant4
-- 
GitLab