53 int startROF{this->mTrkParams[iteration].nROFsPerIterations > 0 ? iROFslice * this->mTrkParams[iteration].nROFsPerIterations : 0};
54 int endROF{o2::gpu::CAMath::Min(this->mTrkParams[iteration].nROFsPerIterations > 0 ? (iROFslice + 1) * this->mTrkParams[iteration].nROFsPerIterations + this->mTrkParams[iteration].DeltaROF : mTimeFrameGPU->getNrof(), mTimeFrameGPU->getNrof())};
56 mTimeFrameGPU->createTrackletsLUTDevice(iteration);
57 countTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
58 mTimeFrameGPU->getDeviceMultCutMask(),
61 mTimeFrameGPU->getNrof(),
62 this->mTrkParams[iteration].DeltaROF,
64 mTimeFrameGPU->getDeviceVertices(),
65 mTimeFrameGPU->getDeviceROFramesPV(),
66 mTimeFrameGPU->getPrimaryVerticesNum(),
67 mTimeFrameGPU->getDeviceArrayClusters(),
68 mTimeFrameGPU->getClusterSizes(),
69 mTimeFrameGPU->getDeviceROframeClusters(),
70 mTimeFrameGPU->getDeviceArrayUsedClusters(),
71 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
72 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
73 mTimeFrameGPU->getDeviceTrackletsLUTs(),
75 this->mTrkParams[iteration].NSigmaCut,
76 mTimeFrameGPU->getPhiCuts(),
77 this->mTrkParams[iteration].PVres,
78 mTimeFrameGPU->getMinRs(),
79 mTimeFrameGPU->getMaxRs(),
80 mTimeFrameGPU->getPositionResolutions(),
81 this->mTrkParams[iteration].LayerRadii,
82 mTimeFrameGPU->getMSangles(),
83 conf.nBlocksLayerTracklets[iteration],
84 conf.nThreadsLayerTracklets[iteration],
85 mTimeFrameGPU->getStreams());
86 mTimeFrameGPU->createTrackletsBuffers();
87 computeTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
88 mTimeFrameGPU->getDeviceMultCutMask(),
91 mTimeFrameGPU->getNrof(),
92 this->mTrkParams[iteration].DeltaROF,
94 mTimeFrameGPU->getDeviceVertices(),
95 mTimeFrameGPU->getDeviceROFramesPV(),
96 mTimeFrameGPU->getPrimaryVerticesNum(),
97 mTimeFrameGPU->getDeviceArrayClusters(),
98 mTimeFrameGPU->getClusterSizes(),
99 mTimeFrameGPU->getDeviceROframeClusters(),
100 mTimeFrameGPU->getDeviceArrayUsedClusters(),
101 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
102 mTimeFrameGPU->getDeviceArrayTracklets(),
103 mTimeFrameGPU->getDeviceTracklet(),
104 mTimeFrameGPU->getNTracklets(),
105 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
106 mTimeFrameGPU->getDeviceTrackletsLUTs(),
108 this->mTrkParams[iteration].NSigmaCut,
109 mTimeFrameGPU->getPhiCuts(),
110 this->mTrkParams[iteration].PVres,
111 mTimeFrameGPU->getMinRs(),
112 mTimeFrameGPU->getMaxRs(),
113 mTimeFrameGPU->getPositionResolutions(),
114 this->mTrkParams[iteration].LayerRadii,
115 mTimeFrameGPU->getMSangles(),
116 conf.nBlocksLayerTracklets[iteration],
117 conf.nThreadsLayerTracklets[iteration],
118 mTimeFrameGPU->getStreams());
124 mTimeFrameGPU->createCellsLUTDevice();
127 for (
int iLayer = 0; iLayer < this->mTrkParams[iteration].CellsPerRoad(); ++iLayer) {
128 if (!mTimeFrameGPU->getNTracklets()[iLayer + 1] || !mTimeFrameGPU->getNTracklets()[iLayer]) {
129 mTimeFrameGPU->getNCells()[iLayer] = 0;
132 const int currentLayerTrackletsNum{
static_cast<int>(mTimeFrameGPU->getNTracklets()[iLayer])};
134 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
135 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
136 mTimeFrameGPU->getDeviceArrayTracklets(),
137 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
138 mTimeFrameGPU->getNTracklets()[iLayer],
141 mTimeFrameGPU->getDeviceArrayCellsLUT(),
142 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
143 this->mTrkParams[iteration].DeltaROF,
145 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
146 this->mTrkParams[iteration].CellDeltaTanLambdaSigma,
147 this->mTrkParams[iteration].NSigmaCut,
148 conf.nBlocksLayerCells[iteration],
149 conf.nThreadsLayerCells[iteration]);
150 mTimeFrameGPU->createCellsBuffers(iLayer);
152 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
153 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
154 mTimeFrameGPU->getDeviceArrayTracklets(),
155 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
156 mTimeFrameGPU->getNTracklets()[iLayer],
158 mTimeFrameGPU->getDeviceCells()[iLayer],
159 mTimeFrameGPU->getDeviceArrayCellsLUT(),
160 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
161 this->mTrkParams[iteration].DeltaROF,
163 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
164 this->mTrkParams[iteration].CellDeltaTanLambdaSigma,
165 this->mTrkParams[iteration].NSigmaCut,
166 conf.nBlocksLayerCells[iteration],
167 conf.nThreadsLayerCells[iteration]);
174 mTimeFrameGPU->createNeighboursIndexTablesDevice();
176 for (
int iLayer{0}; iLayer < this->mTrkParams[iteration].CellsPerRoad() - 1; ++iLayer) {
177 const int currentLayerCellsNum{
static_cast<int>(mTimeFrameGPU->getNCells()[iLayer])};
178 const int nextLayerCellsNum{
static_cast<int>(mTimeFrameGPU->getNCells()[iLayer + 1])};
179 if (!nextLayerCellsNum || !currentLayerCellsNum) {
180 mTimeFrameGPU->getNNeighbours()[iLayer] = 0;
184 mTimeFrameGPU->createNeighboursLUTDevice(iLayer, nextLayerCellsNum);
186 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
187 mTimeFrameGPU->getDeviceArrayCellsLUT(),
188 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
189 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
190 (
const Tracklet**)mTimeFrameGPU->getDeviceArrayTracklets(),
191 this->mTrkParams[0].DeltaROF,
192 this->mTrkParams[0].MaxChi2ClusterAttachment,
195 currentLayerCellsNum,
198 conf.nBlocksFindNeighbours[iteration],
199 conf.nThreadsFindNeighbours[iteration]);
201 mTimeFrameGPU->createNeighboursDevice(iLayer, nNeigh);
204 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
205 mTimeFrameGPU->getDeviceArrayCellsLUT(),
206 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
207 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
208 (
const Tracklet**)mTimeFrameGPU->getDeviceArrayTracklets(),
209 this->mTrkParams[0].DeltaROF,
210 this->mTrkParams[0].MaxChi2ClusterAttachment,
213 currentLayerCellsNum,
216 conf.nBlocksFindNeighbours[iteration],
217 conf.nThreadsFindNeighbours[iteration]);
220 mTimeFrameGPU->getDeviceNeighbours(iLayer),
222 mTimeFrameGPU->getExternalAllocator());
223 mTimeFrameGPU->getArrayNNeighbours()[iLayer] = nNeigh;
225 mTimeFrameGPU->createNeighboursDeviceArray();
226 mTimeFrameGPU->unregisterRest();
233 for (
int startLevel{this->mTrkParams[iteration].CellsPerRoad()}; startLevel >= this->mTrkParams[iteration].CellMinimumLevel(); --startLevel) {
234 const int minimumLayer{startLevel - 1};
236 for (
int startLayer{this->mTrkParams[iteration].CellsPerRoad() - 1}; startLayer >= minimumLayer; --startLayer) {
237 if ((this->mTrkParams[iteration].StartLayerMask & (1 << (startLayer + 2))) == 0) {
240 processNeighboursHandler<nLayers>(startLayer,
242 mTimeFrameGPU->getDeviceArrayCells(),
243 mTimeFrameGPU->getDeviceCells()[startLayer],
244 mTimeFrameGPU->getArrayNCells(),
245 mTimeFrameGPU->getDeviceArrayUsedClusters(),
246 mTimeFrameGPU->getDeviceNeighboursAll(),
247 mTimeFrameGPU->getDeviceNeighboursLUTs(),
248 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
250 mTimeFrameGPU->getExternalAllocator(),
252 this->mTrkParams[0].MaxChi2ClusterAttachment,
253 this->mTrkParams[0].MaxChi2NDF,
254 mTimeFrameGPU->getDevicePropagator(),
255 this->mTrkParams[0].CorrType,
256 conf.nBlocksProcessNeighbours[iteration],
257 conf.nThreadsProcessNeighbours[iteration]);
260 if (trackSeeds.empty()) {
261 LOGP(
debug,
"No track seeds found, skipping track finding");
264 mTimeFrameGPU->createTrackITSExtDevice(trackSeeds);
265 mTimeFrameGPU->loadTrackSeedsDevice(trackSeeds);
268 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
269 mTimeFrameGPU->getDeviceTrackITSExt(),
270 this->mTrkParams[iteration].MinPt,
274 this->mTrkParams[0].MaxChi2ClusterAttachment,
275 this->mTrkParams[0].MaxChi2NDF,
276 mTimeFrameGPU->getDevicePropagator(),
277 this->mTrkParams[0].CorrType,
278 conf.nBlocksTracksSeeds[iteration],
279 conf.nThreadsTracksSeeds[iteration]);
281 mTimeFrameGPU->downloadTrackITSExtDevice(trackSeeds);
283 auto& tracks = mTimeFrameGPU->getTrackITSExt();
285 for (
auto& track : tracks) {
286 if (!track.getChi2()) {
290 bool isFirstShared{
false};
291 for (
int iLayer{0}; iLayer < this->mTrkParams[0].NLayers; ++iLayer) {
295 nShared +=
int(mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer)));
296 isFirstShared |= !iLayer && mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer));
299 if (nShared > this->mTrkParams[0].ClusterSharing) {
303 std::array<int, 3> rofs{INT_MAX, INT_MAX, INT_MAX};
304 for (
int iLayer{0}; iLayer < this->mTrkParams[0].NLayers; ++iLayer) {
308 mTimeFrameGPU->markUsedCluster(iLayer, track.getClusterIndex(iLayer));
309 int currentROF = mTimeFrameGPU->getClusterROF(iLayer, track.getClusterIndex(iLayer));
310 for (
int iR{0}; iR < 3; ++iR) {
311 if (rofs[iR] == INT_MAX) {
312 rofs[iR] = currentROF;
314 if (rofs[iR] == currentROF) {
319 if (rofs[2] != INT_MAX) {
322 if (rofs[1] != INT_MAX) {
323 track.setNextROFbit();
325 mTimeFrameGPU->getTracks(std::min(rofs[0], rofs[1])).emplace_back(track);
327 mTimeFrameGPU->loadUsedClustersDevice();
void countCellsHandler(const Cluster **sortedClusters, const Cluster **unsortedClusters, const TrackingFrameInfo **tfInfo, Tracklet **tracklets, int **trackletsLUT, const int nTracklets, const int layer, CellSeed *cells, int **cellsLUTsDeviceArray, int *cellsLUTsHost, const int deltaROF, const float bz, const float maxChi2ClusterAttachment, const float cellDeltaTanLambdaSigma, const float nSigmaCut, const int nBlocks, const int nThreads)
void computeCellNeighboursHandler(CellSeed **cellsLayersDevice, int *neighboursLUTs, int **cellsLUTs, gpuPair< int, int > *cellNeighbours, int *neighboursIndexTable, const Tracklet **tracklets, const int deltaROF, const float maxChi2ClusterAttachment, const float bz, const int layerIndex, const unsigned int nCells, const unsigned int nCellsNext, const int maxCellNeighbours, const int nBlocks, const int nThreads)
void computeCellsHandler(const Cluster **sortedClusters, const Cluster **unsortedClusters, const TrackingFrameInfo **tfInfo, Tracklet **tracklets, int **trackletsLUT, const int nTracklets, const int layer, CellSeed *cells, int **cellsLUTsDeviceArray, int *cellsLUTsHost, const int deltaROF, const float bz, const float maxChi2ClusterAttachment, const float cellDeltaTanLambdaSigma, const float nSigmaCut, const int nBlocks, const int nThreads)
unsigned int countCellNeighboursHandler(CellSeed **cellsLayersDevice, int *neighboursLUTs, int **cellsLUTs, gpuPair< int, int > *cellNeighbours, int *neighboursIndexTable, const Tracklet **tracklets, const int deltaROF, const float maxChi2ClusterAttachment, const float bz, const int layerIndex, const unsigned int nCells, const unsigned int nCellsNext, const int maxCellNeighbours, const int nBlocks, const int nThreads)
void trackSeedHandler(CellSeed *trackSeeds, const TrackingFrameInfo **foundTrackingFrameInfo, o2::its::TrackITSExt *tracks, std::vector< float > &minPtsHost, const unsigned int nSeeds, const float Bz, const int startLevel, float maxChi2ClusterAttachment, float maxChi2NDF, const o2::base::Propagator *propagator, const o2::base::PropagatorF::MatCorrType matCorrType, const int nBlocks, const int nThreads)