52 mTimeFrameGPU->createTrackletsLUTDevice(iteration);
54 const Vertex diamondVert({this->mTrkParams[iteration].Diamond[0], this->mTrkParams[iteration].Diamond[1], this->mTrkParams[iteration].Diamond[2]}, {25.e-6f, 0.f, 0.f, 25.e-6f, 0.f, 36.f}, 1, 1.f);
55 gsl::span<const Vertex> diamondSpan(&diamondVert, 1);
56 int startROF{this->mTrkParams[iteration].nROFsPerIterations > 0 ? iROFslice * this->mTrkParams[iteration].nROFsPerIterations : 0};
57 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())};
59 countTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
60 mTimeFrameGPU->getDeviceMultCutMask(),
63 mTimeFrameGPU->getNrof(),
64 this->mTrkParams[iteration].DeltaROF,
66 mTimeFrameGPU->getDeviceVertices(),
67 mTimeFrameGPU->getDeviceROFramesPV(),
68 mTimeFrameGPU->getPrimaryVerticesNum(),
69 mTimeFrameGPU->getDeviceArrayClusters(),
70 mTimeFrameGPU->getClusterSizes(),
71 mTimeFrameGPU->getDeviceROframeClusters(),
72 mTimeFrameGPU->getDeviceArrayUsedClusters(),
73 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
74 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
75 mTimeFrameGPU->getDeviceTrackletsLUTs(),
77 this->mTrkParams[iteration].NSigmaCut,
78 mTimeFrameGPU->getPhiCuts(),
79 this->mTrkParams[iteration].PVres,
80 mTimeFrameGPU->getMinRs(),
81 mTimeFrameGPU->getMaxRs(),
82 mTimeFrameGPU->getPositionResolutions(),
83 this->mTrkParams[iteration].LayerRadii,
84 mTimeFrameGPU->getMSangles(),
87 mTimeFrameGPU->createTrackletsBuffers();
88 computeTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
89 mTimeFrameGPU->getDeviceMultCutMask(),
92 mTimeFrameGPU->getNrof(),
93 this->mTrkParams[iteration].DeltaROF,
95 mTimeFrameGPU->getDeviceVertices(),
96 mTimeFrameGPU->getDeviceROFramesPV(),
97 mTimeFrameGPU->getPrimaryVerticesNum(),
98 mTimeFrameGPU->getDeviceArrayClusters(),
99 mTimeFrameGPU->getClusterSizes(),
100 mTimeFrameGPU->getDeviceROframeClusters(),
101 mTimeFrameGPU->getDeviceArrayUsedClusters(),
102 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
103 mTimeFrameGPU->getDeviceArrayTracklets(),
104 mTimeFrameGPU->getDeviceTracklet(),
105 mTimeFrameGPU->getNTracklets(),
106 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
107 mTimeFrameGPU->getDeviceTrackletsLUTs(),
109 this->mTrkParams[iteration].NSigmaCut,
110 mTimeFrameGPU->getPhiCuts(),
111 this->mTrkParams[iteration].PVres,
112 mTimeFrameGPU->getMinRs(),
113 mTimeFrameGPU->getMaxRs(),
114 mTimeFrameGPU->getPositionResolutions(),
115 this->mTrkParams[iteration].LayerRadii,
116 mTimeFrameGPU->getMSangles(),
124 mTimeFrameGPU->createCellsLUTDevice();
127 for (
int iLayer = 0; iLayer < this->mTrkParams[iteration].CellsPerRoad(); ++iLayer) {
128 if (!mTimeFrameGPU->getNTracklets()[iLayer + 1] || !mTimeFrameGPU->getNTracklets()[iLayer]) {
131 const int currentLayerTrackletsNum{
static_cast<int>(mTimeFrameGPU->getNTracklets()[iLayer])};
133 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
134 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
135 mTimeFrameGPU->getDeviceArrayTracklets(),
136 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
137 mTimeFrameGPU->getNTracklets()[iLayer],
140 mTimeFrameGPU->getDeviceArrayCellsLUT(),
141 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
143 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
144 this->mTrkParams[iteration].CellDeltaTanLambdaSigma,
145 this->mTrkParams[iteration].NSigmaCut,
148 mTimeFrameGPU->createCellsBuffers(iLayer);
150 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
151 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
152 mTimeFrameGPU->getDeviceArrayTracklets(),
153 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
154 mTimeFrameGPU->getNTracklets()[iLayer],
156 mTimeFrameGPU->getDeviceCells()[iLayer],
157 mTimeFrameGPU->getDeviceArrayCellsLUT(),
158 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
160 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
161 this->mTrkParams[iteration].CellDeltaTanLambdaSigma,
162 this->mTrkParams[iteration].NSigmaCut,
171 mTimeFrameGPU->createNeighboursIndexTablesDevice();
173 for (
int iLayer{0}; iLayer < this->mTrkParams[iteration].CellsPerRoad() - 1; ++iLayer) {
174 const int nextLayerCellsNum{
static_cast<int>(mTimeFrameGPU->getNCells()[iLayer + 1])};
176 if (!nextLayerCellsNum) {
180 mTimeFrameGPU->createNeighboursLUTDevice(iLayer, nextLayerCellsNum);
182 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
183 mTimeFrameGPU->getDeviceArrayCellsLUT(),
184 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
185 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
186 this->mTrkParams[0].MaxChi2ClusterAttachment,
189 mTimeFrameGPU->getNCells()[iLayer],
195 mTimeFrameGPU->createNeighboursDevice(iLayer, nNeigh);
198 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
199 mTimeFrameGPU->getDeviceArrayCellsLUT(),
200 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
201 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
202 this->mTrkParams[0].MaxChi2ClusterAttachment,
205 mTimeFrameGPU->getNCells()[iLayer],
212 mTimeFrameGPU->getDeviceNeighbours(iLayer),
214 mTimeFrameGPU->getExternalAllocator());
215 mTimeFrameGPU->getArrayNNeighbours()[iLayer] = nNeigh;
217 mTimeFrameGPU->createNeighboursDeviceArray();
218 mTimeFrameGPU->unregisterRest();
225 for (
int startLevel{this->mTrkParams[iteration].CellsPerRoad()}; startLevel >= this->mTrkParams[iteration].CellMinimumLevel(); --startLevel) {
226 const int minimumLayer{startLevel - 1};
228 for (
int startLayer{this->mTrkParams[iteration].CellsPerRoad() - 1}; startLayer >= minimumLayer; --startLayer) {
229 if ((this->mTrkParams[iteration].StartLayerMask & (1 << (startLayer + 2))) == 0) {
232 processNeighboursHandler<nLayers>(startLayer,
234 mTimeFrameGPU->getDeviceArrayCells(),
235 mTimeFrameGPU->getDeviceCells()[startLayer],
236 mTimeFrameGPU->getArrayNCells(),
237 mTimeFrameGPU->getDeviceArrayUsedClusters(),
238 mTimeFrameGPU->getDeviceNeighboursAll(),
239 mTimeFrameGPU->getDeviceNeighboursLUTs(),
240 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
242 mTimeFrameGPU->getExternalAllocator(),
244 this->mTrkParams[0].MaxChi2ClusterAttachment,
245 this->mTrkParams[0].MaxChi2NDF,
246 mTimeFrameGPU->getDevicePropagator(),
252 if (!trackSeeds.size()) {
253 LOGP(info,
"No track seeds found, skipping track finding");
256 mTimeFrameGPU->createTrackITSExtDevice(trackSeeds);
257 mTimeFrameGPU->loadTrackSeedsDevice(trackSeeds);
260 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
261 mTimeFrameGPU->getDeviceTrackITSExt(),
262 this->mTrkParams[iteration].MinPt,
266 this->mTrkParams[0].MaxChi2ClusterAttachment,
267 this->mTrkParams[0].MaxChi2NDF,
268 mTimeFrameGPU->getDevicePropagator(),
273 mTimeFrameGPU->downloadTrackITSExtDevice(trackSeeds);
275 auto& tracks = mTimeFrameGPU->getTrackITSExt();
277 for (
auto& track : tracks) {
278 if (!track.getChi2()) {
282 bool isFirstShared{
false};
283 for (
int iLayer{0}; iLayer < this->mTrkParams[0].NLayers; ++iLayer) {
284 if (track.getClusterIndex(iLayer) ==
UnusedIndex) {
287 nShared +=
int(mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer)));
288 isFirstShared |= !iLayer && mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer));
291 if (nShared > this->mTrkParams[0].ClusterSharing) {
295 std::array<int, 3> rofs{INT_MAX, INT_MAX, INT_MAX};
296 for (
int iLayer{0}; iLayer < this->mTrkParams[0].NLayers; ++iLayer) {
297 if (track.getClusterIndex(iLayer) ==
UnusedIndex) {
300 mTimeFrameGPU->markUsedCluster(iLayer, track.getClusterIndex(iLayer));
301 int currentROF = mTimeFrameGPU->getClusterROF(iLayer, track.getClusterIndex(iLayer));
302 for (
int iR{0}; iR < 3; ++iR) {
303 if (rofs[iR] == INT_MAX) {
304 rofs[iR] = currentROF;
306 if (rofs[iR] == currentROF) {
311 if (rofs[2] != INT_MAX) {
314 if (rofs[1] != INT_MAX) {
315 track.setNextROFbit();
317 mTimeFrameGPU->getTracks(std::min(rofs[0], rofs[1])).emplace_back(track);
319 mTimeFrameGPU->loadUsedClustersDevice();
321 if (iteration == this->mTrkParams.size() - 1) {
322 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)