ITS: add back the code for track following#15456
Conversation
f3sch
left a comment
There was a problem hiding this comment.
Nice work, still have to go through the actual meat of the code but maybe this can be a starting point. Most comments are only of cosmetic nature
f3sch
left a comment
There was a problem hiding this comment.
Still have to actually run it but I think this already in very good shape. I attached more (less than last time) nitpicks. Thanks for addressing.
| @@ -0,0 +1,56 @@ | |||
| // Copyright 2019-2020 CERN and copyright holders of ALICE O2. | |||
| } | ||
|
|
||
| template <int NLayers> | ||
| GPUdi() bool refitTrack(const TrackSeed<NLayers>& trackSeed, |
There was a problem hiding this comment.
Now we have two functions called refitTrack that do different things, maybe we can be verbose here and name it refitTrackWithReseed or something
| mTimeFrame->resetTrackExtensionCounters(); | ||
| iVertex = std::min(maxNvertices, 0); | ||
| logger(std::format("==== ITS {} Tracking iteration {} summary ====", mTraits->getName(), iteration)); | ||
| total += timeFrame = evaluateTask(&Tracker::initialiseTimeFrame, StateNames[mCurStep = TFInit], iteration, evalLog, iteration); |
There was a problem hiding this comment.
Why do we call resetTrackExtensionCounters explicitly and not in the just in the TimeFrame::initialise?
| namespace | ||
| { | ||
| constexpr int trackExtensionLaunchThreads = 60 * 256; | ||
| } |
There was a problem hiding this comment.
This looks odd to me. Since we are currently anyways hardcoding the number of threads and blocks for all kernels, we should here just put this in the Constants.h and and use these constants across all kernels directly. In the future when this code is more integrated in the GPU framework (or we find another way) to compile with optimised parameters for different GPU this will make it easier.
| if (extendTop && temporaryTrack.getLastClusterLayer() != lastLayer) { | ||
| auto candidate = temporaryTrack; | ||
| const auto startHypothesis = TrackExtensionHypothesis<NLayers>{temporaryTrack, true}; | ||
| TrackExtensionHypothesis<NLayers> bestHypothesis; | ||
| if (followTrackExtensionDirection<NLayers>(startHypothesis, | ||
| *utils, | ||
| rofMask, | ||
| rofOverlaps, | ||
| clusters, | ||
| usedClusters, | ||
| clustersIndexTables, | ||
| ROFClusters, | ||
| foundTrackingFrameInfo, | ||
| layerRadii, | ||
| layerxX0, | ||
| nLayers, | ||
| phiBins, | ||
| maxHypotheses, | ||
| bz, | ||
| maxChi2ClusterAttachment, | ||
| maxChi2NDF, | ||
| nSigmaCutPhi, | ||
| nSigmaCutZ, | ||
| true, | ||
| propagator, | ||
| matCorrType, | ||
| activeHypotheses, | ||
| nextHypotheses, | ||
| bestHypothesis)) { | ||
| updateTrackFromExtensionHypothesis(bestHypothesis, true, nLayers, candidate); | ||
| topResult = candidate; | ||
| hasTopResult = true; | ||
| finaliseTrackExtensionTrial<NLayers>(backupPattern, candidate, foundTrackingFrameInfo, layerxX0, nLayers, bz, maxChi2ClusterAttachment, maxChi2NDF, propagator, matCorrType, shiftRefToCluster, repeatRefitOut, best, bestDiff); | ||
| } | ||
| } | ||
| if (extendBot && temporaryTrack.getFirstClusterLayer() != 0) { | ||
| auto candidate = temporaryTrack; | ||
| const auto startHypothesis = TrackExtensionHypothesis<NLayers>{temporaryTrack, false}; | ||
| TrackExtensionHypothesis<NLayers> bestHypothesis; | ||
| if (followTrackExtensionDirection<NLayers>(startHypothesis, | ||
| *utils, | ||
| rofMask, | ||
| rofOverlaps, | ||
| clusters, | ||
| usedClusters, | ||
| clustersIndexTables, | ||
| ROFClusters, | ||
| foundTrackingFrameInfo, | ||
| layerRadii, | ||
| layerxX0, | ||
| nLayers, | ||
| phiBins, | ||
| maxHypotheses, | ||
| bz, | ||
| maxChi2ClusterAttachment, | ||
| maxChi2NDF, | ||
| nSigmaCutPhi, | ||
| nSigmaCutZ, | ||
| false, | ||
| propagator, | ||
| matCorrType, | ||
| activeHypotheses, | ||
| nextHypotheses, | ||
| bestHypothesis)) { | ||
| updateTrackFromExtensionHypothesis(bestHypothesis, false, nLayers, candidate); | ||
| botResult = candidate; | ||
| hasBotResult = true; | ||
| finaliseTrackExtensionTrial<NLayers>(backupPattern, candidate, foundTrackingFrameInfo, layerxX0, nLayers, bz, maxChi2ClusterAttachment, maxChi2NDF, propagator, matCorrType, shiftRefToCluster, repeatRefitOut, best, bestDiff); | ||
| } | ||
| } | ||
| if (extendTop && extendBot) { | ||
| if (hasTopResult && topResult.getFirstClusterLayer() != 0) { | ||
| auto candidate = topResult; | ||
| const auto startHypothesis = TrackExtensionHypothesis<NLayers>{topResult, false}; | ||
| TrackExtensionHypothesis<NLayers> bestHypothesis; | ||
| if (followTrackExtensionDirection<NLayers>(startHypothesis, | ||
| *utils, | ||
| rofMask, | ||
| rofOverlaps, | ||
| clusters, | ||
| usedClusters, | ||
| clustersIndexTables, | ||
| ROFClusters, | ||
| foundTrackingFrameInfo, | ||
| layerRadii, | ||
| layerxX0, | ||
| nLayers, | ||
| phiBins, | ||
| maxHypotheses, | ||
| bz, | ||
| maxChi2ClusterAttachment, | ||
| maxChi2NDF, | ||
| nSigmaCutPhi, | ||
| nSigmaCutZ, | ||
| false, | ||
| propagator, | ||
| matCorrType, | ||
| activeHypotheses, | ||
| nextHypotheses, | ||
| bestHypothesis)) { | ||
| updateTrackFromExtensionHypothesis(bestHypothesis, false, nLayers, candidate); | ||
| finaliseTrackExtensionTrial<NLayers>(backupPattern, candidate, foundTrackingFrameInfo, layerxX0, nLayers, bz, maxChi2ClusterAttachment, maxChi2NDF, propagator, matCorrType, shiftRefToCluster, repeatRefitOut, best, bestDiff); | ||
| } | ||
| } | ||
| if (hasBotResult && botResult.getLastClusterLayer() != lastLayer) { | ||
| auto candidate = botResult; | ||
| const auto startHypothesis = TrackExtensionHypothesis<NLayers>{botResult, true}; | ||
| TrackExtensionHypothesis<NLayers> bestHypothesis; | ||
| if (followTrackExtensionDirection<NLayers>(startHypothesis, | ||
| *utils, | ||
| rofMask, | ||
| rofOverlaps, | ||
| clusters, | ||
| usedClusters, | ||
| clustersIndexTables, | ||
| ROFClusters, | ||
| foundTrackingFrameInfo, | ||
| layerRadii, | ||
| layerxX0, | ||
| nLayers, | ||
| phiBins, | ||
| maxHypotheses, | ||
| bz, | ||
| maxChi2ClusterAttachment, | ||
| maxChi2NDF, | ||
| nSigmaCutPhi, | ||
| nSigmaCutZ, | ||
| true, | ||
| propagator, | ||
| matCorrType, | ||
| activeHypotheses, | ||
| nextHypotheses, | ||
| bestHypothesis)) { | ||
| updateTrackFromExtensionHypothesis(bestHypothesis, true, nLayers, candidate); | ||
| finaliseTrackExtensionTrial<NLayers>(backupPattern, candidate, foundTrackingFrameInfo, layerxX0, nLayers, bz, maxChi2ClusterAttachment, maxChi2NDF, propagator, matCorrType, shiftRefToCluster, repeatRefitOut, best, bestDiff); | ||
| } | ||
| } | ||
| } | ||
| temporaryTrack = best; | ||
| tracks[seedLUT[iCurrentTrackSeedIndex]] = makeTrackITSExt(temporaryTrack); |
There was a problem hiding this comment.
This and
AliceO2/Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx
Lines 707 to 759 in d5d30e7
By default, this is disabled for ITS, but it is required for ALICE3.
This changes the findRoads to avoid the double pass (first count then fill) on CPU, leading to marginal gain on speed while keeping the memory footprint equal (checked on a critical PbPb CTF that Felix gave me)