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 mTimeFrameGPU->createTrackletsLUTDevice(iteration);
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->getStreams());
88 mTimeFrameGPU->createTrackletsBuffers();
89 computeTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
90 mTimeFrameGPU->getDeviceMultCutMask(),
93 mTimeFrameGPU->getNrof(),
94 this->mTrkParams[iteration].DeltaROF,
96 mTimeFrameGPU->getDeviceVertices(),
97 mTimeFrameGPU->getDeviceROFramesPV(),
98 mTimeFrameGPU->getPrimaryVerticesNum(),
99 mTimeFrameGPU->getDeviceArrayClusters(),
100 mTimeFrameGPU->getClusterSizes(),
101 mTimeFrameGPU->getDeviceROframeClusters(),
102 mTimeFrameGPU->getDeviceArrayUsedClusters(),
103 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
104 mTimeFrameGPU->getDeviceArrayTracklets(),
105 mTimeFrameGPU->getDeviceTracklet(),
106 mTimeFrameGPU->getNTracklets(),
107 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
108 mTimeFrameGPU->getDeviceTrackletsLUTs(),
110 this->mTrkParams[iteration].NSigmaCut,
111 mTimeFrameGPU->getPhiCuts(),
112 this->mTrkParams[iteration].PVres,
113 mTimeFrameGPU->getMinRs(),
114 mTimeFrameGPU->getMaxRs(),
115 mTimeFrameGPU->getPositionResolutions(),
116 this->mTrkParams[iteration].LayerRadii,
117 mTimeFrameGPU->getMSangles(),
120 mTimeFrameGPU->getStreams());
126 mTimeFrameGPU->createCellsLUTDevice();
129 for (
int iLayer = 0; iLayer < this->mTrkParams[iteration].CellsPerRoad(); ++iLayer) {
130 if (!mTimeFrameGPU->getNTracklets()[iLayer + 1] || !mTimeFrameGPU->getNTracklets()[iLayer]) {
133 const int currentLayerTrackletsNum{
static_cast<int>(mTimeFrameGPU->getNTracklets()[iLayer])};
135 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
136 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
137 mTimeFrameGPU->getDeviceArrayTracklets(),
138 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
139 mTimeFrameGPU->getNTracklets()[iLayer],
142 mTimeFrameGPU->getDeviceArrayCellsLUT(),
143 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
145 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
146 this->mTrkParams[iteration].CellDeltaTanLambdaSigma,
147 this->mTrkParams[iteration].NSigmaCut,
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],
162 this->mTrkParams[iteration].MaxChi2ClusterAttachment,
163 this->mTrkParams[iteration].CellDeltaTanLambdaSigma,
164 this->mTrkParams[iteration].NSigmaCut,
173 mTimeFrameGPU->createNeighboursIndexTablesDevice();
175 for (
int iLayer{0}; iLayer < this->mTrkParams[iteration].CellsPerRoad() - 1; ++iLayer) {
176 const int nextLayerCellsNum{
static_cast<int>(mTimeFrameGPU->getNCells()[iLayer + 1])};
178 if (!nextLayerCellsNum) {
182 mTimeFrameGPU->createNeighboursLUTDevice(iLayer, nextLayerCellsNum);
184 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
185 mTimeFrameGPU->getDeviceArrayCellsLUT(),
186 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
187 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
188 this->mTrkParams[0].MaxChi2ClusterAttachment,
191 mTimeFrameGPU->getNCells()[iLayer],
197 mTimeFrameGPU->createNeighboursDevice(iLayer, nNeigh);
200 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
201 mTimeFrameGPU->getDeviceArrayCellsLUT(),
202 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
203 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
204 this->mTrkParams[0].MaxChi2ClusterAttachment,
207 mTimeFrameGPU->getNCells()[iLayer],
214 mTimeFrameGPU->getDeviceNeighbours(iLayer),
216 mTimeFrameGPU->getExternalAllocator());
217 mTimeFrameGPU->getArrayNNeighbours()[iLayer] = nNeigh;
219 mTimeFrameGPU->createNeighboursDeviceArray();
220 mTimeFrameGPU->unregisterRest();
227 for (
int startLevel{this->mTrkParams[iteration].CellsPerRoad()}; startLevel >= this->mTrkParams[iteration].CellMinimumLevel(); --startLevel) {
228 const int minimumLayer{startLevel - 1};
230 for (
int startLayer{this->mTrkParams[iteration].CellsPerRoad() - 1}; startLayer >= minimumLayer; --startLayer) {
231 if ((this->mTrkParams[iteration].StartLayerMask & (1 << (startLayer + 2))) == 0) {
234 processNeighboursHandler<nLayers>(startLayer,
236 mTimeFrameGPU->getDeviceArrayCells(),
237 mTimeFrameGPU->getDeviceCells()[startLayer],
238 mTimeFrameGPU->getArrayNCells(),
239 mTimeFrameGPU->getDeviceArrayUsedClusters(),
240 mTimeFrameGPU->getDeviceNeighboursAll(),
241 mTimeFrameGPU->getDeviceNeighboursLUTs(),
242 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
244 mTimeFrameGPU->getExternalAllocator(),
246 this->mTrkParams[0].MaxChi2ClusterAttachment,
247 this->mTrkParams[0].MaxChi2NDF,
248 mTimeFrameGPU->getDevicePropagator(),
254 if (!trackSeeds.size()) {
255 LOGP(info,
"No track seeds found, skipping track finding");
258 mTimeFrameGPU->createTrackITSExtDevice(trackSeeds);
259 mTimeFrameGPU->loadTrackSeedsDevice(trackSeeds);
262 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
263 mTimeFrameGPU->getDeviceTrackITSExt(),
264 this->mTrkParams[iteration].MinPt,
268 this->mTrkParams[0].MaxChi2ClusterAttachment,
269 this->mTrkParams[0].MaxChi2NDF,
270 mTimeFrameGPU->getDevicePropagator(),
275 mTimeFrameGPU->downloadTrackITSExtDevice(trackSeeds);
277 auto& tracks = mTimeFrameGPU->getTrackITSExt();
279 for (
auto& track : tracks) {
280 if (!track.getChi2()) {
284 bool isFirstShared{
false};
285 for (
int iLayer{0}; iLayer < this->mTrkParams[0].NLayers; ++iLayer) {
286 if (track.getClusterIndex(iLayer) ==
UnusedIndex) {
289 nShared +=
int(mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer)));
290 isFirstShared |= !iLayer && mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer));
293 if (nShared > this->mTrkParams[0].ClusterSharing) {
297 std::array<int, 3> rofs{INT_MAX, INT_MAX, INT_MAX};
298 for (
int iLayer{0}; iLayer < this->mTrkParams[0].NLayers; ++iLayer) {
299 if (track.getClusterIndex(iLayer) ==
UnusedIndex) {
302 mTimeFrameGPU->markUsedCluster(iLayer, track.getClusterIndex(iLayer));
303 int currentROF = mTimeFrameGPU->getClusterROF(iLayer, track.getClusterIndex(iLayer));
304 for (
int iR{0}; iR < 3; ++iR) {
305 if (rofs[iR] == INT_MAX) {
306 rofs[iR] = currentROF;
308 if (rofs[iR] == currentROF) {
313 if (rofs[2] != INT_MAX) {
316 if (rofs[1] != INT_MAX) {
317 track.setNextROFbit();
319 mTimeFrameGPU->getTracks(std::min(rofs[0], rofs[1])).emplace_back(track);
321 mTimeFrameGPU->loadUsedClustersDevice();
323 if (iteration == this->mTrkParams.size() - 1) {
324 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)