From 9444e1803e307671ac49e5e12f3682db36c015b5 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Wed, 18 Dec 2024 13:46:37 -0800 Subject: [PATCH] Started removal of kVerticalModuleSlope --- RecoTracker/LSTCore/src/alpaka/MiniDoublet.h | 8 +++++--- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 10 ++++++---- RecoTracker/LSTCore/src/alpaka/Segment.h | 4 +++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h index 80c7f6227e0cd..73dc7051fd93c 100644 --- a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h +++ b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h @@ -2,6 +2,7 @@ #define RecoTracker_LSTCore_src_alpaka_MiniDoublet_h #include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h" +#include "FWCore/Utilities/interface/isFinite.h" #include "RecoTracker/LSTCore/interface/alpaka/Common.h" #include "RecoTracker/LSTCore/interface/MiniDoubletsSoA.h" @@ -299,7 +300,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { drprime = (moduleSeparation / alpaka::math::sin(acc, angleA + angleB)) * alpaka::math::sin(acc, angleA); // Compute arctan of the slope and take care of the slope = infinity case - absArctanSlope = ((slope != kVerticalModuleSlope) ? fabs(alpaka::math::atan(acc, slope)) : kPi / 2.f); + absArctanSlope = + ((slope != kVerticalModuleSlope && edm::isFinite(slope)) ? fabs(alpaka::math::atan(acc, slope)) : kPi / 2.f); // Depending on which quadrant the pixel hit lies, we define the angleM by shifting them slightly differently if (xp > 0 and yp > 0) { @@ -322,8 +324,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ya = yp + drprime_y; // Compute the new strip hit position (if the slope value is in special condition take care of the exceptions) - if (slope == - kVerticalModuleSlope) // Designated for tilted module when the slope is infinity (module lying along y-axis) + if (slope == kVerticalModuleSlope || + edm::isNotFinite(slope)) // Designated for tilted module when the slope is infinity (module lying along y-axis) { xn = xa; // New x point is simply where the anchor is yn = yo; // No shift in y diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index bcd9818a162d4..345a500848d78 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -657,8 +657,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { // Computing sigmas is a very tricky affair // if the module is tilted or endcap, we need to use the slopes properly! - absArctanSlope = ((slopes[i] != kVerticalModuleSlope) ? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i])) - : kPi / 2.f); + absArctanSlope = ((slopes[i] != kVerticalModuleSlope && edm::isFinite(slopes[i])) + ? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i])) + : kPi / 2.f); if (xs[i] > 0 and ys[i] > 0) { angleM = kPi / 2.f - absArctanSlope; @@ -740,8 +741,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { float chiSquared = 0.f; float absArctanSlope, angleM, xPrime, yPrime, sigma2; for (size_t i = 0; i < nPoints; i++) { - absArctanSlope = ((slopes[i] != kVerticalModuleSlope) ? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i])) - : kPi / 2.f); + absArctanSlope = ((slopes[i] != kVerticalModuleSlope && edm::isFinite(slopes[i])) + ? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i])) + : kPi / 2.f); if (xs[i] > 0 and ys[i] > 0) { angleM = kPi / 2.f - absArctanSlope; } else if (xs[i] < 0 and ys[i] > 0) { diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 8fba6d108c5e8..92ed042a77d65 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -1,6 +1,8 @@ #ifndef RecoTracker_LSTCore_src_alpaka_Segment_h #define RecoTracker_LSTCore_src_alpaka_Segment_h +#include + #include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h" #include "RecoTracker/LSTCore/interface/alpaka/Common.h" @@ -246,7 +248,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { mds.anchorY()[innerMDIndex] + circleRadius * alpaka::math::cos(acc, circlePhi)}; //check which of the circles can accommodate r3LH better (we won't get perfect agreement) - float bestChiSquared = kVerticalModuleSlope; + float bestChiSquared = std::numeric_limits::infinity(); float chiSquared; size_t bestIndex; for (size_t i = 0; i < 2; i++) {