51 mTimeFrameGPU->createTrackletsLUTDevice(iteration);
53 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);
54 gsl::span<const Vertex> diamondSpan(&diamondVert, 1);
55 int startROF{this->mTrkParams[iteration].nROFsPerIterations > 0 ? iROFslice * this->mTrkParams[iteration].nROFsPerIterations : 0};
56 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())};
58 countTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
59 mTimeFrameGPU->getDeviceMultCutMask(),
62 mTimeFrameGPU->getNrof(),
63 this->mTrkParams[iteration].DeltaROF,
65 mTimeFrameGPU->getDeviceVertices(),
66 mTimeFrameGPU->getDeviceROFramesPV(),
67 mTimeFrameGPU->getPrimaryVerticesNum(),
68 mTimeFrameGPU->getDeviceArrayClusters(),
69 mTimeFrameGPU->getClusterSizes(),
70 mTimeFrameGPU->getDeviceROframeClusters(),
71 mTimeFrameGPU->getDeviceArrayUsedClusters(),
72 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
73 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
74 mTimeFrameGPU->getDeviceTrackletsLUTs(),
76 this->mTrkParams[iteration].NSigmaCut,
77 mTimeFrameGPU->getPhiCuts(),
78 this->mTrkParams[iteration].PVres,
79 mTimeFrameGPU->getMinRs(),
80 mTimeFrameGPU->getMaxRs(),
81 mTimeFrameGPU->getPositionResolutions(),
82 this->mTrkParams[iteration].LayerRadii,
83 mTimeFrameGPU->getMSangles(),
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(),
123 mTimeFrameGPU->createCellsLUTDevice();
126 for (
int iLayer = 0; iLayer < this->mTrkParams[iteration].CellsPerRoad(); ++iLayer) {
127 if (!mTimeFrameGPU->getNTracklets()[iLayer + 1] || !mTimeFrameGPU->getNTracklets()[iLayer]) {
130 const int currentLayerTrackletsNum{
static_cast<int>(mTimeFrameGPU->getNTracklets()[iLayer])};
132 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
133 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
134 mTimeFrameGPU->getDeviceArrayTracklets(),
135 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
136 mTimeFrameGPU->getNTracklets()[iLayer],
139 mTimeFrameGPU->getDeviceArrayCellsLUT(),
140 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
142 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
143 this->mTrkParams[iteration].CellDeltaTanLambdaSigma,
144 this->mTrkParams[iteration].NSigmaCut,
147 mTimeFrameGPU->createCellsBuffers(iLayer);
149 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
150 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
151 mTimeFrameGPU->getDeviceArrayTracklets(),
152 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
153 mTimeFrameGPU->getNTracklets()[iLayer],
155 mTimeFrameGPU->getDeviceCells()[iLayer],
156 mTimeFrameGPU->getDeviceArrayCellsLUT(),
157 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
159 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
160 this->mTrkParams[iteration].CellDeltaTanLambdaSigma,
161 this->mTrkParams[iteration].NSigmaCut,
170 mTimeFrameGPU->createNeighboursIndexTablesDevice();
172 for (
int iLayer{0}; iLayer < this->mTrkParams[iteration].CellsPerRoad() - 1; ++iLayer) {
173 const int nextLayerCellsNum{
static_cast<int>(mTimeFrameGPU->getNCells()[iLayer + 1])};
175 if (!nextLayerCellsNum) {
179 mTimeFrameGPU->createNeighboursLUTDevice(iLayer, nextLayerCellsNum);
181 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
182 mTimeFrameGPU->getDeviceArrayCellsLUT(),
183 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
184 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
185 this->mTrkParams[0].MaxChi2ClusterAttachment,
188 mTimeFrameGPU->getNCells()[iLayer],
194 mTimeFrameGPU->createNeighboursDevice(iLayer, nNeigh);
197 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
198 mTimeFrameGPU->getDeviceArrayCellsLUT(),
199 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
200 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
201 this->mTrkParams[0].MaxChi2ClusterAttachment,
204 mTimeFrameGPU->getNCells()[iLayer],
211 mTimeFrameGPU->getDeviceNeighbours(iLayer),
214 mTimeFrameGPU->createNeighboursDeviceArray();
215 mTimeFrameGPU->unregisterRest();
222 for (
int startLevel{this->mTrkParams[iteration].CellsPerRoad()}; startLevel >= this->mTrkParams[iteration].CellMinimumLevel(); --startLevel) {
223 const int minimumLayer{startLevel - 1};
225 for (
int startLayer{this->mTrkParams[iteration].CellsPerRoad() - 1}; startLayer >= minimumLayer; --startLayer) {
226 if ((this->mTrkParams[iteration].StartLayerMask & (1 << (startLayer + 2))) == 0) {
229 processNeighboursHandler<nLayers>(startLayer,
231 mTimeFrameGPU->getDeviceArrayCells(),
232 mTimeFrameGPU->getDeviceCells()[startLayer],
233 mTimeFrameGPU->getArrayNCells(),
234 mTimeFrameGPU->getDeviceArrayUsedClusters(),
235 mTimeFrameGPU->getDeviceNeighboursAll(),
236 mTimeFrameGPU->getDeviceNeighboursLUTs(),
237 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
240 this->mTrkParams[0].MaxChi2ClusterAttachment,
241 this->mTrkParams[0].MaxChi2NDF,
242 mTimeFrameGPU->getDevicePropagator(),
248 if (!trackSeeds.size()) {
249 LOGP(info,
"No track seeds found, skipping track finding");
252 mTimeFrameGPU->createTrackITSExtDevice(trackSeeds);
253 mTimeFrameGPU->loadTrackSeedsDevice(trackSeeds);
256 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
257 mTimeFrameGPU->getDeviceTrackITSExt(),
258 this->mTrkParams[iteration].MinPt,
262 this->mTrkParams[0].MaxChi2ClusterAttachment,
263 this->mTrkParams[0].MaxChi2NDF,
264 mTimeFrameGPU->getDevicePropagator(),
269 mTimeFrameGPU->downloadTrackITSExtDevice(trackSeeds);
271 auto& tracks = mTimeFrameGPU->getTrackITSExt();
273 for (
auto& track : tracks) {
274 if (!track.getChi2()) {
278 bool isFirstShared{
false};
279 for (
int iLayer{0}; iLayer < this->mTrkParams[0].NLayers; ++iLayer) {
280 if (track.getClusterIndex(iLayer) ==
UnusedIndex) {
283 nShared +=
int(mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer)));
284 isFirstShared |= !iLayer && mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer));
287 if (nShared > this->mTrkParams[0].ClusterSharing) {
291 std::array<int, 3> rofs{INT_MAX, INT_MAX, INT_MAX};
292 for (
int iLayer{0}; iLayer < this->mTrkParams[0].NLayers; ++iLayer) {
293 if (track.getClusterIndex(iLayer) ==
UnusedIndex) {
296 mTimeFrameGPU->markUsedCluster(iLayer, track.getClusterIndex(iLayer));
297 int currentROF = mTimeFrameGPU->getClusterROF(iLayer, track.getClusterIndex(iLayer));
298 for (
int iR{0}; iR < 3; ++iR) {
299 if (rofs[iR] == INT_MAX) {
300 rofs[iR] = currentROF;
302 if (rofs[iR] == currentROF) {
307 if (rofs[2] != INT_MAX) {
310 if (rofs[1] != INT_MAX) {
311 track.setNextROFbit();
313 mTimeFrameGPU->getTracks(std::min(rofs[0], rofs[1])).emplace_back(track);
315 mTimeFrameGPU->loadUsedClustersDevice();
317 if (iteration == this->mTrkParams.size() - 1) {
318 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)