15#ifndef TRACKINGITSU_INCLUDE_TRACKFOLLOWER_H_
16#define TRACKINGITSU_INCLUDE_TRACKFOLLOWER_H_
36GPUhdi()
void keepTrackExtensionHypothesis(const TrackExtensionHypothesis<NLayers>& hypo,
58GPUhdi()
void updateTrackFromExtensionHypothesis(const TrackExtensionHypothesis<NLayers>& hypo,
64 track.paramOut = hypo.param;
66 track.paramIn = hypo.param;
68 track.time = hypo.time;
70 for (
int iLayer{0}; iLayer <
nLayers; ++iLayer) {
72 track.setClusterIndex(iLayer, hypo.clusters[iLayer]);
99 : backupPattern{backupPattern},
fit{
fit}
103 GPUdi()
void update(TrackITSInternal<NLayers>& trial, TrackITSInternal<NLayers>&
best, uint32_t&
bestDiff)
const
105 const auto diff = (trial.getPattern() & ~backupPattern) & TrackITS::getLayerPatternMask<NLayers>();
106 if (!diff || !track::refitTrack(trial,
fit)) {
109 if (track::isBetter(trial,
best)) {
115 uint32_t backupPattern{0};
116 const track::TrackFitContext<NLayers>&
fit;
119template <
int NLayers,
typename FollowDirection,
typename BestTrial>
129 const uint32_t lastLayer =
static_cast<uint32_t
>(
nLayers - 1);
135 if (
extendTop && backup.getLastClusterLayer() != lastLayer) {
136 auto candidate = backup;
144 auto candidate = backup;
167template <
int NLayers>
168GPUhdi() bool followTrackExtensionDirection(const TrackExtensionHypothesis<NLayers>& startHypothesis,
169 const track::TrackFitContext<NLayers>&
fit,
190 for (
int iHypo{0}; iHypo <
nActive; ++iHypo) {
192 const float r =
ctx.layerRadii[iLayer];
202 if (
fit.matCorrType == o2::base::PropagatorF::MatCorrType::USEMatCorrNONE &&
207 const float ePhi{o2::gpu::CAMath::Sqrt(hypo.param.getSigmaSnp2() / hypo.param.getCsp2())};
208 const float eZ{o2::gpu::CAMath::Sqrt(hypo.param.getSigmaZ2())};
209 const int4 selectedBins =
getBinsRect(iLayer, hypo.param.getPhi(), hypo.param.getZ(),
ctx.nSigmaCutZ * eZ,
ctx.nSigmaCutPhi * ePhi,
utils);
210 if (selectedBins.
x < 0) {
214 int phiBinsNum = selectedBins.
w - selectedBins.
y + 1;
215 if (phiBinsNum < 0) {
216 phiBinsNum +=
ctx.phiBins;
219 const auto rofRange =
ctx.rofOverlaps.getLayer(iLayer).getROFRange(hypo.time);
220 for (
int rof = rofRange.getFirstEntry(); rof < rofRange.getEntriesBound(); ++rof) {
221 if (!
ctx.rofMask.isROFEnabled(iLayer, rof)) {
224 const int rofStart =
ctx.ROFClusters[iLayer][rof];
225 const int nLayerClusters =
ctx.ROFClusters[iLayer][rof + 1] - rofStart;
226 if (nLayerClusters <= 0) {
229 const Cluster* layerClusters =
ctx.clusters[iLayer] + rofStart;
230 const int* indexTable =
ctx.clustersIndexTables[iLayer] + rof *
tableSize;
231 const int zBinRange = selectedBins.
z - selectedBins.
x + 1;
232 for (
int iPhiCount = 0; iPhiCount < phiBinsNum; ++iPhiCount) {
233 const int iPhiBin = (selectedBins.
y + iPhiCount) %
ctx.phiBins;
234 const int firstBinIndex =
utils.getBinIndex(selectedBins.
x, iPhiBin);
235 const int maxBinIndex = firstBinIndex + zBinRange;
236 const int firstRowClusterIndex = indexTable[firstBinIndex];
237 const int maxRowClusterIndex = indexTable[maxBinIndex];
238 for (
int iNextCluster{firstRowClusterIndex}; iNextCluster < maxRowClusterIndex; ++iNextCluster) {
239 if (iNextCluster >= nLayerClusters) {
242 const Cluster& nextCluster = layerClusters[iNextCluster];
258 if (predChi2 < 0.f || predChi2 >
fit.maxChi2ClusterAttachment) {
264 updated.chi2 += predChi2;
265 updated.clusters[iLayer] = nextCluster.
clusterId;
267 updated.edgeLayer = iLayer;
268 updated.time +=
ctx.rofOverlaps.getLayer(iLayer).getROFTimeBounds(rof,
true);
278 for (
int iHypo{0}; iHypo <
nNext; ++iHypo) {
285 for (
int iHypo{0}; iHypo <
nActive; ++iHypo) {
287 if (hypo.nClusters == startHypothesis.nClusters) {
290 const float maxChi2 =
fit.maxChi2NDF *
static_cast<float>(hypo.nClusters * 2 - 5);
291 if (hypo.chi2 >= maxChi2) {
Shared host/device helpers for ITS tracker trait implementations.
static constexpr float MAX_SIN_PHI
static constexpr float MAX_STEP
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
constexpr int UnusedIndex
const bool const bool const int FollowDirection BestTrial TrackITSInternal< NLayers > uint32_t & bestDiff
TrackExtensionHypothesis< NLayers > * keptHypotheses
const bool const int nLayers
const bool const bool const int FollowDirection BestTrial TrackITSInternal< NLayers > & best
GPUhdi() int IndexTableUtils< nLayers >
TrackExtensionHypothesis< NLayers > int const int maxHypotheses
const bool const int TrackITSInternal< NLayers > & track
const bool const bool extendBot
const track::TrackFitContext< NLayers > const TrackFollowContext< NLayers > const bool TrackExtensionHypothesis< NLayers > TrackExtensionHypothesis< NLayers > TrackExtensionHypothesis< NLayers > & bestHypothesis
return getBinsRect(layerIndex, currentCluster.phi, zMean, zDelta, maxdeltaphi, utils)
const TrackExtensionHypothesis< NLayers > * bestHypo
const bool const bool const int FollowDirection BestTrial & bestTrial
TrackITSInternal< NLayers > topResult
const track::TrackFitContext< NLayers > const TrackFollowContext< NLayers > & ctx
const track::TrackFitContext< NLayers > const TrackFollowContext< NLayers > const bool TrackExtensionHypothesis< NLayers > * activeHypotheses
const track::TrackFitContext< NLayers > & fit
TrackITSInternal< NLayers > botResult
const track::TrackFitContext< NLayers > const TrackFollowContext< NLayers > const bool TrackExtensionHypothesis< NLayers > TrackExtensionHypothesis< NLayers > * nextHypotheses
TrackExtensionHypothesis< NLayers > int & nKeptHypotheses
const bool const bool const int FollowDirection & followDirection
Common utility functions.
GPUdi() TrackExtensionBestTrial(uint32_t backupPattern
const track::TrackFitContext< NLayers > & fit
const unsigned char *const * usedClusters
const Cluster *const * clusters
const int *const * ROFClusters
const int *const * clustersIndexTables
ROFMaskTable< NLayers >::View rofMask
ROFOverlapTable< NLayers >::View rofOverlaps
std::array< float, 2 > positionTrackingFrame
std::array< float, 3 > covarianceTrackingFrame