94 mTimeFrameGPU->createTrackletsLUTDevice(iteration);
96 const Vertex diamondVert({mTrkParams[iteration].Diamond[0], mTrkParams[iteration].Diamond[1], mTrkParams[iteration].Diamond[2]}, {25.e-6f, 0.f, 0.f, 25.e-6f, 0.f, 36.f}, 1, 1.f);
97 gsl::span<const Vertex> diamondSpan(&diamondVert, 1);
98 int startROF{mTrkParams[iteration].nROFsPerIterations > 0 ? iROFslice * mTrkParams[iteration].nROFsPerIterations : 0};
99 int endROF{o2::gpu::CAMath::Min(mTrkParams[iteration].nROFsPerIterations > 0 ? (iROFslice + 1) * mTrkParams[iteration].nROFsPerIterations + mTrkParams[iteration].DeltaROF : mTimeFrameGPU->getNrof(), mTimeFrameGPU->getNrof())};
101 countTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
102 mTimeFrameGPU->getDeviceMultCutMask(),
105 mTimeFrameGPU->getNrof(),
106 mTrkParams[iteration].DeltaROF,
108 mTimeFrameGPU->getDeviceVertices(),
109 mTimeFrameGPU->getDeviceROFramesPV(),
110 mTimeFrameGPU->getPrimaryVerticesNum(),
111 mTimeFrameGPU->getDeviceArrayClusters(),
112 mTimeFrameGPU->getClusterSizes(),
113 mTimeFrameGPU->getDeviceROframeClusters(),
114 mTimeFrameGPU->getDeviceArrayUsedClusters(),
115 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
116 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
117 mTimeFrameGPU->getDeviceTrackletsLUTs(),
119 mTrkParams[iteration].NSigmaCut,
120 mTimeFrameGPU->getPhiCuts(),
121 mTrkParams[iteration].PVres,
122 mTimeFrameGPU->getMinRs(),
123 mTimeFrameGPU->getMaxRs(),
124 mTimeFrameGPU->getPositionResolutions(),
125 mTrkParams[iteration].LayerRadii,
126 mTimeFrameGPU->getMSangles(),
129 mTimeFrameGPU->createTrackletsBuffers();
130 computeTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
131 mTimeFrameGPU->getDeviceMultCutMask(),
134 mTimeFrameGPU->getNrof(),
135 mTrkParams[iteration].DeltaROF,
137 mTimeFrameGPU->getDeviceVertices(),
138 mTimeFrameGPU->getDeviceROFramesPV(),
139 mTimeFrameGPU->getPrimaryVerticesNum(),
140 mTimeFrameGPU->getDeviceArrayClusters(),
141 mTimeFrameGPU->getClusterSizes(),
142 mTimeFrameGPU->getDeviceROframeClusters(),
143 mTimeFrameGPU->getDeviceArrayUsedClusters(),
144 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
145 mTimeFrameGPU->getDeviceArrayTracklets(),
146 mTimeFrameGPU->getDeviceTracklet(),
147 mTimeFrameGPU->getNTracklets(),
148 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
149 mTimeFrameGPU->getDeviceTrackletsLUTs(),
151 mTrkParams[iteration].NSigmaCut,
152 mTimeFrameGPU->getPhiCuts(),
153 mTrkParams[iteration].PVres,
154 mTimeFrameGPU->getMinRs(),
155 mTimeFrameGPU->getMaxRs(),
156 mTimeFrameGPU->getPositionResolutions(),
157 mTrkParams[iteration].LayerRadii,
158 mTimeFrameGPU->getMSangles(),
166 mTimeFrameGPU->createCellsLUTDevice();
169 for (
int iLayer = 0; iLayer < mTrkParams[iteration].CellsPerRoad(); ++iLayer) {
170 if (!mTimeFrameGPU->getNTracklets()[iLayer + 1] || !mTimeFrameGPU->getNTracklets()[iLayer]) {
173 const int currentLayerTrackletsNum{
static_cast<int>(mTimeFrameGPU->getNTracklets()[iLayer])};
175 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
176 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
177 mTimeFrameGPU->getDeviceArrayTracklets(),
178 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
179 mTimeFrameGPU->getNTracklets()[iLayer],
182 mTimeFrameGPU->getDeviceArrayCellsLUT(),
183 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
185 mTrkParams[iteration].MaxChi2ClusterAttachment,
186 mTrkParams[iteration].CellDeltaTanLambdaSigma,
187 mTrkParams[iteration].NSigmaCut,
190 mTimeFrameGPU->createCellsBuffers(iLayer);
192 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
193 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
194 mTimeFrameGPU->getDeviceArrayTracklets(),
195 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
196 mTimeFrameGPU->getNTracklets()[iLayer],
198 mTimeFrameGPU->getDeviceCells()[iLayer],
199 mTimeFrameGPU->getDeviceArrayCellsLUT(),
200 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
202 mTrkParams[iteration].MaxChi2ClusterAttachment,
203 mTrkParams[iteration].CellDeltaTanLambdaSigma,
204 mTrkParams[iteration].NSigmaCut,
213 mTimeFrameGPU->createNeighboursIndexTablesDevice();
215 for (
int iLayer{0}; iLayer < mTrkParams[iteration].CellsPerRoad() - 1; ++iLayer) {
216 const int nextLayerCellsNum{
static_cast<int>(mTimeFrameGPU->getNCells()[iLayer + 1])};
218 if (!nextLayerCellsNum) {
222 mTimeFrameGPU->createNeighboursLUTDevice(iLayer, nextLayerCellsNum);
224 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
225 mTimeFrameGPU->getDeviceArrayCellsLUT(),
226 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
227 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
228 mTrkParams[0].MaxChi2ClusterAttachment,
231 mTimeFrameGPU->getNCells()[iLayer],
237 mTimeFrameGPU->createNeighboursDevice(iLayer, nNeigh);
240 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
241 mTimeFrameGPU->getDeviceArrayCellsLUT(),
242 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
243 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
244 mTrkParams[0].MaxChi2ClusterAttachment,
247 mTimeFrameGPU->getNCells()[iLayer],
254 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
255 mTimeFrameGPU->getDeviceNeighbours(iLayer),
258 mTimeFrameGPU->createNeighboursDeviceArray();
259 mTimeFrameGPU->unregisterRest();
266 for (
int startLevel{mTrkParams[iteration].CellsPerRoad()}; startLevel >= mTrkParams[iteration].CellMinimumLevel(); --startLevel) {
267 const int minimumLayer{startLevel - 1};
268 std::vector<CellSeed> trackSeeds;
269 for (
int startLayer{mTrkParams[iteration].CellsPerRoad() - 1}; startLayer >= minimumLayer; --startLayer) {
270 if ((mTrkParams[iteration].StartLayerMask & (1 << (startLayer + 2))) == 0) {
273 std::vector<int> lastCellId, updatedCellId;
274 std::vector<CellSeed> lastCellSeed, updatedCellSeed;
276 processNeighboursHandler<nLayers>(startLayer,
278 mTimeFrameGPU->getDeviceArrayCells(),
279 mTimeFrameGPU->getDeviceCells()[startLayer],
280 mTimeFrameGPU->getArrayNCells(),
281 mTimeFrameGPU->getDeviceArrayUsedClusters(),
282 mTimeFrameGPU->getDeviceNeighboursAll(),
283 mTimeFrameGPU->getDeviceNeighboursLUTs(),
284 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
287 mTrkParams[0].MaxChi2ClusterAttachment,
288 mTrkParams[0].MaxChi2NDF,
289 mTimeFrameGPU->getDevicePropagator(),
295 if (!trackSeeds.size()) {
296 LOGP(info,
"No track seeds found, skipping track finding");
299 mTimeFrameGPU->createTrackITSExtDevice(trackSeeds);
300 mTimeFrameGPU->loadTrackSeedsDevice(trackSeeds);
303 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
304 mTimeFrameGPU->getDeviceTrackITSExt(),
305 mTrkParams[iteration].MinPt,
309 mTrkParams[0].MaxChi2ClusterAttachment,
310 mTrkParams[0].MaxChi2NDF,
311 mTimeFrameGPU->getDevicePropagator(),
316 mTimeFrameGPU->downloadTrackITSExtDevice(trackSeeds);
318 auto& tracks = mTimeFrameGPU->getTrackITSExt();
320 for (
auto& track : tracks) {
321 if (!track.getChi2()) {
325 bool isFirstShared{
false};
326 for (
int iLayer{0}; iLayer < mTrkParams[0].NLayers; ++iLayer) {
327 if (track.getClusterIndex(iLayer) ==
UnusedIndex) {
330 nShared +=
int(mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer)));
331 isFirstShared |= !iLayer && mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer));
334 if (nShared > mTrkParams[0].ClusterSharing) {
338 std::array<int, 3> rofs{INT_MAX, INT_MAX, INT_MAX};
339 for (
int iLayer{0}; iLayer < mTrkParams[0].NLayers; ++iLayer) {
340 if (track.getClusterIndex(iLayer) ==
UnusedIndex) {
343 mTimeFrameGPU->markUsedCluster(iLayer, track.getClusterIndex(iLayer));
344 int currentROF = mTimeFrameGPU->getClusterROF(iLayer, track.getClusterIndex(iLayer));
345 for (
int iR{0}; iR < 3; ++iR) {
346 if (rofs[iR] == INT_MAX) {
347 rofs[iR] = currentROF;
349 if (rofs[iR] == currentROF) {
354 if (rofs[2] != INT_MAX) {
357 if (rofs[1] != INT_MAX) {
358 track.setNextROFbit();
360 mTimeFrameGPU->getTracks(std::min(rofs[0], rofs[1])).emplace_back(track);
362 mTimeFrameGPU->loadUsedClustersDevice();
364 if (iteration == mTrkParams.size() - 1) {
365 mTimeFrameGPU->unregisterHostMemory(0);
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 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 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)
unsigned int countCellNeighboursHandler(CellSeed **cellsLayersDevice, int *neighboursLUTs, int **cellsLUTs, gpuPair< int, int > *cellNeighbours, int *neighboursIndexTable, 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)
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 float bz, const float maxChi2ClusterAttachment, const float cellDeltaTanLambdaSigma, const float nSigmaCut, const int nBlocks, const int nThreads)