From e45ef2ba6107b12f0240b79f83ea42f6c1a03dcb Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Mon, 26 Feb 2024 10:33:20 +0100 Subject: [PATCH] Prefer std::abs over abs --- .../src/SimG4MagneticFieldFromMapTool.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/SimG4Components/src/SimG4MagneticFieldFromMapTool.cpp b/SimG4Components/src/SimG4MagneticFieldFromMapTool.cpp index 9f0b5fa..c6b4b3b 100644 --- a/SimG4Components/src/SimG4MagneticFieldFromMapTool.cpp +++ b/SimG4Components/src/SimG4MagneticFieldFromMapTool.cpp @@ -197,26 +197,26 @@ StatusCode SimG4MagneticFieldFromMapTool::loadRootMap() { by *= tesla; bz *= tesla; - if (m_fieldMaxR.value() > 0 && abs(x) > m_fieldMaxR.value()) { + if (m_fieldMaxR.value() > 0 && std::abs(x) > m_fieldMaxR.value()) { continue; } - if (m_fieldMaxR.value() > 0 && abs(y) > m_fieldMaxR.value()) { + if (m_fieldMaxR.value() > 0 && std::abs(y) > m_fieldMaxR.value()) { continue; } - if (m_fieldMaxZ.value() > 0 && abs(z) > m_fieldMaxZ.value()) { + if (m_fieldMaxZ.value() > 0 && std::abs(z) > m_fieldMaxZ.value()) { continue; } double r = std::sqrt(std::pow(x, 2) + std::pow(y, 2)); if (m_addFieldMaxR.value() > 0 && m_addFieldMaxZ.value() > 0) { - if(r < m_addFieldMaxR.value() && abs(z) < m_addFieldMaxZ.value()) { + if(r < m_addFieldMaxR.value() && std::abs(z) < m_addFieldMaxZ.value()) { bz += m_addFieldBz.value(); } } else if (m_addFieldMaxR.value() <= 0 && m_addFieldMaxZ.value() > 0) { - if (abs(z) < m_addFieldMaxZ.value()) { + if (std::abs(z) < m_addFieldMaxZ.value()) { bz += m_addFieldBz.value(); } } else if (m_addFieldMaxR.value() > 0 && m_addFieldMaxZ.value() <= 0) { @@ -312,16 +312,16 @@ StatusCode SimG4MagneticFieldFromMapTool::loadComsolMap() { continue; } - if (m_fieldMaxZ.value() > 0 && abs(z) > m_fieldMaxZ.value()) { + if (m_fieldMaxZ.value() > 0 && std::abs(z) > m_fieldMaxZ.value()) { continue; } if (m_addFieldMaxR.value() > 0 && m_addFieldMaxZ.value() > 0) { - if(r < m_addFieldMaxR.value() && abs(z) < m_addFieldMaxZ.value()) { + if(r < m_addFieldMaxR.value() && std::abs(z) < m_addFieldMaxZ.value()) { Bz += m_addFieldBz.value(); } } else if (m_addFieldMaxR.value() <= 0 && m_addFieldMaxZ.value() > 0) { - if (abs(z) < m_addFieldMaxZ.value()) { + if (std::abs(z) < m_addFieldMaxZ.value()) { Bz += m_addFieldBz.value(); } } else if (m_addFieldMaxR.value() > 0 && m_addFieldMaxZ.value() <= 0) {