From 7eec94b0b46a141e5af71fe427ad56ffe261a2ed Mon Sep 17 00:00:00 2001
From: Vakhtang Tsulaia <vakhtang.tsulaia@cern.ch>
Date: Tue, 14 Sep 2021 18:33:48 +0200
Subject: [PATCH] Merge branch 'fix-AFPSOFT-127' into 'master'

fix FPE in AFP monitoring

Closes AFPSOFT-127

See merge request atlas/athena!46463

(cherry picked from commit 909b82c9ffdc80eb142f518dac0271b4fd48d04d)

721103c0 fix FPE
---
 ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPFastReco.cxx | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPFastReco.cxx b/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPFastReco.cxx
index 9234e1c3a024..504c4198efc2 100644
--- a/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPFastReco.cxx
+++ b/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPFastReco.cxx
@@ -115,6 +115,7 @@ std::pair<double, double> AFPFastReco::linReg(std::vector<std::pair<double, doub
 		denumerator += dx * dx;
 	}
 
+	if(denumerator==0.0) denumerator=1e-6;
 	const double slope    = numerator / denumerator;
 	const double position = meany - slope * meanx;
 
-- 
GitLab