Skip to content

Commit a89b606

Browse files
committed
Protect agains FPE in getXatLabR, redefine Almost1
1 parent e6404d2 commit a89b606

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Common/Constants/include/CommonConstants/MathConstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace constants
2323
namespace math
2424
{
2525
constexpr float Almost0 = 1.17549e-38;
26-
constexpr float Almost1 = 1.f - Almost0;
26+
constexpr float Almost1 = 1.f - 1.0e-6;
2727
constexpr float VeryBig = 1.f / Almost0;
2828

2929
constexpr float PI = 3.14159274101257324e+00f;

DataFormats/Reconstruction/src/TrackParametrization.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@ GPUd() bool TrackParametrization<value_T>::getXatLabR(value_t r, value_t& x, val
585585
const auto fy = mP[0], sn = mP[2];
586586
const value_t kEps = 1.e-6;
587587
//
588+
if (gpu::CAMath::Abs(getSnp()) > constants::math::Almost1) {
589+
return false;
590+
}
588591
auto crv = getCurvature(bz);
589592
while (gpu::CAMath::Abs(crv) > constants::math::Almost0) { // helix ?
590593
// get center of the track circle

0 commit comments

Comments
 (0)