From 717f915eb12edb947ec3777c6ccb6552d6ea3b7e Mon Sep 17 00:00:00 2001
From: Marilena Bandieramonte <mbandier@pitt-buildnode-01.dyndns.cern.ch>
Date: Thu, 7 Mar 2024 18:27:53 +0100
Subject: [PATCH] Temporary fix to G4GenericTrap distanceToIn and distanceToOut
 methods

---
 source/geometry/solids/specific/src/G4GenericTrap.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/source/geometry/solids/specific/src/G4GenericTrap.cc b/source/geometry/solids/specific/src/G4GenericTrap.cc
index ccc3bbab54..d5768eaae9 100644
--- a/source/geometry/solids/specific/src/G4GenericTrap.cc
+++ b/source/geometry/solids/specific/src/G4GenericTrap.cc
@@ -807,7 +807,10 @@ G4double G4GenericTrap::DistanceToIn(const G4ThreeVector& p) const
     return fTessellatedSolid->DistanceToIn(p);
   }  
 #endif
- 
+  //MB: temporary hack to return a very conservative value of zero to avoid errors in the computation of the safety
+  //
+  return 0.;
+  //
   G4double safz = std::fabs(p.z())-fDz;
   if(safz<0) { safz=0; }
 
@@ -913,7 +916,10 @@ G4double G4GenericTrap::DistanceToOut(const G4ThreeVector& p,
     return fTessellatedSolid->DistanceToOut(p, v, calcNorm, validNorm, n);
   }
 #endif
-
+  //MB: temporary hack to return a very conservative value of zero to avoid errors in the computation of the safety
+  //  
+  return 0.;
+  //      
   G4double distmin;
   G4bool lateral_cross = false;
   ESide side = kUndef;
-- 
GitLab