Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackerTraitsGPU.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,22 @@ void TrackerTraitsGPU<NLayers>::computeLayerCells(const int iteration)
this->mTrkParams[iteration].LayerxX0,
mTimeFrameGPU->getStreams());
}
mTimeFrameGPU->syncStreams(false);
}

template <int NLayers>
void TrackerTraitsGPU<NLayers>::findCellsNeighbours(const int iteration)
{
for (int iLayer{0}; iLayer < this->mTrkParams[iteration].NeighboursPerRoad(); ++iLayer) {
if (iLayer > 0) {
// Previous layer updates levels in this layer's cells.
mTimeFrameGPU->waitEvent(iLayer, iLayer - 1);
}
const int currentLayerCellsNum{static_cast<int>(mTimeFrameGPU->getNCells()[iLayer])};
const int nextLayerCellsNum{static_cast<int>(mTimeFrameGPU->getNCells()[iLayer + 1])};
if (!nextLayerCellsNum || !currentLayerCellsNum) {
mTimeFrameGPU->getNNeighbours()[iLayer] = 0;
mTimeFrameGPU->recordEvent(iLayer);
continue;
}
mTimeFrameGPU->createNeighboursIndexTablesDevice(iLayer);
Expand All @@ -239,6 +245,7 @@ void TrackerTraitsGPU<NLayers>::findCellsNeighbours(const int iteration)
mTimeFrameGPU->getStream(iLayer));
mTimeFrameGPU->createNeighboursDevice(iLayer);
if (mTimeFrameGPU->getNNeighbours()[iLayer] == 0) {
mTimeFrameGPU->recordEvent(iLayer);
continue;
}
computeCellNeighboursHandler<NLayers>(mTimeFrameGPU->getDeviceArrayCells(),
Expand All @@ -259,6 +266,7 @@ void TrackerTraitsGPU<NLayers>::findCellsNeighbours(const int iteration)
mTimeFrameGPU->getArrayNNeighbours()[iLayer],
mTimeFrameGPU->getStream(iLayer),
mTimeFrameGPU->getFrameworkAllocator());
mTimeFrameGPU->recordEvent(iLayer);
}
mTimeFrameGPU->syncStreams(false);
}
Expand Down
41 changes: 23 additions & 18 deletions Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,22 @@
namespace o2::its::track
{

GPUdi() int selectReseedMidLayer(int minLayer, int maxLayer, int nLayers, const float* layerRadii)
// Find the populated interior layer closest to the radial midpoint.
// If no layer can be found, return constants::UnusedIndex.
// Should minimize the sagitta bias.
template <int NLayers>
GPUdi() int selectReseedMidLayer(int minLayer, int maxLayer, const float* layerRadii, const TrackSeed<NLayers>& seed)
{
if (maxLayer - minLayer == nLayers - 1) {
return (minLayer + maxLayer) / 2;
}
int midLayer = minLayer + 1;
int midLayer = constants::UnusedIndex;
float distanceToMidR = layerRadii[NLayers - 1]; // midpoint cannot be last layer
const float midR = 0.5f * (layerRadii[maxLayer] + layerRadii[minLayer]);
float distanceToMidR = o2::gpu::CAMath::Abs(midR - layerRadii[midLayer]);
for (int iLayer = midLayer + 1; iLayer < maxLayer; ++iLayer) { // find the midpoint as closest to the midR
const float distance = o2::gpu::CAMath::Abs(midR - layerRadii[iLayer]);
if (distance < distanceToMidR) {
midLayer = iLayer;
distanceToMidR = distance;
for (int iLayer = minLayer + 1; iLayer < maxLayer; ++iLayer) {
if (seed.getCluster(iLayer) != constants::UnusedIndex) {
const float distance = o2::gpu::CAMath::Abs(midR - layerRadii[iLayer]);
if (distance < distanceToMidR) { // keep the smaller-radius layer on ties
midLayer = iLayer;
distanceToMidR = distance;
}
}
}
return midLayer;
Expand All @@ -59,7 +62,7 @@ GPUdi() o2::track::TrackParCov buildTrackSeed(const Cluster& cluster1,
const float bz,
const bool reverse = false)
{
float ca = NAN, sa = NAN, snp = NAN, q2pt = NAN, q2pt2 = NAN;
float ca = constants::UnsetValue, sa = constants::UnsetValue, snp = constants::UnsetValue, q2pt = constants::UnsetValue, q2pt2 = constants::UnsetValue;
o2::gpu::CAMath::SinCos(tf3.alphaTrackingFrame, sa, ca);
const float sign = reverse ? -1.f : 1.f;
const float x1 = (cluster1.xCoordinate * ca) + (cluster1.yCoordinate * sa);
Expand Down Expand Up @@ -106,12 +109,14 @@ GPUdi() TrackITSExt seedTrackForRefit(const TrackSeed<NLayers>& seed,
}

const int ncl = temporaryTrack.getNClusters();
if (ncl < reseedIfShorter && ncl > 1) {
const int lrMid = selectReseedMidLayer(lrMin, lrMax, NLayers, layerRadii);
const auto& cluster0TF = foundTrackingFrameInfo[lrMin][seed.getCluster(lrMin)];
const auto& cluster1GL = unsortedClusters[lrMid][seed.getCluster(lrMid)];
const auto& cluster2GL = unsortedClusters[lrMax][seed.getCluster(lrMax)];
temporaryTrack.getParamIn() = buildTrackSeed(cluster2GL, cluster1GL, cluster0TF, bz, true);
if (ncl < reseedIfShorter && ncl > 2) {
const int lrMid = selectReseedMidLayer<NLayers>(lrMin, lrMax, layerRadii, seed);
if (lrMid != constants::UnusedIndex) {
const auto& cluster0TF = foundTrackingFrameInfo[lrMin][seed.getCluster(lrMin)];
const auto& cluster1GL = unsortedClusters[lrMid][seed.getCluster(lrMid)];
const auto& cluster2GL = unsortedClusters[lrMax][seed.getCluster(lrMax)];
temporaryTrack.getParamIn() = buildTrackSeed(cluster2GL, cluster1GL, cluster0TF, bz, true);
}
}

resetTrackCovariance(temporaryTrack);
Expand Down
Loading