Skip to content

Commit

Permalink
Started removal of kVerticalModuleSlope
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Dec 18, 2024
1 parent 1532a7c commit 9444e18
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 5 additions & 3 deletions RecoTracker/LSTCore/src/alpaka/MiniDoublet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down
10 changes: 6 additions & 4 deletions RecoTracker/LSTCore/src/alpaka/Quintuplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion RecoTracker/LSTCore/src/alpaka/Segment.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef RecoTracker_LSTCore_src_alpaka_Segment_h
#define RecoTracker_LSTCore_src_alpaka_Segment_h

#include <limits>

#include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"

#include "RecoTracker/LSTCore/interface/alpaka/Common.h"
Expand Down Expand Up @@ -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<float>::infinity();
float chiSquared;
size_t bestIndex;
for (size_t i = 0; i < 2; i++) {
Expand Down

0 comments on commit 9444e18

Please sign in to comment.