@@ -103,16 +103,6 @@ struct compare_track_chi2 {
103103 }
104104};
105105
106- template <int NLayers>
107- struct TrackExtensionHypothesis {
108- o2::track::TrackParCov param;
109- std::array<int , NLayers> clusters{};
110- TimeStamp time;
111- float chi2{0 .f };
112- int nClusters{0 };
113- int edgeLayer{constants::UnusedIndex};
114- };
115-
116106template <int NLayers>
117107GPUdi () bool isBetterTrackExtensionHypothesis (const TrackExtensionHypothesis<NLayers>& a, const TrackExtensionHypothesis<NLayers>& b)
118108{
@@ -236,13 +226,13 @@ GPUdi() bool followTrackExtensionDirection(const TrackExtensionStartState<NLayer
236226 const bool outward,
237227 const o2::base::Propagator* propagator,
238228 const o2::base::PropagatorF::MatCorrType matCorrType,
229+ TrackExtensionHypothesis<NLayers>* activeHypotheses,
230+ TrackExtensionHypothesis<NLayers>* nextHypotheses,
239231 TrackExtensionStartState<NLayers>& updatedTrack)
240232{
241233 const int step = outward ? 1 : -1 ;
242234 const int end = outward ? nLayers - 1 : 0 ;
243- const int beamWidth = o2::gpu::CAMath::Min (o2::gpu::CAMath::Max (beamWidthConfig, 1 ), MaxTrackExtensionGPUBeamWidth);
244- TrackExtensionHypothesis<NLayers> activeHypotheses[MaxTrackExtensionGPUBeamWidth];
245- TrackExtensionHypothesis<NLayers> nextHypotheses[MaxTrackExtensionGPUBeamWidth];
235+ const int beamWidth = o2::gpu::CAMath::Max (beamWidthConfig, 1 );
246236 int nActive{1 };
247237 int nNext{0 };
248238 initialiseTrackExtensionHypothesis (track, outward, activeHypotheses[0 ]);
@@ -431,6 +421,8 @@ GPUg() void __launch_bounds__(256, 1) computeTrackExtensionCandidatesKernel(cons
431421 const int ** ROFClusters,
432422 const TrackingFrameInfo** trackingFrameInfo,
433423 TrackExtensionCandidate<NLayers>* candidates,
424+ TrackExtensionHypothesis<NLayers>* activeHypothesesScratch,
425+ TrackExtensionHypothesis<NLayers>* nextHypothesesScratch,
434426 const float * layerRadii,
435427 const float * layerxX0,
436428 const int nTracks,
@@ -452,26 +444,28 @@ GPUg() void __launch_bounds__(256, 1) computeTrackExtensionCandidatesKernel(cons
452444 candidates[getFlatTrackExtensionCandidateIndex (iTrack, iCandidate)].reset ();
453445 }
454446 const auto & track = tracks[iTrack];
447+ auto * activeHypotheses = activeHypothesesScratch + (iTrack * beamWidth);
448+ auto * nextHypotheses = nextHypothesesScratch + (iTrack * beamWidth);
455449 int slot{0 };
456450 if (extendTop && track.lastClusterLayer != nLayers - 1 ) {
457451 TrackExtensionStartState<NLayers> topCandidate;
458- if (followTrackExtensionDirection (track, *utils, rofMask, rofOverlaps, clusters, usedClusters, clustersIndexTables, ROFClusters, trackingFrameInfo, layerRadii, layerxX0, nLayers, phiBins, beamWidth, bz, maxChi2ClusterAttachment, maxChi2NDF, nSigmaCutPhi, nSigmaCutZ, true , propagator, matCorrType, topCandidate)) {
452+ if (followTrackExtensionDirection (track, *utils, rofMask, rofOverlaps, clusters, usedClusters, clustersIndexTables, ROFClusters, trackingFrameInfo, layerRadii, layerxX0, nLayers, phiBins, beamWidth, bz, maxChi2ClusterAttachment, maxChi2NDF, nSigmaCutPhi, nSigmaCutZ, true , propagator, matCorrType, activeHypotheses, nextHypotheses, topCandidate)) {
459453 writeTrackExtensionCandidate (iTrack, track, topCandidate, candidates, slot);
460454 if (extendBot && topCandidate.firstClusterLayer != 0 ) {
461455 TrackExtensionStartState<NLayers> topBottomCandidate;
462- if (followTrackExtensionDirection (topCandidate, *utils, rofMask, rofOverlaps, clusters, usedClusters, clustersIndexTables, ROFClusters, trackingFrameInfo, layerRadii, layerxX0, nLayers, phiBins, beamWidth, bz, maxChi2ClusterAttachment, maxChi2NDF, nSigmaCutPhi, nSigmaCutZ, false , propagator, matCorrType, topBottomCandidate)) {
456+ if (followTrackExtensionDirection (topCandidate, *utils, rofMask, rofOverlaps, clusters, usedClusters, clustersIndexTables, ROFClusters, trackingFrameInfo, layerRadii, layerxX0, nLayers, phiBins, beamWidth, bz, maxChi2ClusterAttachment, maxChi2NDF, nSigmaCutPhi, nSigmaCutZ, false , propagator, matCorrType, activeHypotheses, nextHypotheses, topBottomCandidate)) {
463457 writeTrackExtensionCandidate (iTrack, track, topBottomCandidate, candidates, slot);
464458 }
465459 }
466460 }
467461 }
468462 if (extendBot && track.firstClusterLayer != 0 ) {
469463 TrackExtensionStartState<NLayers> bottomCandidate;
470- if (followTrackExtensionDirection (track, *utils, rofMask, rofOverlaps, clusters, usedClusters, clustersIndexTables, ROFClusters, trackingFrameInfo, layerRadii, layerxX0, nLayers, phiBins, beamWidth, bz, maxChi2ClusterAttachment, maxChi2NDF, nSigmaCutPhi, nSigmaCutZ, false , propagator, matCorrType, bottomCandidate)) {
464+ if (followTrackExtensionDirection (track, *utils, rofMask, rofOverlaps, clusters, usedClusters, clustersIndexTables, ROFClusters, trackingFrameInfo, layerRadii, layerxX0, nLayers, phiBins, beamWidth, bz, maxChi2ClusterAttachment, maxChi2NDF, nSigmaCutPhi, nSigmaCutZ, false , propagator, matCorrType, activeHypotheses, nextHypotheses, bottomCandidate)) {
471465 writeTrackExtensionCandidate (iTrack, track, bottomCandidate, candidates, slot);
472466 if (extendTop && bottomCandidate.lastClusterLayer != nLayers - 1 ) {
473467 TrackExtensionStartState<NLayers> bottomTopCandidate;
474- if (followTrackExtensionDirection (bottomCandidate, *utils, rofMask, rofOverlaps, clusters, usedClusters, clustersIndexTables, ROFClusters, trackingFrameInfo, layerRadii, layerxX0, nLayers, phiBins, beamWidth, bz, maxChi2ClusterAttachment, maxChi2NDF, nSigmaCutPhi, nSigmaCutZ, true , propagator, matCorrType, bottomTopCandidate)) {
468+ if (followTrackExtensionDirection (bottomCandidate, *utils, rofMask, rofOverlaps, clusters, usedClusters, clustersIndexTables, ROFClusters, trackingFrameInfo, layerRadii, layerxX0, nLayers, phiBins, beamWidth, bz, maxChi2ClusterAttachment, maxChi2NDF, nSigmaCutPhi, nSigmaCutZ, true , propagator, matCorrType, activeHypotheses, nextHypotheses, bottomTopCandidate)) {
475469 writeTrackExtensionCandidate (iTrack, track, bottomTopCandidate, candidates, slot);
476470 }
477471 }
@@ -948,6 +942,8 @@ void computeTrackExtensionCandidatesHandler(const TrackExtensionStartState<NLaye
948942 const int ** ROFClusters,
949943 const TrackingFrameInfo** trackingFrameInfo,
950944 TrackExtensionCandidate<NLayers>* candidates,
945+ TrackExtensionHypothesis<NLayers>* activeHypotheses,
946+ TrackExtensionHypothesis<NLayers>* nextHypotheses,
951947 const std::vector<float >& layerRadiiHost,
952948 const std::vector<float >& layerxX0Host,
953949 const int nTracks,
@@ -965,7 +961,7 @@ void computeTrackExtensionCandidatesHandler(const TrackExtensionStartState<NLaye
965961 const o2::base::PropagatorF::MatCorrType matCorrType,
966962 gpu::Stream& stream)
967963{
968- if (nTracks <= 0 || candidates == nullptr ) {
964+ if (nTracks <= 0 || candidates == nullptr || activeHypotheses == nullptr || nextHypotheses == nullptr ) {
969965 return ;
970966 }
971967 thrust::device_vector<float > layerRadii (layerRadiiHost);
@@ -981,6 +977,8 @@ void computeTrackExtensionCandidatesHandler(const TrackExtensionStartState<NLaye
981977 ROFClusters,
982978 trackingFrameInfo,
983979 candidates,
980+ activeHypotheses,
981+ nextHypotheses,
984982 thrust::raw_pointer_cast (&layerRadii[0 ]),
985983 thrust::raw_pointer_cast (&layerxX0[0 ]),
986984 nTracks,
@@ -1529,6 +1527,8 @@ template void computeTrackExtensionCandidatesHandler<7>(const TrackExtensionStar
15291527 const int ** ROFClusters,
15301528 const TrackingFrameInfo** trackingFrameInfo,
15311529 TrackExtensionCandidate<7 >* candidates,
1530+ TrackExtensionHypothesis<7 >* activeHypotheses,
1531+ TrackExtensionHypothesis<7 >* nextHypotheses,
15321532 const std::vector<float >& layerRadiiHost,
15331533 const std::vector<float >& layerxX0Host,
15341534 const int nTracks,
@@ -1737,6 +1737,8 @@ template void computeTrackExtensionCandidatesHandler<11>(const TrackExtensionSta
17371737 const int ** ROFClusters,
17381738 const TrackingFrameInfo** trackingFrameInfo,
17391739 TrackExtensionCandidate<11 >* candidates,
1740+ TrackExtensionHypothesis<11 >* activeHypotheses,
1741+ TrackExtensionHypothesis<11 >* nextHypotheses,
17401742 const std::vector<float >& layerRadiiHost,
17411743 const std::vector<float >& layerxX0Host,
17421744 const int nTracks,
0 commit comments