From acff43f8e726cf2395b257bfce777268d40504b3 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Fri, 20 Sep 2024 08:30:54 -0700 Subject: [PATCH] Switched to only using views --- RecoTracker/LSTCore/src/alpaka/Event.dev.cc | 125 +++++++++--------- RecoTracker/LSTCore/src/alpaka/Event.h | 9 +- RecoTracker/LSTCore/src/alpaka/Kernels.h | 44 +++--- .../LSTCore/src/alpaka/NeuralNetwork.h | 4 +- .../LSTCore/src/alpaka/PixelQuintuplet.h | 42 +++--- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 114 ++++++++-------- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 62 ++++----- RecoTracker/LSTCore/src/alpaka/Segment.h | 113 ++++++++-------- .../LSTCore/src/alpaka/TrackCandidate.h | 69 +++++----- RecoTracker/LSTCore/src/alpaka/Triplet.h | 55 ++++---- .../standalone/code/core/AccessHelper.cc | 12 +- .../standalone/code/core/write_lst_ntuple.cc | 80 +++++------ 12 files changed, 376 insertions(+), 353 deletions(-) diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index 2f73e77478de1..6b8b746704f9a 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -57,7 +57,6 @@ void Event::resetEventSync() { miniDoubletsBuffers_.reset(); rangesInGPU_.reset(); rangesBuffers_.reset(); - segmentsDevCol_.reset(); segmentsDev_.reset(); tripletsInGPU_.reset(); tripletsBuffers_.reset(); @@ -73,7 +72,6 @@ void Event::resetEventSync() { hitsInCPU_.reset(); rangesInCPU_.reset(); mdsInCPU_.reset(); - segmentsHostCol_.reset(); segmentsHost_.reset(); tripletsInCPU_.reset(); quintupletsInCPU_.reset(); @@ -202,7 +200,7 @@ void Event::addPixelSegmentToEvent(std::vector const& hitIndices0, alpaka::memcpy(queue_, miniDoubletsBuffers_->nMemoryLocations_buf, nTotalMDs_buf_h); } - if (!segmentsDevCol_) { + if (!segmentsDev_) { // can be optimized here: because we didn't distinguish pixel segments and outer-tracker segments and call them both "segments", so they use the index continuously. // If we want to further study the memory footprint in detail, we can separate the two and allocate different memories to them @@ -223,12 +221,8 @@ void Event::addPixelSegmentToEvent(std::vector const& hitIndices0, nTotalSegments_ += n_max_pixel_segments_per_module; std::array const segments_sizes{{static_cast(nTotalSegments_), static_cast(nLowerModules_+1), static_cast(n_max_pixel_segments_per_module)}}; - segmentsDevCol_.emplace(segments_sizes, queue_); - - segmentsDev_.emplace(); - segmentsDev_->setData(*segmentsDevCol_); - - alpaka::memcpy(queue_, alpaka::createView(devAcc_, &segmentsDev_->mem.nMemoryLocations(), 1u), nTotalSegments_view); + segmentsDev_.emplace(segments_sizes, queue_); + alpaka::memset(queue_, segmentsDev_->buffer(), 0u); // TODO: We don't need to initialize the entire buffer } auto hitIndices0_dev = allocBufWrapper(devAcc_, size, queue_); @@ -243,29 +237,31 @@ void Event::addPixelSegmentToEvent(std::vector const& hitIndices0, alpaka::memcpy(queue_, hitIndices3_dev, hitIndices3, size); alpaka::memcpy(queue_, dPhiChange_dev, dPhiChange, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.ptIn(), size), ptIn, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.ptErr(), size), ptErr, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.px(), size), px, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.py(), size), py, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.pz(), size), pz, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.etaErr(), size), etaErr, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.isQuad(), size), isQuad, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.eta(), size), eta, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.phi(), size), phi, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.charge(), size), charge, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.seedIdx(), size), seedIdx, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.superbin(), size), superbin, size); - alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsDev_->pix.pixelType(), size), pixelType, size); + SegmentsPixel segmentsPixel = segmentsDev_->view(); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.ptIn(), size), ptIn, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.ptErr(), size), ptErr, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.px(), size), px, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.py(), size), py, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.pz(), size), pz, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.etaErr(), size), etaErr, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.isQuad(), size), isQuad, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.eta(), size), eta, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.phi(), size), phi, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.charge(), size), charge, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.seedIdx(), size), seedIdx, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.superbin(), size), superbin, size); + alpaka::memcpy(queue_, alpaka::createView(devAcc_, segmentsPixel.pixelType(), size), pixelType, size); // Create source views for size and mdSize auto src_view_size = alpaka::createView(cms::alpakatools::host(), &size, (Idx)1u); auto src_view_mdSize = alpaka::createView(cms::alpakatools::host(), &mdSize, (Idx)1u); - auto nSegments_view = alpaka::createView(devAcc_, segmentsDev_->mod.nSegments(), (Idx)nLowerModules_+1); + SegmentsOccupancy segmentsOccupancy = segmentsDev_->view(); + auto nSegments_view = alpaka::createView(devAcc_, segmentsOccupancy.nSegments(), (Idx)nLowerModules_+1); auto dst_view_segments = alpaka::createSubView(nSegments_view, (Idx)1u, (Idx)pixelModuleIndex); alpaka::memcpy(queue_, dst_view_segments, src_view_size); - auto totOccupancySegments_view = alpaka::createView(devAcc_, segmentsDev_->mod.totOccupancySegments(), (Idx)nLowerModules_+1); + auto totOccupancySegments_view = alpaka::createView(devAcc_, segmentsOccupancy.totOccupancySegments(), (Idx)nLowerModules_+1); auto dst_view_totOccupancySegments = alpaka::createSubView(totOccupancySegments_view, (Idx)1u, (Idx)pixelModuleIndex); alpaka::memcpy(queue_, dst_view_totOccupancySegments, src_view_size); @@ -290,7 +286,8 @@ void Event::addPixelSegmentToEvent(std::vector const& hitIndices0, *rangesInGPU_, *hitsInGPU_, *mdsInGPU_, - *segmentsDev_, + segmentsDev_->view(), + segmentsDev_->view(), hitIndices0_dev.data(), hitIndices1_dev.data(), hitIndices2_dev.data(), @@ -360,9 +357,8 @@ void Event::createMiniDoublets() { void Event::createSegmentsWithModuleMap() { if (!segmentsDev_) { std::array const segments_sizes{{static_cast(nTotalSegments_), static_cast(nLowerModules_+1), static_cast(n_max_pixel_segments_per_module)}}; - segmentsDevCol_.emplace(segments_sizes, queue_); - segmentsDev_.emplace(); - segmentsDev_->setData(*segmentsDevCol_); + segmentsDev_.emplace(segments_sizes, queue_); + alpaka::memset(queue_, segmentsDev_->buffer(), 0u); // TODO: We don't need to initialize the entire buffer } Vec3D const threadsPerBlockCreateSeg{1, 1, 64}; @@ -375,7 +371,8 @@ void Event::createSegmentsWithModuleMap() { CreateSegmentsInGPUv2{}, *modulesBuffers_.data(), *mdsInGPU_, - *segmentsDev_, + segmentsDev_->view(), + segmentsDev_->view(), *rangesInGPU_); WorkDiv1D const addSegmentRangesToEventExplicit_workDiv = createWorkDiv({1}, {1024}, {1}); @@ -384,7 +381,7 @@ void Event::createSegmentsWithModuleMap() { addSegmentRangesToEventExplicit_workDiv, AddSegmentRangesToEventExplicit{}, *modulesBuffers_.data(), - *segmentsDev_, + segmentsDev_->view(), *rangesInGPU_); if (addObjects_) { @@ -401,7 +398,7 @@ void Event::createTriplets() { CreateTripletArrayRanges{}, *modulesBuffers_.data(), *rangesInGPU_, - *segmentsDev_); + segmentsDev_->const_view()); // TODO: Why are we pulling this back down only to put it back on the device in a new struct? auto maxTriplets_buf_h = cms::alpakatools::make_host_buffer(queue_, (Idx)1u); @@ -421,7 +418,7 @@ void Event::createTriplets() { // Allocate and copy nSegments from device to host (only nLowerModules in OT, not the +1 with pLSs) auto nSegments_buf_h = cms::alpakatools::make_host_buffer(queue_, nLowerModules_); - auto nSegments_buf_d = alpaka::createView(devAcc_, segmentsDev_->mod.nSegments(), nLowerModules_); + auto nSegments_buf_d = alpaka::createView(devAcc_, segmentsDev_->const_view().nSegments(), nLowerModules_); alpaka::memcpy(queue_, nSegments_buf_h, nSegments_buf_d, nLowerModules_); // ... same for module_nConnectedModules @@ -462,7 +459,8 @@ void Event::createTriplets() { CreateTripletsInGPUv2{}, *modulesBuffers_.data(), *mdsInGPU_, - *segmentsDev_, + segmentsDev_->const_view(), + segmentsDev_->const_view(), *tripletsInGPU_, *rangesInGPU_, index_gpu_buf.data(), @@ -500,7 +498,7 @@ void Event::createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets) { *modulesBuffers_.data(), *rangesInGPU_, *pixelTripletsInGPU_, - *segmentsDev_, + segmentsDev_->const_view(), *pixelQuintupletsInGPU_); WorkDiv1D const addpT3asTrackCandidatesInGPU_workDiv = createWorkDiv({1}, {512}, {1}); @@ -511,7 +509,7 @@ void Event::createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets) { nLowerModules_, *pixelTripletsInGPU_, *trackCandidatesInGPU_, - *segmentsDev_, + segmentsDev_->const_view(), *rangesInGPU_); // Pull nEligibleT5Modules from the device. @@ -564,7 +562,7 @@ void Event::createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets) { WorkDiv3D const checkHitspLS_workDiv = createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread); - alpaka::exec(queue_, checkHitspLS_workDiv, CheckHitspLS{}, *modulesBuffers_.data(), *segmentsDev_, true); + alpaka::exec(queue_, checkHitspLS_workDiv, CheckHitspLS{}, *modulesBuffers_.data(), segmentsDev_->const_view(), segmentsDev_->view(), true); } Vec3D const threadsPerBlock_crossCleanpLS{1, 16, 32}; @@ -579,7 +577,9 @@ void Event::createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets) { *rangesInGPU_, *pixelTripletsInGPU_, *trackCandidatesInGPU_, - *segmentsDev_, + segmentsDev_->const_view(), + segmentsDev_->const_view(), + segmentsDev_->view(), *mdsInGPU_, *hitsInGPU_, *quintupletsInGPU_); @@ -594,7 +594,8 @@ void Event::createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets) { AddpLSasTrackCandidateInGPU{}, nLowerModules_, *trackCandidatesInGPU_, - *segmentsDev_, + segmentsDev_->const_view(), + segmentsDev_->const_view(), tc_pls_triplets); // Check if either n_max_pixel_track_candidates or n_max_nonpixel_track_candidates was reached @@ -629,12 +630,14 @@ void Event::createPixelTriplets() { pixelTripletsBuffers_.emplace(n_max_pixel_triplets, devAcc_, queue_); pixelTripletsInGPU_->setData(*pixelTripletsBuffers_); } + SegmentsOccupancy segmentsOccupancy = segmentsDev_->view(); + SegmentsPixelConst segmentsPixel = segmentsDev_->view(); auto superbins_buf = allocBufWrapper(cms::alpakatools::host(), n_max_pixel_segments_per_module, queue_); auto pixelTypes_buf = allocBufWrapper(cms::alpakatools::host(), n_max_pixel_segments_per_module, queue_); - alpaka::memcpy(queue_, superbins_buf, alpaka::createView(devAcc_, segmentsDev_->pix.superbin(), n_max_pixel_segments_per_module)); - alpaka::memcpy(queue_, pixelTypes_buf, alpaka::createView(devAcc_, segmentsDev_->pix.pixelType(), n_max_pixel_segments_per_module)); + alpaka::memcpy(queue_, superbins_buf, alpaka::createView(devAcc_, segmentsPixel.superbin(), n_max_pixel_segments_per_module)); + alpaka::memcpy(queue_, pixelTypes_buf, alpaka::createView(devAcc_, segmentsPixel.pixelType(), n_max_pixel_segments_per_module)); auto const* superbins = superbins_buf.data(); auto const* pixelTypes = pixelTypes_buf.data(); @@ -643,7 +646,7 @@ void Event::createPixelTriplets() { // Create a sub-view for the device buffer unsigned int totalModules = nLowerModules_ + 1; - auto dev_view_nSegments_buf = alpaka::createView(devAcc_, segmentsDev_->mod.nSegments(), totalModules); + auto dev_view_nSegments_buf = alpaka::createView(devAcc_, segmentsOccupancy.nSegments(), totalModules); auto dev_view_nSegments = alpaka::createSubView(dev_view_nSegments_buf, (Idx)1u, (Idx)nLowerModules_); alpaka::memcpy(queue_, nInnerSegments_src_view, dev_view_nSegments); @@ -714,7 +717,8 @@ void Event::createPixelTriplets() { *modulesBuffers_.data(), *rangesInGPU_, *mdsInGPU_, - *segmentsDev_, + segmentsDev_->const_view(), + segmentsDev_->const_view(), *tripletsInGPU_, *pixelTripletsInGPU_, connectedPixelSize_dev_buf.data(), @@ -779,7 +783,7 @@ void Event::createQuintuplets() { CreateQuintupletsInGPUv2{}, *modulesBuffers_.data(), *mdsInGPU_, - *segmentsDev_, + segmentsDev_->const_view(), *tripletsInGPU_, *quintupletsInGPU_, *rangesInGPU_, @@ -818,7 +822,7 @@ void Event::pixelLineSegmentCleaning(bool no_pls_dupclean) { WorkDiv3D const checkHitspLS_workDiv = createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread); - alpaka::exec(queue_, checkHitspLS_workDiv, CheckHitspLS{}, *modulesBuffers_.data(), *segmentsDev_, false); + alpaka::exec(queue_, checkHitspLS_workDiv, CheckHitspLS{}, *modulesBuffers_.data(), segmentsDev_->const_view(), segmentsDev_->view(), false); } } @@ -833,12 +837,14 @@ void Event::createPixelQuintuplets() { trackCandidatesBuffers_.emplace(n_max_nonpixel_track_candidates + n_max_pixel_track_candidates, devAcc_, queue_); trackCandidatesInGPU_->setData(*trackCandidatesBuffers_); } + SegmentsOccupancy segmentsOccupancy = segmentsDev_->view(); + SegmentsPixelConst segmentsPixel = segmentsDev_->view(); auto superbins_buf = allocBufWrapper(cms::alpakatools::host(), n_max_pixel_segments_per_module, queue_); auto pixelTypes_buf = allocBufWrapper(cms::alpakatools::host(), n_max_pixel_segments_per_module, queue_); - alpaka::memcpy(queue_, superbins_buf, alpaka::createView(devAcc_, segmentsDev_->pix.superbin(), n_max_pixel_segments_per_module)); - alpaka::memcpy(queue_, pixelTypes_buf, alpaka::createView(devAcc_, segmentsDev_->pix.pixelType(), n_max_pixel_segments_per_module)); + alpaka::memcpy(queue_, superbins_buf, alpaka::createView(devAcc_, segmentsPixel.superbin(), n_max_pixel_segments_per_module)); + alpaka::memcpy(queue_, pixelTypes_buf, alpaka::createView(devAcc_, segmentsPixel.pixelType(), n_max_pixel_segments_per_module)); auto const* superbins = superbins_buf.data(); auto const* pixelTypes = pixelTypes_buf.data(); @@ -847,7 +853,7 @@ void Event::createPixelQuintuplets() { // Create a sub-view for the device buffer unsigned int totalModules = nLowerModules_ + 1; - auto dev_view_nSegments_buf = alpaka::createView(devAcc_, segmentsDev_->mod.nSegments(), totalModules); + auto dev_view_nSegments_buf = alpaka::createView(devAcc_, segmentsOccupancy.nSegments(), totalModules); auto dev_view_nSegments = alpaka::createSubView(dev_view_nSegments_buf, (Idx)1u, (Idx)nLowerModules_); alpaka::memcpy(queue_, nInnerSegments_src_view, dev_view_nSegments); @@ -916,7 +922,8 @@ void Event::createPixelQuintuplets() { CreatePixelQuintupletsInGPUFromMapv2{}, *modulesBuffers_.data(), *mdsInGPU_, - *segmentsDev_, + segmentsDev_->const_view(), + segmentsDev_->view(), *tripletsInGPU_, *quintupletsInGPU_, *pixelQuintupletsInGPU_, @@ -943,7 +950,7 @@ void Event::createPixelQuintuplets() { nLowerModules_, *pixelQuintupletsInGPU_, *trackCandidatesInGPU_, - *segmentsDev_, + segmentsDev_->const_view(), *rangesInGPU_); #ifdef WARNINGS @@ -990,7 +997,7 @@ void Event::addMiniDoubletsToEventExplicit() { void Event::addSegmentsToEventExplicit() { auto nSegmentsCPU_buf = allocBufWrapper(cms::alpakatools::host(), nLowerModules_, queue_); - auto nSegments_buf = alpaka::createView(devAcc_, segmentsDev_->mod.nSegments(), nLowerModules_); + auto nSegments_buf = alpaka::createView(devAcc_, segmentsDev_->const_view().nSegments(), nLowerModules_); alpaka::memcpy(queue_, nSegmentsCPU_buf, nSegments_buf, nLowerModules_); // FIXME: replace by ES host data @@ -1355,20 +1362,20 @@ MiniDoubletsBuffer& Event::getMiniDoublets(bool sync) { return mdsInCPU_.value(); } -Segments& Event::getSegments(bool sync) { +template +typename TSoA::ConstView Event::getSegments(bool sync) { + if constexpr (std::is_same_v) + return segmentsDev_->const_view(); if (!segmentsHost_) { - if constexpr (std::is_same_v) { - segmentsHost_.emplace(*segmentsDev_); - } else { - segmentsHostCol_.emplace(cms::alpakatools::CopyToHost::copyAsync(queue_, *segmentsDevCol_)); - segmentsHost_.emplace(); - segmentsHost_->setData(*segmentsHostCol_); - } + segmentsHost_.emplace(cms::alpakatools::CopyToHost::copyAsync(queue_, *segmentsDev_)); if (sync) alpaka::wait(queue_); // host consumers expect filled data } - return segmentsHost_.value(); + return segmentsHost_->const_view(); } +template SegmentsConst Event::getSegments(bool); +template SegmentsOccupancyConst Event::getSegments(bool); +template SegmentsPixelConst Event::getSegments(bool); TripletsBuffer& Event::getTriplets(bool sync) { if (!tripletsInCPU_) { diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index 68816bbb65a6c..398370438d0a5 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -48,8 +48,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { std::optional> hitsBuffers_; std::optional mdsInGPU_; std::optional> miniDoubletsBuffers_; - std::optional segmentsDevCol_; - std::optional segmentsDev_; + std::optional segmentsDev_; std::optional tripletsInGPU_; std::optional> tripletsBuffers_; std::optional quintupletsInGPU_; @@ -65,8 +64,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { std::optional> rangesInCPU_; std::optional> hitsInCPU_; std::optional> mdsInCPU_; - std::optional segmentsHostCol_; - std::optional segmentsHost_; + std::optional segmentsHost_; std::optional> tripletsInCPU_; std::optional> trackCandidatesInCPU_; std::optional> modulesInCPU_; @@ -185,7 +183,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { HitsBuffer& getHitsInCMSSW(bool sync = true); ObjectRangesBuffer& getRanges(bool sync = true); MiniDoubletsBuffer& getMiniDoublets(bool sync = true); - Segments& getSegments(bool sync = true); + template + typename TSoA::ConstView getSegments(bool sync = true); TripletsBuffer& getTriplets(bool sync = true); QuintupletsBuffer& getQuintuplets(bool sync = true); PixelTripletsBuffer& getPixelTriplets(bool sync = true); diff --git a/RecoTracker/LSTCore/src/alpaka/Kernels.h b/RecoTracker/LSTCore/src/alpaka/Kernels.h index 1cd3ef07145de..0f907dbe243dd 100644 --- a/RecoTracker/LSTCore/src/alpaka/Kernels.h +++ b/RecoTracker/LSTCore/src/alpaka/Kernels.h @@ -30,10 +30,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { pixelQuintupletsInGPU.isDup[pixelQuintupletIndex] = true; } - ALPAKA_FN_ACC ALPAKA_FN_INLINE void rmPixelSegmentFromMemory(Segments segments, + ALPAKA_FN_ACC ALPAKA_FN_INLINE void rmPixelSegmentFromMemory(SegmentsPixel segmentsPixel, unsigned int pixelSegmentArrayIndex, bool secondpass = false) { - segments.pix.isDup()[pixelSegmentArrayIndex] |= 1 + secondpass; + segmentsPixel.isDup()[pixelSegmentArrayIndex] |= 1 + secondpass; } ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitsT5(unsigned int ix, @@ -331,40 +331,40 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { struct CheckHitspLS { template - ALPAKA_FN_ACC void operator()(TAcc const& acc, Modules modulesInGPU, Segments segments, bool secondpass) const { + ALPAKA_FN_ACC void operator()(TAcc const& acc, Modules modulesInGPU, SegmentsOccupancyConst segmentsOccupancy, SegmentsPixel segmentsPixel, bool secondpass) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); int pixelModuleIndex = *modulesInGPU.nLowerModules; - unsigned int nPixelSegments = segments.mod.nSegments()[pixelModuleIndex]; + unsigned int nPixelSegments = segmentsOccupancy.nSegments()[pixelModuleIndex]; if (nPixelSegments > n_max_pixel_segments_per_module) nPixelSegments = n_max_pixel_segments_per_module; for (unsigned int ix = globalThreadIdx[1]; ix < nPixelSegments; ix += gridThreadExtent[1]) { - if (secondpass && (!segments.pix.isQuad()[ix] || (segments.pix.isDup()[ix] & 1))) + if (secondpass && (!segmentsPixel.isQuad()[ix] || (segmentsPixel.isDup()[ix] & 1))) continue; unsigned int phits1[Params_pLS::kHits]; - phits1[0] = segments.pix.pLSHitsIdxs()[ix].x; - phits1[1] = segments.pix.pLSHitsIdxs()[ix].y; - phits1[2] = segments.pix.pLSHitsIdxs()[ix].z; - phits1[3] = segments.pix.pLSHitsIdxs()[ix].w; - float eta_pix1 = segments.pix.eta()[ix]; - float phi_pix1 = segments.pix.phi()[ix]; + phits1[0] = segmentsPixel.pLSHitsIdxs()[ix].x; + phits1[1] = segmentsPixel.pLSHitsIdxs()[ix].y; + phits1[2] = segmentsPixel.pLSHitsIdxs()[ix].z; + phits1[3] = segmentsPixel.pLSHitsIdxs()[ix].w; + float eta_pix1 = segmentsPixel.eta()[ix]; + float phi_pix1 = segmentsPixel.phi()[ix]; for (unsigned int jx = ix + 1 + globalThreadIdx[2]; jx < nPixelSegments; jx += gridThreadExtent[2]) { - float eta_pix2 = segments.pix.eta()[jx]; - float phi_pix2 = segments.pix.phi()[jx]; + float eta_pix2 = segmentsPixel.eta()[jx]; + float phi_pix2 = segmentsPixel.phi()[jx]; if (alpaka::math::abs(acc, eta_pix2 - eta_pix1) > 0.1f) continue; - if (secondpass && (!segments.pix.isQuad()[jx] || (segments.pix.isDup()[jx] & 1))) + if (secondpass && (!segmentsPixel.isQuad()[jx] || (segmentsPixel.isDup()[jx] & 1))) continue; - int8_t quad_diff = segments.pix.isQuad()[ix] - segments.pix.isQuad()[jx]; - float score_diff = segments.pix.score()[ix] - segments.pix.score()[jx]; + int8_t quad_diff = segmentsPixel.isQuad()[ix] - segmentsPixel.isQuad()[jx]; + float score_diff = segmentsPixel.score()[ix] - segmentsPixel.score()[jx]; // Always keep quads over trips. If they are the same, we want the object with better score int idxToRemove; if (quad_diff > 0) @@ -379,10 +379,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { idxToRemove = ix; unsigned int phits2[Params_pLS::kHits]; - phits2[0] = segments.pix.pLSHitsIdxs()[jx].x; - phits2[1] = segments.pix.pLSHitsIdxs()[jx].y; - phits2[2] = segments.pix.pLSHitsIdxs()[jx].z; - phits2[3] = segments.pix.pLSHitsIdxs()[jx].w; + phits2[0] = segmentsPixel.pLSHitsIdxs()[jx].x; + phits2[1] = segmentsPixel.pLSHitsIdxs()[jx].y; + phits2[2] = segmentsPixel.pLSHitsIdxs()[jx].z; + phits2[3] = segmentsPixel.pLSHitsIdxs()[jx].w; int npMatched = 0; for (int i = 0; i < Params_pLS::kHits; i++) { @@ -402,7 +402,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { } const int minNHitsForDup_pLS = 3; if (npMatched >= minNHitsForDup_pLS) { - rmPixelSegmentFromMemory(segments, idxToRemove, secondpass); + rmPixelSegmentFromMemory(segmentsPixel, idxToRemove, secondpass); } if (secondpass) { float dEta = alpaka::math::abs(acc, eta_pix1 - eta_pix2); @@ -410,7 +410,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { float dR2 = dEta * dEta + dPhi * dPhi; if ((npMatched >= 1) || (dR2 < 1e-5f)) { - rmPixelSegmentFromMemory(segments, idxToRemove, secondpass); + rmPixelSegmentFromMemory(segmentsPixel, idxToRemove, secondpass); } } } diff --git a/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h b/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h index 7f25f5882a8e8..8171a67e09705 100644 --- a/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h +++ b/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h @@ -18,7 +18,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE float runInference(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, Triplets const& tripletsInGPU, const float* xVec, const float* yVec, @@ -59,7 +59,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { layer2_adjustment = 1; // get upper segment to be in second layer } unsigned int md_idx_for_t5_eta_phi = - segments.mem.mdIndices()[2 * tripletsInGPU.segmentIndices[2 * innerTripletIndex + layer2_adjustment]][0]; + segments.mdIndices()[2 * tripletsInGPU.segmentIndices[2 * innerTripletIndex + layer2_adjustment]][0]; bool is_endcap1 = (modulesInGPU.subdets[lowerModuleIndex1] == 4); // true if anchor hit 1 is in the endcap bool is_endcap2 = (modulesInGPU.subdets[lowerModuleIndex2] == 4); // true if anchor hit 2 is in the endcap bool is_endcap3 = (modulesInGPU.subdets[lowerModuleIndex3] == 4); // true if anchor hit 3 is in the endcap diff --git a/RecoTracker/LSTCore/src/alpaka/PixelQuintuplet.h b/RecoTracker/LSTCore/src/alpaka/PixelQuintuplet.h index 7d39609fc78f2..1989c7bd67983 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelQuintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelQuintuplet.h @@ -108,7 +108,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE void addPixelQuintupletToMemory(Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, Quintuplets const& quintupletsInGPU, PixelQuintuplets& pixelQuintupletsInGPU, unsigned int pixelIndex, @@ -150,9 +150,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 4]; pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex] = - segments.mem.innerLowerModuleIndices()[pixelIndex]; + segments.innerLowerModuleIndices()[pixelIndex]; pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 1] = - segments.mem.outerLowerModuleIndices()[pixelIndex]; + segments.outerLowerModuleIndices()[pixelIndex]; pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 2] = quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers]; pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 3] = @@ -164,8 +164,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 6] = quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 4]; - unsigned int pixelInnerMD = segments.mem.mdIndices()[Params_pLS::kLayers * pixelIndex][0]; - unsigned int pixelOuterMD = segments.mem.mdIndices()[Params_pLS::kLayers * pixelIndex][1]; + unsigned int pixelInnerMD = segments.mdIndices()[Params_pLS::kLayers * pixelIndex][0]; + unsigned int pixelOuterMD = segments.mdIndices()[Params_pLS::kLayers * pixelIndex][1]; pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; @@ -676,7 +676,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { Modules const& modulesInGPU, ObjectRanges const& rangesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, + SegmentsPixelConst segmentsPixel, Triplets const& tripletsInGPU, Quintuplets const& quintupletsInGPU, unsigned int pixelSegmentIndex, @@ -700,6 +701,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { rangesInGPU, mdsInGPU, segments, + segmentsPixel, tripletsInGPU, pixelSegmentIndex, T5InnerT3Index, @@ -718,13 +720,13 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { unsigned int thirdSegmentIndex = tripletsInGPU.segmentIndices[2 * T5OuterT3Index]; unsigned int fourthSegmentIndex = tripletsInGPU.segmentIndices[2 * T5OuterT3Index + 1]; - unsigned int pixelInnerMDIndex = segments.mem.mdIndices()[pixelSegmentIndex][0]; - unsigned int pixelOuterMDIndex = segments.mem.mdIndices()[pixelSegmentIndex][1]; - unsigned int firstMDIndex = segments.mem.mdIndices()[firstSegmentIndex][0]; - unsigned int secondMDIndex = segments.mem.mdIndices()[secondSegmentIndex][0]; - unsigned int thirdMDIndex = segments.mem.mdIndices()[secondSegmentIndex][1]; - unsigned int fourthMDIndex = segments.mem.mdIndices()[thirdSegmentIndex][1]; - unsigned int fifthMDIndex = segments.mem.mdIndices()[fourthSegmentIndex][1]; + unsigned int pixelInnerMDIndex = segments.mdIndices()[pixelSegmentIndex][0]; + unsigned int pixelOuterMDIndex = segments.mdIndices()[pixelSegmentIndex][1]; + unsigned int firstMDIndex = segments.mdIndices()[firstSegmentIndex][0]; + unsigned int secondMDIndex = segments.mdIndices()[secondSegmentIndex][0]; + unsigned int thirdMDIndex = segments.mdIndices()[secondSegmentIndex][1]; + unsigned int fourthMDIndex = segments.mdIndices()[thirdSegmentIndex][1]; + unsigned int fifthMDIndex = segments.mdIndices()[fourthSegmentIndex][1]; uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex]; uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 1]; @@ -774,9 +776,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { mdsInGPU.anchorY[fifthMDIndex]}; //get the appropriate radii and centers - centerX = segments.pix.circleCenterX()[pixelSegmentArrayIndex]; - centerY = segments.pix.circleCenterY()[pixelSegmentArrayIndex]; - pixelRadius = segments.pix.circleRadius()[pixelSegmentArrayIndex]; + centerX = segmentsPixel.circleCenterX()[pixelSegmentArrayIndex]; + centerY = segmentsPixel.circleCenterY()[pixelSegmentArrayIndex]; + pixelRadius = segmentsPixel.circleRadius()[pixelSegmentArrayIndex]; float T5CenterX = quintupletsInGPU.regressionG[quintupletIndex]; float T5CenterY = quintupletsInGPU.regressionF[quintupletIndex]; @@ -822,7 +824,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC void operator()(TAcc const& acc, Modules modulesInGPU, MiniDoublets mdsInGPU, - Segments segments, + SegmentsConst segments, + SegmentsPixel segmentsPixel, Triplets tripletsInGPU, Quintuplets quintupletsInGPU, PixelQuintuplets pixelQuintupletsInGPU, @@ -846,7 +849,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { if (modulesInGPU.moduleType[quintupletLowerModuleIndex] == TwoS) continue; uint16_t pixelModuleIndex = *modulesInGPU.nLowerModules; - if (segments.pix.isDup()[i_pLS]) + if (segmentsPixel.isDup()[i_pLS]) continue; unsigned int nOuterQuintuplets = quintupletsInGPU.nQuintuplets[quintupletLowerModuleIndex]; @@ -872,6 +875,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { rangesInGPU, mdsInGPU, segments, + segmentsPixel, tripletsInGPU, quintupletsInGPU, pixelSegmentIndex, @@ -918,7 +922,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { tripletsInGPU.partOfPT5[quintupletsInGPU.tripletIndices[2 * quintupletIndex]] = true; tripletsInGPU.partOfPT5[quintupletsInGPU.tripletIndices[2 * quintupletIndex + 1]] = true; - segments.pix.partOfPT5()[i_pLS] = true; + segmentsPixel.partOfPT5()[i_pLS] = true; quintupletsInGPU.partOfPT5[quintupletIndex] = true; } // tot occupancy } // end success diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index 08574cc96436e..6e5d61623fdc7 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -130,7 +130,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { }; ALPAKA_FN_ACC ALPAKA_FN_INLINE void addPixelTripletToMemory(MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, Triplets const& tripletsInGPU, PixelTriplets& pixelTripletsInGPU, unsigned int pixelSegmentIndex, @@ -173,9 +173,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 2]; pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex] = - segments.mem.innerLowerModuleIndices()[pixelSegmentIndex]; + segments.innerLowerModuleIndices()[pixelSegmentIndex]; pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 1] = - segments.mem.outerLowerModuleIndices()[pixelSegmentIndex]; + segments.outerLowerModuleIndices()[pixelSegmentIndex]; pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 2] = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex]; pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 3] = @@ -183,8 +183,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 4] = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 2]; - unsigned int pixelInnerMD = segments.mem.mdIndices()[pixelSegmentIndex][0]; - unsigned int pixelOuterMD = segments.mem.mdIndices()[pixelSegmentIndex][1]; + unsigned int pixelInnerMD = segments.mdIndices()[pixelSegmentIndex][0]; + unsigned int pixelOuterMD = segments.mdIndices()[pixelSegmentIndex][1]; pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; @@ -213,7 +213,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { Modules const& modulesInGPU, ObjectRanges const& rangesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, + SegmentsPixelConst segmentsPixel, uint16_t pixelLowerModuleIndex, uint16_t outerInnerLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, @@ -222,11 +223,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { short outerInnerLowerModuleSubdet = modulesInGPU.subdets[outerInnerLowerModuleIndex]; short outerOuterLowerModuleSubdet = modulesInGPU.subdets[outerOuterLowerModuleIndex]; - unsigned int firstMDIndex = segments.mem.mdIndices()[Params_LS::kLayers * innerSegmentIndex][0]; - unsigned int secondMDIndex = segments.mem.mdIndices()[Params_LS::kLayers * innerSegmentIndex][1]; + unsigned int firstMDIndex = segments.mdIndices()[Params_LS::kLayers * innerSegmentIndex][0]; + unsigned int secondMDIndex = segments.mdIndices()[Params_LS::kLayers * innerSegmentIndex][1]; - unsigned int thirdMDIndex = segments.mem.mdIndices()[Params_LS::kLayers * outerSegmentIndex][0]; - unsigned int fourthMDIndex = segments.mem.mdIndices()[Params_LS::kLayers * outerSegmentIndex][1]; + unsigned int thirdMDIndex = segments.mdIndices()[Params_LS::kLayers * outerSegmentIndex][0]; + unsigned int fourthMDIndex = segments.mdIndices()[Params_LS::kLayers * outerSegmentIndex][1]; if (outerInnerLowerModuleSubdet == Barrel and (outerOuterLowerModuleSubdet == Barrel or outerOuterLowerModuleSubdet == Endcap)) { @@ -235,6 +236,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { rangesInGPU, mdsInGPU, segments, + segmentsPixel, pixelLowerModuleIndex, outerInnerLowerModuleIndex, outerOuterLowerModuleIndex, @@ -250,6 +252,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { rangesInGPU, mdsInGPU, segments, + segmentsPixel, pixelLowerModuleIndex, outerInnerLowerModuleIndex, outerOuterLowerModuleIndex, @@ -766,7 +769,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { Modules const& modulesInGPU, ObjectRanges const& rangesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, + SegmentsPixelConst segmentsPixel, Triplets const& tripletsInGPU, unsigned int pixelSegmentIndex, unsigned int tripletIndex, @@ -779,7 +783,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { float& rPhiChiSquaredInwards, bool runChiSquaredCuts = true) { //run pT4 compatibility between the pixel segment and inner segment, and between the pixel and outer segment of the triplet - uint16_t pixelModuleIndex = segments.mem.innerLowerModuleIndices()[pixelSegmentIndex]; + uint16_t pixelModuleIndex = segments.innerLowerModuleIndices()[pixelSegmentIndex]; uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex]; uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 1]; @@ -792,6 +796,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { rangesInGPU, mdsInGPU, segments, + segmentsPixel, pixelModuleIndex, lowerModuleIndex, middleModuleIndex, @@ -805,6 +810,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { rangesInGPU, mdsInGPU, segments, + segmentsPixel, pixelModuleIndex, middleModuleIndex, upperModuleIndex, @@ -815,28 +821,28 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { //pt matching between the pixel ptin and the triplet circle pt unsigned int pixelSegmentArrayIndex = pixelSegmentIndex - rangesInGPU.segmentModuleIndices[pixelModuleIndex]; - float pixelSegmentPt = segments.pix.ptIn()[pixelSegmentArrayIndex]; - float pixelSegmentPtError = segments.pix.ptErr()[pixelSegmentArrayIndex]; - float pixelSegmentPx = segments.pix.px()[pixelSegmentArrayIndex]; - float pixelSegmentPy = segments.pix.py()[pixelSegmentArrayIndex]; - float pixelSegmentPz = segments.pix.pz()[pixelSegmentArrayIndex]; - int pixelSegmentCharge = segments.pix.charge()[pixelSegmentArrayIndex]; + float pixelSegmentPt = segmentsPixel.ptIn()[pixelSegmentArrayIndex]; + float pixelSegmentPtError = segmentsPixel.ptErr()[pixelSegmentArrayIndex]; + float pixelSegmentPx = segmentsPixel.px()[pixelSegmentArrayIndex]; + float pixelSegmentPy = segmentsPixel.py()[pixelSegmentArrayIndex]; + float pixelSegmentPz = segmentsPixel.pz()[pixelSegmentArrayIndex]; + int pixelSegmentCharge = segmentsPixel.charge()[pixelSegmentArrayIndex]; - float pixelG = segments.pix.circleCenterX()[pixelSegmentArrayIndex]; - float pixelF = segments.pix.circleCenterY()[pixelSegmentArrayIndex]; - float pixelRadiusPCA = segments.pix.circleRadius()[pixelSegmentArrayIndex]; + float pixelG = segmentsPixel.circleCenterX()[pixelSegmentArrayIndex]; + float pixelF = segmentsPixel.circleCenterY()[pixelSegmentArrayIndex]; + float pixelRadiusPCA = segmentsPixel.circleRadius()[pixelSegmentArrayIndex]; - unsigned int pixelInnerMDIndex = segments.mem.mdIndices()[Params_pLS::kLayers * pixelSegmentIndex][0]; - unsigned int pixelOuterMDIndex = segments.mem.mdIndices()[Params_pLS::kLayers * pixelSegmentIndex][1]; + unsigned int pixelInnerMDIndex = segments.mdIndices()[Params_pLS::kLayers * pixelSegmentIndex][0]; + unsigned int pixelOuterMDIndex = segments.mdIndices()[Params_pLS::kLayers * pixelSegmentIndex][1]; pixelRadius = pixelSegmentPt * kR1GeVf; float pixelRadiusError = pixelSegmentPtError * kR1GeVf; unsigned int tripletInnerSegmentIndex = tripletsInGPU.segmentIndices[2 * tripletIndex]; unsigned int tripletOuterSegmentIndex = tripletsInGPU.segmentIndices[2 * tripletIndex + 1]; - unsigned int firstMDIndex = segments.mem.mdIndices()[tripletInnerSegmentIndex][0]; - unsigned int secondMDIndex = segments.mem.mdIndices()[tripletInnerSegmentIndex][1]; - unsigned int thirdMDIndex = segments.mem.mdIndices()[tripletOuterSegmentIndex][1]; + unsigned int firstMDIndex = segments.mdIndices()[tripletInnerSegmentIndex][0]; + unsigned int secondMDIndex = segments.mdIndices()[tripletInnerSegmentIndex][1]; + unsigned int thirdMDIndex = segments.mdIndices()[tripletOuterSegmentIndex][1]; float xs[Params_T3::kLayers] = { mdsInGPU.anchorX[firstMDIndex], mdsInGPU.anchorX[secondMDIndex], mdsInGPU.anchorX[thirdMDIndex]}; @@ -922,7 +928,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { Modules modulesInGPU, ObjectRanges rangesInGPU, MiniDoublets mdsInGPU, - Segments segments, + SegmentsConst segments, + SegmentsPixelConst segmentsPixel, Triplets tripletsInGPU, PixelTriplets pixelTripletsInGPU, unsigned int* connectedPixelSize, @@ -960,9 +967,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { unsigned int pixelSegmentIndex = rangesInGPU.segmentModuleIndices[pixelModuleIndex] + i_pLS; - if (segments.pix.isDup()[i_pLS]) + if (segmentsPixel.isDup()[i_pLS]) continue; - if (segments.pix.partOfPT5()[i_pLS]) + if (segmentsPixel.partOfPT5()[i_pLS]) continue; //don't make pT3s for those pixels that are part of pT5 short layer2_adjustment; @@ -993,6 +1000,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { rangesInGPU, mdsInGPU, segments, + segmentsPixel, tripletsInGPU, pixelSegmentIndex, outerTripletIndex, @@ -1006,14 +1014,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { if (success) { float phi = - mdsInGPU.anchorPhi[segments.mem.mdIndices()[tripletsInGPU.segmentIndices[2 * outerTripletIndex] + + mdsInGPU.anchorPhi[segments.mdIndices()[tripletsInGPU.segmentIndices[2 * outerTripletIndex] + layer2_adjustment][0]]; float eta = - mdsInGPU.anchorEta[segments.mem.mdIndices()[tripletsInGPU.segmentIndices[2 * outerTripletIndex] + + mdsInGPU.anchorEta[segments.mdIndices()[tripletsInGPU.segmentIndices[2 * outerTripletIndex] + layer2_adjustment][0]]; - float eta_pix = segments.pix.eta()[i_pLS]; - float phi_pix = segments.pix.phi()[i_pLS]; - float pt = segments.pix.ptIn()[i_pLS]; + float eta_pix = segmentsPixel.eta()[i_pLS]; + float phi_pix = segmentsPixel.phi()[i_pLS]; + float pt = segmentsPixel.ptIn()[i_pLS]; float score = rPhiChiSquared + rPhiChiSquaredInwards; unsigned int totOccupancyPixelTriplets = alpaka::atomicAdd( acc, pixelTripletsInGPU.totOccupancyPixelTriplets, 1u, alpaka::hierarchy::Threads{}); @@ -1157,7 +1165,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { Modules const& modulesInGPU, ObjectRanges const& rangesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, + SegmentsPixelConst segmentsPixel, uint16_t pixelModuleIndex, uint16_t outerInnerLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, @@ -1195,13 +1204,13 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { return false; unsigned int pixelSegmentArrayIndex = innerSegmentIndex - rangesInGPU.segmentModuleIndices[pixelModuleIndex]; - float ptIn = segments.pix.ptIn()[pixelSegmentArrayIndex]; + float ptIn = segmentsPixel.ptIn()[pixelSegmentArrayIndex]; float ptSLo = ptIn; - float px = segments.pix.px()[pixelSegmentArrayIndex]; - float py = segments.pix.py()[pixelSegmentArrayIndex]; - float pz = segments.pix.pz()[pixelSegmentArrayIndex]; - float ptErr = segments.pix.ptErr()[pixelSegmentArrayIndex]; - float etaErr = segments.pix.etaErr()[pixelSegmentArrayIndex]; + float px = segmentsPixel.px()[pixelSegmentArrayIndex]; + float py = segmentsPixel.py()[pixelSegmentArrayIndex]; + float pz = segmentsPixel.pz()[pixelSegmentArrayIndex]; + float ptErr = segmentsPixel.ptErr()[pixelSegmentArrayIndex]; + float etaErr = segmentsPixel.etaErr()[pixelSegmentArrayIndex]; ptSLo = alpaka::math::max(acc, ptCut, ptSLo - 10.0f * alpaka::math::max(acc, ptErr, 0.005f * ptSLo)); ptSLo = alpaka::math::min(acc, 10.0f, ptSLo); @@ -1272,8 +1281,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { //lots of array accesses below this... - float alpha_InLo = __H2F(segments.mem.dPhiChanges()[innerSegmentIndex]); - float alpha_OutLo = __H2F(segments.mem.dPhiChanges()[outerSegmentIndex]); + float alpha_InLo = __H2F(segments.dPhiChanges()[innerSegmentIndex]); + float alpha_OutLo = __H2F(segments.dPhiChanges()[outerSegmentIndex]); bool isEC_lastLayer = modulesInGPU.subdets[outerOuterLowerModuleIndex] == Endcap and modulesInGPU.moduleType[outerOuterLowerModuleIndex] == TwoS; @@ -1415,7 +1424,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { Modules const& modulesInGPU, ObjectRanges const& rangesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, + SegmentsPixelConst segmentsPixel, uint16_t pixelModuleIndex, uint16_t outerInnerLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, @@ -1452,13 +1462,13 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { unsigned int pixelSegmentArrayIndex = innerSegmentIndex - rangesInGPU.segmentModuleIndices[pixelModuleIndex]; - float ptIn = segments.pix.ptIn()[pixelSegmentArrayIndex]; + float ptIn = segmentsPixel.ptIn()[pixelSegmentArrayIndex]; float ptSLo = ptIn; - float px = segments.pix.px()[pixelSegmentArrayIndex]; - float py = segments.pix.py()[pixelSegmentArrayIndex]; - float pz = segments.pix.pz()[pixelSegmentArrayIndex]; - float ptErr = segments.pix.ptErr()[pixelSegmentArrayIndex]; - float etaErr = segments.pix.etaErr()[pixelSegmentArrayIndex]; + float px = segmentsPixel.px()[pixelSegmentArrayIndex]; + float py = segmentsPixel.py()[pixelSegmentArrayIndex]; + float pz = segmentsPixel.pz()[pixelSegmentArrayIndex]; + float ptErr = segmentsPixel.ptErr()[pixelSegmentArrayIndex]; + float etaErr = segmentsPixel.etaErr()[pixelSegmentArrayIndex]; ptSLo = alpaka::math::max(acc, ptCut, ptSLo - 10.0f * alpaka::math::max(acc, ptErr, 0.005f * ptSLo)); ptSLo = alpaka::math::min(acc, 10.0f, ptSLo); @@ -1534,8 +1544,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { if (alpaka::math::abs(acc, dPhi) > dPhiCut) return false; - float alpha_InLo = __H2F(segments.mem.dPhiChanges()[innerSegmentIndex]); - float alpha_OutLo = __H2F(segments.mem.dPhiChanges()[outerSegmentIndex]); + float alpha_InLo = __H2F(segments.dPhiChanges()[innerSegmentIndex]); + float alpha_OutLo = __H2F(segments.dPhiChanges()[outerSegmentIndex]); bool isEC_lastLayer = modulesInGPU.subdets[outerOuterLowerModuleIndex] == Endcap and modulesInGPU.moduleType[outerOuterLowerModuleIndex] == TwoS; diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index 4fec41818a17b..23183b444c3d5 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -751,15 +751,15 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { template ALPAKA_FN_ACC ALPAKA_FN_INLINE bool T5HasCommonMiniDoublet(Triplets const& tripletsInGPU, - Segments segments, + SegmentsConst segments, unsigned int innerTripletIndex, unsigned int outerTripletIndex) { unsigned int innerOuterSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex + 1]; unsigned int outerInnerSegmentIndex = tripletsInGPU.segmentIndices[2 * outerTripletIndex]; unsigned int innerOuterOuterMiniDoubletIndex = - segments.mem.mdIndices()[innerOuterSegmentIndex][1]; //inner triplet outer segment outer MD index + segments.mdIndices()[innerOuterSegmentIndex][1]; //inner triplet outer segment outer MD index unsigned int outerInnerInnerMiniDoubletIndex = - segments.mem.mdIndices()[outerInnerSegmentIndex][0]; //outer triplet inner segment inner MD index + segments.mdIndices()[outerInnerSegmentIndex][0]; //outer triplet inner segment inner MD index return (innerOuterOuterMiniDoubletIndex == outerInnerInnerMiniDoubletIndex); } @@ -1343,7 +1343,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool runQuintupletDefaultAlgoBBBB(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t innerOuterLowerModuleIndex, uint16_t outerInnerLowerModuleIndex, @@ -1430,8 +1430,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { return false; // First obtaining the raw betaIn and betaOut values without any correction and just purely based on the mini-doublet hit positions - float alpha_InLo = __H2F(segments.mem.dPhiChanges()[innerSegmentIndex]); - float alpha_OutLo = __H2F(segments.mem.dPhiChanges()[outerSegmentIndex]); + float alpha_InLo = __H2F(segments.dPhiChanges()[innerSegmentIndex]); + float alpha_OutLo = __H2F(segments.dPhiChanges()[outerSegmentIndex]); bool isEC_lastLayer = modulesInGPU.subdets[outerOuterLowerModuleIndex] == Endcap and modulesInGPU.moduleType[outerOuterLowerModuleIndex] == TwoS; @@ -1587,7 +1587,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool runQuintupletDefaultAlgoBBEE(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t innerOuterLowerModuleIndex, uint16_t outerInnerLowerModuleIndex, @@ -1685,9 +1685,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { if (alpaka::math::abs(acc, dPhi) > dPhiCut) return false; - float sdIn_alpha = __H2F(segments.mem.dPhiChanges()[innerSegmentIndex]); - float sdIn_alpha_min = __H2F(segments.mem.dPhiChangeMins()[innerSegmentIndex]); - float sdIn_alpha_max = __H2F(segments.mem.dPhiChangeMaxs()[innerSegmentIndex]); + float sdIn_alpha = __H2F(segments.dPhiChanges()[innerSegmentIndex]); + float sdIn_alpha_min = __H2F(segments.dPhiChangeMins()[innerSegmentIndex]); + float sdIn_alpha_max = __H2F(segments.dPhiChangeMaxs()[innerSegmentIndex]); float sdOut_alpha = sdIn_alpha; float sdOut_alphaOut = phi_mpi_pi(acc, @@ -1697,9 +1697,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { mdsInGPU.anchorPhi[fourthMDIndex]); float sdOut_alphaOut_min = phi_mpi_pi( - acc, __H2F(segments.mem.dPhiChangeMins()[outerSegmentIndex]) - __H2F(segments.mem.dPhiMins()[outerSegmentIndex])); + acc, __H2F(segments.dPhiChangeMins()[outerSegmentIndex]) - __H2F(segments.dPhiMins()[outerSegmentIndex])); float sdOut_alphaOut_max = phi_mpi_pi( - acc, __H2F(segments.mem.dPhiChangeMaxs()[outerSegmentIndex]) - __H2F(segments.mem.dPhiMaxs()[outerSegmentIndex])); + acc, __H2F(segments.dPhiChangeMaxs()[outerSegmentIndex]) - __H2F(segments.dPhiMaxs()[outerSegmentIndex])); float tl_axis_x = mdsInGPU.anchorX[fourthMDIndex] - mdsInGPU.anchorX[firstMDIndex]; float tl_axis_y = mdsInGPU.anchorY[fourthMDIndex] - mdsInGPU.anchorY[firstMDIndex]; @@ -1834,7 +1834,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool runQuintupletDefaultAlgoEEEE(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t innerOuterLowerModuleIndex, uint16_t outerInnerLowerModuleIndex, @@ -1936,13 +1936,13 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { if (alpaka::math::abs(acc, dPhi) > dPhiCut) return false; - float sdIn_alpha = __H2F(segments.mem.dPhiChanges()[innerSegmentIndex]); + float sdIn_alpha = __H2F(segments.dPhiChanges()[innerSegmentIndex]); float sdOut_alpha = sdIn_alpha; //weird float sdOut_dPhiPos = phi_mpi_pi(acc, mdsInGPU.anchorPhi[fourthMDIndex] - mdsInGPU.anchorPhi[thirdMDIndex]); - float sdOut_dPhiChange = __H2F(segments.mem.dPhiChanges()[outerSegmentIndex]); - float sdOut_dPhiChange_min = __H2F(segments.mem.dPhiChangeMins()[outerSegmentIndex]); - float sdOut_dPhiChange_max = __H2F(segments.mem.dPhiChangeMaxs()[outerSegmentIndex]); + float sdOut_dPhiChange = __H2F(segments.dPhiChanges()[outerSegmentIndex]); + float sdOut_dPhiChange_min = __H2F(segments.dPhiChangeMins()[outerSegmentIndex]); + float sdOut_dPhiChange_max = __H2F(segments.dPhiChangeMaxs()[outerSegmentIndex]); float sdOut_alphaOutRHmin = phi_mpi_pi(acc, sdOut_dPhiChange_min - sdOut_dPhiPos); float sdOut_alphaOutRHmax = phi_mpi_pi(acc, sdOut_dPhiChange_max - sdOut_dPhiPos); @@ -1953,8 +1953,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { float betaIn = sdIn_alpha - phi_mpi_pi(acc, phi(acc, tl_axis_x, tl_axis_y) - mdsInGPU.anchorPhi[firstMDIndex]); - float sdIn_alphaRHmin = __H2F(segments.mem.dPhiChangeMins()[innerSegmentIndex]); - float sdIn_alphaRHmax = __H2F(segments.mem.dPhiChangeMaxs()[innerSegmentIndex]); + float sdIn_alphaRHmin = __H2F(segments.dPhiChangeMins()[innerSegmentIndex]); + float sdIn_alphaRHmax = __H2F(segments.dPhiChangeMaxs()[innerSegmentIndex]); float betaInRHmin = betaIn + sdIn_alphaRHmin - sdIn_alpha; float betaInRHmax = betaIn + sdIn_alphaRHmax - sdIn_alpha; @@ -2060,7 +2060,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool runQuintupletAlgoSelector(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t innerOuterLowerModuleIndex, uint16_t outerInnerLowerModuleIndex, @@ -2165,7 +2165,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool runQuintupletDefaultAlgo(TAcc const& acc, Modules& modulesInGPU, MiniDoublets& mdsInGPU, - Segments segments, + SegmentsConst segments, Triplets& tripletsInGPU, uint16_t lowerModuleIndex1, uint16_t lowerModuleIndex2, @@ -2190,19 +2190,19 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { unsigned int fourthSegmentIndex = tripletsInGPU.segmentIndices[2 * outerTripletIndex + 1]; unsigned int innerOuterOuterMiniDoubletIndex = - segments.mem.mdIndices()[secondSegmentIndex][1]; //inner triplet outer segment outer MD index + segments.mdIndices()[secondSegmentIndex][1]; //inner triplet outer segment outer MD index unsigned int outerInnerInnerMiniDoubletIndex = - segments.mem.mdIndices()[thirdSegmentIndex][0]; //outer triplet inner segment inner MD index + segments.mdIndices()[thirdSegmentIndex][0]; //outer triplet inner segment inner MD index //this cut reduces the number of candidates by a factor of 3, i.e., 2 out of 3 warps can end right here! if (innerOuterOuterMiniDoubletIndex != outerInnerInnerMiniDoubletIndex) return false; - unsigned int firstMDIndex = segments.mem.mdIndices()[firstSegmentIndex][0]; - unsigned int secondMDIndex = segments.mem.mdIndices()[secondSegmentIndex][0]; - unsigned int thirdMDIndex = segments.mem.mdIndices()[secondSegmentIndex][1]; - unsigned int fourthMDIndex = segments.mem.mdIndices()[thirdSegmentIndex][1]; - unsigned int fifthMDIndex = segments.mem.mdIndices()[fourthSegmentIndex][1]; + unsigned int firstMDIndex = segments.mdIndices()[firstSegmentIndex][0]; + unsigned int secondMDIndex = segments.mdIndices()[secondSegmentIndex][0]; + unsigned int thirdMDIndex = segments.mdIndices()[secondSegmentIndex][1]; + unsigned int fourthMDIndex = segments.mdIndices()[thirdSegmentIndex][1]; + unsigned int fifthMDIndex = segments.mdIndices()[fourthSegmentIndex][1]; if (not runQuintupletAlgoSelector(acc, modulesInGPU, @@ -2508,7 +2508,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC void operator()(TAcc const& acc, Modules modulesInGPU, MiniDoublets mdsInGPU, - Segments segments, + SegmentsConst segments, Triplets tripletsInGPU, Quintuplets quintupletsInGPU, ObjectRanges rangesInGPU, @@ -2588,10 +2588,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { unsigned int quintupletIndex = rangesInGPU.quintupletModuleIndices[lowerModule1] + quintupletModuleIndex; float phi = - mdsInGPU.anchorPhi[segments.mem.mdIndices()[tripletsInGPU.segmentIndices[2 * innerTripletIndex + + mdsInGPU.anchorPhi[segments.mdIndices()[tripletsInGPU.segmentIndices[2 * innerTripletIndex + layer2_adjustment]][0]]; float eta = - mdsInGPU.anchorEta[segments.mem.mdIndices()[tripletsInGPU.segmentIndices[2 * innerTripletIndex + + mdsInGPU.anchorEta[segments.mdIndices()[tripletsInGPU.segmentIndices[2 * innerTripletIndex + layer2_adjustment]][0]]; float pt = (innerRadius + outerRadius) * k2Rinv1GeVf; float scores = chiSquared + nonAnchorChiSquared; diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 65a3751b27c16..f9fc34dbfc51d 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -15,7 +15,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { - GENERATE_SOA_LAYOUT(SegmentsMemSoALayout, + GENERATE_SOA_LAYOUT(SegmentsSoALayout, SOA_COLUMN(FPX, dPhis), SOA_COLUMN(FPX, dPhiMins), SOA_COLUMN(FPX, dPhiMaxs), @@ -26,14 +26,15 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { SOA_COLUMN(uint16_t, outerLowerModuleIndices), SOA_COLUMN(Params_LS::ArrayUxLayers, mdIndices), SOA_COLUMN(unsigned int, innerMiniDoubletAnchorHitIndices), - SOA_COLUMN(unsigned int, outerMiniDoubletAnchorHitIndices), - SOA_SCALAR(unsigned int, nMemoryLocations)) + SOA_COLUMN(unsigned int, outerMiniDoubletAnchorHitIndices) + //SOA_SCALAR(unsigned int, nMemoryLocations) + ) - GENERATE_SOA_LAYOUT(SegmentsModSoALayout, + GENERATE_SOA_LAYOUT(SegmentsOccupancySoALayout, SOA_COLUMN(unsigned int, nSegments), //number of segments per inner lower module SOA_COLUMN(unsigned int, totOccupancySegments)) - GENERATE_SOA_LAYOUT(SegmentsPixSoALayout, + GENERATE_SOA_LAYOUT(SegmentsPixelSoALayout, SOA_COLUMN(unsigned int, seedIdx), SOA_COLUMN(int, charge), SOA_COLUMN(int, superbin), @@ -55,25 +56,19 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { SOA_COLUMN(float, circleCenterY), SOA_COLUMN(float, circleRadius)) - using SegmentsMemSoA = SegmentsMemSoALayout<>; - using SegmentsModSoA = SegmentsModSoALayout<>; - using SegmentsPixSoA = SegmentsPixSoALayout<>; + using SegmentsSoA = SegmentsSoALayout<>; + using SegmentsOccupancySoA = SegmentsOccupancySoALayout<>; + using SegmentsPixelSoA = SegmentsPixelSoALayout<>; - using SegmentsDeviceCollection = PortableCollection3; - using SegmentsHostCollection = PortableHostMultiCollection; + using Segments = SegmentsSoA::View; + using SegmentsConst = SegmentsSoA::ConstView; + using SegmentsOccupancy = SegmentsOccupancySoA::View; + using SegmentsOccupancyConst = SegmentsOccupancySoA::ConstView; + using SegmentsPixel = SegmentsPixelSoA::View; + using SegmentsPixelConst = SegmentsPixelSoA::ConstView; - struct Segments { - SegmentsMemSoA::View mem; - SegmentsModSoA::View mod; - SegmentsPixSoA::View pix; - - template - void setData(PortableMultiCollection& segmentsCol) { - mem = segmentsCol.template view(); - mod = segmentsCol.template view(); - pix = segmentsCol.template view(); - } - }; + using SegmentsDeviceCollection = PortableCollection3; + using SegmentsHostCollection = PortableHostMultiCollection; ALPAKA_FN_ACC ALPAKA_FN_INLINE float isTighterTiltedModules_seg(Modules const& modulesInGPU, unsigned int moduleIndex) { @@ -268,24 +263,25 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { float dPhiChangeMin, float dPhiChangeMax, unsigned int idx) { - segments.mem.mdIndices()[idx][0] = lowerMDIndex; - segments.mem.mdIndices()[idx][1] = upperMDIndex; - segments.mem.innerLowerModuleIndices()[idx] = innerLowerModuleIndex; - segments.mem.outerLowerModuleIndices()[idx] = outerLowerModuleIndex; - segments.mem.innerMiniDoubletAnchorHitIndices()[idx] = innerMDAnchorHitIndex; - segments.mem.outerMiniDoubletAnchorHitIndices()[idx] = outerMDAnchorHitIndex; - - segments.mem.dPhis()[idx] = __F2H(dPhi); - segments.mem.dPhiMins()[idx] = __F2H(dPhiMin); - segments.mem.dPhiMaxs()[idx] = __F2H(dPhiMax); - segments.mem.dPhiChanges()[idx] = __F2H(dPhiChange); - segments.mem.dPhiChangeMins()[idx] = __F2H(dPhiChangeMin); - segments.mem.dPhiChangeMaxs()[idx] = __F2H(dPhiChangeMax); + segments.mdIndices()[idx][0] = lowerMDIndex; + segments.mdIndices()[idx][1] = upperMDIndex; + segments.innerLowerModuleIndices()[idx] = innerLowerModuleIndex; + segments.outerLowerModuleIndices()[idx] = outerLowerModuleIndex; + segments.innerMiniDoubletAnchorHitIndices()[idx] = innerMDAnchorHitIndex; + segments.outerMiniDoubletAnchorHitIndices()[idx] = outerMDAnchorHitIndex; + + segments.dPhis()[idx] = __F2H(dPhi); + segments.dPhiMins()[idx] = __F2H(dPhiMin); + segments.dPhiMaxs()[idx] = __F2H(dPhiMax); + segments.dPhiChanges()[idx] = __F2H(dPhiChange); + segments.dPhiChangeMins()[idx] = __F2H(dPhiChangeMin); + segments.dPhiChangeMaxs()[idx] = __F2H(dPhiChangeMax); } template ALPAKA_FN_ACC ALPAKA_FN_INLINE void addPixelSegmentToMemory(TAcc const& acc, Segments segments, + SegmentsPixel segmentsPixel, MiniDoublets const& mdsInGPU, unsigned int innerMDIndex, unsigned int outerMDIndex, @@ -297,20 +293,20 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { unsigned int idx, unsigned int pixelSegmentArrayIndex, float score) { - segments.mem.mdIndices()[idx][0] = innerMDIndex; - segments.mem.mdIndices()[idx][1] = outerMDIndex; - segments.mem.innerLowerModuleIndices()[idx] = pixelModuleIndex; - segments.mem.outerLowerModuleIndices()[idx] = pixelModuleIndex; - segments.mem.innerMiniDoubletAnchorHitIndices()[idx] = innerAnchorHitIndex; - segments.mem.outerMiniDoubletAnchorHitIndices()[idx] = outerAnchorHitIndex; - segments.mem.dPhiChanges()[idx] = __F2H(dPhiChange); - - segments.pix.isDup()[pixelSegmentArrayIndex] = false; - segments.pix.score()[pixelSegmentArrayIndex] = score; - segments.pix.pLSHitsIdxs()[pixelSegmentArrayIndex].x = hitIdxs[0]; - segments.pix.pLSHitsIdxs()[pixelSegmentArrayIndex].y = hitIdxs[1]; - segments.pix.pLSHitsIdxs()[pixelSegmentArrayIndex].z = hitIdxs[2]; - segments.pix.pLSHitsIdxs()[pixelSegmentArrayIndex].w = hitIdxs[3]; + segments.mdIndices()[idx][0] = innerMDIndex; + segments.mdIndices()[idx][1] = outerMDIndex; + segments.innerLowerModuleIndices()[idx] = pixelModuleIndex; + segments.outerLowerModuleIndices()[idx] = pixelModuleIndex; + segments.innerMiniDoubletAnchorHitIndices()[idx] = innerAnchorHitIndex; + segments.outerMiniDoubletAnchorHitIndices()[idx] = outerAnchorHitIndex; + segments.dPhiChanges()[idx] = __F2H(dPhiChange); + + segmentsPixel.isDup()[pixelSegmentArrayIndex] = false; + segmentsPixel.score()[pixelSegmentArrayIndex] = score; + segmentsPixel.pLSHitsIdxs()[pixelSegmentArrayIndex].x = hitIdxs[0]; + segmentsPixel.pLSHitsIdxs()[pixelSegmentArrayIndex].y = hitIdxs[1]; + segmentsPixel.pLSHitsIdxs()[pixelSegmentArrayIndex].z = hitIdxs[2]; + segmentsPixel.pLSHitsIdxs()[pixelSegmentArrayIndex].w = hitIdxs[3]; //computing circle parameters /* @@ -341,9 +337,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { bestIndex = i; } } - segments.pix.circleCenterX()[pixelSegmentArrayIndex] = candidateCenterXs[bestIndex]; - segments.pix.circleCenterY()[pixelSegmentArrayIndex] = candidateCenterYs[bestIndex]; - segments.pix.circleRadius()[pixelSegmentArrayIndex] = circleRadius; + segmentsPixel.circleCenterX()[pixelSegmentArrayIndex] = candidateCenterXs[bestIndex]; + segmentsPixel.circleCenterY()[pixelSegmentArrayIndex] = candidateCenterYs[bestIndex]; + segmentsPixel.circleRadius()[pixelSegmentArrayIndex] = circleRadius; } template @@ -602,6 +598,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { Modules modulesInGPU, MiniDoublets mdsInGPU, Segments segments, + SegmentsOccupancy segmentsOccupancy, ObjectRanges rangesInGPU) const { auto const globalBlockIdx = alpaka::getIdx(acc); auto const blockThreadIdx = alpaka::getIdx(acc); @@ -658,14 +655,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { dPhiChangeMin, dPhiChangeMax)) { unsigned int totOccupancySegments = alpaka::atomicAdd( - acc, &segments.mod.totOccupancySegments()[innerLowerModuleIndex], 1u, alpaka::hierarchy::Threads{}); + acc, &segmentsOccupancy.totOccupancySegments()[innerLowerModuleIndex], 1u, alpaka::hierarchy::Threads{}); if (static_cast(totOccupancySegments) >= rangesInGPU.segmentModuleOccupancy[innerLowerModuleIndex]) { #ifdef WARNINGS printf("Segment excess alert! Module index = %d\n", innerLowerModuleIndex); #endif } else { unsigned int segmentModuleIdx = alpaka::atomicAdd( - acc, &segments.mod.nSegments()[innerLowerModuleIndex], 1u, alpaka::hierarchy::Threads{}); + acc, &segmentsOccupancy.nSegments()[innerLowerModuleIndex], 1u, alpaka::hierarchy::Threads{}); unsigned int segmentIdx = rangesInGPU.segmentModuleIndices[innerLowerModuleIndex] + segmentModuleIdx; addSegmentToMemory(segments, @@ -798,7 +795,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { template ALPAKA_FN_ACC void operator()(TAcc const& acc, Modules modulesInGPU, - Segments segments, + SegmentsOccupancyConst segmentsOccupancy, ObjectRanges rangesInGPU) const { // implementation is 1D with a single block static_assert(std::is_same_v, "Should be Acc1D"); @@ -808,12 +805,12 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { auto const gridThreadExtent = alpaka::getWorkDiv(acc); for (uint16_t i = globalThreadIdx[0]; i < *modulesInGPU.nLowerModules; i += gridThreadExtent[0]) { - if (segments.mod.nSegments()[i] == 0) { + if (segmentsOccupancy.nSegments()[i] == 0) { rangesInGPU.segmentRanges[i * 2] = -1; rangesInGPU.segmentRanges[i * 2 + 1] = -1; } else { rangesInGPU.segmentRanges[i * 2] = rangesInGPU.segmentModuleIndices[i]; - rangesInGPU.segmentRanges[i * 2 + 1] = rangesInGPU.segmentModuleIndices[i] + segments.mod.nSegments()[i] - 1; + rangesInGPU.segmentRanges[i * 2 + 1] = rangesInGPU.segmentModuleIndices[i] + segmentsOccupancy.nSegments()[i] - 1; } } } @@ -827,6 +824,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { Hits hitsInGPU, MiniDoublets mdsInGPU, Segments segments, + SegmentsPixel segmentsPixel, unsigned int* hitIndices0, unsigned int* hitIndices1, unsigned int* hitIndices2, @@ -890,6 +888,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { hits1[3] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[outerMDIndex]]; addPixelSegmentToMemory(acc, segments, + segmentsPixel, mdsInGPU, innerMDIndex, outerMDIndex, diff --git a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h index 3ccbf52fa8fb5..5f1a8d2836580 100644 --- a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h +++ b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h @@ -167,20 +167,20 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkPixelHits(unsigned int ix, unsigned int jx, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, Hits const& hitsInGPU) { int phits1[Params_pLS::kHits]; int phits2[Params_pLS::kHits]; - phits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segments.mem.mdIndices()[ix][0]]]; - phits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segments.mem.mdIndices()[ix][1]]]; - phits1[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[segments.mem.mdIndices()[ix][0]]]; - phits1[3] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[segments.mem.mdIndices()[ix][0]]]; + phits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segments.mdIndices()[ix][0]]]; + phits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segments.mdIndices()[ix][1]]]; + phits1[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[segments.mdIndices()[ix][0]]]; + phits1[3] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[segments.mdIndices()[ix][0]]]; - phits2[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segments.mem.mdIndices()[jx][0]]]; - phits2[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segments.mem.mdIndices()[jx][1]]]; - phits2[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[segments.mem.mdIndices()[jx][0]]]; - phits2[3] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[segments.mem.mdIndices()[jx][1]]]; + phits2[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segments.mdIndices()[jx][0]]]; + phits2[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segments.mdIndices()[jx][1]]]; + phits2[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[segments.mdIndices()[jx][0]]]; + phits2[3] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[segments.mdIndices()[jx][1]]]; int npMatched = 0; @@ -210,7 +210,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { Modules modulesInGPU, ObjectRanges rangesInGPU, PixelTriplets pixelTripletsInGPU, - Segments segments, + SegmentsPixelConst segmentsPixel, PixelQuintuplets pixelQuintupletsInGPU) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); @@ -232,8 +232,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { for (unsigned int pixelQuintupletIndex = globalThreadIdx[1]; pixelQuintupletIndex < nPixelQuintuplets; pixelQuintupletIndex += gridThreadExtent[1]) { unsigned int pLS_jx = pixelQuintupletsInGPU.pixelIndices[pixelQuintupletIndex]; - float eta2 = segments.pix.eta()[pLS_jx - prefix]; - float phi2 = segments.pix.phi()[pLS_jx - prefix]; + float eta2 = segmentsPixel.eta()[pLS_jx - prefix]; + float phi2 = segmentsPixel.phi()[pLS_jx - prefix]; float dEta = alpaka::math::abs(acc, (eta1 - eta2)); float dPhi = calculate_dPhi(phi1, phi2); @@ -307,7 +307,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ObjectRanges rangesInGPU, PixelTriplets pixelTripletsInGPU, TrackCandidates trackCandidatesInGPU, - Segments segments, + SegmentsConst segments, + SegmentsOccupancyConst segmentsOccupancy, + SegmentsPixel segmentsPixel, MiniDoublets mdsInGPU, Hits hitsInGPU, Quintuplets quintupletsInGPU) const { @@ -315,14 +317,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { auto const gridThreadExtent = alpaka::getWorkDiv(acc); int pixelModuleIndex = *modulesInGPU.nLowerModules; - unsigned int nPixels = segments.mod.nSegments()[pixelModuleIndex]; + unsigned int nPixels = segmentsOccupancy.nSegments()[pixelModuleIndex]; for (unsigned int pixelArrayIndex = globalThreadIdx[2]; pixelArrayIndex < nPixels; pixelArrayIndex += gridThreadExtent[2]) { - if (!segments.pix.isQuad()[pixelArrayIndex] || segments.pix.isDup()[pixelArrayIndex]) + if (!segmentsPixel.isQuad()[pixelArrayIndex] || segmentsPixel.isDup()[pixelArrayIndex]) continue; - float eta1 = segments.pix.eta()[pixelArrayIndex]; - float phi1 = segments.pix.phi()[pixelArrayIndex]; + float eta1 = segmentsPixel.eta()[pixelArrayIndex]; + float phi1 = segmentsPixel.phi()[pixelArrayIndex]; unsigned int prefix = rangesInGPU.segmentModuleIndices[pixelModuleIndex]; unsigned int nTrackCandidates = *(trackCandidatesInGPU.nTrackCandidates); @@ -340,14 +342,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { float dR2 = dEta * dEta + dPhi * dPhi; if (dR2 < 1e-3f) - segments.pix.isDup()[pixelArrayIndex] = true; + segmentsPixel.isDup()[pixelArrayIndex] = true; } if (type == 5) // pT3 { int pLSIndex = pixelTripletsInGPU.pixelSegmentIndices[innerTrackletIdx]; int npMatched = checkPixelHits(prefix + pixelArrayIndex, pLSIndex, mdsInGPU, segments, hitsInGPU); if (npMatched > 0) - segments.pix.isDup()[pixelArrayIndex] = true; + segmentsPixel.isDup()[pixelArrayIndex] = true; int pT3Index = innerTrackletIdx; float eta2 = __H2F(pixelTripletsInGPU.eta_pix[pT3Index]); @@ -357,24 +359,24 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { float dR2 = dEta * dEta + dPhi * dPhi; if (dR2 < 0.000001f) - segments.pix.isDup()[pixelArrayIndex] = true; + segmentsPixel.isDup()[pixelArrayIndex] = true; } if (type == 7) // pT5 { unsigned int pLSIndex = innerTrackletIdx; int npMatched = checkPixelHits(prefix + pixelArrayIndex, pLSIndex, mdsInGPU, segments, hitsInGPU); if (npMatched > 0) { - segments.pix.isDup()[pixelArrayIndex] = true; + segmentsPixel.isDup()[pixelArrayIndex] = true; } - float eta2 = segments.pix.eta()[pLSIndex - prefix]; - float phi2 = segments.pix.phi()[pLSIndex - prefix]; + float eta2 = segmentsPixel.eta()[pLSIndex - prefix]; + float phi2 = segmentsPixel.phi()[pLSIndex - prefix]; float dEta = alpaka::math::abs(acc, eta1 - eta2); float dPhi = calculate_dPhi(phi1, phi2); float dR2 = dEta * dEta + dPhi * dPhi; if (dR2 < 0.000001f) - segments.pix.isDup()[pixelArrayIndex] = true; + segmentsPixel.isDup()[pixelArrayIndex] = true; } } } @@ -387,7 +389,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { uint16_t nLowerModules, PixelTriplets pixelTripletsInGPU, TrackCandidates trackCandidatesInGPU, - Segments segments, + SegmentsPixelConst segmentsPixel, ObjectRanges rangesInGPU) const { // implementation is 1D with a single block @@ -427,7 +429,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { &pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex], &pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex], &pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex], - segments.pix.seedIdx()[pT3PixelIndex - pLS_offset], + segmentsPixel.seedIdx()[pT3PixelIndex - pLS_offset], __H2F(pixelTripletsInGPU.centerX[pixelTripletIndex]), __H2F(pixelTripletsInGPU.centerY[pixelTripletIndex]), radius, @@ -497,15 +499,16 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC void operator()(TAcc const& acc, uint16_t nLowerModules, TrackCandidates trackCandidatesInGPU, - Segments segments, + SegmentsOccupancyConst segmentsOccupancy, + SegmentsPixelConst segmentsPixel, bool tc_pls_triplets) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); - unsigned int nPixels = segments.mod.nSegments()[nLowerModules]; + unsigned int nPixels = segmentsOccupancy.nSegments()[nLowerModules]; for (unsigned int pixelArrayIndex = globalThreadIdx[2]; pixelArrayIndex < nPixels; pixelArrayIndex += gridThreadExtent[2]) { - if ((tc_pls_triplets ? 0 : !segments.pix.isQuad()[pixelArrayIndex]) || (segments.pix.isDup()[pixelArrayIndex])) + if ((tc_pls_triplets ? 0 : !segmentsPixel.isQuad()[pixelArrayIndex]) || (segmentsPixel.isDup()[pixelArrayIndex])) continue; unsigned int trackCandidateIdx = @@ -524,8 +527,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { addpLSTrackCandidateToMemory(trackCandidatesInGPU, pixelArrayIndex, trackCandidateIdx, - segments.pix.pLSHitsIdxs()[pixelArrayIndex], - segments.pix.seedIdx()[pixelArrayIndex]); + segmentsPixel.pLSHitsIdxs()[pixelArrayIndex], + segmentsPixel.seedIdx()[pixelArrayIndex]); } } } @@ -537,7 +540,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { uint16_t nLowerModules, PixelQuintuplets pixelQuintupletsInGPU, TrackCandidates trackCandidatesInGPU, - Segments segments, + SegmentsPixelConst segmentsPixel, ObjectRanges rangesInGPU) const { // implementation is 1D with a single block @@ -578,7 +581,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { &pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex], &pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex], &pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex], - segments.pix.seedIdx()[pT5PixelIndex - pLS_offset], + segmentsPixel.seedIdx()[pT5PixelIndex - pLS_offset], __H2F(pixelQuintupletsInGPU.centerX[pixelQuintupletIndex]), __H2F(pixelQuintupletsInGPU.centerY[pixelQuintupletIndex]), radius, diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 74ce948a0334c..d2b0303147ddb 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -138,7 +138,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { #ifdef CUT_VALUE_DEBUG ALPAKA_FN_ACC ALPAKA_FN_INLINE void addTripletToMemory(Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, Triplets& tripletsInGPU, unsigned int innerSegmentIndex, unsigned int outerSegmentIndex, @@ -156,7 +156,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { #else ALPAKA_FN_ACC ALPAKA_FN_INLINE void addTripletToMemory(Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, Triplets& tripletsInGPU, unsigned int innerSegmentIndex, unsigned int outerSegmentIndex, @@ -187,9 +187,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 2] = modulesInGPU.layers[outerOuterLowerModuleIndex] + (modulesInGPU.subdets[outerOuterLowerModuleIndex] == 4) * 6; //get the hits - unsigned int firstMDIndex = segments.mem.mdIndices()[innerSegmentIndex][0]; - unsigned int secondMDIndex = segments.mem.mdIndices()[innerSegmentIndex][1]; - unsigned int thirdMDIndex = segments.mem.mdIndices()[outerSegmentIndex][1]; + unsigned int firstMDIndex = segments.mdIndices()[innerSegmentIndex][0]; + unsigned int secondMDIndex = segments.mdIndices()[innerSegmentIndex][1]; + unsigned int thirdMDIndex = segments.mdIndices()[outerSegmentIndex][1]; tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits] = mdsInGPU.anchorHitIndices[firstMDIndex]; tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; @@ -208,7 +208,6 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool passRZConstraint(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, @@ -268,7 +267,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool passPointingConstraintBBB(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, @@ -337,7 +336,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { return false; // raw betaIn value without any correction, based on the mini-doublet hit positions - float alpha_InLo = __H2F(segments.mem.dPhiChanges()[innerSegmentIndex]); + float alpha_InLo = __H2F(segments.dPhiChanges()[innerSegmentIndex]); float tl_axis_x = mdsInGPU.anchorX[thirdMDIndex] - mdsInGPU.anchorX[firstMDIndex]; float tl_axis_y = mdsInGPU.anchorY[thirdMDIndex] - mdsInGPU.anchorY[firstMDIndex]; betaIn = alpha_InLo - phi_mpi_pi(acc, phi(acc, tl_axis_x, tl_axis_y) - mdsInGPU.anchorPhi[firstMDIndex]); @@ -364,7 +363,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool passPointingConstraintBBE(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, @@ -446,7 +445,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { float rt_InLo = mdsInGPU.anchorRt[firstMDIndex]; float rt_InOut = mdsInGPU.anchorRt[secondMDIndex]; - float sdIn_alpha = __H2F(segments.mem.dPhiChanges()[innerSegmentIndex]); + float sdIn_alpha = __H2F(segments.dPhiChanges()[innerSegmentIndex]); float tl_axis_x = mdsInGPU.anchorX[thirdMDIndex] - mdsInGPU.anchorX[firstMDIndex]; float tl_axis_y = mdsInGPU.anchorY[thirdMDIndex] - mdsInGPU.anchorY[firstMDIndex]; @@ -483,7 +482,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool passPointingConstraintEEE(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, @@ -566,15 +565,15 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { float rt_InLo = mdsInGPU.anchorRt[firstMDIndex]; float rt_InOut = mdsInGPU.anchorRt[secondMDIndex]; - float sdIn_alpha = __H2F(segments.mem.dPhiChanges()[innerSegmentIndex]); + float sdIn_alpha = __H2F(segments.dPhiChanges()[innerSegmentIndex]); float tl_axis_x = mdsInGPU.anchorX[thirdMDIndex] - mdsInGPU.anchorX[firstMDIndex]; float tl_axis_y = mdsInGPU.anchorY[thirdMDIndex] - mdsInGPU.anchorY[firstMDIndex]; betaIn = sdIn_alpha - phi_mpi_pi(acc, phi(acc, tl_axis_x, tl_axis_y) - mdsInGPU.anchorPhi[firstMDIndex]); - float sdIn_alphaRHmin = __H2F(segments.mem.dPhiChangeMins()[innerSegmentIndex]); - float sdIn_alphaRHmax = __H2F(segments.mem.dPhiChangeMaxs()[innerSegmentIndex]); + float sdIn_alphaRHmin = __H2F(segments.dPhiChangeMins()[innerSegmentIndex]); + float sdIn_alphaRHmax = __H2F(segments.dPhiChangeMaxs()[innerSegmentIndex]); float betaInRHmin = betaIn + sdIn_alphaRHmin - sdIn_alpha; float betaInRHmax = betaIn + sdIn_alphaRHmax - sdIn_alpha; @@ -604,7 +603,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool passPointingConstraint(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, @@ -739,7 +738,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC ALPAKA_FN_INLINE bool runTripletConstraintsAndAlgo(TAcc const& acc, Modules const& modulesInGPU, MiniDoublets const& mdsInGPU, - Segments segments, + SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, @@ -753,17 +752,16 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { float& circleCenterX, float& circleCenterY) { //this cut reduces the number of candidates by a factor of 4, i.e., 3 out of 4 warps can end right here! - if (segments.mem.mdIndices()[innerSegmentIndex][1] != segments.mem.mdIndices()[outerSegmentIndex][0]) + if (segments.mdIndices()[innerSegmentIndex][1] != segments.mdIndices()[outerSegmentIndex][0]) return false; - unsigned int firstMDIndex = segments.mem.mdIndices()[innerSegmentIndex][0]; - unsigned int secondMDIndex = segments.mem.mdIndices()[outerSegmentIndex][0]; - unsigned int thirdMDIndex = segments.mem.mdIndices()[outerSegmentIndex][1]; + unsigned int firstMDIndex = segments.mdIndices()[innerSegmentIndex][0]; + unsigned int secondMDIndex = segments.mdIndices()[outerSegmentIndex][0]; + unsigned int thirdMDIndex = segments.mdIndices()[outerSegmentIndex][1]; if (not(passRZConstraint(acc, modulesInGPU, mdsInGPU, - segments, innerInnerLowerModuleIndex, middleLowerModuleIndex, outerOuterLowerModuleIndex, @@ -806,7 +804,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC void operator()(TAcc const& acc, Modules modulesInGPU, MiniDoublets mdsInGPU, - Segments segments, + SegmentsConst segments, + SegmentsOccupancyConst segmentsOccupancy, Triplets tripletsInGPU, ObjectRanges rangesInGPU, uint16_t* index_gpu, @@ -824,22 +823,22 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { if (nConnectedModules == 0) continue; - unsigned int nInnerSegments = segments.mod.nSegments()[innerInnerLowerModuleIndex]; + unsigned int nInnerSegments = segmentsOccupancy.nSegments()[innerInnerLowerModuleIndex]; for (unsigned int innerSegmentArrayIndex = globalThreadIdx[1]; innerSegmentArrayIndex < nInnerSegments; innerSegmentArrayIndex += gridThreadExtent[1]) { unsigned int innerSegmentIndex = rangesInGPU.segmentRanges[innerInnerLowerModuleIndex * 2] + innerSegmentArrayIndex; // middle lower module - outer lower module of inner segment - uint16_t middleLowerModuleIndex = segments.mem.outerLowerModuleIndices()[innerSegmentIndex]; + uint16_t middleLowerModuleIndex = segments.outerLowerModuleIndices()[innerSegmentIndex]; - unsigned int nOuterSegments = segments.mod.nSegments()[middleLowerModuleIndex]; + unsigned int nOuterSegments = segmentsOccupancy.nSegments()[middleLowerModuleIndex]; for (unsigned int outerSegmentArrayIndex = globalThreadIdx[2]; outerSegmentArrayIndex < nOuterSegments; outerSegmentArrayIndex += gridThreadExtent[2]) { unsigned int outerSegmentIndex = rangesInGPU.segmentRanges[2 * middleLowerModuleIndex] + outerSegmentArrayIndex; - uint16_t outerOuterLowerModuleIndex = segments.mem.outerLowerModuleIndices()[outerSegmentIndex]; + uint16_t outerOuterLowerModuleIndex = segments.outerLowerModuleIndices()[outerSegmentIndex]; float zOut, rtOut, betaIn, betaInCut, circleRadius, circleCenterX, circleCenterY; @@ -923,7 +922,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { ALPAKA_FN_ACC void operator()(TAcc const& acc, Modules modulesInGPU, ObjectRanges rangesInGPU, - Segments segments) const { + SegmentsOccupancyConst segmentsOccupancy) const { // implementation is 1D with a single block static_assert(std::is_same_v, "Should be Acc1D"); ALPAKA_ASSERT_ACC((alpaka::getWorkDiv(acc)[0] == 1)); @@ -942,7 +941,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { int occupancy, category_number, eta_number; for (uint16_t i = globalThreadIdx[0]; i < *modulesInGPU.nLowerModules; i += gridThreadExtent[0]) { - if (segments.mod.nSegments()[i] == 0) { + if (segmentsOccupancy.nSegments()[i] == 0) { rangesInGPU.tripletModuleIndices[i] = nTotalTriplets; rangesInGPU.tripletModuleOccupancy[i] = 0; continue; diff --git a/RecoTracker/LSTCore/standalone/code/core/AccessHelper.cc b/RecoTracker/LSTCore/standalone/code/core/AccessHelper.cc index a64be1c286467..0ecadf1325f66 100644 --- a/RecoTracker/LSTCore/standalone/code/core/AccessHelper.cc +++ b/RecoTracker/LSTCore/standalone/code/core/AccessHelper.cc @@ -28,13 +28,13 @@ std::tuple, std::vector> convertHitsToHi //____________________________________________________________________________________________ std::vector getPixelHitsFrompLS(Event* event, unsigned int pLS) { - Segments& segments = event->getSegments(); + SegmentsConst segments = event->getSegments(); MiniDoublets const* miniDoublets = event->getMiniDoublets().data(); ObjectRanges const* rangesEvt = event->getRanges().data(); Modules const* modulesEvt = event->getModules().data(); const unsigned int pLS_offset = rangesEvt->segmentModuleIndices[*(modulesEvt->nLowerModules)]; - unsigned int MD_1 = segments.mem.mdIndices()[2 * (pLS + pLS_offset)][0]; - unsigned int MD_2 = segments.mem.mdIndices()[2 * (pLS + pLS_offset)][1]; + unsigned int MD_1 = segments.mdIndices()[2 * (pLS + pLS_offset)][0]; + unsigned int MD_2 = segments.mdIndices()[2 * (pLS + pLS_offset)][1]; unsigned int hit_1 = miniDoublets->anchorHitIndices[MD_1]; unsigned int hit_2 = miniDoublets->outerHitIndices[MD_1]; unsigned int hit_3 = miniDoublets->anchorHitIndices[MD_2]; @@ -92,9 +92,9 @@ std::tuple, std::vector> getHitIdxsAndHi //____________________________________________________________________________________________ std::vector getMDsFromLS(Event* event, unsigned int LS) { - Segments& segments = event->getSegments(); - unsigned int MD_1 = segments.mem.mdIndices()[2 * LS][0]; - unsigned int MD_2 = segments.mem.mdIndices()[2 * LS][1]; + SegmentsConst segments = event->getSegments(); + unsigned int MD_1 = segments.mdIndices()[2 * LS][0]; + unsigned int MD_2 = segments.mdIndices()[2 * LS][1]; return {MD_1, MD_2}; } diff --git a/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc b/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc index 35970b17c3c2c..2662df730ccec 100644 --- a/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc +++ b/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc @@ -293,7 +293,7 @@ void setPixelQuintupletOutputBranches(Event* event) { // ============ pT5 ============= PixelQuintuplets const* pixelQuintuplets = event->getPixelQuintuplets().data(); Quintuplets const* quintuplets = event->getQuintuplets().data(); - Segments& segments = event->getSegments(); + SegmentsPixelConst segmentsPixel = event->getSegments(); Modules const* modules = event->getModules().data(); int n_accepted_simtrk = ana.tx->getBranch>("sim_TC_matched").size(); @@ -305,9 +305,9 @@ void setPixelQuintupletOutputBranches(Event* event) { for (unsigned int pT5 = 0; pT5 < nPixelQuintuplets; pT5++) { unsigned int T5Index = getT5FrompT5(event, pT5); unsigned int pLSIndex = getPixelLSFrompT5(event, pT5); - float pt = (__H2F(quintuplets->innerRadius[T5Index]) * k2Rinv1GeVf * 2 + segments.pix.ptIn()[pLSIndex]) / 2; - float eta = segments.pix.eta()[pLSIndex]; - float phi = segments.pix.phi()[pLSIndex]; + float pt = (__H2F(quintuplets->innerRadius[T5Index]) * k2Rinv1GeVf * 2 + segmentsPixel.ptIn()[pLSIndex]) / 2; + float eta = segmentsPixel.eta()[pLSIndex]; + float phi = segmentsPixel.phi()[pLSIndex]; std::vector hit_idx = getHitIdxsFrompT5(event, pT5); std::vector module_idx = getModuleIdxsFrompT5(event, pT5); @@ -439,7 +439,7 @@ void setQuintupletOutputBranches(Event* event) { void setPixelTripletOutputBranches(Event* event) { PixelTriplets const* pixelTriplets = event->getPixelTriplets().data(); Modules const* modules = event->getModules().data(); - Segments& segments = event->getSegments(); + SegmentsPixelConst segmentsPixel = event->getSegments(); int n_accepted_simtrk = ana.tx->getBranch>("sim_TC_matched").size(); unsigned int nPixelTriplets = *pixelTriplets->nPixelTriplets; @@ -449,10 +449,10 @@ void setPixelTripletOutputBranches(Event* event) { for (unsigned int pT3 = 0; pT3 < nPixelTriplets; pT3++) { unsigned int T3Index = getT3FrompT3(event, pT3); unsigned int pLSIndex = getPixelLSFrompT3(event, pT3); - const float pt = segments.pix.ptIn()[pLSIndex]; + const float pt = segmentsPixel.ptIn()[pLSIndex]; - float eta = segments.pix.eta()[pLSIndex]; - float phi = segments.pix.phi()[pLSIndex]; + float eta = segmentsPixel.eta()[pLSIndex]; + float phi = segmentsPixel.phi()[pLSIndex]; std::vector hit_idx = getHitIdxsFrompT3(event, pT3); std::vector hit_type = getHitTypesFrompT3(event, pT3); @@ -501,7 +501,7 @@ void setPixelTripletOutputBranches(Event* event) { //________________________________________________________________________________________________________________________________ void setGnnNtupleBranches(Event* event) { // Get relevant information - Segments& segments = event->getSegments(); + SegmentsOccupancyConst segmentsOccupancy = event->getSegments(); MiniDoublets const* miniDoublets = event->getMiniDoublets().data(); Hits const* hitsEvt = event->getHits().data(); Modules const* modules = event->getModules().data(); @@ -517,7 +517,7 @@ void setGnnNtupleBranches(Event* event) { unsigned int nTotalLS = 0; for (unsigned int idx = 0; idx < *(modules->nLowerModules); ++idx) { nTotalMD += miniDoublets->nMDs[idx]; - nTotalLS += segments.mod.nSegments()[idx]; + nTotalLS += segmentsOccupancy.nSegments()[idx]; } std::set lss_used_in_true_tc; @@ -556,7 +556,7 @@ void setGnnNtupleBranches(Event* event) { // } // Loop over segments - for (unsigned int jdx = 0; jdx < segments.mod.nSegments()[idx]; jdx++) { + for (unsigned int jdx = 0; jdx < segmentsOccupancy.nSegments()[idx]; jdx++) { // Get the actual index to the segments using ranges unsigned int sgIdx = ranges->segmentModuleIndices[idx] + jdx; @@ -746,7 +746,7 @@ std::tuple, std::vectorgetTrackCandidates().data(); Quintuplets const* quintuplets = event->getQuintuplets().data(); - Segments& segments = event->getSegments(); + SegmentsPixelConst segmentsPixel = event->getSegments(); // // pictorial representation of a pT5 @@ -839,9 +839,9 @@ std::tuple, std::vectorinnerRadius[T5Index]) * 2 * k2Rinv1GeVf; const float pt = (pt_T5 + pt_pLS) / 2; @@ -858,7 +858,7 @@ std::tuple, std::vectorgetTrackCandidates().data(); Triplets const* triplets = event->getTriplets().data(); - Segments& segments = event->getSegments(); + SegmentsPixelConst segmentsPixel = event->getSegments(); // // pictorial representation of a pT3 @@ -872,9 +872,9 @@ std::tuple, std::vectorcircleRadius[T3] * 2 * k2Rinv1GeVf; // average pt @@ -925,15 +925,15 @@ std::tuple, std::vector, std::vector> parsepLS(Event* event, unsigned int idx) { TrackCandidates const* trackCandidates = event->getTrackCandidates().data(); - Segments& segments = event->getSegments(); + SegmentsPixelConst segmentsPixel = event->getSegments(); // Getting pLS index unsigned int pLS = trackCandidates->directObjectIndices[idx]; // Getting pt eta and phi - float pt = segments.pix.ptIn()[pLS]; - float eta = segments.pix.eta()[pLS]; - float phi = segments.pix.phi()[pLS]; + float pt = segmentsPixel.ptIn()[pLS]; + float eta = segmentsPixel.eta()[pLS]; + float phi = segmentsPixel.phi()[pLS]; // Getting hit indices and types std::vector hit_idx = getPixelHitIdxsFrompLS(event, pLS); @@ -1008,7 +1008,8 @@ void printMDs(Event* event) { //________________________________________________________________________________________________________________________________ void printLSs(Event* event) { - Segments& segments = event->getSegments(); + SegmentsConst segments = event->getSegments(); + SegmentsOccupancyConst segmentsOccupancy = event->getSegments(); MiniDoublets const* miniDoublets = event->getMiniDoublets().data(); Hits const* hitsEvt = event->getHits().data(); Modules const* modules = event->getModules().data(); @@ -1017,11 +1018,11 @@ void printLSs(Event* event) { int nSegments = 0; for (unsigned int i = 0; i < *(modules->nLowerModules); ++i) { unsigned int idx = i; //modules->lowerModuleIndices[i]; - nSegments += segments.mod.nSegments()[idx]; - for (unsigned int jdx = 0; jdx < segments.mod.nSegments()[idx]; jdx++) { + nSegments += segmentsOccupancy.nSegments()[idx]; + for (unsigned int jdx = 0; jdx < segmentsOccupancy.nSegments()[idx]; jdx++) { unsigned int sgIdx = ranges->segmentModuleIndices[idx] + jdx; - unsigned int InnerMiniDoubletIndex = segments.mem.mdIndices()[2 * sgIdx][0]; - unsigned int OuterMiniDoubletIndex = segments.mem.mdIndices()[2 * sgIdx][1]; + unsigned int InnerMiniDoubletIndex = segments.mdIndices()[2 * sgIdx][0]; + unsigned int OuterMiniDoubletIndex = segments.mdIndices()[2 * sgIdx][1]; unsigned int InnerMiniDoubletLowerHitIndex = miniDoublets->anchorHitIndices[InnerMiniDoubletIndex]; unsigned int InnerMiniDoubletUpperHitIndex = miniDoublets->outerHitIndices[InnerMiniDoubletIndex]; unsigned int OuterMiniDoubletLowerHitIndex = miniDoublets->anchorHitIndices[OuterMiniDoubletIndex]; @@ -1040,7 +1041,8 @@ void printLSs(Event* event) { //________________________________________________________________________________________________________________________________ void printpLSs(Event* event) { - Segments& segments = event->getSegments(); + SegmentsConst segments = event->getSegments(); + SegmentsOccupancyConst segmentsOccupancy = event->getSegments(); MiniDoublets const* miniDoublets = event->getMiniDoublets().data(); Hits const* hitsEvt = event->getHits().data(); Modules const* modules = event->getModules().data(); @@ -1048,11 +1050,11 @@ void printpLSs(Event* event) { unsigned int i = *(modules->nLowerModules); unsigned int idx = i; //modules->lowerModuleIndices[i]; - int npLS = segments.mod.nSegments()[idx]; - for (unsigned int jdx = 0; jdx < segments.mod.nSegments()[idx]; jdx++) { + int npLS = segmentsOccupancy.nSegments()[idx]; + for (unsigned int jdx = 0; jdx < segmentsOccupancy.nSegments()[idx]; jdx++) { unsigned int sgIdx = ranges->segmentModuleIndices[idx] + jdx; - unsigned int InnerMiniDoubletIndex = segments.mem.mdIndices()[2 * sgIdx][0]; - unsigned int OuterMiniDoubletIndex = segments.mem.mdIndices()[2 * sgIdx][1]; + unsigned int InnerMiniDoubletIndex = segments.mdIndices()[2 * sgIdx][0]; + unsigned int OuterMiniDoubletIndex = segments.mdIndices()[2 * sgIdx][1]; unsigned int InnerMiniDoubletLowerHitIndex = miniDoublets->anchorHitIndices[InnerMiniDoubletIndex]; unsigned int InnerMiniDoubletUpperHitIndex = miniDoublets->outerHitIndices[InnerMiniDoubletIndex]; unsigned int OuterMiniDoubletLowerHitIndex = miniDoublets->anchorHitIndices[OuterMiniDoubletIndex]; @@ -1071,7 +1073,7 @@ void printpLSs(Event* event) { //________________________________________________________________________________________________________________________________ void printT3s(Event* event) { Triplets const* triplets = event->getTriplets().data(); - Segments segments = event->getSegments(); + SegmentsConst segments = event->getSegments(); MiniDoublets const* miniDoublets = event->getMiniDoublets().data(); Hits const* hitsEvt = event->getHits().data(); Modules const* modules = event->getModules().data(); @@ -1084,9 +1086,9 @@ void printT3s(Event* event) { unsigned int tpIdx = idx * 5000 + jdx; unsigned int InnerSegmentIndex = triplets->segmentIndices[2 * tpIdx]; unsigned int OuterSegmentIndex = triplets->segmentIndices[2 * tpIdx + 1]; - unsigned int InnerSegmentInnerMiniDoubletIndex = segments.mem.mdIndices()[2 * InnerSegmentIndex][0]; - unsigned int InnerSegmentOuterMiniDoubletIndex = segments.mem.mdIndices()[2 * InnerSegmentIndex][1]; - unsigned int OuterSegmentOuterMiniDoubletIndex = segments.mem.mdIndices()[2 * OuterSegmentIndex][1]; + unsigned int InnerSegmentInnerMiniDoubletIndex = segments.mdIndices()[2 * InnerSegmentIndex][0]; + unsigned int InnerSegmentOuterMiniDoubletIndex = segments.mdIndices()[2 * InnerSegmentIndex][1]; + unsigned int OuterSegmentOuterMiniDoubletIndex = segments.mdIndices()[2 * OuterSegmentIndex][1]; unsigned int hit_idx0 = miniDoublets->anchorHitIndices[InnerSegmentInnerMiniDoubletIndex]; unsigned int hit_idx1 = miniDoublets->outerHitIndices[InnerSegmentInnerMiniDoubletIndex]; @@ -1114,7 +1116,7 @@ void printT3s(Event* event) { void debugPrintOutlierMultiplicities(Event* event) { TrackCandidates const* trackCandidates = event->getTrackCandidates().data(); Triplets const* triplets = event->getTriplets().data(); - Segments& segments = event->getSegments(); + SegmentsOccupancyConst segmentsOccupancy = event->getSegments(); MiniDoublets const* miniDoublets = event->getMiniDoublets().data(); Modules const* modules = event->getModules().data(); ObjectRanges const* ranges = event->getRanges().data(); @@ -1126,7 +1128,7 @@ void debugPrintOutlierMultiplicities(Event* event) { << " trackCandidates->nTrackCandidates[idx]: " << trackCandidates->nTrackCandidates[idx] << std::endl; std::cout << " idx: " << idx << " triplets->nTriplets[idx]: " << triplets->nTriplets[idx] << std::endl; unsigned int i = idx; //modules->lowerModuleIndices[idx]; - std::cout << " idx: " << idx << " i: " << i << " segments.mod.nSegments()[i]: " << segments.mod.nSegments()[i] << std::endl; + std::cout << " idx: " << idx << " i: " << i << " segmentsOccupancy.nSegments()[i]: " << segmentsOccupancy.nSegments()[i] << std::endl; int nMD = miniDoublets->nMDs[2 * idx] + miniDoublets->nMDs[2 * idx + 1]; std::cout << " idx: " << idx << " nMD: " << nMD << std::endl; int nHits = 0;