Skip to content

Commit 9d8221d

Browse files
committed
GPU TPC: Adjust tagging of adjacent looper clusters to segmented looping tracks
1 parent f09d8f6 commit 9d8221d

File tree

3 files changed

+64
-101
lines changed

3 files changed

+64
-101
lines changed

GPU/GPUTracking/Merger/GPUTPCGMMergerGPU.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ template <>
3232
GPUdii() void GPUTPCGMMergerFollowLoopers::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
3333
{
3434
GPUCA_TBB_KERNEL_LOOP(merger.GetRec(), uint32_t, i, merger.Memory()->nLoopData, {
35-
GPUTPCGMTrackParam::RefitLoop(&merger, i);
35+
GPUTPCGMTrackParam::PropagateLooper(&merger, i);
3636
});
3737
}
3838

GPU/GPUTracking/Merger/GPUTPCGMTrackParam.cxx

Lines changed: 58 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
8585
float sumInvSqrtCharge = 0.f;
8686
int32_t nAvgCharge = 0;
8787

88-
if (iWay) {
89-
if (iWay && ((nWays - iWay) & 1) == 1) {
90-
StoreOuter(&track.OuterParam(), prop.GetAlpha());
91-
}
88+
if (iWay && ((nWays - iWay) & 1) == 1) {
89+
StoreOuter(&track.OuterParam(), prop.GetAlpha());
9290
}
9391

9492
int32_t resetT0 = initResetT0();
@@ -106,16 +104,14 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
106104

107105
N = 0;
108106
lastUpdateX = -1;
109-
const bool inFlyDirection = (track.Leg() & 1);
107+
const bool inFlyDirection = !((iWay ^ nWays) & 1);
110108
const int32_t wayDirection = (iWay & 1) ? -1 : 1;
111109

112-
bool noFollowCircle = false, noFollowCircle2 = false;
113110
int32_t goodRows = 0;
114111
for (int32_t ihit = ihitStart; ihit >= 0 && ihit < maxN; ihit += wayDirection) {
115112
const bool crossCE = lastSector != 255 && ((lastSector < 18) ^ (clusters[ihit].sector < 18));
116113
if (crossCE) {
117114
lastSector = clusters[ihit].sector;
118-
noFollowCircle2 = true;
119115
}
120116

121117
if ((param.rec.tpc.trackFitRejectMode > 0 && nMissed >= param.rec.tpc.trackFitRejectMode) || nMissed2 >= param.rec.tpc.trackFitMaxRowMissedHard || clusters[ihit].state & GPUTPCGMMergedTrackHit::flagReject) {
@@ -160,14 +156,7 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
160156
// clang-format off
161157
CADEBUG(printf("\tSector %2d %4sTrack Alpha %8.3f %s, X %8.3f - Y %8.3f, Z %8.3f - QPt %7.2f (%7.2f), SP %5.2f (%5.2f) %28s --- Cov sY %8.3f sZ %8.3f sSP %8.3f sPt %8.3f - YPt %8.3f\n", (int32_t)cluster.sector, "", prop.GetAlpha(), (CAMath::Abs(prop.GetAlpha() - clAlpha) < 0.01 ? " " : " R!"), mX, mP[0], mP[1], mP[4], prop.GetQPt0(), mP[2], prop.GetSinPhi0(), "", sqrtf(mC[0]), sqrtf(mC[2]), sqrtf(mC[5]), sqrtf(mC[14]), mC[10]));
162158
// clang-format on
163-
if (allowModification && false /*changeDirection*/ && !noFollowCircle && !noFollowCircle2) {
164-
if (lastRow != 255) {
165-
if (!(merger->Param().rec.tpc.disableRefitAttachment & 4)) {
166-
StoreAttachMirror(merger, lastSector, lastRow, iTrk, clAlpha, yy, xx, cluster.sector, cluster.row, inFlyDirection, prop.GetAlpha());
167-
noFollowCircle = true;
168-
}
169-
}
170-
} else if (allowModification && lastRow != 255 && CAMath::Abs(cluster.row - lastRow) > 1) {
159+
if (allowModification && lastRow != 255 && CAMath::Abs(cluster.row - lastRow) > 1) {
171160
if GPUCA_RTC_CONSTEXPR (GPUCA_GET_CONSTEXPR(param.par, dodEdx)) {
172161
bool dodEdx = param.dodEdxEnabled && param.rec.tpc.adddEdxSubThresholdClusters && iWay == nWays - 1 && CAMath::Abs(cluster.row - lastRow) == 2;
173162
dodEdx = AttachClustersPropagate(merger, cluster.sector, lastRow, cluster.row, iTrk, track.Leg() == 0, prop, inFlyDirection, GPUCA_MAX_SIN_PHI, dodEdx);
@@ -180,23 +169,23 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
180169
}
181170
}
182171

183-
int32_t err = prop.PropagateToXAlpha(xx, clAlpha, inFlyDirection);
172+
int32_t retValProp = prop.PropagateToXAlpha(xx, clAlpha, inFlyDirection);
184173
// clang-format off
185174
CADEBUG(if (!CheckCov()){printf("INVALID COV AFTER PROPAGATE!!!\n");});
186175
// clang-format on
187-
if (err == -2) // Rotation failed, try to bring to new x with old alpha first, rotate, and then propagate to x, alpha
176+
if (retValProp == -2) // Rotation failed, try to bring to new x with old alpha first, rotate, and then propagate to x, alpha
188177
{
189178
CADEBUG(printf("REROTATE\n"));
190179
if (prop.PropagateToXAlpha(xx, prop.GetAlpha(), inFlyDirection) == 0) {
191-
err = prop.PropagateToXAlpha(xx, clAlpha, inFlyDirection);
180+
retValProp = prop.PropagateToXAlpha(xx, clAlpha, inFlyDirection);
192181
}
193182
}
194183
if (lastRow == 255 || CAMath::Abs((int32_t)lastRow - (int32_t)cluster.row) > 5 || lastSector != cluster.sector || (param.rec.tpc.trackFitRejectMode < 0 && -nMissed <= param.rec.tpc.trackFitRejectMode)) {
195184
goodRows = 0;
196185
} else {
197186
goodRows++;
198187
}
199-
if (err == 0) {
188+
if (retValProp == 0) {
200189
lastRow = cluster.row;
201190
lastSector = cluster.sector;
202191
}
@@ -216,51 +205,28 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
216205
}
217206
}
218207

219-
if (err == 0 && false /*changeDirection*/) {
220-
const float mirrordY = prop.GetMirroredYTrack();
221-
CADEBUG(printf(" -- MirroredY: %f --> %f", mP[0], mirrordY));
222-
if (CAMath::Abs(yy - mP[0]) > CAMath::Abs(yy - mirrordY)) {
223-
CADEBUG(printf(" - Mirroring!!!"));
224-
if (allowModification && !(merger->Param().rec.tpc.disableRefitAttachment & 8)) {
225-
StoreAttachMirror(merger, cluster.sector, cluster.row, iTrk, 0, yy, 0, -1, 0, 0, prop.GetAlpha());
226-
}
227-
MirrorTo(prop, yy, zz, inFlyDirection, param, cluster.row, clusterState, true, cluster.sector);
228-
noFollowCircle = false;
229-
230-
lastUpdateX = mX;
231-
lastRow = 255;
232-
N++;
233-
resetT0 = initResetT0();
234-
// clang-format off
235-
CADEBUG(printf("\n"));
236-
CADEBUG(printf("\t%21sMirror Alpha %8.3f , X %8.3f - Y %8.3f, Z %8.3f - QPt %7.2f (%7.2f), SP %5.2f (%5.2f) %28s --- Cov sY %8.3f sZ %8.3f sSP %8.3f sPt %8.3f - YPt %8.3f\n", "", prop.GetAlpha(), mX, mP[0], mP[1], mP[4], prop.GetQPt0(), mP[2], prop.GetSinPhi0(), "", sqrtf(mC[0]), sqrtf(mC[2]), sqrtf(mC[5]), sqrtf(mC[14]), mC[10]));
237-
// clang-format on
238-
continue;
239-
}
240-
}
241-
242208
float uncorrectedY = -1e6f;
243209
if (allowModification) {
244210
uncorrectedY = AttachClusters(merger, cluster.sector, cluster.row, iTrk, track.Leg() == 0, prop);
245211
}
246212

247-
const int32_t err2 = mNDF > 0 && CAMath::Abs(prop.GetSinPhi0()) >= maxSinForUpdate;
248-
if (err || err2) {
213+
const bool sinPhiErr = mNDF > 0 && CAMath::Abs(prop.GetSinPhi0()) >= maxSinForUpdate;
214+
if (retValProp || sinPhiErr) {
249215
if (mC[0] > param.rec.tpc.trackFitCovLimit || mC[2] > param.rec.tpc.trackFitCovLimit) {
250216
break;
251217
}
252218
MarkClusters(clusters, ihitMergeFirst, ihit, wayDirection, GPUTPCGMMergedTrackHit::flagHighIncl);
253219
nMissed2++;
254220
NTolerated++;
255-
CADEBUG(printf(" --- break (%d, %d)\n", err, err2));
221+
CADEBUG(printf(" --- break (%d, %d)\n", retValProp, (int32_t)sinPhiErr));
256222
continue;
257223
}
258224
CADEBUG(printf("\n"));
259225

260-
int32_t retVal;
226+
int32_t retValUpd;
261227
float threshold = 3.f + (lastUpdateX >= 0 ? (CAMath::Abs(mX - lastUpdateX) / 2) : 0.f);
262228
if (mNDF > 5 && (CAMath::Abs(yy - mP[0]) > threshold || CAMath::Abs(zz - mP[1]) > threshold)) {
263-
retVal = GPUTPCGMPropagator::updateErrorClusterRejectedDistance;
229+
retValUpd = GPUTPCGMPropagator::updateErrorClusterRejectedDistance;
264230
} else {
265231
int8_t rejectChi2 = attempt ? 0 : ((param.rec.tpc.mergerInterpolateErrors && CAMath::Abs(ihit - ihitMergeFirst) <= 1) ? (refit ? (GPUTPCGMPropagator::rejectInterFill + ((nWays - iWay) & 1)) : 0) : (allowModification && goodRows > 5));
266232
#if EXTRACT_RESIDUALS == 1
@@ -284,28 +250,27 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
284250
#endif
285251
GPUCA_DEBUG_STREAMER_CHECK(GPUTPCGMPropagator::DebugStreamerVals debugVals;);
286252
if (param.rec.tpc.rejectEdgeClustersInTrackFit && uncorrectedY > -1e6f && param.rejectEdgeClusterByY(uncorrectedY, cluster.row, CAMath::Sqrt(mC[0]))) { // uncorrectedY > -1e6f implies allowModification
287-
retVal = GPUTPCGMPropagator::updateErrorClusterRejectedEdge;
253+
retValUpd = GPUTPCGMPropagator::updateErrorClusterRejectedEdge;
288254
} else {
289255
const float time = merger->GetConstantMem()->ioPtrs.clustersNative ? merger->GetConstantMem()->ioPtrs.clustersNative->clustersLinear[cluster.num].getTime() : -1.f;
290256
const float invSqrtCharge = merger->GetConstantMem()->ioPtrs.clustersNative ? CAMath::InvSqrt(merger->GetConstantMem()->ioPtrs.clustersNative->clustersLinear[cluster.num].qMax) : 0.f;
291257
const float invCharge = merger->GetConstantMem()->ioPtrs.clustersNative ? (1.f / merger->GetConstantMem()->ioPtrs.clustersNative->clustersLinear[cluster.num].qMax) : 0.f;
292258
float invAvgCharge = (sumInvSqrtCharge += invSqrtCharge) / ++nAvgCharge;
293259
invAvgCharge *= invAvgCharge;
294-
retVal = prop.Update(yy, zz, cluster.row, param, clusterState, rejectChi2, &interpolation.hit[ihit], refit, cluster.sector, time, invAvgCharge, invCharge GPUCA_DEBUG_STREAMER_CHECK(, &debugVals));
260+
retValUpd = prop.Update(yy, zz, cluster.row, param, clusterState, rejectChi2, &interpolation.hit[ihit], refit, cluster.sector, time, invAvgCharge, invCharge GPUCA_DEBUG_STREAMER_CHECK(, &debugVals));
295261
}
296262
GPUCA_DEBUG_STREAMER_CHECK(if (o2::utils::DebugStreamer::checkStream(o2::utils::StreamFlags::streamUpdateTrack, iTrk)) {
297-
merger->DebugStreamerUpdate(iTrk, ihit, xx, yy, zz, cluster, merger->GetConstantMem()->ioPtrs.clustersNative->clustersLinear[cluster.num], *this, prop, interpolation.hit[ihit], rejectChi2, refit, retVal, sumInvSqrtCharge / nAvgCharge * sumInvSqrtCharge / nAvgCharge, yy, zz, clusterState, debugVals.retVal, debugVals.err2Y, debugVals.err2Z);
263+
merger->DebugStreamerUpdate(iTrk, ihit, xx, yy, zz, cluster, merger->GetConstantMem()->ioPtrs.clustersNative->clustersLinear[cluster.num], *this, prop, interpolation.hit[ihit], rejectChi2, refit, retValUpd, sumInvSqrtCharge / nAvgCharge * sumInvSqrtCharge / nAvgCharge, yy, zz, clusterState, debugVals.retVal, debugVals.err2Y, debugVals.err2Z);
298264
});
299265
}
300266
// clang-format off
301267
CADEBUG(if (!CheckCov()) GPUError("INVALID COV AFTER UPDATE!!!"));
302-
CADEBUG(printf("\t%21sFit Alpha %8.3f , X %8.3f - Y %8.3f, Z %8.3f - QPt %7.2f (%7.2f), SP %5.2f (%5.2f), DzDs %5.2f %16s --- Cov sY %8.3f sZ %8.3f sSP %8.3f sPt %8.3f - YPt %8.3f - Err %d\n", "", prop.GetAlpha(), mX, mP[0], mP[1], mP[4], prop.GetQPt0(), mP[2], prop.GetSinPhi0(), mP[3], "", sqrtf(mC[0]), sqrtf(mC[2]), sqrtf(mC[5]), sqrtf(mC[14]), mC[10], retVal));
268+
CADEBUG(printf("\t%21sFit Alpha %8.3f , X %8.3f - Y %8.3f, Z %8.3f - QPt %7.2f (%7.2f), SP %5.2f (%5.2f), DzDs %5.2f %16s --- Cov sY %8.3f sZ %8.3f sSP %8.3f sPt %8.3f - YPt %8.3f - Err %d\n", "", prop.GetAlpha(), mX, mP[0], mP[1], mP[4], prop.GetQPt0(), mP[2], prop.GetSinPhi0(), mP[3], "", sqrtf(mC[0]), sqrtf(mC[2]), sqrtf(mC[5]), sqrtf(mC[14]), mC[10], retValUpd));
303269
// clang-format on
304270

305271
ConstrainSinPhi();
306-
if (retVal == 0) // track is updated
272+
if (retValUpd == 0) // track is updated
307273
{
308-
noFollowCircle2 = false;
309274
lastUpdateX = mX;
310275
covYYUpd = mC[0];
311276
nMissed = nMissed2 = 0;
@@ -346,7 +311,7 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
346311
}
347312
}
348313
}
349-
} else if (retVal >= GPUTPCGMPropagator::updateErrorClusterRejected) { // cluster far away form the track
314+
} else if (retValUpd >= GPUTPCGMPropagator::updateErrorClusterRejected) { // cluster far away form the track
350315
if (allowModification) {
351316
MarkClusters(clusters, ihitMergeFirst, ihit, wayDirection, GPUTPCGMMergedTrackHit::flagRejectDistance);
352317
} else if (iWay == nWays - 1) {
@@ -358,6 +323,9 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
358323
break; // bad chi2 for the whole track, stop the fit
359324
}
360325
}
326+
if (nWays - iWay <= 2 && !(merger->Param().rec.tpc.disableRefitAttachment & 4)) {
327+
StoreLoopPropagation(merger, lastSector, lastRow, iTrk, lastRow > clusters[0].row, prop.GetAlpha());
328+
}
361329
if (((nWays - iWay) & 1) && (iWay != nWays - 1) && !track.CCE() && !track.Looper()) {
362330
ShiftZ(clusters, merger, maxN);
363331
}
@@ -639,8 +607,21 @@ GPUdii() void GPUTPCGMTrackParam::StoreOuter(gputpcgmmergertypes::GPUTPCOuterPar
639607
outerParam->alpha = alpha;
640608
}
641609

642-
GPUdic(0, 1) void GPUTPCGMTrackParam::StoreAttachMirror(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t sector, int32_t iRow, int32_t iTrack, float toAlpha, float toY, float toX, int32_t toSector, int32_t toRow, bool inFlyDirection, float alpha)
610+
GPUdic(0, 1) void GPUTPCGMTrackParam::StoreLoopPropagation(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t sector, int32_t iRow, int32_t iTrack, bool outerParam, float alpha)
643611
{
612+
if (iRow == 0 || iRow == GPUCA_ROW_COUNT - 1) {
613+
return;
614+
}
615+
if (CAMath::Abs(mP[2]) >= GPUCA_MAX_SIN_PHI_LOW) {
616+
return;
617+
}
618+
if (CAMath::Abs(mP[2]) < 0.75) {
619+
return;
620+
}
621+
if ((mP[2] * mP[4] < 0) ^ outerParam) {
622+
return;
623+
}
624+
644625
uint32_t nLoopData = CAMath::AtomicAdd(&Merger->Memory()->nLoopData, 1u);
645626
if (nLoopData >= Merger->NMaxTracks()) {
646627
Merger->raiseError(GPUErrors::ERROR_MERGER_LOOPER_OVERFLOW, nLoopData, Merger->NMaxTracks());
@@ -649,20 +630,15 @@ GPUdic(0, 1) void GPUTPCGMTrackParam::StoreAttachMirror(const GPUTPCGMMerger* GP
649630
}
650631
GPUTPCGMLoopData data;
651632
data.param = *this;
652-
data.alpha = alpha;
653633
data.track = iTrack;
654-
data.toAlpha = toAlpha;
655-
data.toY = toY;
656-
data.toX = toX;
634+
data.alpha = alpha;
657635
data.sector = sector;
658636
data.row = iRow;
659-
data.toSector = toSector;
660-
data.toRow = toRow;
661-
data.inFlyDirection = inFlyDirection;
637+
data.outerParam = outerParam;
662638
Merger->LoopData()[nLoopData] = data;
663639
}
664640

665-
GPUdii() void GPUTPCGMTrackParam::RefitLoop(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t loopIdx)
641+
GPUdii() void GPUTPCGMTrackParam::PropagateLooper(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t loopIdx)
666642
{
667643
GPUTPCGMPropagator prop;
668644
prop.SetMaterialTPC();
@@ -675,11 +651,8 @@ GPUdii() void GPUTPCGMTrackParam::RefitLoop(const GPUTPCGMMerger* GPUrestrict()
675651

676652
GPUTPCGMLoopData& data = Merger->LoopData()[loopIdx];
677653
prop.SetTrack(&data.param, data.alpha);
678-
if (data.toSector == -1) {
679-
data.param.AttachClustersMirror(Merger, data.sector, data.row, data.track, data.toY, prop);
680-
} else {
681-
data.param.FollowCircle(Merger, prop, data.sector, data.row, data.track, data.toAlpha, data.toX, data.toY, data.toSector, data.toRow, data.inFlyDirection);
682-
}
654+
data.param.AttachClustersLooper(Merger, data.sector, data.row, data.track, data.outerParam, prop);
655+
// data.param.FollowCircle(Merger, prop, data.sector, data.row, data.track, data.toAlpha, data.toX, data.toY, data.toSector, data.toRow, data.inFlyDirection);
683656
}
684657

685658
GPUdi() int32_t GPUTPCGMTrackParam::FollowCircle(const GPUTPCGMMerger* GPUrestrict() Merger, GPUTPCGMPropagator& GPUrestrict() prop, int32_t sector, int32_t iRow, int32_t iTrack, float toAlpha, float toX, float toY, int32_t toSector, int32_t toRow, bool inFlyDirection)
@@ -778,38 +751,33 @@ GPUdi() int32_t GPUTPCGMTrackParam::FollowCircle(const GPUTPCGMMerger* GPUrestri
778751
return (0);
779752
}
780753

781-
GPUdi() void GPUTPCGMTrackParam::AttachClustersMirror(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t sector, int32_t iRow, int32_t iTrack, float toY, GPUTPCGMPropagator& GPUrestrict() prop)
754+
GPUdi() void GPUTPCGMTrackParam::AttachClustersLooper(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t sector, int32_t iRow, int32_t iTrack, bool outer, GPUTPCGMPropagator& GPUrestrict() prop)
782755
{
783756
static constexpr float kSectAngle = 2 * M_PI / 18.f;
784757
// Note that the coordinate system is rotated by 90 degree swapping X and Y!
785758
float X = mP[2] > 0 ? mP[0] : -mP[0];
786-
float toX = mP[2] > 0 ? toY : -toY;
787759
float Y = mP[2] > 0 ? -mX : mX;
788760
float Z = mP[1];
789-
if (CAMath::Abs(mP[2]) >= GPUCA_MAX_SIN_PHI_LOW) {
790-
return;
791-
}
792761
float SinPhi = CAMath::Sqrt(1 - mP[2] * mP[2]) * (mP[2] > 0 ? -1 : 1);
793-
if (CAMath::Abs(SinPhi) >= GPUCA_MAX_SIN_PHI_LOW) {
794-
return;
795-
}
796762
float b = prop.GetBz(prop.GetAlpha(), mX, mP[0], mP[1]);
797763

798-
int32_t count = CAMath::Float2IntRn(CAMath::Abs((toX - X) * 2.f));
799-
if (count == 0) {
800-
return;
801-
}
802-
float dx = (toX - X) / count;
764+
float dx = outer ? 1.f : -1.f;
803765
const float myRowX = GPUTPCGeometry::Row2X(iRow);
804-
// printf("AttachMirror\n");
805-
// printf("X %f Y %f Z %f SinPhi %f toY %f -->\n", mX, mP[0], mP[1], mP[2], toY);
806-
// printf("X %f Y %f Z %f SinPhi %f, count %d dx %f (to: %f)\n", X, Y, Z, SinPhi, count, dx, X + count * dx);
807-
while (count--) {
766+
// printf("\nAttachMirror sector %d row %d outer %d\n", (int)sector, (int)iRow, (int)outer);
767+
// printf("X %f Y %f Z %f SinPhi %f -->\n", mX, mP[0], mP[1], mP[2]);
768+
// printf("X %f Y %f Z %f SinPhi %f, dx %f\n", X, Y, Z, SinPhi, dx);
769+
uint32_t maxTries = 100;
770+
while (maxTries--) {
808771
float ex = CAMath::Sqrt(1 - SinPhi * SinPhi);
809772
float exi = 1.f / ex;
810773
float dxBzQ = dx * -b * mP[4];
811774
float newSinPhi = SinPhi + dxBzQ;
812775
if (CAMath::Abs(newSinPhi) > GPUCA_MAX_SIN_PHI_LOW) {
776+
// printf("Abort, newSinPhi %f\n", newSinPhi);
777+
return;
778+
}
779+
if (mP[2] > 0 ? (newSinPhi > 0.5) : (newSinPhi < -0.5)) {
780+
// printf("Finished, newSinPhi %f\n", newSinPhi);
813781
return;
814782
}
815783
float dS = dx * exi;
@@ -821,18 +789,18 @@ GPUdi() void GPUTPCGMTrackParam::AttachClustersMirror(const GPUTPCGMMerger* GPUr
821789
Z += dS * mP[3];
822790
SinPhi = newSinPhi;
823791
if (CAMath::Abs(X) > CAMath::Abs(Y) * CAMath::Tan(kSectAngle / 2.f)) {
824-
continue;
792+
// printf("Abort, sector edge\n");
793+
return;
825794
}
826795

827-
// printf("count %d: At X %f Y %f Z %f SinPhi %f\n", count, mP[2] > 0 ? -Y : Y, mP[2] > 0 ? X : -X, Z, SinPhi);
828-
796+
// printf("count %d: At X %f Y %f Z %f SinPhi %f\n", maxTries, mP[2] > 0 ? -Y : Y, mP[2] > 0 ? X : -X, Z, SinPhi);
829797
float paramX = mP[2] > 0 ? -Y : Y;
830-
int32_t step = paramX >= mX ? 1 : -1;
798+
int32_t step = outer ? 1 : -1;
831799
int32_t found = 0;
832800
for (int32_t j = iRow; j >= 0 && j < GPUCA_ROW_COUNT && found < 3; j += step) {
833801
float rowX = mX + GPUTPCGeometry::Row2X(j) - myRowX;
834802
if (CAMath::Abs(rowX - paramX) < 1.5f) {
835-
// printf("Attempt row %d\n", j);
803+
// printf("Attempt row %d at y %f\n", j, X);
836804
AttachClusters(Merger, sector, j, iTrack, false, mP[2] > 0 ? X : -X, Z);
837805
}
838806
}

0 commit comments

Comments
 (0)