Skip to content

Commit 8e46424

Browse files
committed
Started removal of kVerticalModuleSlope
1 parent f1a4cc6 commit 8e46424

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

RecoTracker/LSTCore/src/alpaka/MiniDoublet.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define RecoTracker_LSTCore_src_alpaka_MiniDoublet_h
33

44
#include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"
5+
#include "FWCore/Utilities/interface/isFinite.h"
56

67
#include "RecoTracker/LSTCore/interface/alpaka/Common.h"
78
#include "RecoTracker/LSTCore/interface/MiniDoubletsSoA.h"
@@ -299,7 +300,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
299300
drprime = (moduleSeparation / alpaka::math::sin(acc, angleA + angleB)) * alpaka::math::sin(acc, angleA);
300301

301302
// Compute arctan of the slope and take care of the slope = infinity case
302-
absArctanSlope = ((slope != kVerticalModuleSlope) ? fabs(alpaka::math::atan(acc, slope)) : kPi / 2.f);
303+
absArctanSlope =
304+
((slope != kVerticalModuleSlope && edm::isFinite(slope)) ? fabs(alpaka::math::atan(acc, slope)) : kPi / 2.f);
303305

304306
// Depending on which quadrant the pixel hit lies, we define the angleM by shifting them slightly differently
305307
if (xp > 0 and yp > 0) {
@@ -322,8 +324,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
322324
ya = yp + drprime_y;
323325

324326
// Compute the new strip hit position (if the slope value is in special condition take care of the exceptions)
325-
if (slope ==
326-
kVerticalModuleSlope) // Designated for tilted module when the slope is infinity (module lying along y-axis)
327+
if (slope == kVerticalModuleSlope ||
328+
edm::isNotFinite(slope)) // Designated for tilted module when the slope is infinity (module lying along y-axis)
327329
{
328330
xn = xa; // New x point is simply where the anchor is
329331
yn = yo; // No shift in y

RecoTracker/LSTCore/src/alpaka/Quintuplet.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
657657
// Computing sigmas is a very tricky affair
658658
// if the module is tilted or endcap, we need to use the slopes properly!
659659

660-
absArctanSlope = ((slopes[i] != kVerticalModuleSlope) ? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i]))
661-
: kPi / 2.f);
660+
absArctanSlope = ((slopes[i] != kVerticalModuleSlope && edm::isFinite(slopes[i]))
661+
? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i]))
662+
: kPi / 2.f);
662663

663664
if (xs[i] > 0 and ys[i] > 0) {
664665
angleM = kPi / 2.f - absArctanSlope;
@@ -740,8 +741,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
740741
float chiSquared = 0.f;
741742
float absArctanSlope, angleM, xPrime, yPrime, sigma2;
742743
for (size_t i = 0; i < nPoints; i++) {
743-
absArctanSlope = ((slopes[i] != kVerticalModuleSlope) ? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i]))
744-
: kPi / 2.f);
744+
absArctanSlope = ((slopes[i] != kVerticalModuleSlope && edm::isFinite(slopes[i]))
745+
? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i]))
746+
: kPi / 2.f);
745747
if (xs[i] > 0 and ys[i] > 0) {
746748
angleM = kPi / 2.f - absArctanSlope;
747749
} else if (xs[i] < 0 and ys[i] > 0) {

RecoTracker/LSTCore/src/alpaka/Segment.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef RecoTracker_LSTCore_src_alpaka_Segment_h
22
#define RecoTracker_LSTCore_src_alpaka_Segment_h
33

4+
#include <limits>
5+
46
#include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"
57

68
#include "RecoTracker/LSTCore/interface/alpaka/Common.h"
@@ -246,7 +248,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
246248
mds.anchorY()[innerMDIndex] + circleRadius * alpaka::math::cos(acc, circlePhi)};
247249

248250
//check which of the circles can accommodate r3LH better (we won't get perfect agreement)
249-
float bestChiSquared = kVerticalModuleSlope;
251+
float bestChiSquared = std::numeric_limits<float>::infinity();
250252
float chiSquared;
251253
size_t bestIndex;
252254
for (size_t i = 0; i < 2; i++) {

0 commit comments

Comments
 (0)