44 mTimeFrameGPU->createTrackletsLUTDevice(iteration);
46 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);
47 gsl::span<const Vertex> diamondSpan(&diamondVert, 1);
48 int startROF{mTrkParams[iteration].nROFsPerIterations > 0 ? iROFslice * mTrkParams[iteration].nROFsPerIterations : 0};
49 int endROF{o2::gpu::CAMath::Min(mTrkParams[iteration].nROFsPerIterations > 0 ? (iROFslice + 1) * mTrkParams[iteration].nROFsPerIterations + mTrkParams[iteration].DeltaROF : mTimeFrameGPU->getNrof(), mTimeFrameGPU->getNrof())};
51 countTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
52 mTimeFrameGPU->getDeviceMultCutMask(),
55 mTimeFrameGPU->getNrof(),
56 mTrkParams[iteration].DeltaROF,
58 mTimeFrameGPU->getDeviceVertices(),
59 mTimeFrameGPU->getDeviceROFramesPV(),
60 mTimeFrameGPU->getPrimaryVerticesNum(),
61 mTimeFrameGPU->getDeviceArrayClusters(),
62 mTimeFrameGPU->getClusterSizes(),
63 mTimeFrameGPU->getDeviceROframeClusters(),
64 mTimeFrameGPU->getDeviceArrayUsedClusters(),
65 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
66 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
67 mTimeFrameGPU->getDeviceTrackletsLUTs(),
69 mTrkParams[iteration].NSigmaCut,
70 mTimeFrameGPU->getPhiCuts(),
71 mTrkParams[iteration].PVres,
72 mTimeFrameGPU->getMinRs(),
73 mTimeFrameGPU->getMaxRs(),
74 mTimeFrameGPU->getPositionResolutions(),
75 mTrkParams[iteration].LayerRadii,
76 mTimeFrameGPU->getMSangles(),
79 mTimeFrameGPU->createTrackletsBuffers();
80 computeTrackletsInROFsHandler<nLayers>(mTimeFrameGPU->getDeviceIndexTableUtils(),
81 mTimeFrameGPU->getDeviceMultCutMask(),
84 mTimeFrameGPU->getNrof(),
85 mTrkParams[iteration].DeltaROF,
87 mTimeFrameGPU->getDeviceVertices(),
88 mTimeFrameGPU->getDeviceROFramesPV(),
89 mTimeFrameGPU->getPrimaryVerticesNum(),
90 mTimeFrameGPU->getDeviceArrayClusters(),
91 mTimeFrameGPU->getClusterSizes(),
92 mTimeFrameGPU->getDeviceROframeClusters(),
93 mTimeFrameGPU->getDeviceArrayUsedClusters(),
94 mTimeFrameGPU->getDeviceArrayClustersIndexTables(),
95 mTimeFrameGPU->getDeviceArrayTracklets(),
96 mTimeFrameGPU->getDeviceTracklet(),
97 mTimeFrameGPU->getNTracklets(),
98 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
99 mTimeFrameGPU->getDeviceTrackletsLUTs(),
101 mTrkParams[iteration].NSigmaCut,
102 mTimeFrameGPU->getPhiCuts(),
103 mTrkParams[iteration].PVres,
104 mTimeFrameGPU->getMinRs(),
105 mTimeFrameGPU->getMaxRs(),
106 mTimeFrameGPU->getPositionResolutions(),
107 mTrkParams[iteration].LayerRadii,
108 mTimeFrameGPU->getMSangles(),
116 mTimeFrameGPU->createCellsLUTDevice();
119 for (
int iLayer = 0; iLayer < mTrkParams[iteration].CellsPerRoad(); ++iLayer) {
120 if (!mTimeFrameGPU->getNTracklets()[iLayer + 1] || !mTimeFrameGPU->getNTracklets()[iLayer]) {
123 const int currentLayerTrackletsNum{
static_cast<int>(mTimeFrameGPU->getNTracklets()[iLayer])};
125 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
126 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
127 mTimeFrameGPU->getDeviceArrayTracklets(),
128 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
129 mTimeFrameGPU->getNTracklets()[iLayer],
132 mTimeFrameGPU->getDeviceArrayCellsLUT(),
133 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
135 mTrkParams[iteration].MaxChi2ClusterAttachment,
136 mTrkParams[iteration].CellDeltaTanLambdaSigma,
137 mTrkParams[iteration].NSigmaCut,
140 mTimeFrameGPU->createCellsBuffers(iLayer);
142 mTimeFrameGPU->getDeviceArrayUnsortedClusters(),
143 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
144 mTimeFrameGPU->getDeviceArrayTracklets(),
145 mTimeFrameGPU->getDeviceArrayTrackletsLUT(),
146 mTimeFrameGPU->getNTracklets()[iLayer],
148 mTimeFrameGPU->getDeviceCells()[iLayer],
149 mTimeFrameGPU->getDeviceArrayCellsLUT(),
150 mTimeFrameGPU->getDeviceCellLUTs()[iLayer],
152 mTrkParams[iteration].MaxChi2ClusterAttachment,
153 mTrkParams[iteration].CellDeltaTanLambdaSigma,
154 mTrkParams[iteration].NSigmaCut,
163 mTimeFrameGPU->createNeighboursIndexTablesDevice();
165 for (
int iLayer{0}; iLayer < mTrkParams[iteration].CellsPerRoad() - 1; ++iLayer) {
166 const int nextLayerCellsNum{
static_cast<int>(mTimeFrameGPU->getNCells()[iLayer + 1])};
168 if (!nextLayerCellsNum) {
172 mTimeFrameGPU->createNeighboursLUTDevice(iLayer, nextLayerCellsNum);
174 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
175 mTimeFrameGPU->getDeviceArrayCellsLUT(),
176 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
177 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
178 mTrkParams[0].MaxChi2ClusterAttachment,
181 mTimeFrameGPU->getNCells()[iLayer],
187 mTimeFrameGPU->createNeighboursDevice(iLayer, nNeigh);
190 mTimeFrameGPU->getDeviceNeighboursLUT(iLayer),
191 mTimeFrameGPU->getDeviceArrayCellsLUT(),
192 mTimeFrameGPU->getDeviceNeighbourPairs(iLayer),
193 mTimeFrameGPU->getDeviceNeighboursIndexTables(iLayer),
194 mTrkParams[0].MaxChi2ClusterAttachment,
197 mTimeFrameGPU->getNCells()[iLayer],
204 mTimeFrameGPU->getDeviceNeighbours(iLayer),
207 mTimeFrameGPU->createNeighboursDeviceArray();
208 mTimeFrameGPU->unregisterRest();
215 for (
int startLevel{mTrkParams[iteration].CellsPerRoad()}; startLevel >= mTrkParams[iteration].CellMinimumLevel(); --startLevel) {
216 const int minimumLayer{startLevel - 1};
217 std::vector<CellSeed> trackSeeds;
218 for (
int startLayer{mTrkParams[iteration].CellsPerRoad() - 1}; startLayer >= minimumLayer; --startLayer) {
219 if ((mTrkParams[iteration].StartLayerMask & (1 << (startLayer + 2))) == 0) {
222 processNeighboursHandler<nLayers>(startLayer,
224 mTimeFrameGPU->getDeviceArrayCells(),
225 mTimeFrameGPU->getDeviceCells()[startLayer],
226 mTimeFrameGPU->getArrayNCells(),
227 mTimeFrameGPU->getDeviceArrayUsedClusters(),
228 mTimeFrameGPU->getDeviceNeighboursAll(),
229 mTimeFrameGPU->getDeviceNeighboursLUTs(),
230 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
233 mTrkParams[0].MaxChi2ClusterAttachment,
234 mTrkParams[0].MaxChi2NDF,
235 mTimeFrameGPU->getDevicePropagator(),
241 if (!trackSeeds.size()) {
242 LOGP(info,
"No track seeds found, skipping track finding");
245 mTimeFrameGPU->createTrackITSExtDevice(trackSeeds);
246 mTimeFrameGPU->loadTrackSeedsDevice(trackSeeds);
249 mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(),
250 mTimeFrameGPU->getDeviceTrackITSExt(),
251 mTrkParams[iteration].MinPt,
255 mTrkParams[0].MaxChi2ClusterAttachment,
256 mTrkParams[0].MaxChi2NDF,
257 mTimeFrameGPU->getDevicePropagator(),
262 mTimeFrameGPU->downloadTrackITSExtDevice(trackSeeds);
264 auto& tracks = mTimeFrameGPU->getTrackITSExt();
266 for (
auto& track : tracks) {
267 if (!track.getChi2()) {
271 bool isFirstShared{
false};
272 for (
int iLayer{0}; iLayer < mTrkParams[0].NLayers; ++iLayer) {
273 if (track.getClusterIndex(iLayer) ==
UnusedIndex) {
276 nShared +=
int(mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer)));
277 isFirstShared |= !iLayer && mTimeFrameGPU->isClusterUsed(iLayer, track.getClusterIndex(iLayer));
280 if (nShared > mTrkParams[0].ClusterSharing) {
284 std::array<int, 3> rofs{INT_MAX, INT_MAX, INT_MAX};
285 for (
int iLayer{0}; iLayer < mTrkParams[0].NLayers; ++iLayer) {
286 if (track.getClusterIndex(iLayer) ==
UnusedIndex) {
289 mTimeFrameGPU->markUsedCluster(iLayer, track.getClusterIndex(iLayer));
290 int currentROF = mTimeFrameGPU->getClusterROF(iLayer, track.getClusterIndex(iLayer));
291 for (
int iR{0}; iR < 3; ++iR) {
292 if (rofs[iR] == INT_MAX) {
293 rofs[iR] = currentROF;
295 if (rofs[iR] == currentROF) {
300 if (rofs[2] != INT_MAX) {
303 if (rofs[1] != INT_MAX) {
304 track.setNextROFbit();
306 mTimeFrameGPU->getTracks(std::min(rofs[0], rofs[1])).emplace_back(track);
308 mTimeFrameGPU->loadUsedClustersDevice();
310 if (iteration == mTrkParams.size() - 1) {
311 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)