From a2dcee96ebc33107816b02fb142807eea4474f97 Mon Sep 17 00:00:00 2001 From: John Kenneth Anders <john.kenneth.anders@cern.ch> Date: Mon, 18 Mar 2019 12:34:36 +0000 Subject: [PATCH] Merge branch 'PRW_fixPrecisionProblem' into '21.0' Add protection for rounding errors See merge request atlas/athena!21963 (cherry picked from commit ebf2f6fcf56371a5434f16d258abdad08b1a2dda) 8adaa12a Add protection for rounding errors --- .../SimuJobTransforms/python/SimBeamSpotShapeFilter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Simulation/SimuJobTransforms/python/SimBeamSpotShapeFilter.py b/Simulation/SimuJobTransforms/python/SimBeamSpotShapeFilter.py index f03aae2d750..dd1e2b11c45 100644 --- a/Simulation/SimuJobTransforms/python/SimBeamSpotShapeFilter.py +++ b/Simulation/SimuJobTransforms/python/SimBeamSpotShapeFilter.py @@ -79,8 +79,11 @@ class SimBeamSpotShapeFilter( PyAthena.AthFilterAlgorithm ): # Calculate the prob a event falling in the window given the original and target widths def calcScale(self, sigmaO, sigmaT, x): + #if the beamspot are the same to 1 nm don't reweight + if math.fabs( sigmaO - sigmaT ) < 1e-6: + return 1. if sigmaO < sigmaT: - self.msg.error( 'This will not work target width larger than original width: %f < %f' %(sigmaO, sigmaT) ) + self.msg.error( 'This will not work target width larger than original width: %f < %f ' %(sigmaO, sigmaT) ) return 1. value = math.exp( -0.5*(x*x)*(1./(sigmaT*sigmaT) - 1./(sigmaO*sigmaO))) #print 'Targetn Original Prob ',x, ' ', sigmaT, ' ', sigmaO, ' ', value -- GitLab