Skip to content

Commit

Permalink
Code format and checks
Browse files Browse the repository at this point in the history
  • Loading branch information
VourMa committed Jul 9, 2024
1 parent a3a8054 commit 7cfe3a5
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 43 deletions.
26 changes: 19 additions & 7 deletions RecoTracker/LSTCore/interface/alpaka/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,27 @@ namespace SDL {

//defining the constant host device variables right up here
// Currently pixel tracks treated as LSs with 2 double layers (IT layers 1+2 and 3+4) and 4 hits. To be potentially handled better in the future.
struct Params_pLS { static constexpr int kLayers = 2, kHits = 4; };
struct Params_LS { static constexpr int kLayers = 2, kHits = 4; };
struct Params_T3 { static constexpr int kLayers = 3, kHits = 6; };
struct Params_pT3 { static constexpr int kLayers = 5, kHits = 10; };
struct Params_T5 { static constexpr int kLayers = 5, kHits = 10; };
struct Params_pT5 { static constexpr int kLayers = 7, kHits = 14; };
struct Params_pLS {
static constexpr int kLayers = 2, kHits = 4;
};
struct Params_LS {
static constexpr int kLayers = 2, kHits = 4;
};
struct Params_T3 {
static constexpr int kLayers = 3, kHits = 6;
};
struct Params_pT3 {
static constexpr int kLayers = 5, kHits = 10;
};
struct Params_T5 {
static constexpr int kLayers = 5, kHits = 10;
};
struct Params_pT5 {
static constexpr int kLayers = 7, kHits = 14;
};

// 15 MeV constant from the approximate Bethe-Bloch formula
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMulsInGeV = 0.015;
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMulsInGeV = 0.015;
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float miniMulsPtScaleBarrel[6] = {
0.0052, 0.0038, 0.0034, 0.0034, 0.0032, 0.0034};
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float miniMulsPtScaleEndcap[5] = {0.006, 0.006, 0.006, 0.006, 0.006};
Expand Down
41 changes: 22 additions & 19 deletions RecoTracker/LSTCore/src/alpaka/PixelTriplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1989,11 +1989,14 @@ namespace SDL {
unsigned int pixelInnerMD = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelIndex];
unsigned int pixelOuterMD = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelIndex + 1];

pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD];
pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD];
pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex] =
mdsInGPU.anchorHitIndices[pixelInnerMD];
pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 1] =
mdsInGPU.outerHitIndices[pixelInnerMD];
pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 2] =
mdsInGPU.anchorHitIndices[pixelOuterMD];
pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD];
pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 3] =
mdsInGPU.outerHitIndices[pixelOuterMD];

pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 4] =
quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index];
Expand Down Expand Up @@ -2529,15 +2532,15 @@ namespace SDL {
float zPix[Params_pLS::kLayers] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]};
float rtPix[Params_pLS::kLayers] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]};
float zs[Params_T5::kLayers] = {mdsInGPU.anchorZ[firstMDIndex],
mdsInGPU.anchorZ[secondMDIndex],
mdsInGPU.anchorZ[thirdMDIndex],
mdsInGPU.anchorZ[fourthMDIndex],
mdsInGPU.anchorZ[fifthMDIndex]};
mdsInGPU.anchorZ[secondMDIndex],
mdsInGPU.anchorZ[thirdMDIndex],
mdsInGPU.anchorZ[fourthMDIndex],
mdsInGPU.anchorZ[fifthMDIndex]};
float rts[Params_T5::kLayers] = {mdsInGPU.anchorRt[firstMDIndex],
mdsInGPU.anchorRt[secondMDIndex],
mdsInGPU.anchorRt[thirdMDIndex],
mdsInGPU.anchorRt[fourthMDIndex],
mdsInGPU.anchorRt[fifthMDIndex]};
mdsInGPU.anchorRt[secondMDIndex],
mdsInGPU.anchorRt[thirdMDIndex],
mdsInGPU.anchorRt[fourthMDIndex],
mdsInGPU.anchorRt[fifthMDIndex]};

rzChiSquared = computePT5RZChiSquared(acc, modulesInGPU, lowerModuleIndices, rtPix, zPix, rts, zs);

Expand All @@ -2554,15 +2557,15 @@ namespace SDL {

//outer T5
float xs[Params_T5::kLayers] = {mdsInGPU.anchorX[firstMDIndex],
mdsInGPU.anchorX[secondMDIndex],
mdsInGPU.anchorX[thirdMDIndex],
mdsInGPU.anchorX[fourthMDIndex],
mdsInGPU.anchorX[fifthMDIndex]};
mdsInGPU.anchorX[secondMDIndex],
mdsInGPU.anchorX[thirdMDIndex],
mdsInGPU.anchorX[fourthMDIndex],
mdsInGPU.anchorX[fifthMDIndex]};
float ys[Params_T5::kLayers] = {mdsInGPU.anchorY[firstMDIndex],
mdsInGPU.anchorY[secondMDIndex],
mdsInGPU.anchorY[thirdMDIndex],
mdsInGPU.anchorY[fourthMDIndex],
mdsInGPU.anchorY[fifthMDIndex]};
mdsInGPU.anchorY[secondMDIndex],
mdsInGPU.anchorY[thirdMDIndex],
mdsInGPU.anchorY[fourthMDIndex],
mdsInGPU.anchorY[fifthMDIndex]};

//get the appropriate radii and centers
centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex];
Expand Down
14 changes: 12 additions & 2 deletions RecoTracker/LSTCore/src/alpaka/Quintuplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -2877,8 +2877,18 @@ namespace SDL {
bool isFlat[5];

computeSigmasForRegression(acc, modulesInGPU, lowerModuleIndices, delta1, delta2, slopes, isFlat);
regressionRadius = computeRadiusUsingRegression(
acc, Params_T5::kLayers, xVec, yVec, delta1, delta2, slopes, isFlat, regressionG, regressionF, sigmas2, chiSquared);
regressionRadius = computeRadiusUsingRegression(acc,
Params_T5::kLayers,
xVec,
yVec,
delta1,
delta2,
slopes,
isFlat,
regressionG,
regressionF,
sigmas2,
chiSquared);

#ifdef USE_T5_DNN
unsigned int mdIndices[] = {firstMDIndex, secondMDIndex, thirdMDIndex, fourthMDIndex, fifthMDIndex};
Expand Down
32 changes: 17 additions & 15 deletions RecoTracker/LSTCore/src/alpaka/TrackCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ namespace SDL {
trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = innerTrackletIndex;
trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = outerTrackletIndex;

size_t limits = trackCandidateType == 7 ? Params_pT5::kLayers
: Params_pT3::kLayers; // 7 means pT5, Params_pT3::kLayers = Params_T5::kLayers = 5
size_t limits = trackCandidateType == 7
? Params_pT5::kLayers
: Params_pT3::kLayers; // 7 means pT5, Params_pT3::kLayers = Params_T5::kLayers = 5

//send the starting pointer to the logicalLayer and hitIndices
for (size_t i = 0; i < limits; i++) {
Expand Down Expand Up @@ -556,19 +557,20 @@ namespace SDL {
float radius = 0.5f * (__H2F(pixelQuintupletsInGPU.pixelRadius[pixelQuintupletIndex]) +
__H2F(pixelQuintupletsInGPU.quintupletRadius[pixelQuintupletIndex]));
unsigned int pT5PixelIndex = pixelQuintupletsInGPU.pixelIndices[pixelQuintupletIndex];
addTrackCandidateToMemory(trackCandidatesInGPU,
7 /*track candidate type pT5=7*/,
pT5PixelIndex,
pixelQuintupletsInGPU.T5Indices[pixelQuintupletIndex],
&pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex],
&pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex],
&pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex],
segmentsInGPU.seedIdx[pT5PixelIndex - pLS_offset],
__H2F(pixelQuintupletsInGPU.centerX[pixelQuintupletIndex]),
__H2F(pixelQuintupletsInGPU.centerY[pixelQuintupletIndex]),
radius,
trackCandidateIdx,
pixelQuintupletIndex);
addTrackCandidateToMemory(
trackCandidatesInGPU,
7 /*track candidate type pT5=7*/,
pT5PixelIndex,
pixelQuintupletsInGPU.T5Indices[pixelQuintupletIndex],
&pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex],
&pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex],
&pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex],
segmentsInGPU.seedIdx[pT5PixelIndex - pLS_offset],
__H2F(pixelQuintupletsInGPU.centerX[pixelQuintupletIndex]),
__H2F(pixelQuintupletsInGPU.centerY[pixelQuintupletIndex]),
radius,
trackCandidateIdx,
pixelQuintupletIndex);
}
}
}
Expand Down

0 comments on commit 7cfe3a5

Please sign in to comment.