Skip to content

Commit d94dc03

Browse files
committed
ITS: introduce configuration context to reduce number of arguments
1 parent 001e143 commit d94dc03

5 files changed

Lines changed: 176 additions & 373 deletions

File tree

Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackingKernels.cu

Lines changed: 24 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -114,59 +114,18 @@ template <int NLayers>
114114
struct TrackExtensionDirectionFollowerDevice {
115115
GPUdi() bool operator()(TrackITSInternal<NLayers>& candidate, bool outward) const
116116
{
117-
const auto startHypothesis = TrackExtensionHypothesis<NLayers>{candidate, outward};
117+
const TrackExtensionHypothesis<NLayers> startHypothesis{candidate, outward};
118118
TrackExtensionHypothesis<NLayers> bestHypothesis;
119-
if (!followTrackExtensionDirection<NLayers>(startHypothesis,
120-
*utils,
121-
rofMask,
122-
rofOverlaps,
123-
clusters,
124-
usedClusters,
125-
clustersIndexTables,
126-
ROFClusters,
127-
trackingFrameInfo,
128-
layerRadii,
129-
layerxX0,
130-
nLayers,
131-
phiBins,
132-
maxHypotheses,
133-
bz,
134-
maxChi2ClusterAttachment,
135-
maxChi2NDF,
136-
nSigmaCutPhi,
137-
nSigmaCutZ,
138-
outward,
139-
propagator,
140-
matCorrType,
141-
activeHypotheses,
142-
nextHypotheses,
143-
bestHypothesis)) {
119+
if (!followTrackExtensionDirection<NLayers>(startHypothesis, *fitCtx, *followCtx, outward,
120+
activeHypotheses, nextHypotheses, bestHypothesis)) {
144121
return false;
145122
}
146-
updateTrackFromExtensionHypothesis(bestHypothesis, outward, nLayers, candidate);
123+
updateTrackFromExtensionHypothesis(bestHypothesis, outward, fitCtx->nLayers, candidate);
147124
return true;
148125
}
149126

150-
const IndexTableUtils<NLayers>* utils{nullptr};
151-
typename ROFMaskTable<NLayers>::View rofMask;
152-
typename ROFOverlapTable<NLayers>::View rofOverlaps;
153-
const Cluster* const* clusters{nullptr};
154-
const unsigned char* const* usedClusters{nullptr};
155-
const int* const* clustersIndexTables{nullptr};
156-
const int* const* ROFClusters{nullptr};
157-
const TrackingFrameInfo* const* trackingFrameInfo{nullptr};
158-
const float* layerRadii{nullptr};
159-
const float* layerxX0{nullptr};
160-
int nLayers{0};
161-
int phiBins{0};
162-
int maxHypotheses{0};
163-
float bz{0.f};
164-
float maxChi2ClusterAttachment{0.f};
165-
float maxChi2NDF{0.f};
166-
float nSigmaCutPhi{0.f};
167-
float nSigmaCutZ{0.f};
168-
const o2::base::Propagator* propagator{nullptr};
169-
o2::base::PropagatorF::MatCorrType matCorrType{o2::base::PropagatorF::MatCorrType::USEMatCorrNONE};
127+
const o2::its::track::TrackFitContext<NLayers>* fitCtx{nullptr};
128+
const TrackFollowContext<NLayers>* followCtx{nullptr};
170129
TrackExtensionHypothesis<NLayers>* activeHypotheses{nullptr};
171130
TrackExtensionHypothesis<NLayers>* nextHypotheses{nullptr};
172131
};
@@ -190,23 +149,19 @@ GPUg() void __launch_bounds__(constants::GPUThreads, 1) countTrackSeedsKernel(
190149
const o2::base::Propagator* propagator,
191150
const o2::base::PropagatorF::MatCorrType matCorrType)
192151
{
152+
const o2::its::track::TrackFitContext<NLayers> fitCtx{
153+
foundTrackingFrameInfo, layerxX0, NLayers, bz,
154+
maxChi2ClusterAttachment, maxChi2NDF,
155+
propagator, matCorrType, shiftRefToCluster, repeatRefitOut};
193156
for (int iCurrentTrackSeedIndex = blockIdx.x * blockDim.x + threadIdx.x; iCurrentTrackSeedIndex < nSeeds; iCurrentTrackSeedIndex += blockDim.x * gridDim.x) {
194157
TrackITSInternal<NLayers> temporaryTrack;
195158
if (o2::its::track::refitTrackSeed(trackSeeds[iCurrentTrackSeedIndex],
196159
temporaryTrack,
197-
maxChi2ClusterAttachment,
198-
maxChi2NDF,
199-
bz,
200-
foundTrackingFrameInfo,
160+
fitCtx,
201161
unsortedClusters,
202-
layerxX0,
203162
layerRadii,
204163
minPts,
205-
propagator,
206-
matCorrType,
207-
reseedIfShorter,
208-
shiftRefToCluster,
209-
repeatRefitOut)) {
164+
reseedIfShorter)) {
210165
seedLUT[iCurrentTrackSeedIndex] = 1;
211166
}
212167
}
@@ -248,26 +203,26 @@ GPUg() void __launch_bounds__(constants::GPUThreads, 1) fitTrackSeedsKernel(
248203
const o2::base::Propagator* propagator,
249204
const o2::base::PropagatorF::MatCorrType matCorrType)
250205
{
206+
const o2::its::track::TrackFitContext<NLayers> fitCtx{
207+
foundTrackingFrameInfo, layerxX0, nLayers, bz,
208+
maxChi2ClusterAttachment, maxChi2NDF,
209+
propagator, matCorrType, shiftRefToCluster, repeatRefitOut};
210+
const TrackFollowContext<NLayers> followCtx{
211+
utils, rofMask, rofOverlaps,
212+
clusters, usedClusters, clustersIndexTables, ROFClusters,
213+
layerRadii, phiBins, maxHypothesesConfig, nSigmaCutPhi, nSigmaCutZ};
251214
for (int iCurrentTrackSeedIndex = blockIdx.x * blockDim.x + threadIdx.x; iCurrentTrackSeedIndex < nSeeds; iCurrentTrackSeedIndex += blockDim.x * gridDim.x) {
252215
if (seedLUT[iCurrentTrackSeedIndex] == seedLUT[iCurrentTrackSeedIndex + 1]) {
253216
continue;
254217
}
255218
TrackITSInternal<NLayers> temporaryTrack;
256219
bool refitSuccess = o2::its::track::refitTrackSeed(trackSeeds[iCurrentTrackSeedIndex],
257220
temporaryTrack,
258-
maxChi2ClusterAttachment,
259-
maxChi2NDF,
260-
bz,
261-
foundTrackingFrameInfo,
221+
fitCtx,
262222
unsortedClusters,
263-
layerxX0,
264223
layerRadii,
265224
minPts,
266-
propagator,
267-
matCorrType,
268-
reseedIfShorter,
269-
shiftRefToCluster,
270-
repeatRefitOut);
225+
reseedIfShorter);
271226
if (refitSuccess) {
272227
if ((extendTop || extendBot) && activeHypothesesScratch && nextHypothesesScratch) {
273228
const int maxHypotheses = o2::gpu::CAMath::Max(maxHypothesesConfig, 1);
@@ -277,41 +232,8 @@ GPUg() void __launch_bounds__(constants::GPUThreads, 1) fitTrackSeedsKernel(
277232
const auto backup = temporaryTrack;
278233
auto best = temporaryTrack;
279234
uint32_t bestDiff{0};
280-
TrackExtensionDirectionFollowerDevice<NLayers> followDirection{
281-
utils,
282-
rofMask,
283-
rofOverlaps,
284-
clusters,
285-
usedClusters,
286-
clustersIndexTables,
287-
ROFClusters,
288-
foundTrackingFrameInfo,
289-
layerRadii,
290-
layerxX0,
291-
nLayers,
292-
phiBins,
293-
maxHypotheses,
294-
bz,
295-
maxChi2ClusterAttachment,
296-
maxChi2NDF,
297-
nSigmaCutPhi,
298-
nSigmaCutZ,
299-
propagator,
300-
matCorrType,
301-
activeHypotheses,
302-
nextHypotheses};
303-
TrackExtensionBestTrial<NLayers> bestTrial{
304-
backup.getPattern(),
305-
foundTrackingFrameInfo,
306-
layerxX0,
307-
nLayers,
308-
bz,
309-
maxChi2ClusterAttachment,
310-
maxChi2NDF,
311-
propagator,
312-
matCorrType,
313-
shiftRefToCluster,
314-
repeatRefitOut};
235+
TrackExtensionDirectionFollowerDevice<NLayers> followDirection{&fitCtx, &followCtx, activeHypotheses, nextHypotheses};
236+
TrackExtensionBestTrial<NLayers> bestTrial{backup.getPattern(), fitCtx};
315237
followTrackExtensionBranches(backup, extendTop, extendBot, nLayers, followDirection, bestTrial, best, bestDiff);
316238
temporaryTrack = best;
317239
tracks[seedLUT[iCurrentTrackSeedIndex]] = makeTrackITSExt(temporaryTrack);

0 commit comments

Comments
 (0)