15#define GPUCA_CADEBUG 0
16#define GPUCA_MERGE_LOOPER_MC 0
21#if !defined(GPUCA_GPUCODE) && (defined(GPUCA_MERGER_BY_MC_LABEL) || defined(GPUCA_CADEBUG_ENABLED) || GPUCA_MERGE_LOOPER_MC)
26#ifndef GPUCA_GPUCODE_DEVICE
40#include "GPUDefParametersRuntime.h"
64using namespace gputpcgmmergertypes;
91 GPUd() bool operator()(const int32_t aa, const int32_t
bb)
98 if (
a.CCE() !=
b.CCE()) {
99 return a.CCE() >
b.CCE();
102 if (
a.NClusters() !=
b.NClusters()) {
103 return a.NClusters() > b.NClusters();
104 }
if (CAMath::Abs(
a.GetParam().GetQPt()) != CAMath::Abs(
b.GetParam().GetQPt())) {
105 return CAMath::Abs(a.GetParam().GetQPt()) > CAMath::Abs(b.GetParam().GetQPt());
106 }
if (
a.GetParam().GetY() !=
b.GetParam().GetY()) {
107 return a.GetParam().GetY() > b.GetParam().GetY();
111 return a.NClusters() >
b.NClusters();
119 GPUd() bool operator()(const int32_t aa, const int32_t
bb)
125 return CAMath::Abs(
a.GetParam().GetQPt()) > CAMath::Abs(
b.GetParam().GetQPt());
126 }
if (
a.GetParam().GetY() !=
b.GetParam().GetY()) {
127 return a.GetParam().GetY() >
b.GetParam().GetY();
129 return a.GetParam().GetZ() >
b.GetParam().GetZ();
131 return CAMath::Abs(
a.GetParam().GetQPt()) > CAMath::Abs(
b.GetParam().GetQPt());
139 return GPUCA_DETERMINISTIC_CODE(CAMath::Abs(
a.refz) != CAMath::Abs(
b.refz) ? CAMath::Abs(
a.refz) < CAMath::Abs(
b.refz) :
a.id <
b.id, CAMath::Abs(
a.refz) < CAMath::Abs(
b.refz));
158 int32_t mid = NSECTORS / 2 - 1;
160 mNextSectorInd[mid] = 0;
161 mPrevSectorInd[0] = mid;
162 mNextSectorInd[last] = NSECTORS / 2;
163 mPrevSectorInd[NSECTORS / 2] = last;
167#if !defined(GPUCA_GPUCODE) && (defined(GPUCA_MERGER_BY_MC_LABEL) || defined(GPUCA_CADEBUG_ENABLED) || GPUCA_MERGE_LOOPER_MC)
181template <
class T,
class S>
182int64_t GPUTPCGMMerger::GetTrackLabelA(
const S& trk)
const
186 if constexpr (std::is_same_v<S, GPUTPCGMBorderTrack&>) {
187 sectorTrack = &mSectorTrackInfos[trk.TrackID()];
188 nClusters = sectorTrack->OrigTrack()->NHits();
192 auto acc =
GPUTPCTrkLbl<false, GPUTPCTrkLbl_ret>(resolveMCLabels<T>(GetConstantMem()->ioPtrs.clustersNative ? GetConstantMem()->ioPtrs.clustersNative->clustersMCTruth : nullptr, GetConstantMem()->ioPtrs.mcLabelsTPC), 0.5f);
195 if constexpr (std::is_same_v<S, GPUTPCGMBorderTrack&>) {
196 const GPUTPCTracker& tracker = GetConstantMem()->tpcTrackers[sectorTrack->Sector()];
197 const GPUTPCHitId& ic = tracker.TrackHits()[sectorTrack->OrigTrack()->FirstHitID() +
i];
198 id = tracker.Data().ClusterDataIndex(tracker.Data().Row(ic.RowIndex()), ic.HitIndex()) + GetConstantMem()->ioPtrs.clustersNative->clusterOffset[sectorTrack->Sector()][0];
200 id = mClusters[trk.FirstClusterRef() +
i].
num;
204 return acc.computeLabel().id;
208int64_t GPUTPCGMMerger::GetTrackLabel(
const S& trk)
const
211 if (GetConstantMem()->ioPtrs.clustersNative->clustersMCTruth) {
212 return GetTrackLabelA<o2::dataformats::ConstMCTruthContainerView<o2::MCCompLabel>,
S>(trk);
216 return GetTrackLabelA<AliHLTTPCClusterMCLabel, S>(trk);
226 for (
uint32_t i = 0;
i < mMemory->nMergedTracks;
i++) {
229 if (trk.NClusters() == 0) {
230 GPUError(
"FAILURE: Track marked ok but has 0 clusters");
233 if (!trk.CCE() && !trk.MergedLooper()) {
235 while (updTrk->PrevSegment() >= 0) {
236 auto next = &mMergedTracks[updTrk->PrevSegment()];
237 if (!next->MergedLooper()) {
238 GPUError(
"FAILURE: prev segment not marked as merged looper\n");
242 GPUError(
"FAILURE: segment cycle found\n");
247 if (updTrk->NClusters() == 0) {
248 printf(
"FAILURE: segment leg has 0 clusters");
255 GPUInfo(
"Merged Tracks OK");
257 throw std::runtime_error(
"Error during track merging");
264 std::vector<bool> trkUsed(SectorTrackInfoLocalTotal());
265 for (
int32_t i = 0;
i < SectorTrackInfoLocalTotal();
i++) {
269 for (
int32_t itr = 0; itr < SectorTrackInfoLocalTotal(); itr++) {
271 if (track.PrevSegmentNeighbour() >= 0 && mSectorTrackInfos[track.PrevSegmentNeighbour()].NextSegmentNeighbour() != itr) {
272 GPUError(
"FAILURE: Invalid reciprocal segment link: %d PrevSegmentNeighbour %d NextSegmentNeighbour %d", itr, track.PrevSegmentNeighbour(), mSectorTrackInfos[track.PrevSegmentNeighbour()].NextSegmentNeighbour());
275 if (track.NextSegmentNeighbour() >= 0 && mSectorTrackInfos[track.NextSegmentNeighbour()].PrevSegmentNeighbour() != itr) {
276 GPUError(
"FAILURE: Invalid reciprocal segment link: %d NextSegmentNeighbour %d PrevSegmentNeighbour %d", itr, track.NextSegmentNeighbour(), mSectorTrackInfos[track.NextSegmentNeighbour()].PrevSegmentNeighbour());
279 if (track.PrevNeighbour() >= 0 && mSectorTrackInfos[track.PrevNeighbour()].NextNeighbour() != itr) {
280 GPUError(
"FAILURE: Invalid reciprocal link: %d PrevNeighbour %d NextNeighbour %d", itr, track.PrevNeighbour(), mSectorTrackInfos[track.PrevNeighbour()].NextNeighbour());
283 if (track.NextNeighbour() >= 0 && mSectorTrackInfos[track.NextNeighbour()].PrevNeighbour() != itr) {
284 GPUError(
"FAILURE: Invalid reciprocal link: %d NextNeighbour %d PrevNeighbour %d", itr, track.NextNeighbour(), mSectorTrackInfos[track.NextNeighbour()].PrevNeighbour());
287 if (track.PrevSegmentNeighbour() >= 0) {
290 if (track.PrevNeighbour() >= 0) {
295 int32_t iTrk = tr - mSectorTrackInfos;
297 GPUError(
"FAILURE: double use");
301 trkUsed[iTrk] =
true;
303 int32_t jtr = tr->NextSegmentNeighbour();
305 tr = &(mSectorTrackInfos[jtr]);
306 if (tr->PrevNeighbour() >= 0) {
307 GPUError(
"FAILURE: Non-base segment has previous leg");
312 jtr = trbase->NextNeighbour();
314 trbase = &(mSectorTrackInfos[jtr]);
316 if (tr->PrevSegmentNeighbour() >= 0) {
317 GPUError(
"FAILURE: Neibhbour leg has previous segment neightbout");
326 for (
int32_t i = 0;
i < SectorTrackInfoLocalTotal();
i++) {
327 if (trkUsed[
i] ==
false) {
328 GPUError(
"FAILURE: trk missed");
333 GPUInfo(
"Merged Track Graph OK");
335 throw std::runtime_error(
"Invalid merge graph");
339void GPUTPCGMMerger::PrintMergeGraph(
const GPUTPCGMSectorTrack* trk, std::ostream& out)
const
342 while (trk->PrevSegmentNeighbour() >= 0) {
343 trk = &mSectorTrackInfos[trk->PrevSegmentNeighbour()];
346 while (trk->PrevNeighbour() >= 0) {
347 trk = &mSectorTrackInfos[trk->PrevNeighbour()];
350 int32_t nextId = trk - mSectorTrackInfos;
351 out <<
"Graph of track " << (orgTrack - mSectorTrackInfos) <<
"\n";
352 while (nextId >= 0) {
353 trk = &mSectorTrackInfos[nextId];
354 if (trk->PrevSegmentNeighbour() >= 0) {
355 out <<
"TRACK TREE INVALID!!! " << trk->PrevSegmentNeighbour() <<
" --> " << nextId <<
"\n";
357 out << (trk == orgTower ?
"--" :
" ");
358 while (nextId >= 0) {
360 if (trk != trk2 && (trk2->PrevNeighbour() >= 0 || trk2->NextNeighbour() >= 0)) {
361 out <<
" (TRACK TREE INVALID!!! " << trk2->PrevNeighbour() <<
" <-- " << nextId <<
" --> " << trk2->NextNeighbour() <<
") ";
364 snprintf(tmp, 128,
" %s%5d(%5.2f)", trk2 == orgTrack ?
"!" :
" ", nextId, trk2->QPt());
366 nextId = trk2->NextSegmentNeighbour();
369 nextId = trk->NextNeighbour();
389 mBorder[
iSector] = mBorderMemory + 2 * nTracks;
390 mBorder[NSECTORS +
iSector] = mBorderMemory + 2 * nTracks +
n;
391 mBorderRange[
iSector] = mBorderRangeMemory + 2 * nTracks;
399 memMax = (
void*)std::max((
size_t)mem, (size_t)memMax);
403 memMax = (
void*)std::max((
size_t)mem, (size_t)memMax);
407 memMax = (
void*)std::max((
size_t)mem, (size_t)memMax);
410 memMax = (
void*)std::max((
size_t)mem, (size_t)memMax);
424 if (mergerSortTracks) {
449 mClusterStateExt =
nullptr;
499 mNTotalSectorTracks = 0;
501 mNMaxSingleSectorTracks = 0;
504 mNTotalSectorTracks += ntrk;
506 if (mNMaxSingleSectorTracks < ntrk) {
507 mNMaxSingleSectorTracks = ntrk;
511 if (CAMath::Abs(Param().polynomialField.GetNominalBz()) < (gpu_common_constants::kZeroFieldCut * gpu_common_constants::kCLight)) {
524 mNMaxClusters = mNClusters;
526 mNMaxLooperMatches = mNMaxClusters / 4;
533 throw std::runtime_error(
"mNMaxSingleSectorTracks too small");
537 throw std::runtime_error(
"Must run also sector tracking");
546 const int32_t n =
output ? mMemory->nMergedTracks : SectorTrackInfoLocalTotal();
547 for (
int32_t i = iBlock * nThreads + iThread;
i <
n;
i += nThreads * nBlocks) {
555 prop.SetMaterialTPC();
556 prop.SetMaxSinPhi(constants::MAX_SIN_PHI);
557 prop.SetSeedingErrors(
true);
558 prop.SetFitInProjections(
true);
559 prop.SetPolynomialField(&Param().polynomialField);
561 trk.X() = inTrack->Param().GetX();
562 trk.
Y() = inTrack->Param().GetY();
563 trk.
Z() = inTrack->Param().GetZ();
564 trk.SinPhi() = inTrack->Param().GetSinPhi();
565 trk.DzDs() = inTrack->Param().GetDzDs();
566 trk.QPt() = inTrack->Param().GetQPt();
567 trk.TOffset() = Param().par.continuousTracking ? GetConstantMem()->calibObjects.fastTransform->convZOffsetToVertexTime(
sector, inTrack->Param().GetZOffset(), Param().continuousMaxTimeBin) : 0;
568 const auto tmp = sectorTrack.ClusterTN() > sectorTrack.ClusterT0() ? std::array<float, 2>{sectorTrack.ClusterTN(), sectorTrack.ClusterT0()} : std::array<float, 2>{sectorTrack.ClusterT0(), sectorTrack.ClusterTN()};
569 trk.ShiftZ(
this,
sector, tmp[0], tmp[1], inTrack->Param().GetX());
570 sectorTrack.SetX2(0.f);
571 for (int32_t way = 0; way < 2; way++) {
573 prop.SetFitInProjections(
true);
574 prop.SetPropagateBzOnly(
true);
576 trk.ResetCovariance();
577 prop.SetTrack(&trk,
alpha);
579 int32_t end = way ? 0 : (inTrack->NHits() - 1);
585 const GPUTPCHitId& ic = tracker.TrackHits()[inTrack->FirstHitID() +
i];
586 int32_t clusterIndex = tracker.Data().ClusterDataIndex(tracker.Data().Row(ic.RowIndex()), ic.HitIndex());
588 const ClusterNative& cl = GetConstantMem()->ioPtrs.clustersNative->clustersLinear[GetConstantMem()->ioPtrs.clustersNative->clusterOffset[
sector][0] + clusterIndex];
589 flags = cl.getFlags();
590 GetConstantMem()->calibObjects.fastTransform->Transform(
sector,
row, cl.getPad(), cl.getTime(),
x,
y,
z, trk.TOffset());
591 if (prop.PropagateToXAlpha(
x,
alpha, way == 0)) {
594 trk.ConstrainSinPhi();
595 if (prop.Update(
y,
z,
row, Param(),
flags &
GPUTPCGMMergedTrackHit::clustererAndSharedFlags, 0,
false,
sector, -1.f, 0.f, 0.f)) {
598 trk.ConstrainSinPhi();
601 sectorTrack.SetParam2(trk);
612 const GPUTPCHitId& ic1 = trk.TrackHits()[sectorTr->FirstHitID()];
613 const GPUTPCHitId& ic2 = trk.TrackHits()[sectorTr->FirstHitID() + sectorTr->NHits() - 1];
614 int32_t clusterIndex1 = trk.Data().ClusterDataIndex(trk.Data().Row(ic1.RowIndex()), ic1.HitIndex());
615 int32_t clusterIndex2 = trk.Data().ClusterDataIndex(trk.Data().Row(ic2.RowIndex()), ic2.HitIndex());
616 const ClusterNative* cl = GetConstantMem()->ioPtrs.clustersNative->clustersLinear + GetConstantMem()->ioPtrs.clustersNative->clusterOffset[
iSector][0];
622 mSectorTrackInfoIndex[
id] = mMemory->nUnpackedTracks;
630 uint32_t nLocalTracks = trk.CommonMemory()->nLocalTracks;
632 for (
uint32_t itr = nLocalTracks + iBlock * nThreads + iThread; itr < nTracks; itr += nBlocks * nThreads) {
633 sectorTr = &trk.Tracks()[itr];
634 int32_t localId = mTrackIDs[((sectorTr->LocalTrackId() >> 24) & 0x3F) * mNMaxSingleSectorTracks + (sectorTr->LocalTrackId() & 0xFFFFFF)];
638 uint32_t myTrack = CAMath::AtomicAdd(&mMemory->nUnpackedTracks, 1u);
640 SetTrackClusterT(track,
iSector, sectorTr);
642 track.SetGlobalSectorTrackCov();
644 track.SetPrevNeighbour(-1);
645 track.SetNextNeighbour(-1);
646 track.SetNextSegmentNeighbour(-1);
647 track.SetPrevSegmentNeighbour(-1);
648 track.SetLocalTrackId(localId | (sectorTr->LocalTrackId() & 0x40000000));
655 uint32_t nLocalTracks = trk.CommonMemory()->nLocalTracks;
656 for (
uint32_t i = iBlock * nThreads + iThread;
i < nLocalTracks;
i += nBlocks * nThreads) {
657 mTrackIDs[
iSector * mNMaxSingleSectorTracks +
i] = -1;
664 uint32_t nLocalTracks = trk.CommonMemory()->nLocalTracks;
669 for (
uint32_t itr = iBlock * nThreads + iThread; itr < nLocalTracks; itr += nBlocks * nThreads) {
670 sectorTr = &trk.Tracks()[itr];
672 SetTrackClusterT(track,
iSector, sectorTr);
673 if (RefitSectorTrack(track, sectorTr,
alpha,
iSector)) {
675 if (!
track.FilterErrors(
this,
iSector, constants::MAX_SIN_PHI, 0.1f)) {
681 track.SetPrevNeighbour(-1);
682 track.SetNextNeighbour(-1);
683 track.SetNextSegmentNeighbour(-1);
684 track.SetPrevSegmentNeighbour(-1);
685 track.SetExtrapolatedTrackId(0, -1);
686 track.SetExtrapolatedTrackId(1, -1);
687 uint32_t myTrack = CAMath::AtomicAdd(&mMemory->nUnpackedTracks, 1u);
688 mTrackIDs[
iSector * mNMaxSingleSectorTracks + sectorTr->LocalTrackId()] = myTrack;
689 mSectorTrackInfos[myTrack] =
track;
693GPUd()
void GPUTPCGMMerger::LinkExtrapolatedTracks(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
695 for (int32_t itr = SectorTrackInfoGlobalFirst(0) + iBlock * nThreads + iThread; itr < SectorTrackInfoGlobalLast(NSECTORS - 1); itr += nThreads * nBlocks) {
697 GPUTPCGMSectorTrack& localTrack = mSectorTrackInfos[extrapolatedTrack.LocalTrackId() & 0xFFFFFF];
698 int up = (extrapolatedTrack.LocalTrackId() & 0x40000000) ? 1 : 0;
699 localTrack.SetExtrapolatedTrackId(up, itr);
708 float fieldBz = Param().bzCLight;
710 float dAlpha = Param().dAlpha / 2;
714 dAlpha = dAlpha - CAMath::Pi() / 2;
715 }
else if (iBorder == 1) {
716 dAlpha = -dAlpha - CAMath::Pi() / 2;
717 }
else if (iBorder == 2) {
718 x0 = GPUTPCGeometry::Row2X(63);
719 }
else if (iBorder == 3) {
721 x0 = GPUTPCGeometry::Row2X(63);
724 const float maxSin = CAMath::Sin(60.f / 180.f * CAMath::Pi());
725 float cosAlpha = CAMath::Cos(dAlpha);
726 float sinAlpha = CAMath::Sin(dAlpha);
729 for (int32_t itr = iBlock * nThreads + iThread; itr < SectorTrackInfoLocalTotal(); itr += nThreads * nBlocks) {
733 if (
track->PrevSegmentNeighbour() >= 0 &&
track->Sector() == mSectorTrackInfos[
track->PrevSegmentNeighbour()].Sector()) {
736 if (useOrigTrackParam) {
737 if (CAMath::Abs(
track->QPt()) * Param().qptB5Scaler < Param().rec.tpc.mergerLooperQPtB5Limit) {
741 while (
track->NextSegmentNeighbour() >= 0 &&
track->Sector() == mSectorTrackInfos[
track->NextSegmentNeighbour()].Sector()) {
742 track = &mSectorTrackInfos[
track->NextSegmentNeighbour()];
743 if (
track->OrigTrack()->Param().X() < trackMin->OrigTrack()->Param().X()) {
747 trackTmp = *trackMin;
749 if (trackTmp.X2() != 0.f) {
750 trackTmp.UseParam2();
752 trackTmp.Set(
this, trackMin->OrigTrack(), trackMin->Alpha(), trackMin->Sector());
755 if (CAMath::Abs(
track->QPt()) * Param().qptB5Scaler < Param().rec.tpc.mergerLooperSecondHorizontalQPtB5Limit) {
756 if (iBorder == 0 &&
track->NextNeighbour() >= 0) {
759 if (iBorder == 1 &&
track->PrevNeighbour() >= 0) {
766 if (
track->TransportToXAlpha(
this,
x0, sinAlpha, cosAlpha, fieldBz,
b, maxSin)) {
768 b.SetNClusters(
track->NClusters());
769 for (int32_t
i = 0;
i < 4;
i++) {
770 if (CAMath::Abs(
b.Cov()[
i]) >= 5.0f) {
774 if (CAMath::Abs(
b.Cov()[4]) >= 0.5f) {
784GPUd()
void GPUTPCGMMerger::MergeBorderTracks<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, int32_t iSector1, const
GPUTPCGMBorderTrack* B1, int32_t N1, int32_t iSector2, const
GPUTPCGMBorderTrack* B2, int32_t N2,
uint8_t mergeMode)
786 CADEBUG(GPUInfo(
"\nMERGING Sectors %d %d NTracks %d %d CROSS %d", iSector1, iSector2, N1, N2, mergeMode));
788 GPUTPCGMBorderRange* range2 = mBorderRange[iSector2] + *GetConstantMem()->tpcTrackers[iSector2].NTracks();
789 for (
int32_t itr = iBlock * nThreads + iThread; itr < N1; itr += nThreads * nBlocks) {
791 float d = CAMath::Max(0.5f, 3.5f * CAMath::Sqrt(
b.Cov()[1]));
792 if (CAMath::Abs(
b.Par()[4]) * Param().qptB5Scaler >= 20) {
797 CADEBUG(printf(
" Input Sector 1 %d Track %d: ", iSector1, itr);
for (
int32_t i = 0;
i < 5;
i++) { printf(
"%8.3f ",
b.Par()[
i]); } printf(
" - ");
for (
int32_t i = 0;
i < 5;
i++) { printf(
"%8.3f ",
b.Cov()[
i]); } printf(
" - D %8.3f\n",
d));
800 if (iSector1 == iSector2) {
804 if (iSector1 != iSector2) {
805 for (
int32_t itr = iBlock * nThreads + iThread; itr < N2; itr += nThreads * nBlocks) {
807 float d = CAMath::Max(0.5f, 3.5f * CAMath::Sqrt(
b.Cov()[1]));
808 if (CAMath::Abs(
b.Par()[4]) * Param().qptB5Scaler >= 20) {
813 CADEBUG(printf(
" Input Sector 2 %d Track %d: ", iSector2, itr);
for (
int32_t i = 0;
i < 5;
i++) { printf(
"%8.3f ",
b.Par()[
i]); } printf(
" - ");
for (
int32_t i = 0;
i < 5;
i++) { printf(
"%8.3f ",
b.Cov()[
i]); } printf(
" - D %8.3f\n",
d));
814 range2[itr] = {.
fId = itr, .fMin =
b.Par()[1] +
b.ZOffsetLinear() -
d, .fMax =
b.Par()[1] +
b.ZOffsetLinear() +
d};
820GPUd()
void GPUTPCGMMerger::MergeBorderTracks<1>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, int32_t iSector1, const
GPUTPCGMBorderTrack* B1, int32_t N1, int32_t iSector2, const
GPUTPCGMBorderTrack* B2, int32_t N2,
uint8_t mergeMode)
822#if !defined(GPUCA_GPUCODE_GENRTC)
824 GPUTPCGMBorderRange* range2 = mBorderRange[iSector2] + *GetConstantMem()->tpcTrackers[iSector2].NTracks();
829 }
else if (iBlock == 1) {
834 printf(
"This sorting variant is disabled for RTC\n");
841#ifndef GPUCA_SPECIALIZE_THRUST_SORTS
842 if (iThread == 0 && iBlock == 0) {
853GPUd()
void GPUTPCGMMerger::MergeBorderTracks<2>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, int32_t iSector1, const
GPUTPCGMBorderTrack* B1, int32_t N1, int32_t iSector2, const
GPUTPCGMBorderTrack* B2, int32_t N2,
uint8_t mergeMode)
856 float factor2ys = Param().rec.tpc.trackMergerFactor2YS;
857 float factor2zt = Param().rec.tpc.trackMergerFactor2ZT;
858 float factor2k = Param().rec.tpc.trackMergerFactor2K;
859 float factor2General = Param().rec.tpc.trackMergerFactor2General;
861 factor2k = factor2General * factor2k;
862 factor2ys = factor2General * factor2ys;
863 factor2zt = factor2General * factor2zt;
865 int32_t minNPartHits = Param().rec.tpc.trackMergerMinPartHits;
866 int32_t minNTotalHits = Param().rec.tpc.trackMergerMinTotalHits;
868 bool sameSector = (iSector1 == iSector2);
871 GPUTPCGMBorderRange* range2 = mBorderRange[iSector2] + *GetConstantMem()->tpcTrackers[iSector2].NTracks();
874 for (
int32_t i1 = iBlock * nThreads + iThread; i1 < N1; i1 += nThreads * nBlocks) {
876 while (i2 < N2 && range2[i2].fMax < r1.
fMin) {
881 if (b1.NClusters() < minNPartHits) {
887 for (
int32_t k2 = i2; k2 < N2; k2++) {
892 if (sameSector && (r1.
fId >= r2.
fId)) {
898#if defined(GPUCA_MERGER_BY_MC_LABEL) && !defined(GPUCA_GPUCODE)
899 int64_t label1 = GetTrackLabel(b1);
900 int64_t label2 = GetTrackLabel(b2);
901 if (label1 != label2 && label1 != -1)
904 CADEBUG(
if (GetConstantMem()->ioPtrs.mcLabelsTPC) {printf(
"Comparing track %3d to %3d: ", r1.fId, r2.fId); for (int32_t i = 0; i < 5; i++) { printf(
"%8.3f ", b1.Par()[i]); } printf(
" - ");
for (
int32_t i = 0;
i < 5;
i++) { printf(
"%8.3f ", b1.Cov()[
i]); } printf(
"\n%28s",
""); });
905 CADEBUG(
if (GetConstantMem()->ioPtrs.mcLabelsTPC) {for (int32_t i = 0; i < 5; i++) { printf(
"%8.3f ", b2.Par()[i]); } printf(
" - ");
for (
int32_t i = 0;
i < 5;
i++) { printf(
"%8.3f ", b2.Cov()[
i]); } printf(
" - %5s - ", GetTrackLabel(b1) == GetTrackLabel(b2) ?
"CLONE" :
"FAKE"); });
906 if (b2.NClusters() < lBest2) {
907 CADEBUG2(
continue, printf(
"!NCl1\n"));
909 if (mergeMode & mergeModes::mergeAcrossCE) {
911 int32_t maxRowDiff = (mergeMode & mergeModes::mergeAtCluster) ? 1 : 3;
912 if (CAMath::Abs(b1.Row() - b2.Row()) > maxRowDiff) {
913 CADEBUG2(
continue, printf(
"!ROW\n"));
915 if (CAMath::Abs(b1.Par()[2] - b2.Par()[2]) > 0.5f || CAMath::Abs(b1.Par()[3] - b2.Par()[3]) > 0.5f) {
916 CADEBUG2(
continue, printf(
"!CE SinPhi/Tgl\n"));
922 if (!b1.CheckChi2Y(b2, factor2ys)) {
926 if (!b1.CheckChi2QPt(b2, factor2k)) {
927 CADEBUG2(
continue, printf(
"!QPt\n"));
929 float fys = CAMath::Abs(b1.Par()[4]) * Param().qptB5Scaler < 20 ? factor2ys : (2.f * factor2ys);
930 float fzt = CAMath::Abs(b1.Par()[4]) * Param().qptB5Scaler < 20 ? factor2zt : (2.f * factor2zt);
931 if (!b1.CheckChi2YS(b2, fys)) {
932 CADEBUG2(
continue, printf(
"!YS\n"));
934 if (!b1.CheckChi2ZT(b2, fzt)) {
935 CADEBUG2(
continue, printf(
"!ZT\n"));
937 if (CAMath::Abs(b1.Par()[4]) * Param().qptB5Scaler < 20) {
938 if (b2.NClusters() < minNPartHits) {
939 CADEBUG2(
continue, printf(
"!NCl2\n"));
941 if (b1.NClusters() + b2.NClusters() < minNTotalHits) {
942 CADEBUG2(
continue, printf(
"!NCl3\n"));
945 CADEBUG(printf(
"OK: dZ %8.3f D1 %8.3f D2 %8.3f\n", CAMath::Abs(b1.Par()[1] - b2.Par()[1]), 3.5f * sqrt(b1.Cov()[1]), 3.5f * sqrt(b2.Cov()[1])));
947 lBest2 = b2.NClusters();
948 iBest2 = b2.TrackID();
954 GPUCA_DEBUG_STREAMER_CHECK(
float weight = b1.Par()[4] * b1.Par()[4];
if (o2::utils::DebugStreamer::checkStream(
o2::utils::StreamFlags::streamMergeBorderTracksBest, b1.TrackID(),
weight)) { MergedTrackStreamer(b1, MergedTrackStreamerFindBorderTrack(B2, N2, iBest2),
"merge_best_track", iSector1, iSector2, mergeMode,
weight, o2::utils::DebugStreamer::getSamplingFrequency(
o2::utils::StreamFlags::streamMergeBorderTracksBest)); });
958 CADEBUG(GPUInfo(
"Found match %d %d", b1.TrackID(), iBest2));
960 mTrackLinks[b1.TrackID()] = iBest2;
961 if (mergeMode & mergeModes::mergeAcrossCE) {
962 GPUCA_DETERMINISTIC_CODE(CAMath::AtomicMax(&mTrackLinks[iBest2], b1.TrackID()), mTrackLinks[iBest2] = b1.TrackID());
970 if (mergeMode & mergeModes::mergeWithinSector) {
972 n1 = n2 = mMemory->tmpCounter[
iSector];
974 }
else if (mergeMode & mergeModes::mergeAcrossCE) {
975 jSector = (
iSector + NSECTORS / 2);
976 const int32_t offset = (mergeMode & mergeModes::mergeAtCluster) ? NSECTORS : 0;
978 n2 = mMemory->tmpCounter[jSector +
offset];
980 b2 = mBorder[jSector +
offset];
982 jSector = mNextSectorInd[
iSector];
983 n1 = mMemory->tmpCounter[
iSector];
984 n2 = mMemory->tmpCounter[NSECTORS + jSector];
986 b2 = mBorder[NSECTORS + jSector];
996 MergeBorderTracksSetup(n1, n2, b1, b2, jSector,
iSector, mergeMode);
997 MergeBorderTracks<I>(nBlocks, nThreads, iBlock, iThread,
iSector, b1, n1, jSector, b2, n2, mergeMode);
1000#if !defined(GPUCA_GPUCODE) || defined(GPUCA_GPUCODE_DEVICE)
1006GPUd()
void GPUTPCGMMerger::MergeWithinSectorsPrepare(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1008 float x0 = GPUTPCGeometry::Row2X(63);
1009 const float maxSin = CAMath::Sin(60.f / 180.f * CAMath::Pi());
1011 for (int32_t itr = iBlock * nThreads + iThread; itr < SectorTrackInfoLocalTotal(); itr += nThreads * nBlocks) {
1015 if (
track.TransportToX(
this,
x0, Param().bzCLight,
b, maxSin)) {
1017 CADEBUG(printf(
"WITHIN SECTOR %d Track %d - ",
iSector, itr);
for (int32_t
i = 0;
i < 5;
i++) { printf(
"%8.3f ",
b.Par()[
i]); } printf(
" - ");
for (int32_t
i = 0;
i < 5;
i++) { printf(
"%8.3f ",
b.Cov()[
i]); } printf(
"\n"));
1018 b.SetNClusters(
track.NClusters());
1019 uint32_t myTrack = CAMath::AtomicAdd(&mMemory->tmpCounter[
iSector], 1u);
1025GPUd()
void GPUTPCGMMerger::MergeSectorsPrepare(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, int32_t border0, int32_t border1, int8_t useOrigTrackParam)
1027 bool part2 = iBlock & 1;
1035 MergeSectorsPrepareStep2((nBlocks + !part2) >> 1, nThreads, iBlock >> 1, iThread,
border,
b,
n, useOrigTrackParam);
1040 start = (elems + nBlocks - 1) / nBlocks * iBlock;
1041 end = (elems + nBlocks - 1) / nBlocks * (iBlock + 1);
1042 end = CAMath::Min(elems,
end);
1051 u = mTrackCCRoots[u];
1052 v = mTrackCCRoots[
v];
1059 int32_t old = CAMath::AtomicCAS(&mTrackCCRoots[
h],
h, l);
1064 u = mTrackCCRoots[
h];
1069GPUd()
void GPUTPCGMMerger::ResolveFindConnectedComponentsSetup(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1072 setBlockRange(SectorTrackInfoLocalTotal(), nBlocks, iBlock,
start,
end);
1073 for (int32_t
i =
start + iThread;
i <
end;
i += nThreads) {
1074 mTrackCCRoots[
i] =
i;
1078GPUd()
void GPUTPCGMMerger::ResolveFindConnectedComponentsHookLinks(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1083 setBlockRange(SectorTrackInfoLocalTotal(), nBlocks, iBlock,
start,
end);
1084 for (int32_t itr =
start + iThread; itr <
end; itr += nThreads) {
1085 hookEdge(itr, mTrackLinks[itr]);
1089GPUd()
void GPUTPCGMMerger::ResolveFindConnectedComponentsHookNeighbors(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1092 nBlocks = nBlocks / 4 * 4;
1093 if (iBlock >= nBlocks) {
1098 setBlockRange(SectorTrackInfoLocalTotal(), nBlocks / 4, iBlock / 4,
start,
end);
1100 int32_t myNeighbor = iBlock % 4;
1102 for (int32_t itr =
start + iThread; itr <
end; itr += nThreads) {
1103 int32_t v = mSectorTrackInfos[itr].AnyNeighbour(myNeighbor);
1108GPUd()
void GPUTPCGMMerger::ResolveFindConnectedComponentsMultiJump(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1112 setBlockRange(SectorTrackInfoLocalTotal(), nBlocks, iBlock,
start,
end);
1113 for (int32_t itr =
start + iThread; itr <
end; itr += nThreads) {
1115 int32_t next = mTrackCCRoots[root];
1121 next = mTrackCCRoots[next];
1122 }
while (root != next);
1123 mTrackCCRoots[itr] = root;
1160 setBlockRange(SectorTrackInfoLocalTotal(), nBlocks, iBlock,
start,
end);
1165 while (
track->SegmentNeighbour(dir) >= 0) {
1175 for (int32_t k = 0; k < 2; k++) {
1177 while (tmp->Neighbour(k) >= 0) {
1178 tmp = &
tracks[tmp->Neighbour(k)];
1187 for (int32_t baseIdx = 0; baseIdx < SectorTrackInfoLocalTotal(); baseIdx += nThreads) {
1188 int32_t itr = baseIdx + iThread;
1189 bool inRange = itr < SectorTrackInfoLocalTotal();
1193 itr2 = mTrackLinks[itr];
1196 bool resolveSector = (itr2 > -1);
1197 if (resolveSector) {
1198 int32_t root = mTrackCCRoots[itr];
1199 resolveSector &= (
start <= root) && (root <
end);
1202 int16_t smemIdx = work_group_scan_inclusive_add(int16_t(resolveSector));
1204 if (resolveSector) {
1205 smem.iTrack1[smemIdx - 1] = itr;
1206 smem.iTrack2[smemIdx - 1] = itr2;
1210 if (iThread < nThreads - 1) {
1214 const int32_t nSectors = smemIdx;
1216 for (int32_t
i = 0;
i < nSectors;
i++) {
1217 itr = smem.iTrack1[
i];
1218 itr2 = smem.iTrack2[
i];
1225 bool sameSegment = CAMath::Abs(track1->NClusters() > track2->NClusters() ? track1->QPt() : track2->QPt()) * Param().qptB5Scaler < 2 || track1->QPt() * track2->QPt() > 0;
1230 walkSegmentChain(track2,
nullptr, 0);
1232 if (track1 == track2) {
1235 if (walkSegmentChain(track1, track2, 0)) {
1238 GPUCommonAlgorithm::swap(track1, track1Base);
1239 if (neighbourChainReaches(track1Base, track2)) {
1242 if (walkSegmentChain(track1, track2, 1)) {
1246 walkSegmentChain(track1,
nullptr, 0);
1248 if (track1 == track2) {
1251 if (neighbourChainReaches(track1, track2)) {
1255 float z1min, z1max, z2min, z2max;
1256 z1min = track1->MinClusterT();
1257 z1max = track1->MaxClusterT();
1258 z2min = track2->MinClusterT();
1259 z2max = track2->MaxClusterT();
1260 if (track1 != track1Base) {
1261 z1min = CAMath::Min(z1min, track1Base->MinClusterT());
1262 z1max = CAMath::Max(z1max, track1Base->MaxClusterT());
1264 if (track2 != track2Base) {
1265 z2min = CAMath::Min(z2min, track2Base->MinClusterT());
1266 z2max = CAMath::Max(z2max, track2Base->MaxClusterT());
1268 bool goUp = z2max - z1min > z1max - z2min;
1270 if (track1->Neighbour(goUp) < 0 && track2->Neighbour(!goUp) < 0) {
1271 track1->SetNeighbor(track2 - mSectorTrackInfos, goUp);
1272 track2->SetNeighbor(track1 - mSectorTrackInfos, !goUp);
1276 }
else if (track1->Neighbour(goUp) < 0) {
1277 track2 = &mSectorTrackInfos[track2->Neighbour(!goUp)];
1278 GPUCommonAlgorithm::swap(track1, track2);
1279 }
else if (track2->Neighbour(!goUp) < 0) {
1280 track1 = &mSectorTrackInfos[track1->Neighbour(goUp)];
1282 track1 = &mSectorTrackInfos[track1->Neighbour(goUp)];
1284 track1Base = track1;
1287 track2Base = track2;
1289 walkSegmentChain(track1,
nullptr, 1);
1291 track1->SetNextSegmentNeighbour(track2 - mSectorTrackInfos);
1292 track2->SetPrevSegmentNeighbour(track1 - mSectorTrackInfos);
1295 for (int32_t k = 0; k < 2; k++) {
1296 track1 = track1Base;
1297 track2 = track2Base;
1298 while (track2->Neighbour(k) >= 0) {
1299 if (track1->Neighbour(k) >= 0) {
1302 track2->SetNeighbor(-1, k);
1303 track2new->SetNeighbor(-1, k ^ 1);
1305 walkSegmentChain(track1,
nullptr, 1);
1306 track1->SetNextSegmentNeighbour(track2new - mSectorTrackInfos);
1307 track2new->SetPrevSegmentNeighbour(track1 - mSectorTrackInfos);
1312 track1->SetNeighbor(track2->Neighbour(k), k);
1313 track2->SetNeighbor(-1, k);
1314 track2new->SetNeighbor(track1 - mSectorTrackInfos, k ^ 1);
1326 if (Param().
rec.tpc.mergerCERowLimit > 0 && CAMath::Abs(
track->QPt()) * Param().qptB5Scaler < 0.3f && (cls.row < Param().
rec.tpc.mergerCERowLimit || cls.row >= GPUTPCGeometry::NROWS - Param().
rec.tpc.mergerCERowLimit)) {
1333 auto& cln = mConstantMem->ioPtrs.clustersNative->clustersLinear[cls.num];
1334 GPUTPCConvertImpl::convert(*mConstantMem, cls.sector, cls.row, cln.getPad(), cln.getTime(),
x,
y,
z);
1337 if (!Param().
par.continuousTracking && CAMath::Abs(
z) > 10) {
1341 for (int32_t attempt = 0; attempt < 2; attempt++) {
1343 const float x0 = GPUTPCGeometry::Row2X(attempt == 0 ? 63 : cls.
row);
1344 if (
track->TransportToX(
this,
x0, Param().bzCLight,
b, constants::MAX_SIN_PHI_LOW)) {
1346 b.SetNClusters(mMergedTracks[itr].NClusters());
1347 if (CAMath::Abs(
b.Cov()[4]) >= 0.5f) {
1350 if (
track->CSide()) {
1351 b.SetPar(1,
b.Par()[1] - 2 * (
z -
b.ZOffsetLinear()));
1352 b.SetZOffsetLinear(-
b.ZOffsetLinear());
1356 uint32_t myTrack = CAMath::AtomicAdd(&mMemory->tmpCounter[
id], 1u);
1357 mBorder[
id][myTrack] =
b;
1365 const ClusterNative* cls = mConstantMem->ioPtrs.clustersNative->clustersLinear;
1366 for (
uint32_t i = iBlock * nThreads + iThread;
i < mMemory->nMergedTracks;
i += nThreads * nBlocks) {
1367 if (mMergedTracks[
i].CSide() == 0 && mTrackLinks[
i] >= 0) {
1368 if (mTrackLinks[mTrackLinks[
i]] != (int32_t)
i) {
1373 if (!trk[1]->
OK() || trk[1]->CCE()) {
1376 bool celooper = (trk[0]->GetParam().GetQPt() * Param().qptB5Scaler > 1 && trk[0]->GetParam().GetQPt() * trk[1]->GetParam().GetQPt() < 0);
1377 celooper |= trk[0]->PrevSegment() != -1 && trk[1]->PrevSegment() != -1;
1378 if (!celooper && trk[0]->GetParam().GetPar(3) * trk[1]->GetParam().GetPar(3) < 0) {
1382 bool needswap =
false;
1383 if (trk[0]->PrevSegment() == -1 && trk[1]->PrevSegment() >= 0) {
1385 }
else if (celooper) {
1386 const float z0max = -CAMath::Min(cls[mClusters[trk[0]->FirstClusterRef()].
num].
getTime(), cls[mClusters[trk[0]->FirstClusterRef() + trk[0]->NClusters() - 1].
num].
getTime());
1387 const float z1max = -CAMath::Min(cls[mClusters[trk[1]->FirstClusterRef()].
num].
getTime(), cls[mClusters[trk[1]->FirstClusterRef() + trk[1]->NClusters() - 1].
num].
getTime());
1388 if (z1max < z0max) {
1392 if (mClusters[trk[0]->FirstClusterRef()].
row > mClusters[trk[1]->FirstClusterRef()].
row) {
1397 GPUCommonAlgorithm::swap(trk[0], trk[1]);
1400 if (Param().
par.continuousTracking) {
1402 const float tmax = CAMath::MaxWithRef(cls[mClusters[trk[0]->FirstClusterRef()].
num].
getTime(), cls[mClusters[trk[0]->FirstClusterRef() + trk[0]->NClusters() - 1].
num].
getTime(),
1403 cls[mClusters[trk[1]->FirstClusterRef()].
num].
getTime(), cls[mClusters[trk[1]->FirstClusterRef() + trk[1]->NClusters() - 1].
num].
getTime(),
1404 &mClusters[trk[0]->FirstClusterRef()], &mClusters[trk[0]->FirstClusterRef() + trk[0]->NClusters() - 1],
1405 &mClusters[trk[1]->FirstClusterRef()], &mClusters[trk[1]->FirstClusterRef() + trk[1]->NClusters() - 1], clsmax);
1406 const float offset = CAMath::Max(tmax - mConstantMem->calibObjects.fastTransform->getMaxDriftTime(clsmax->
sector, clsmax->
row, cls[clsmax->
num].getPad()), 0.f);
1407 trk[1]->Param().Z() += mConstantMem->calibObjects.fastTransform->convDeltaTimeToDeltaZinTimeFrame(trk[1]->CSide() * NSECTORS / 2, trk[1]->Param().TOffset() -
offset);
1408 trk[1]->Param().TOffset() =
offset;
1410 trk[0]->Param().Z() += mConstantMem->calibObjects.fastTransform->convDeltaTimeToDeltaZinTimeFrame(trk[0]->CSide() * NSECTORS / 2, trk[0]->Param().TOffset() -
offset);
1411 trk[0]->Param().TOffset() =
offset;
1416 trk[0]->SetMergedLooperConnected(
true);
1417 trk[0]->SetCCE(
true);
1418 trk[0]->SetLooper(
true);
1419 trk[1]->SetMergedLooperConnected(
true);
1420 trk[1]->SetCCE(
true);
1421 trk[1]->SetLooper(
true);
1425 uint32_t newRef = CAMath::AtomicAdd(&mMemory->nMergedTrackClusters, trk[0]->NClusters() + trk[1]->NClusters());
1426 if (newRef + trk[0]->NClusters() + trk[1]->NClusters() >= mNMaxMergedTrackClusters) {
1427 raiseError(GPUErrors::ERROR_MERGER_CE_HIT_OVERFLOW, newRef + trk[0]->NClusters() + trk[1]->NClusters(), mNMaxMergedTrackClusters);
1428 for (
uint32_t k = newRef; k < mNMaxMergedTrackClusters; k++) {
1429 mClusters[k].num = 0;
1430 mClusters[k].state = 0;
1432 CAMath::AtomicExch(&mMemory->nMergedTrackClusters, mNMaxMergedTrackClusters);
1438 for (int32_t k = 1; k >= 0; k--) {
1439 for (
uint32_t j = 0;
j != trk[k]->NClusters();
j++) {
1440 mClusters[
pos++] = mClusters[trk[k]->FirstClusterRef() +
j];
1443 trk[1]->SetFirstClusterRef(newRef);
1444 trk[1]->SetNClusters(trk[0]->NClusters() + trk[1]->NClusters());
1445 if (trk[1]->NClusters() > constants::MERGER_MAX_TRACK_CLUSTERS) {
1446 trk[1]->SetFirstClusterRef(trk[1]->FirstClusterRef() + trk[1]->NClusters() - constants::MERGER_MAX_TRACK_CLUSTERS);
1447 trk[1]->SetNClusters(constants::MERGER_MAX_TRACK_CLUSTERS);
1449 trk[1]->SetCCE(
true);
1450 trk[0]->SetNClusters(0);
1451 trk[0]->SetOK(
false);
1462struct GPUTPCGMMerger_CompareClusterIds {
1466 GPUd() bool operator()(const int16_t aa, const int16_t
bb)
1470 if (
a.row !=
b.row) {
1479GPUd()
void GPUTPCGMMerger::CollectMergedTracks(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1481 constexpr int32_t kMaxParts = 16;
1482 constexpr int32_t kMaxClusters = constants::MERGER_MAX_TRACK_CLUSTERS;
1486 int32_t itr = iBlock * nThreads + iThread;
1489 int32_t lastMergedSegment = -1;
1490 bool revertSegments =
false;
1491 bool revertInSegment =
false;
1493 if (trbase && !Param().
rec.tpc.dropLoopers) {
1494 int32_t jtr = trbase->NextNeighbour();
1496 trbase = &(mSectorTrackInfos[jtr]);
1497 if (trbase->PrevSegmentNeighbour() >= 0) {
1500 if (Param().rec.enableCyclicGraphWorkarounds) {
1501 trbase->SetPrevSegmentNeighbour(1000000001);
1503 leg += revertSegments ? 1 : -1;
1510 if (trbase ==
nullptr) {
1511 while (itr < SectorTrackInfoLocalTotal()) {
1512 trbase = &mSectorTrackInfos[itr];
1513 if (trbase->PrevSegmentNeighbour() >= 0 || trbase->PrevNeighbour() >= 0) {
1514 itr += nThreads * nBlocks;
1519 if (itr >= SectorTrackInfoLocalTotal()) {
1522 revertSegments =
false;
1523 revertInSegment =
false;
1524 if (Param().rec.enableCyclicGraphWorkarounds) {
1525 trbase->SetPrevSegmentNeighbour(1000000000);
1527 int32_t jtr = trbase->NextNeighbour();
1532 if (Param().rec.enableCyclicGraphWorkarounds && &mSectorTrackInfos[jtr] == trbase) {
1537 jtr = mSectorTrackInfos[jtr].NextNeighbour();
1541 revertSegments =
true;
1543 int32_t ichk = k ? lasttr : itr;
1546 float t = -trchk->MinClusterT();
1549 revertSegments =
false;
1554 int32_t next = trchk->NextSegmentNeighbour();
1555 if (next < 0 || (Param().
rec.enableCyclicGraphWorkarounds && next == ichk)) {
1558 trchk = &mSectorTrackInfos[next];
1561 if (revertSegments) {
1567 int32_t ichk = revertSegments ? itr : lasttr;
1571 if (trchk->OrigTrack()->NHits() >
length) {
1573 length = trchk->OrigTrack()->NHits();
1575 int32_t next = trchk->NextSegmentNeighbour();
1576 if (next < 0 || (Param().
rec.enableCyclicGraphWorkarounds && next == ichk)) {
1579 trchk = &mSectorTrackInfos[next];
1581 revertInSegment = longest->ClusterT0() < longest->ClusterTN();
1584 lastMergedSegment = -1;
1585 itr += nThreads * nBlocks;
1594 if (nParts >= kMaxParts) {
1597 if (nHits + tr->NClusters() > kMaxClusters) {
1600 nHits += tr->NClusters();
1602 trackParts[nParts++] = tr;
1603 for (int32_t
i = 0;
i < 2;
i++) {
1604 if (tr->ExtrapolatedTrackId(
i) != -1) {
1605 if (nParts >= kMaxParts) {
1608 if (nHits + mSectorTrackInfos[tr->ExtrapolatedTrackId(
i)].NClusters() > kMaxClusters) {
1611 trackParts[nParts++] = &mSectorTrackInfos[tr->ExtrapolatedTrackId(
i)];
1612 nHits += mSectorTrackInfos[tr->ExtrapolatedTrackId(
i)].NClusters();
1615 int32_t jtr = tr->NextSegmentNeighbour();
1617 tr = &(mSectorTrackInfos[jtr]);
1618 if (Param().rec.enableCyclicGraphWorkarounds) {
1619 tr->SetPrevSegmentNeighbour(1000000002);
1627 if (nParts > 1 && (!revertInSegment ^ (leg & 1))) {
1628#pragma GCC diagnostic push
1629#pragma GCC diagnostic ignored "-Warray-bounds"
1631#pragma GCC diagnostic pop
1633 if (
a->X() !=
b->X()) {
1634 return (a->X() > b->X());
1636 if (
a->Y() !=
b->Y()) {
1637 return (a->Y() > b->Y());
1639 if (
a->Z() !=
b->Z()) {
1640 return (a->Z() > b->Z());
1642 return a->QPt() >
b->QPt();
1644 return (
a->X() >
b->X());
1649 trackCluster trackClusters[kMaxClusters];
1651 for (int32_t ipart = 0; ipart < nParts; ipart++) {
1653 CADEBUG(printf(
"Collect Track %d Part %d QPt %f DzDs %f\n", mMemory->nMergedTracks, ipart,
t->QPt(),
t->DzDs()));
1654 int32_t nTrackHits =
t->NClusters();
1655 trackCluster* c2 = trackClusters + nHits + nTrackHits - 1;
1656 for (int32_t
i = 0;
i < nTrackHits;
i++, c2--) {
1657 const GPUTPCTracker& trk = GetConstantMem()->tpcTrackers[
t->Sector()];
1658 const GPUTPCHitId& ic = trk.TrackHits()[
t->OrigTrack()->FirstHitID() +
i];
1659 uint32_t id = trk.Data().ClusterDataIndex(trk.Data().Row(ic.RowIndex()), ic.HitIndex()) + GetConstantMem()->ioPtrs.clustersNative->clusterOffset[
t->Sector()][0];
1660 *c2 = trackCluster{
id, (
uint8_t)ic.RowIndex(),
t->Sector()};
1662 nHits += nTrackHits;
1664 if (nHits < Param().tpcMinHitsB5(trbase->QPt() * Param().qptB5Scaler)) {
1668 const bool mustReverse = revertInSegment ^ (leg & 1);
1672 if ((trackClusters[
i].
row > trackClusters[
i - 1].
row) ^ mustReverse || trackClusters[
i].id == trackClusters[
i - 1].id) {
1679 int32_t lastTrackIndex = nParts - 1;
1682 trackCluster trackClustersUnsorted[kMaxClusters];
1685 trackClustersUnsorted[
i] = trackClusters[
i];
1692 firstTrackIndex = lastTrackIndex = -1;
1693 for (int32_t
i = 0;
i < nParts;
i++) {
1694 nTmpHits += trackParts[
i]->NClusters();
1696 firstTrackIndex =
i;
1698 if (nTmpHits >
clusterIndices[nHits - 1] && lastTrackIndex == -1) {
1707 if (indPrev >= 0 && trackClustersUnsorted[ind].
id == trackClustersUnsorted[indPrev].
id) {
1711 trackClusters[nFilteredHits] = trackClustersUnsorted[ind];
1714 nHits = nFilteredHits;
1717 const uint32_t iMergedTrackFirstCluster = CAMath::AtomicAdd(&mMemory->nMergedTrackClusters, (
uint32_t)nHits);
1718 if (iMergedTrackFirstCluster + nHits > mNMaxMergedTrackClusters) {
1719 raiseError(GPUErrors::ERROR_MERGER_HIT_OVERFLOW, iMergedTrackFirstCluster, mNMaxMergedTrackClusters);
1720 CAMath::AtomicExch(&mMemory->nMergedTrackClusters, mNMaxMergedTrackClusters);
1728 const ClusterNative&
c = GetConstantMem()->ioPtrs.clustersNative->clustersLinear[trackClusters[
i].id];
1731 cl[
i].
row = trackClusters[
i].row;
1732 cl[
i].
num = trackClusters[
i].id;
1733 cl[
i].
sector = trackClusters[
i].sector;
1736 uint32_t iOutputTrack = CAMath::AtomicAdd(&mMemory->nMergedTracks, 1u);
1737 if (iOutputTrack >= mNMaxTracks) {
1738 raiseError(GPUErrors::ERROR_MERGER_TRACK_OVERFLOW, iOutputTrack, mNMaxTracks);
1739 CAMath::AtomicExch(&mMemory->nMergedTracks, mNMaxTracks);
1746 mergedTrack.SetFlags(0);
1747 mergedTrack.SetOK(
true);
1748 mergedTrack.SetLeg(leg);
1749 mergedTrack.SetLooper(leg > 0);
1750 mergedTrack.SetNClusters(nHits);
1751 mergedTrack.SetFirstClusterRef(iMergedTrackFirstCluster);
1752 mergedTrack.SetCSide(
p2.CSide());
1753 mergedTrack.SetMergedLooperConnected(leg > 0);
1754 if (revertSegments) {
1755 mergedTrack.SetPrevSegment(-1);
1756 if (lastMergedSegment >= 0) {
1757 mMergedTracks[lastMergedSegment].SetPrevSegment(iOutputTrack);
1760 mergedTrack.SetPrevSegment(lastMergedSegment);
1762 lastMergedSegment = iOutputTrack;
1765 const float toX = GPUTPCGeometry::Row2X(cl[0].
row);
1766 if (
p2.TransportToX<2>(
this, toX, Param().bzCLight,
b, constants::MAX_SIN_PHI,
false)) {
1768 p1.Y() =
b.Par()[0];
1769 p1.Z() =
b.Par()[1];
1770 p1.SinPhi() =
b.Par()[2];
1775 p1.SinPhi() =
p2.SinPhi();
1777 p1.TOffset() =
p2.TOffset();
1778 p1.DzDs() =
p2.DzDs();
1779 p1.QPt() =
p2.QPt();
1780 mergedTrack.SetAlpha(
p2.Alpha());
1781 if (CAMath::Abs(Param().polynomialField.GetNominalBz()) < (gpu_common_constants::kZeroFieldCut * gpu_common_constants::kCLight)) {
1782 p1.QPt() = 100.f / Param().rec.bz0Pt10MeV;
1793 if (leg == 0 && Param().
rec.tpc.mergeCE) {
1794 auto& cls = mConstantMem->ioPtrs.clustersNative->clustersLinear;
1795 bool CEside = cls[cl[0].
num].getTime() < cls[cl[nHits - 1].
num].getTime();
1796 MergeCEFill(trackParts[CEside ? lastTrackIndex : firstTrackIndex], cl[CEside ? (nHits - 1) : 0], iOutputTrack);
1802GPUd()
void GPUTPCGMMerger::SortTracksPrepare(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1804 for (
uint32_t i = iBlock * nThreads + iThread;
i < mMemory->nMergedTracks;
i += nThreads * nBlocks) {
1805 mTrackOrderProcess[
i] =
i;
1809GPUd()
void GPUTPCGMMerger::PrepareForFit0(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1811 for (
uint32_t i = iBlock * nThreads + iThread;
i < mMemory->nMergedTracks;
i += nBlocks * nThreads) {
1816GPUd()
void GPUTPCGMMerger::SortTracks(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1818#ifndef GPUCA_SPECIALIZE_THRUST_SORTS
1819 if (iThread == 0 && iBlock == 0) {
1820 GPUCommonAlgorithm::sortDeviceDynamic(mTrackOrderProcess, mTrackOrderProcess + mMemory->nMergedTracks,
GPUTPCGMMergerSortTracks_comp(mMergedTracks));
1825GPUd()
void GPUTPCGMMerger::SortTracksQPt(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1827#ifndef GPUCA_SPECIALIZE_THRUST_SORTS
1828 if (iThread == 0 && iBlock == 0) {
1834GPUd()
void GPUTPCGMMerger::PrepareForFit1(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1836 for (
uint32_t i = iBlock * nThreads + iThread;
i < mMemory->nMergedTracks;
i += nBlocks * nThreads) {
1837 mTrackOrderAttach[mTrackSort[
i]] =
i;
1842 if (CAMath::Abs(trk.GetParam().GetQPt() * Param().qptB5Scaler) <= Param().
rec.tpc.rejectQPtB5 && !trk.MergedLooper() && trk.Leg() == 0) {
1845 CAMath::AtomicMax(&mClusterAttachment[mClusters[trk.FirstClusterRef() +
j].num],
weight);
1846 CAMath::AtomicAdd(&mSharedCount[mClusters[trk.FirstClusterRef() +
j].num], 1u);
1848 if (!trk.CCE() && !trk.MergedLooper()) {
1849 GPUTPCGMMergedTrack* updTrk = trk.GetFirstSegment(mMergedTracks, Param().
rec.enableCyclicGraphWorkarounds);
1850 const auto &cl0 = mClusters[trk.FirstClusterRef()], &cln = mClusters[updTrk->FirstClusterRef() + updTrk->NClusters() - 1];
1851 const auto&
GPUrestrict() cls = GetConstantMem()->ioPtrs.clustersNative->clustersLinear;
1853 const auto tmp = zn > z0 ?
std::
array<
float, 3>{zn, z0, GPUTPCGeometry::Row2X(cln.row)} : std::array<float, 3>{z0, zn, GPUTPCGeometry::Row2X(cl0.row)};
1854 trk.Param().ShiftZ(
this, cl0.sector, tmp[0], tmp[1], tmp[2]);
1856 while (updTrk->PrevSegment() >= 0) {
1857 auto next = &mMergedTracks[updTrk->PrevSegment()];
1858 if (Param().
rec.enableCyclicGraphWorkarounds && next == &trk) {
1862 updTrk->Param().TOffset() = trk.Param().TOffset();
1869GPUd()
void GPUTPCGMMerger::PrepareForFit2(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1871 for (
uint32_t i = iBlock * nThreads + iThread;
i < mMemory->nMergedTrackClusters;
i += nBlocks * nThreads) {
1872 if (mSharedCount[mClusters[
i].
num] > 1) {
1876 if (mClusterStateExt) {
1877 for (
uint32_t i = iBlock * nThreads + iThread;
i < mNMaxClusters;
i += nBlocks * nThreads) {
1878 uint8_t state = GetConstantMem()->ioPtrs.clustersNative->clustersLinear[
i].getFlags();
1879 if (mSharedCount[
i] > 1) {
1882 mClusterStateExt[
i] =
state;
1889 for (
uint32_t i = iBlock * nThreads + iThread;
i < mMemory->nMergedTracks;
i += nThreads * nBlocks) {
1890 mTrackSort[mTrackOrderAttach[
i]] =
i;
1892 for (
uint32_t i = iBlock * nThreads + iThread;
i < mMemory->nMergedTrackClusters;
i += nThreads * nBlocks) {
1894 mClusterAttachment[mClusters[
i].num] = 0;
1901 for (
uint32_t i = iBlock * nThreads + iThread;
i < mMemory->nMergedTracks;
i += nThreads * nBlocks) {
1903 if (!trk.OK() || trk.NClusters() == 0) {
1907 int32_t id = mClusters[trk.FirstClusterRef() +
j].num;
1909 uint8_t clusterState = mClusters[trk.FirstClusterRef() +
j].state;
1915 if (trk.Leg() == 0) {
1918 if (CAMath::Abs(trk.GetParam().GetQPt() * Param().qptB5Scaler) <= Param().
rec.tpc.rejectQPtB5 && !trk.MergedLooper() && trk.Leg() == 0) {
1921 CAMath::AtomicMax(&mClusterAttachment[
id],
weight);
1928 for (
uint32_t i = iBlock * nThreads + iThread;
i < mNMaxClusters;
i += nThreads * nBlocks) {
1929 if (mClusterAttachment[
i] != 0) {
1935GPUd()
void GPUTPCGMMerger::MergeLoopersInit(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1937 const float lowPtThresh = Param().rec.tpc.rejectQPtB5 * 1.1f;
1939 const auto& trk = mMergedTracks[
i];
1940 const auto&
p = trk.GetParam();
1941 const float qptabs = CAMath::Abs(
p.GetQPt());
1942 if (trk.OK() && trk.NClusters() && trk.Leg() == 0 && qptabs * Param().qptB5Scaler > 5.f && qptabs * Param().qptB5Scaler <= lowPtThresh) {
1943 const int32_t sector = mClusters[trk.FirstClusterRef() + trk.NClusters() - 1].sector;
1944 const float refz =
p.GetZ() + (Param().par.continuousTracking ? GetConstantMem()->calibObjects.fastTransform->convVertexTimeToZOffset(
sector,
p.GetTOffset(), Param().continuousMaxTimeBin) : 0) + (trk.CSide() ? -100 : 100);
1946 CAMath::SinCos(trk.GetAlpha(), sinA, cosA);
1947 float gx = cosA *
p.GetX() - sinA *
p.GetY();
1948 float gy = cosA *
p.GetY() + sinA *
p.GetX();
1949 float bz = Param().polynomialField.GetFieldBz(gx, gy,
p.GetZ());
1950 const float r1 =
p.GetQPt() *
bz;
1951 const float r = CAMath::Abs(r1) > 0.0001f ? (1.f / r1) : 10000;
1952 const float mx =
p.GetX() +
r *
p.GetSinPhi();
1953 const float my =
p.GetY() -
r * CAMath::Sqrt(1 -
p.GetSinPhi() *
p.GetSinPhi());
1954 const float gmx = cosA * mx - sinA * my;
1955 const float gmy = cosA * my + sinA * mx;
1956 uint32_t myId = CAMath::AtomicAdd(&mMemory->nLooperMatchCandidates, 1u);
1957 if (myId >= mNMaxLooperMatches) {
1958 raiseError(GPUErrors::ERROR_LOOPER_MATCH_OVERFLOW, myId, mNMaxLooperMatches);
1959 CAMath::AtomicExch(&mMemory->nLooperMatchCandidates, mNMaxLooperMatches);
1980GPUd()
void GPUTPCGMMerger::MergeLoopersSort(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1982#ifndef GPUCA_SPECIALIZE_THRUST_SORTS
1983 if (iThread == 0 && iBlock == 0) {
1989GPUd()
void GPUTPCGMMerger::MergeLoopersMain(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread)
1993#if GPUCA_MERGE_LOOPER_MC && !defined(GPUCA_GPUCODE)
1994 std::vector<int64_t> paramLabels(mMemory->nLooperMatchCandidates);
1995 for (
uint32_t i = 0;
i < mMemory->nLooperMatchCandidates;
i++) {
1996 paramLabels[
i] = GetTrackLabel(mMergedTracks[candidates[
i].
id]);
2002 if (!mRec->GetProcessingSettings().runQA) {
2003 throw std::runtime_error(
"Need QA enabled for the Merge Loopers MC QA");
2008 for (
uint32_t j =
i + 1;
j < mMemory->nLooperMatchCandidates;
j++) {
2010 assert(CAMath::Abs(candidates[
i].refz) <= CAMath::Abs(candidates[
j].refz));
2011 if (CAMath::Abs(candidates[
j].refz) > CAMath::Abs(candidates[
i].refz) + 100.f) {
2014 const float d2xy = CAMath::Sum2(candidates[
i].
x - candidates[
j].
x, candidates[
i].
y - candidates[
j].
y);
2021 float refZI = candidates[
i].refz;
2023 const auto* tmp = trkI->GetFirstSegment(mMergedTracks, Param().
rec.enableCyclicGraphWorkarounds);
2024 if (tmp != trkI && tmp->CSide() == trkI->CSide() && CAMath::Abs(tmp->GetParam().GetZ()) > CAMath::Abs(trkI->GetParam().GetZ())) {
2025 float tmpRefZ = refZI + tmp->GetParam().GetZ() - trkI->GetParam().GetZ();
2026 if (CAMath::Abs(tmpRefZ) < CAMath::Abs(candidates[
j].refz) && CAMath::Abs(tmpRefZ) > CAMath::Abs(refZI)) {
2032 const auto& trk1 = *trkI;
2033 const auto& trk2 = mMergedTracks[candidates[
j].id];
2034 const auto& param1 = trk1.GetParam();
2035 const auto& param2 = trk2.GetParam();
2036 if (CAMath::Abs(param1.GetDzDs()) > 0.03f && CAMath::Abs(param2.GetDzDs()) > 0.03f && param1.GetDzDs() * param2.GetDzDs() * param1.GetQPt() * param2.GetQPt() < 0) {
2041 const float dznormalized = (CAMath::Abs(candidates[
j].refz) - CAMath::Abs(refZI)) / (CAMath::TwoPi() * 0.5f * (CAMath::Abs(param1.GetDzDs()) + CAMath::Abs(param2.GetDzDs())) * 1.f / (0.5f * (CAMath::Abs(param1.GetQPt()) + CAMath::Abs(param2.GetQPt())) * CAMath::Abs(Param().polynomialField.GetNominalBz())));
2042 const float phasecorr = CAMath::Modf((CAMath::ASin(param1.GetSinPhi()) + trk1.GetAlpha() - CAMath::ASin(param2.GetSinPhi()) - trk2.GetAlpha()) / CAMath::TwoPi() + 5.5f, 1.f) - 0.5f;
2043 const float phasecorrdirection = (candidates[
j].refz * param1.GetQPt() * param1.GetDzDs()) > 0 ? 1 : -1;
2044 const float dzcorr = dznormalized + phasecorr * phasecorrdirection;
2045 const bool sameside = !(trk1.CSide() ^ trk2.CSide());
2046 const float dzcorrlimit[4] = {sameside ? 0.018f : 0.012f, sameside ? 0.12f : 0.025f, 0.14f, 0.15f};
2047 const int32_t dzcorrcount = sameside ? 4 : 2;
2048 bool dzcorrok =
false;
2050 for (int32_t k = 0; k < dzcorrcount; k++) {
2051 const float d = CAMath::Abs(dzcorr - 0.5f * k);
2052 if (
d <= dzcorrlimit[k]) {
2054 dznorm =
d / dzcorrlimit[k];
2063 const float dtgl = param1.GetDzDs() - (param1.GetQPt() * param2.GetQPt() > 0 ? param2.GetDzDs() : -param2.GetDzDs());
2064 const float dqpt = (CAMath::Abs(param1.GetQPt()) - CAMath::Abs(param2.GetQPt())) / CAMath::Min(param1.GetQPt(), param2.GetQPt());
2065 float d = CAMath::Sum2(dtgl * (1.f / 0.03f), dqpt * (1.f / 0.04f)) + d2xy * (1.f / 4.f) + dznorm * (1.f / 0.3f);
2067#if GPUCA_MERGE_LOOPER_MC && !defined(GPUCA_GPUCODE)
2068 const int64_t label1 = paramLabels[
i];
2069 const int64_t label2 = paramLabels[
j];
2070 bool labelEQ = label1 != -1 && label1 == label2;
2071 if (1 || EQ || labelEQ) {
2073 static auto& tup =
GPUROOTDump<TNtuple>::get(
"mergeloopers",
"labeleq:sides:d2xy:tgl1:tgl2:qpt1:qpt2:dz:dzcorr:dtgl:dqpt:dznorm:bs");
2074 tup.Fill((
float)labelEQ, (trk1.CSide() ? 1 : 0) | (trk2.CSide() ? 2 : 0), d2xy, param1.GetDzDs(), param2.GetDzDs(), param1.GetQPt(), param2.GetQPt(),
CAMath::
Abs(candidates[
j].refz) -
CAMath::
Abs(refZI), dzcorr, dtgl, dqpt, dznorm, bs);
2075 static auto tup2 =
GPUROOTDump<TNtuple>::getNew(
"mergeloopers2",
"labeleq:refz1:refz2:tgl1:tgl2:qpt1:qpt2:snp1:snp2:a1:a2:dzn:phasecor:phasedir:dzcorr");
2076 tup2.Fill((
float)labelEQ, refZI, candidates[
j].refz, param1.GetDzDs(), param2.GetDzDs(), param1.GetQPt(), param2.GetQPt(), param1.GetSinPhi(), param2.GetSinPhi(), trk1.GetAlpha(), trk2.GetAlpha(), dznormalized, phasecorr, phasecorrdirection, dzcorr);
2090 mMergedTracks[candidates[
j].id].SetMergedLooperUnconnected(
true);
2091 if (CAMath::Abs(param2.GetQPt() * Param().qptB5Scaler) >= Param().
rec.tpc.rejectQPtB5) {
2092 mMergedTracks[candidates[
i].id].SetMergedLooperUnconnected(
true);
Class of a TPC cluster in TPC-native coordinates (row, time)
A const (ready only) version of MCTruthContainer.
#define get_global_size(dim)
#define get_global_id(dim)
#define GPUCA_DEBUG_STREAMER_CHECK(...)
#define GPUCA_DETERMINISTIC_CODE(det, indet)
#define CADEBUG2(cmd,...)
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
const GPUTPCGMMerger::trackCluster *const mCmp
constexpr int p1()
constexpr to accelerate the coordinates changing
std::vector< int > clusterIndices
std::vector< o2::its::TrackITS > tracks
Class for time synchronization of RawReader instances.
static void computePointerWithAlignment(T *&basePtr, S *&objPtr, size_t nEntries=1)
void AllocateAndInitializeLate()
RecoStepField GetRecoStepsGPU() const
int16_t RegisterMemoryAllocation(T *proc, void *(T::*setPtr)(void *), int32_t type, const char *name="", const GPUMemoryReuse &re=GPUMemoryReuse())
RecoStepField GetRecoSteps() const
const GPUParam & GetParam() const
const GPUConstantMem & GetConstantMem() const
GPUMemorySizeScalers * MemoryScalers()
const GPUSettingsProcessing & GetProcessingSettings() const
virtual const GPUDefParameters & getGPUParameters(bool doGPU) const =0
void * SetPointersRefitScratch(void *mem)
void CheckCollectedTracks()
void RegisterMemoryAllocation()
void * SetPointersMemory(void *mem)
void * SetPointersOutput(void *mem)
void InitializeProcessor()
void * SetPointersOutputO2MC(void *mem)
void * SetPointersOutputO2Scratch(void *mem)
void * SetPointersMerger(void *mem)
void * SetPointersOutputO2Clus(void *mem)
void * SetPointersOutputState(void *mem)
void SetMaxData(const GPUTrackingInOutPointers &io)
void * SetPointersOutputO2(void *mem)
int32_t int32_t int32_t bool float float Z
int32_t int32_t int32_t bool float Y
GLint GLint GLsizei GLint border
GLfloat GLfloat GLfloat alpha
GLuint GLuint GLfloat weight
GLboolean GLboolean GLboolean b
GLuint GLsizei GLsizei * length
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLboolean GLboolean GLboolean GLboolean a
GLdouble GLdouble GLdouble z
GPUd() const expr uint32_t MultivariatePolynomialHelper< Dim
const bool const int TrackITSInternal< NLayers > & track
o2::track::TrackParametrization< float > par
const float const float const float bz
if(!okForPhiMin(phi0, phi1))
Global TPC definitions and constants.
@ streamMergeBorderTracksBest
stream MergeBorderTracks best track
@ streamMergeBorderTracksAll
stream MergeBorderTracks all tracks
std::string getTime(uint64_t ts)
GPUTPCTracker tpcTrackers[GPUTPCGeometry::NSECTORS]
size_t NTPCMergedTracks(size_t tpcSectorTracks)
size_t NTPCMergedTrackHits(size_t tpcSectorTrackHitss)
size_t getValue(size_t maxVal, size_t val)
@ clustererAndSharedFlags
const o2::tpc::ClusterNativeAccess * clustersNative
const GPUTPCGMMergedTrack & GPUrestrict() b
GPUd() bool operator()(const int32_t aa
const GPUTPCGMMergedTrack *const mCmp
GPUhd() GPUTPCGMMergerSortTracksQPt_comp(GPUTPCGMMergedTrack *cmp)
const GPUTPCGMMergedTrack & GPUrestrict() b
GPUhd() GPUTPCGMMergerSortTracks_comp(GPUTPCGMMergedTrack *cmp)
GPUd() bool operator()(const int32_t aa
const GPUTPCGMMergedTrack *const mCmp
unsigned int nClustersTotal
char const *restrict const cmp