From a3a8054945636973191c9c4cc76e2ed36e271e1e Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Tue, 9 Jul 2024 05:19:42 -0700 Subject: [PATCH] Even further work on naming values and sqrt, loop, etc. simplifications --- .../LSTCore/interface/alpaka/Constants.h | 32 +-- RecoTracker/LSTCore/src/alpaka/Event.dev.cc | 12 +- RecoTracker/LSTCore/src/alpaka/Kernels.h | 76 ++--- RecoTracker/LSTCore/src/alpaka/LST.dev.cc | 10 +- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 264 +++++++++--------- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 100 +++---- RecoTracker/LSTCore/src/alpaka/Segment.h | 4 +- .../LSTCore/src/alpaka/TrackCandidate.h | 50 ++-- RecoTracker/LSTCore/src/alpaka/Triplet.h | 38 +-- 9 files changed, 287 insertions(+), 299 deletions(-) diff --git a/RecoTracker/LSTCore/interface/alpaka/Constants.h b/RecoTracker/LSTCore/interface/alpaka/Constants.h index aa6898b814f57..7cb70125a427e 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Constants.h +++ b/RecoTracker/LSTCore/interface/alpaka/Constants.h @@ -120,28 +120,16 @@ namespace SDL { constexpr unsigned int size_superbins = 45000; //defining the constant host device variables right up here - namespace objLayers { - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpLS = - 2; // Currently pixel tracks treated as LSs with 2 double layers (IT layers 1+2 and 3+4). To be potentially handled better in the future. - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kLS = 2; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT3 = 3; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT3 = 5; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT5 = 5; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT5 = 7; - } // namespace objLayers - - namespace objHits { - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpLS = - 4; // Currently pixel tracks treated as LSs with 4 hits. To be potentially handled better in the future. - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kLS = 4; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT3 = 6; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT3 = 10; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT5 = 10; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT5 = 14; - } // namespace objHits - - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMulsInGev2 = - 0.015; // 15 MeV constant from the approximate Bethe-Bloch formula + // 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; }; + + // 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 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}; diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index 1cc547e505442..18f86217f9e72 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -1623,9 +1623,9 @@ SDL::tripletsBuffer* SDL::Event::getTriplets() { alpaka::memcpy(queue, tripletsInCPU->rtLo_buf, tripletsBuffers->rtLo_buf, nMemHost); alpaka::memcpy(queue, tripletsInCPU->rtHi_buf, tripletsBuffers->rtHi_buf, nMemHost); #endif - alpaka::memcpy(queue, tripletsInCPU->hitIndices_buf, tripletsBuffers->hitIndices_buf, objHits::kT3 * nMemHost); + alpaka::memcpy(queue, tripletsInCPU->hitIndices_buf, tripletsBuffers->hitIndices_buf, Params_T3::kHits * nMemHost); alpaka::memcpy( - queue, tripletsInCPU->logicalLayers_buf, tripletsBuffers->logicalLayers_buf, objLayers::kT3 * nMemHost); + queue, tripletsInCPU->logicalLayers_buf, tripletsBuffers->logicalLayers_buf, Params_T3::kLayers * nMemHost); alpaka::memcpy(queue, tripletsInCPU->segmentIndices_buf, tripletsBuffers->segmentIndices_buf, 2 * nMemHost); alpaka::memcpy(queue, tripletsInCPU->betaIn_buf, tripletsBuffers->betaIn_buf, nMemHost); alpaka::memcpy(queue, tripletsInCPU->circleRadius_buf, tripletsBuffers->circleRadius_buf, nMemHost); @@ -1655,7 +1655,7 @@ SDL::quintupletsBuffer* SDL::Event::getQuintuplets() { alpaka::memcpy(queue, quintupletsInCPU->lowerModuleIndices_buf, quintupletsBuffers->lowerModuleIndices_buf, - objLayers::kT5 * nMemHost); + Params_T5::kLayers * nMemHost); alpaka::memcpy(queue, quintupletsInCPU->innerRadius_buf, quintupletsBuffers->innerRadius_buf, nMemHost); alpaka::memcpy(queue, quintupletsInCPU->bridgeRadius_buf, quintupletsBuffers->bridgeRadius_buf, nMemHost); alpaka::memcpy(queue, quintupletsInCPU->outerRadius_buf, quintupletsBuffers->outerRadius_buf, nMemHost); @@ -1763,13 +1763,13 @@ SDL::trackCandidatesBuffer* SDL::Event::getTrackCandid alpaka::memcpy(queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, - objHits::kpT5 * nTrackCanHost); + Params_pT5::kHits * nTrackCanHost); alpaka::memcpy( queue, trackCandidatesInCPU->pixelSeedIndex_buf, trackCandidatesBuffers->pixelSeedIndex_buf, nTrackCanHost); alpaka::memcpy(queue, trackCandidatesInCPU->logicalLayers_buf, trackCandidatesBuffers->logicalLayers_buf, - objLayers::kpT5 * nTrackCanHost); + Params_pT5::kLayers * nTrackCanHost); alpaka::memcpy(queue, trackCandidatesInCPU->directObjectIndices_buf, trackCandidatesBuffers->directObjectIndices_buf, @@ -1801,7 +1801,7 @@ SDL::trackCandidatesBuffer* SDL::Event::getTrackCandid alpaka::memcpy(queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, - objHits::kpT5 * nTrackCanHost); + Params_pT5::kHits * nTrackCanHost); alpaka::memcpy( queue, trackCandidatesInCPU->pixelSeedIndex_buf, trackCandidatesBuffers->pixelSeedIndex_buf, nTrackCanHost); alpaka::memcpy(queue, diff --git a/RecoTracker/LSTCore/src/alpaka/Kernels.h b/RecoTracker/LSTCore/src/alpaka/Kernels.h index 9edafaa7d1520..c053f9e52c1e6 100644 --- a/RecoTracker/LSTCore/src/alpaka/Kernels.h +++ b/RecoTracker/LSTCore/src/alpaka/Kernels.h @@ -37,18 +37,18 @@ namespace SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitsT5(unsigned int ix, unsigned int jx, struct SDL::quintuplets& quintupletsInGPU) { - unsigned int hits1[objHits::kT5]; - unsigned int hits2[objHits::kT5]; + unsigned int hits1[Params_T5::kHits]; + unsigned int hits2[Params_T5::kHits]; - for (int i = 0; i < objHits::kT5; i++) { - hits1[i] = quintupletsInGPU.hitIndices[objHits::kT5 * ix + i]; - hits2[i] = quintupletsInGPU.hitIndices[objHits::kT5 * jx + i]; + for (int i = 0; i < Params_T5::kHits; i++) { + hits1[i] = quintupletsInGPU.hitIndices[Params_T5::kHits * ix + i]; + hits2[i] = quintupletsInGPU.hitIndices[Params_T5::kHits * jx + i]; } int nMatched = 0; - for (int i = 0; i < objHits::kT5; i++) { + for (int i = 0; i < Params_T5::kHits; i++) { bool matched = false; - for (int j = 0; j < objHits::kT5; j++) { + for (int j = 0; j < Params_T5::kHits; j++) { if (hits1[i] == hits2[j]) { matched = true; break; @@ -64,18 +64,18 @@ namespace SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitspT5(unsigned int ix, unsigned int jx, struct SDL::pixelQuintuplets& pixelQuintupletsInGPU) { - unsigned int hits1[objHits::kpT5]; - unsigned int hits2[objHits::kpT5]; + unsigned int hits1[Params_pT5::kHits]; + unsigned int hits2[Params_pT5::kHits]; - for (int i = 0; i < objHits::kpT5; i++) { - hits1[i] = pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * ix + i]; - hits2[i] = pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * jx + i]; + for (int i = 0; i < Params_pT5::kHits; i++) { + hits1[i] = pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * ix + i]; + hits2[i] = pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * jx + i]; } int nMatched = 0; - for (int i = 0; i < objHits::kpT5; i++) { + for (int i = 0; i < Params_pT5::kHits; i++) { bool matched = false; - for (int j = 0; j < objHits::kpT5; j++) { + for (int j = 0; j < Params_pT5::kHits; j++) { if (hits1[i] == hits2[j]) { matched = true; break; @@ -92,18 +92,18 @@ namespace SDL { unsigned int jx, struct SDL::pixelTriplets& pixelTripletsInGPU, int* matched) { - int phits1[objHits::kpLS]; - int phits2[objHits::kpLS]; + int phits1[Params_pLS::kHits]; + int phits2[Params_pLS::kHits]; - for (int i = 0; i < objHits::kpLS; i++) { - phits1[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * ix + i]; - phits2[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * jx + i]; + for (int i = 0; i < Params_pLS::kHits; i++) { + phits1[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * ix + i]; + phits2[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * jx + i]; } int npMatched = 0; - for (int i = 0; i < objHits::kpLS; i++) { + for (int i = 0; i < Params_pLS::kHits; i++) { bool pmatched = false; - for (int j = 0; j < objHits::kpLS; j++) { + for (int j = 0; j < Params_pLS::kHits; j++) { if (phits1[i] == phits2[j]) { pmatched = true; break; @@ -114,18 +114,18 @@ namespace SDL { } } - int hits1[objHits::kT3]; - int hits2[objHits::kT3]; + int hits1[Params_T3::kHits]; + int hits2[Params_T3::kHits]; - for (int i = 0; i < objHits::kpLS; i++) { - hits1[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * ix + i + 4]; // Omitting the pLS hits - hits2[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * jx + i + 4]; // Omitting the pLS hits + for (int i = 0; i < Params_pLS::kHits; i++) { + hits1[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * ix + i + 4]; // Omitting the pLS hits + hits2[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * jx + i + 4]; // Omitting the pLS hits } int nMatched = 0; - for (int i = 0; i < objHits::kT3; i++) { + for (int i = 0; i < Params_T3::kHits; i++) { bool tmatched = false; - for (int j = 0; j < objHits::kT3; j++) { + for (int j = 0; j < Params_T3::kHits; j++) { if (hits1[i] == hits2[j]) { tmatched = true; break; @@ -281,17 +281,17 @@ namespace SDL { const int minNHitsForDup_pT3 = 5; if ((nMatched[0] + nMatched[1]) >= minNHitsForDup_pT3) { // Check the layers - if (pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * jx + 2] < - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * ix + 2]) { + if (pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * jx + 2] < + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * ix + 2]) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; - } else if (pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * ix + 2] == - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * jx + 2] && + } else if (pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * ix + 2] == + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * jx + 2] && __H2F(pixelTripletsInGPU.score[ix]) > __H2F(pixelTripletsInGPU.score[jx])) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; - } else if (pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * ix + 2] == - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * jx + 2] && + } else if (pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * ix + 2] == + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * jx + 2] && (__H2F(pixelTripletsInGPU.score[ix]) == __H2F(pixelTripletsInGPU.score[jx])) && (ix < jx)) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; @@ -348,7 +348,7 @@ namespace SDL { if (secondpass && (!segmentsInGPU.isQuad[ix] || (segmentsInGPU.isDup[ix] & 1))) continue; - unsigned int phits1[objHits::kpLS]; + unsigned int phits1[Params_pLS::kHits]; phits1[0] = segmentsInGPU.pLSHitsIdxs[ix].x; phits1[1] = segmentsInGPU.pLSHitsIdxs[ix].y; phits1[2] = segmentsInGPU.pLSHitsIdxs[ix].z; @@ -381,16 +381,16 @@ namespace SDL { else idxToRemove = ix; - unsigned int phits2[objHits::kpLS]; + unsigned int phits2[Params_pLS::kHits]; phits2[0] = segmentsInGPU.pLSHitsIdxs[jx].x; phits2[1] = segmentsInGPU.pLSHitsIdxs[jx].y; phits2[2] = segmentsInGPU.pLSHitsIdxs[jx].z; phits2[3] = segmentsInGPU.pLSHitsIdxs[jx].w; int npMatched = 0; - for (int i = 0; i < objHits::kpLS; i++) { + for (int i = 0; i < Params_pLS::kHits; i++) { bool pmatched = false; - for (int j = 0; j < objHits::kpLS; j++) { + for (int j = 0; j < Params_pLS::kHits; j++) { if (phits1[i] == phits2[j]) { pmatched = true; break; diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index b42095df156b6..0c6cf5cc0e961 100644 --- a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc @@ -397,16 +397,16 @@ std::vector SDL::LST::getHitIdxs(const short trackCandid unsigned int maxNHits = 0; if (trackCandidateType == 7) - maxNHits = objHits::kpT5; // pT5 + maxNHits = Params_pT5::kHits; // pT5 else if (trackCandidateType == 5) - maxNHits = objHits::kpT3; // pT3 + maxNHits = Params_pT3::kHits; // pT3 else if (trackCandidateType == 4) - maxNHits = objHits::kT5; // T5 + maxNHits = Params_T5::kHits; // T5 else if (trackCandidateType == 8) - maxNHits = objHits::kpLS; // pLS + maxNHits = Params_pLS::kHits; // pLS for (unsigned int i = 0; i < maxNHits; i++) { - unsigned int hitIdxInGPU = TCHitIndices[objHits::kpT5 * TCIdx + i]; + unsigned int hitIdxInGPU = TCHitIndices[Params_pT5::kHits * TCIdx + i]; unsigned int hitIdx = (trackCandidateType == 8) ? hitIdxInGPU diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index 9b2bcaaed841e..b4323c03dabb0 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -110,9 +110,9 @@ namespace SDL { score_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), isDup_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), partOfPT5_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelTriplets * objLayers::kpT3, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * objHits::kpT3, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * objLayers::kpT3, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelTriplets * Params_pT3::kLayers, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * Params_pT3::kHits, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * Params_pT3::kLayers, queue)), centerX_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), centerY_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), pixelRadiusError_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), @@ -161,46 +161,46 @@ namespace SDL { pixelTripletsInGPU.centerX[pixelTripletIndex] = __F2H(centerX); pixelTripletsInGPU.centerY[pixelTripletIndex] = __F2H(centerY); - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex] = 0; - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 1] = 0; - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 2] = - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3]; - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 3] = - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 1]; - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 4] = - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 2]; - - pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex] = + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex] = 0; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 1] = 0; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 2] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers]; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 3] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 1]; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 4] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 2]; + + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex] = segmentsInGPU.innerLowerModuleIndices[pixelSegmentIndex]; - pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 1] = + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 1] = segmentsInGPU.outerLowerModuleIndices[pixelSegmentIndex]; - pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 2] = - tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex]; - pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 3] = - tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 1]; - pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 4] = - tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 2]; + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 2] = + tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex]; + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 3] = + tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 1]; + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 4] = + tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 2]; unsigned int pixelInnerMD = segmentsInGPU.mdIndices[2 * pixelSegmentIndex]; unsigned int pixelOuterMD = segmentsInGPU.mdIndices[2 * pixelSegmentIndex + 1]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; - - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 4] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 5] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 1]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 6] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 2]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 7] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 3]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 8] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 4]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 9] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 5]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; + + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 4] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 5] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 1]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 6] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 2]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 7] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 3]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 8] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 4]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 9] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 5]; pixelTripletsInGPU.rPhiChiSquared[pixelTripletIndex] = rPhiChiSquared; pixelTripletsInGPU.rPhiChiSquaredInwards[pixelTripletIndex] = rPhiChiSquaredInwards; pixelTripletsInGPU.rzChiSquared[pixelTripletIndex] = rzChiSquared; @@ -247,11 +247,11 @@ namespace SDL { short outerInnerLowerModuleSubdet = modulesInGPU.subdets[outerInnerLowerModuleIndex]; short outerOuterLowerModuleSubdet = modulesInGPU.subdets[outerOuterLowerModuleIndex]; - unsigned int firstMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * innerSegmentIndex]; - unsigned int secondMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * innerSegmentIndex + 1]; + unsigned int firstMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * innerSegmentIndex]; + unsigned int secondMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * innerSegmentIndex + 1]; - unsigned int thirdMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * outerSegmentIndex]; - unsigned int fourthMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * outerSegmentIndex + 1]; + unsigned int thirdMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * outerSegmentIndex]; + unsigned int fourthMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * outerSegmentIndex + 1]; if (outerInnerLowerModuleSubdet == SDL::Barrel and (outerOuterLowerModuleSubdet == SDL::Barrel or outerOuterLowerModuleSubdet == SDL::Endcap)) { @@ -765,7 +765,7 @@ namespace SDL { float a = -2.f * k2Rinv1GeVf * 100 * charge; // multiply by 100 to make the correct length units - for (size_t i = 0; i < objLayers::kT3; i++) { + for (size_t i = 0; i < Params_T3::kLayers; i++) { float zsi = zs[i] / 100; float rtsi = rts[i] / 100; uint16_t lowerModuleIndex = lowerModuleIndices[i]; @@ -845,9 +845,9 @@ namespace SDL { //run pT4 compatibility between the pixel segment and inner segment, and between the pixel and outer segment of the triplet uint16_t pixelModuleIndex = segmentsInGPU.innerLowerModuleIndices[pixelSegmentIndex]; - uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex]; - uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 1]; - uint16_t upperModuleIndex = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 2]; + uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex]; + uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 1]; + uint16_t upperModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 2]; { //placeholder @@ -864,7 +864,7 @@ namespace SDL { lowerModuleIndex, middleModuleIndex, pixelSegmentIndex, - tripletsInGPU.segmentIndices[objLayers::kLS * tripletIndex], + tripletsInGPU.segmentIndices[Params_LS::kLayers * tripletIndex], zOut, rtOut, deltaPhiPos, @@ -895,7 +895,7 @@ namespace SDL { middleModuleIndex, upperModuleIndex, pixelSegmentIndex, - tripletsInGPU.segmentIndices[objLayers::kLS * tripletIndex + 1], + tripletsInGPU.segmentIndices[Params_LS::kLayers * tripletIndex + 1], zOut, rtOut, deltaPhiPos, @@ -930,8 +930,8 @@ namespace SDL { float pixelF = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; float pixelRadiusPCA = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; - unsigned int pixelInnerMDIndex = segmentsInGPU.mdIndices[objLayers::kpLS * pixelSegmentIndex]; - unsigned int pixelOuterMDIndex = segmentsInGPU.mdIndices[objLayers::kpLS * pixelSegmentIndex + 1]; + unsigned int pixelInnerMDIndex = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelSegmentIndex]; + unsigned int pixelOuterMDIndex = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelSegmentIndex + 1]; pixelRadius = pixelSegmentPt * kR1GeVf; pixelRadiusError = pixelSegmentPtError * kR1GeVf; @@ -942,9 +942,9 @@ namespace SDL { unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * tripletInnerSegmentIndex + 1]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * tripletOuterSegmentIndex + 1]; - float xs[objLayers::kT3] = { + float xs[Params_T3::kLayers] = { mdsInGPU.anchorX[firstMDIndex], mdsInGPU.anchorX[secondMDIndex], mdsInGPU.anchorX[thirdMDIndex]}; - float ys[objLayers::kT3] = { + float ys[Params_T3::kLayers] = { mdsInGPU.anchorY[firstMDIndex], mdsInGPU.anchorY[secondMDIndex], mdsInGPU.anchorY[thirdMDIndex]}; float g, f; @@ -962,17 +962,17 @@ namespace SDL { upperModuleIndex)) return false; - uint16_t lowerModuleIndices[objLayers::kT3] = {lowerModuleIndex, middleModuleIndex, upperModuleIndex}; + uint16_t lowerModuleIndices[Params_T3::kLayers] = {lowerModuleIndex, middleModuleIndex, upperModuleIndex}; if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { - float rts[objLayers::kT3] = { + float rts[Params_T3::kLayers] = { mdsInGPU.anchorRt[firstMDIndex], mdsInGPU.anchorRt[secondMDIndex], mdsInGPU.anchorRt[thirdMDIndex]}; - float zs[objLayers::kT3] = { + float zs[Params_T3::kLayers] = { mdsInGPU.anchorZ[firstMDIndex], mdsInGPU.anchorZ[secondMDIndex], mdsInGPU.anchorZ[thirdMDIndex]}; - float rtPix[objLayers::kpLS] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; - float xPix[objLayers::kpLS] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; - float yPix[objLayers::kpLS] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; - float zPix[objLayers::kpLS] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; + float rtPix[Params_pLS::kLayers] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; + float xPix[Params_pLS::kLayers] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; + float yPix[Params_pLS::kLayers] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; + float zPix[Params_pLS::kLayers] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; rzChiSquared = computePT3RZChiSquared(acc, modulesInGPU, @@ -1006,8 +1006,8 @@ namespace SDL { return false; } - float xPix[objLayers::kpLS] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; - float yPix[objLayers::kpLS] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; + float xPix[Params_pLS::kLayers] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; + float yPix[Params_pLS::kLayers] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; rPhiChiSquaredInwards = computePT3RPhiChiSquaredInwards(modulesInGPU, g, f, tripletRadius, xPix, yPix); if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { @@ -1351,7 +1351,7 @@ namespace SDL { float drt_InSeg = rt_InOut - rt_InLo; const float sdlThetaMulsF2 = - (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); + (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (ptCut * ptCut) * 16.f; float dzErr = (drt_OutLo_InUp * drt_OutLo_InUp) * (etaErr * etaErr) * cosh2Eta; @@ -1637,7 +1637,7 @@ namespace SDL { const float multDzDr2 = (dzOutInAbs * dzOutInAbs) * cosh2Eta / ((cosh2Eta - 1.f) * (cosh2Eta - 1.f)); const float r3_InUp = alpaka::math::sqrt(acc, z_InUp * z_InUp + rt_InUp * rt_InUp); const float sdlThetaMulsF2 = - (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); + (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (ptCut * ptCut) * 16.f; float drtErr = (etaErr * etaErr) * multDzDr2; @@ -1912,9 +1912,9 @@ namespace SDL { score_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), eta_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), phi_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * objLayers::kpT5, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * objHits::kpT5, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * objLayers::kpT5, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * Params_pT5::kLayers, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * Params_pT5::kHits, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * Params_pT5::kLayers, queue)), pixelRadius_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), quintupletRadius_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), centerX_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), @@ -1958,63 +1958,63 @@ namespace SDL { pixelQuintupletsInGPU.centerX[pixelQuintupletIndex] = __F2H(centerX); pixelQuintupletsInGPU.centerY[pixelQuintupletIndex] = __F2H(centerY); - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex] = 0; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 1] = 0; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 2] = - quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5]; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 3] = - quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 1]; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 4] = - quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 2]; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 5] = - quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 3]; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 6] = - quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 4]; - - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex] = + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex] = 0; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 1] = 0; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 2] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 3] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 1]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 4] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 2]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 5] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 3]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 6] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 4]; + + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex] = segmentsInGPU.innerLowerModuleIndices[pixelIndex]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 1] = + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 1] = segmentsInGPU.outerLowerModuleIndices[pixelIndex]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 2] = - quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 3] = - quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 1]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 4] = - quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 2]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 5] = - quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 3]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 6] = - quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 4]; - - unsigned int pixelInnerMD = segmentsInGPU.mdIndices[objLayers::kpLS * pixelIndex]; - unsigned int pixelOuterMD = segmentsInGPU.mdIndices[objLayers::kpLS * pixelIndex + 1]; - - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 2] = + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 2] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 3] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 1]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 4] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 2]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 5] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 3]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 6] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 4]; + + 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 + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; - - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 4] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 5] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 1]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 6] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 2]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 7] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 3]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 8] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 4]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 9] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 5]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 10] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 6]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 11] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 7]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 12] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 8]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 13] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 9]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; + + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 4] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 5] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 1]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 6] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 2]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 7] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 3]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 8] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 4]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 9] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 5]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 10] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 6]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 11] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 7]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 12] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 8]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 13] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 9]; pixelQuintupletsInGPU.rzChiSquared[pixelQuintupletIndex] = rzChiSquared; pixelQuintupletsInGPU.rPhiChiSquared[pixelQuintupletIndex] = rPhiChiSquared; @@ -2517,23 +2517,23 @@ namespace SDL { unsigned int fourthMDIndex = segmentsInGPU.mdIndices[2 * thirdSegmentIndex + 1]; unsigned int fifthMDIndex = segmentsInGPU.mdIndices[2 * fourthSegmentIndex + 1]; - uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex]; - uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 1]; - uint16_t lowerModuleIndex3 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 2]; - uint16_t lowerModuleIndex4 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 3]; - uint16_t lowerModuleIndex5 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 4]; + uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex]; + uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 1]; + uint16_t lowerModuleIndex3 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 2]; + uint16_t lowerModuleIndex4 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 3]; + uint16_t lowerModuleIndex5 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 4]; - uint16_t lowerModuleIndices[objLayers::kT5] = { + uint16_t lowerModuleIndices[Params_T5::kLayers] = { lowerModuleIndex1, lowerModuleIndex2, lowerModuleIndex3, lowerModuleIndex4, lowerModuleIndex5}; - float zPix[objLayers::kpLS] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; - float rtPix[objLayers::kpLS] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; - float zs[objLayers::kT5] = {mdsInGPU.anchorZ[firstMDIndex], + 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]}; - float rts[objLayers::kT5] = {mdsInGPU.anchorRt[firstMDIndex], + float rts[Params_T5::kLayers] = {mdsInGPU.anchorRt[firstMDIndex], mdsInGPU.anchorRt[secondMDIndex], mdsInGPU.anchorRt[thirdMDIndex], mdsInGPU.anchorRt[fourthMDIndex], @@ -2553,12 +2553,12 @@ namespace SDL { } //outer T5 - float xs[objLayers::kT5] = {mdsInGPU.anchorX[firstMDIndex], + float xs[Params_T5::kLayers] = {mdsInGPU.anchorX[firstMDIndex], mdsInGPU.anchorX[secondMDIndex], mdsInGPU.anchorX[thirdMDIndex], mdsInGPU.anchorX[fourthMDIndex], mdsInGPU.anchorX[fifthMDIndex]}; - float ys[objLayers::kT5] = {mdsInGPU.anchorY[firstMDIndex], + float ys[Params_T5::kLayers] = {mdsInGPU.anchorY[firstMDIndex], mdsInGPU.anchorY[secondMDIndex], mdsInGPU.anchorY[thirdMDIndex], mdsInGPU.anchorY[fourthMDIndex], @@ -2625,7 +2625,7 @@ namespace SDL { float error2 = 0; //hardcoded array indices!!! float RMSE = 0; - for (size_t i = 0; i < objLayers::kT5; i++) { + for (size_t i = 0; i < Params_T5::kLayers; i++) { uint16_t& lowerModuleIndex = lowerModuleIndices[i]; const int moduleType = modulesInGPU.moduleType[lowerModuleIndex]; const int moduleSide = modulesInGPU.sides[lowerModuleIndex]; diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index 3463119a77db9..0950e2244d20e 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -103,7 +103,7 @@ namespace SDL { template quintupletsBuffer(unsigned int nTotalQuintuplets, unsigned int nLowerModules, TDevAcc const& devAccIn, TQueue& queue) : tripletIndices_buf(allocBufWrapper(devAccIn, 2 * nTotalQuintuplets, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, objLayers::kT5 * nTotalQuintuplets, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, Params_T5::kLayers * nTotalQuintuplets, queue)), nQuintuplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), totOccupancyQuintuplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), nMemoryLocations_buf(allocBufWrapper(devAccIn, 1, queue)), @@ -121,8 +121,8 @@ namespace SDL { regressionRadius_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), regressionG_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), regressionF_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, objLayers::kT5 * nTotalQuintuplets, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, objHits::kT5 * nTotalQuintuplets, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, Params_T5::kLayers * nTotalQuintuplets, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, Params_T5::kHits * nTotalQuintuplets, queue)), rzChiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), chiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), nonAnchorChiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)) { @@ -170,11 +170,11 @@ namespace SDL { quintupletsInGPU.tripletIndices[2 * quintupletIndex] = innerTripletIndex; quintupletsInGPU.tripletIndices[2 * quintupletIndex + 1] = outerTripletIndex; - quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex] = lowerModule1; - quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 1] = lowerModule2; - quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 2] = lowerModule3; - quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 3] = lowerModule4; - quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 4] = lowerModule5; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex] = lowerModule1; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 1] = lowerModule2; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 2] = lowerModule3; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 3] = lowerModule4; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 4] = lowerModule5; quintupletsInGPU.innerRadius[quintupletIndex] = __F2H(innerRadius); quintupletsInGPU.outerRadius[quintupletIndex] = __F2H(outerRadius); quintupletsInGPU.pt[quintupletIndex] = __F2H(pt); @@ -187,37 +187,37 @@ namespace SDL { quintupletsInGPU.regressionRadius[quintupletIndex] = regressionRadius; quintupletsInGPU.regressionG[quintupletIndex] = regressionG; quintupletsInGPU.regressionF[quintupletIndex] = regressionF; - quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex] = - tripletsInGPU.logicalLayers[objLayers::kT3 * innerTripletIndex]; - quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 1] = - tripletsInGPU.logicalLayers[objLayers::kT3 * innerTripletIndex + 1]; - quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 2] = - tripletsInGPU.logicalLayers[objLayers::kT3 * innerTripletIndex + 2]; - quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 3] = - tripletsInGPU.logicalLayers[objLayers::kT3 * outerTripletIndex + 1]; - quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 4] = - tripletsInGPU.logicalLayers[objLayers::kT3 * outerTripletIndex + 2]; - - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 1] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 1]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 2] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 2]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 3] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 3]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 4] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 4]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 5] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 5]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 6] = - tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 2]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 7] = - tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 3]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 8] = - tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 4]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 9] = - tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 5]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * innerTripletIndex]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 1] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * innerTripletIndex + 1]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 2] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * innerTripletIndex + 2]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 3] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * outerTripletIndex + 1]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 4] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * outerTripletIndex + 2]; + + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 1] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 1]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 2] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 2]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 3] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 3]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 4] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 4]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 5] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 5]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 6] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 2]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 7] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 3]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 8] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 4]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 9] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 5]; quintupletsInGPU.bridgeRadius[quintupletIndex] = bridgeRadius; quintupletsInGPU.rzChiSquared[quintupletIndex] = rzChiSquared; quintupletsInGPU.chiSquared[quintupletIndex] = rPhiChiSquared; @@ -1541,7 +1541,7 @@ namespace SDL { float dzErr = (zpitch_InLo + zpitch_OutLo) * (zpitch_InLo + zpitch_OutLo) * 2.f; float sdlThetaMulsF2 = - (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (r3_InLo / rt_InLo); + (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (r3_InLo / rt_InLo); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; dzErr += sdlMuls2 * drt_OutLo_InLo * drt_OutLo_InLo / 3.f * coshEta * coshEta; dzErr = alpaka::math::sqrt(acc, dzErr); @@ -1832,7 +1832,7 @@ namespace SDL { float drtErr = zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ); const float sdlThetaMulsF2 = - (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (rIn / rt_InLo); + (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (rIn / rt_InLo); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; drtErr += sdlMuls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta; drtErr = alpaka::math::sqrt(acc, drtErr); @@ -2098,7 +2098,7 @@ namespace SDL { float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f); kZ = (z_OutLo - z_InLo) / dzSDIn; - float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f); + float sdlThetaMulsF2 = (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; @@ -2878,7 +2878,7 @@ namespace SDL { computeSigmasForRegression(acc, modulesInGPU, lowerModuleIndices, delta1, delta2, slopes, isFlat); regressionRadius = computeRadiusUsingRegression( - acc, objLayers::kT5, xVec, yVec, delta1, delta2, slopes, isFlat, regressionG, regressionF, sigmas2, chiSquared); + 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}; @@ -2917,7 +2917,7 @@ namespace SDL { //compute the other chisquared //non anchor is always shifted for tilted and endcap! - float nonAnchorDelta1[objLayers::kT5], nonAnchorDelta2[objLayers::kT5], nonAnchorSlopes[objLayers::kT5]; + float nonAnchorDelta1[Params_T5::kLayers], nonAnchorDelta2[Params_T5::kLayers], nonAnchorSlopes[Params_T5::kLayers]; float nonAnchorxs[] = {mdsInGPU.outerX[firstMDIndex], mdsInGPU.outerX[secondMDIndex], mdsInGPU.outerX[thirdMDIndex], @@ -2936,10 +2936,10 @@ namespace SDL { nonAnchorDelta2, nonAnchorSlopes, isFlat, - objLayers::kT5, + Params_T5::kLayers, false); nonAnchorChiSquared = computeChiSquared(acc, - objLayers::kT5, + Params_T5::kLayers, nonAnchorxs, nonAnchorys, nonAnchorDelta1, @@ -2982,14 +2982,14 @@ namespace SDL { for (unsigned int innerTripletArrayIndex = globalThreadIdx[1]; innerTripletArrayIndex < nInnerTriplets; innerTripletArrayIndex += gridThreadExtent[1]) { unsigned int innerTripletIndex = rangesInGPU.tripletModuleIndices[lowerModule1] + innerTripletArrayIndex; - uint16_t lowerModule2 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * innerTripletIndex + 1]; - uint16_t lowerModule3 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * innerTripletIndex + 2]; + uint16_t lowerModule2 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * innerTripletIndex + 1]; + uint16_t lowerModule3 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * innerTripletIndex + 2]; unsigned int nOuterTriplets = tripletsInGPU.nTriplets[lowerModule3]; for (unsigned int outerTripletArrayIndex = globalThreadIdx[2]; outerTripletArrayIndex < nOuterTriplets; outerTripletArrayIndex += gridThreadExtent[2]) { unsigned int outerTripletIndex = rangesInGPU.tripletModuleIndices[lowerModule3] + outerTripletArrayIndex; - uint16_t lowerModule4 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * outerTripletIndex + 1]; - uint16_t lowerModule5 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * outerTripletIndex + 2]; + uint16_t lowerModule4 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * outerTripletIndex + 1]; + uint16_t lowerModule5 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * outerTripletIndex + 2]; float innerRadius, outerRadius, bridgeRadius, regressionG, regressionF, regressionRadius, rzChiSquared, chiSquared, nonAnchorChiSquared; //required for making distributions diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 39936d3d068d5..0acf2623b4675 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -676,7 +676,7 @@ namespace SDL { return false; if (alpaka::math::abs(acc, dAlphaOuterMDSegment) >= dAlphaThresholdValues[1]) return false; - return alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaThresholdValues[2] + return alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaThresholdValues[2]; }; template @@ -1068,7 +1068,7 @@ namespace SDL { (hitsInGPU.zs[mdsInGPU.anchorHitIndices[outerMDIndex]]); score_lsq = score_lsq * score_lsq; - unsigned int hits1[objHits::kpLS]; + unsigned int hits1[Params_pLS::kHits]; hits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[innerMDIndex]]; hits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[outerMDIndex]]; hits1[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[innerMDIndex]]; diff --git a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h index c527bc0eb9373..5adb74e79932e 100644 --- a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h +++ b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h @@ -83,10 +83,10 @@ namespace SDL { nTrackCandidatespT5_buf(allocBufWrapper(devAccIn, 1, queue)), nTrackCandidatespLS_buf(allocBufWrapper(devAccIn, 1, queue)), nTrackCandidatesT5_buf(allocBufWrapper(devAccIn, 1, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, objLayers::kpT5 * maxTrackCandidates, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, objHits::kpT5 * maxTrackCandidates, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, Params_pT5::kLayers * maxTrackCandidates, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, Params_pT5::kHits * maxTrackCandidates, queue)), pixelSeedIndex_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, objLayers::kpT5 * maxTrackCandidates, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, Params_pT5::kLayers * maxTrackCandidates, queue)), centerX_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), centerY_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), radius_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)) { @@ -115,11 +115,11 @@ namespace SDL { trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = trackletIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = trackletIndex; - trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 0] = + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 0] = hitIndices.x; // Order explanation in https://github.com/SegmentLinking/TrackLooper/issues/267 - trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 1] = hitIndices.z; - trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 2] = hitIndices.y; - trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 3] = hitIndices.w; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 1] = hitIndices.z; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 2] = hitIndices.y; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 3] = hitIndices.w; }; ALPAKA_FN_ACC ALPAKA_FN_INLINE void addTrackCandidateToMemory(struct SDL::trackCandidates& trackCandidatesInGPU, @@ -142,16 +142,16 @@ namespace SDL { trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = innerTrackletIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = outerTrackletIndex; - size_t limits = trackCandidateType == 7 ? objLayers::kpT5 - : objLayers::kpT3; // 7 means pT5, objLayers::kpT3 = objLayers::kT5 = 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++) { - trackCandidatesInGPU.logicalLayers[objLayers::kpT5 * trackCandidateIndex + i] = logicalLayerIndices[i]; - trackCandidatesInGPU.lowerModuleIndices[objLayers::kpT5 * trackCandidateIndex + i] = lowerModuleIndices[i]; + trackCandidatesInGPU.logicalLayers[Params_pT5::kLayers * trackCandidateIndex + i] = logicalLayerIndices[i]; + trackCandidatesInGPU.lowerModuleIndices[Params_pT5::kLayers * trackCandidateIndex + i] = lowerModuleIndices[i]; } for (size_t i = 0; i < 2 * limits; i++) { - trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + i] = hitIndices[i]; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + i] = hitIndices[i]; } trackCandidatesInGPU.centerX[trackCandidateIndex] = __F2H(centerX); trackCandidatesInGPU.centerY[trackCandidateIndex] = __F2H(centerY); @@ -163,8 +163,8 @@ namespace SDL { struct SDL::miniDoublets& mdsInGPU, struct SDL::segments& segmentsInGPU, struct SDL::hits& hitsInGPU) { - int phits1[objHits::kpLS]; - int phits2[objHits::kpLS]; + int phits1[Params_pLS::kHits]; + int phits2[Params_pLS::kHits]; phits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segmentsInGPU.mdIndices[2 * ix]]]; phits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segmentsInGPU.mdIndices[2 * ix + 1]]]; @@ -178,12 +178,12 @@ namespace SDL { int npMatched = 0; - for (int i = 0; i < objHits::kpLS; i++) { + for (int i = 0; i < Params_pLS::kHits; i++) { bool pmatched = false; if (phits1[i] == -1) continue; - for (int j = 0; j < objHits::kpLS; j++) { + for (int j = 0; j < Params_pLS::kHits; j++) { if (phits2[j] == -1) continue; @@ -415,9 +415,9 @@ namespace SDL { 5 /*track candidate type pT3=5*/, pixelTripletIndex, pixelTripletIndex, - &pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex], - &pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex], - &pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex], + &pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex], + &pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex], + &pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex], segmentsInGPU.seedIdx[pT3PixelIndex - pLS_offset], __H2F(pixelTripletsInGPU.centerX[pixelTripletIndex]), __H2F(pixelTripletsInGPU.centerY[pixelTripletIndex]), @@ -468,9 +468,9 @@ namespace SDL { 4 /*track candidate type T5=4*/, quintupletIndex, quintupletIndex, - &quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex], - &quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex], - &quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex], + &quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex], + &quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex], + &quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex], -1 /*no pixel seed index for T5s*/, quintupletsInGPU.regressionG[quintupletIndex], quintupletsInGPU.regressionF[quintupletIndex], @@ -560,9 +560,9 @@ namespace SDL { 7 /*track candidate type pT5=7*/, pT5PixelIndex, pixelQuintupletsInGPU.T5Indices[pixelQuintupletIndex], - &pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex], - &pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex], - &pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * 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]), diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 2bc5e63cd0098..08309b1f50443 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -108,12 +108,12 @@ namespace SDL { template tripletsBuffer(unsigned int maxTriplets, unsigned int nLowerModules, TDevAcc const& devAccIn, TQueue& queue) : segmentIndices_buf(allocBufWrapper(devAccIn, 2 * maxTriplets, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, objLayers::kT3 * maxTriplets, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, Params_T3::kLayers * maxTriplets, queue)), nTriplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), totOccupancyTriplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), nMemoryLocations_buf(allocBufWrapper(devAccIn, 1, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxTriplets * objLayers::kT3, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxTriplets * objHits::kT3, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxTriplets * Params_T3::kLayers, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxTriplets * Params_T3::kHits, queue)), betaIn_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), circleRadius_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), circleCenterX_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), @@ -191,31 +191,31 @@ namespace SDL { { tripletsInGPU.segmentIndices[tripletIndex * 2] = innerSegmentIndex; tripletsInGPU.segmentIndices[tripletIndex * 2 + 1] = outerSegmentIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * objLayers::kT3] = innerInnerLowerModuleIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * objLayers::kT3 + 1] = middleLowerModuleIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * objLayers::kT3 + 2] = outerOuterLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * Params_T3::kLayers] = innerInnerLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * Params_T3::kLayers + 1] = middleLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * Params_T3::kLayers + 2] = outerOuterLowerModuleIndex; tripletsInGPU.betaIn[tripletIndex] = __F2H(betaIn); tripletsInGPU.circleRadius[tripletIndex] = circleRadius; tripletsInGPU.circleCenterX[tripletIndex] = circleCenterX; tripletsInGPU.circleCenterY[tripletIndex] = circleCenterY; - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers] = modulesInGPU.layers[innerInnerLowerModuleIndex] + (modulesInGPU.subdets[innerInnerLowerModuleIndex] == 4) * 6; - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 1] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 1] = modulesInGPU.layers[middleLowerModuleIndex] + (modulesInGPU.subdets[middleLowerModuleIndex] == 4) * 6; - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 2] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 2] = modulesInGPU.layers[outerOuterLowerModuleIndex] + (modulesInGPU.subdets[outerOuterLowerModuleIndex] == 4) * 6; //get the hits unsigned int firstMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex]; unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex + 1]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * outerSegmentIndex + 1]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3] = mdsInGPU.anchorHitIndices[firstMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 2] = mdsInGPU.anchorHitIndices[secondMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 3] = mdsInGPU.outerHitIndices[secondMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 4] = mdsInGPU.anchorHitIndices[thirdMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 5] = mdsInGPU.outerHitIndices[thirdMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits] = mdsInGPU.anchorHitIndices[firstMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 2] = mdsInGPU.anchorHitIndices[secondMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 3] = mdsInGPU.outerHitIndices[secondMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 4] = mdsInGPU.anchorHitIndices[thirdMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 5] = mdsInGPU.outerHitIndices[thirdMDIndex]; #ifdef CUT_VALUE_DEBUG tripletsInGPU.zOut[tripletIndex] = zOut; tripletsInGPU.rtOut[tripletIndex] = rtOut; @@ -347,7 +347,7 @@ namespace SDL { float coshEta = dr3_InSeg / drt_InSeg; float dzErr = (zpitchIn + zpitchOut) * (zpitchIn + zpitchOut) * 2.f; - float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f) * (r3In / rtIn); + float sdlThetaMulsF2 = (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f) * (r3In / rtIn); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; dzErr += sdlMuls2 * drt_OutIn * drt_OutIn / 3.f * coshEta * coshEta; dzErr = alpaka::math::sqrt(acc, dzErr); @@ -388,7 +388,7 @@ namespace SDL { (0.02f / drt_InSeg); //Cut #3: first beta cut - return alpaka::math::abs(acc, betaIn) < betaInCut + return alpaka::math::abs(acc, betaIn) < betaInCut; }; template @@ -465,7 +465,7 @@ namespace SDL { const float kZ = (zOut - zIn) / dzSDIn; float drtErr = zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ); - const float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2 * (rtOut - rtIn) / 50.f) * (rIn / rtIn); + const float sdlThetaMulsF2 = (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2 * (rtOut - rtIn) / 50.f) * (rIn / rtIn); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; drtErr += sdlMuls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta; drtErr = alpaka::math::sqrt(acc, drtErr); @@ -575,7 +575,7 @@ namespace SDL { float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f); float kZ = (zOut - zIn) / dzSDIn; - float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f); + float sdlThetaMulsF2 = (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f;