Skip to content

Commit 04ce127

Browse files
authored
Protect MatLut against dZ=0 (#12124)
Co-authored-by: shahoian <ruben.shahoyan@cern.ch>
1 parent f1c8ce7 commit 04ce127

File tree

1 file changed

+2
-2
lines changed
  • Detectors/Base/include/DetectorsBase

1 file changed

+2
-2
lines changed

Detectors/Base/include/DetectorsBase/Ray.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ inline Ray::Ray(const math_utils::Point3D<float> point0, const math_utils::Point
164164
mXDxPlusYDy2 = mXDxPlusYDy * mXDxPlusYDy;
165165
mR02 = point0.Perp2();
166166
mR12 = point1.Perp2();
167-
mInvDz = 1.f / mD[2];
167+
mInvDz = std::abs(mD[2]) > Tiny ? (1.f / mD[2]) : (mD[2] > 0 ? 1.f / Tiny : -1.f / Tiny);
168168
}
169169
#endif // !GPUCA_ALIGPUCODE
170170

@@ -180,7 +180,7 @@ GPUdi() Ray::Ray(float x0, float y0, float z0, float x1, float y1, float z1)
180180
mXDxPlusYDy2 = mXDxPlusYDy * mXDxPlusYDy;
181181
mR02 = x0 * x0 + y0 * y0;
182182
mR12 = x1 * x1 + y1 * y1;
183-
mInvDz = 1.f / mD[2];
183+
mInvDz = std::abs(mD[2]) > Tiny ? (1.f / mD[2]) : (mD[2] > 0 ? 1.f / Tiny : -1.f / Tiny);
184184
}
185185

186186
//______________________________________________________

0 commit comments

Comments
 (0)