Skip to content

Commit 769933f

Browse files
committed
GPU: Leave tracks where they are if they cannot be transported to the reference X
1 parent e6082ff commit 769933f

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

GPU/GPUTracking/Merger/GPUTPCGMTrackParam.cxx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,25 +341,26 @@ GPUd() bool GPUTPCGMTrackParam::Fit(const GPUTPCGMMerger* GPUrestrict() merger,
341341
return (true);
342342
}
343343

344-
GPUd() void GPUTPCGMTrackParam::MoveToReference(GPUTPCGMPropagator& prop, const GPUParam& param, float& Alpha)
344+
GPUdni() void GPUTPCGMTrackParam::MoveToReference(GPUTPCGMPropagator& prop, const GPUParam& param, float& Alpha)
345345
{
346346
if (param.rec.TrackReferenceX <= 500) {
347-
for (int k = 0; k < 3; k++) // max 3 attempts
348-
{
349-
int err = prop.PropagateToXAlpha(param.rec.TrackReferenceX, Alpha, 0);
350-
ConstrainSinPhi();
351-
if (CAMath::Abs(mP[0]) <= mX * CAMath::Tan(kSectAngle / 2.f)) {
352-
break;
353-
}
347+
GPUTPCGMTrackParam save = *this;
348+
float saveAlpha = Alpha;
349+
for (int attempt = 0; attempt < 3; attempt++) {
354350
float dAngle = floor(CAMath::ATan2(mP[0], mX) / kDeg2Rad / 20.f + 0.5f) * kSectAngle;
355351
Alpha += dAngle;
356-
if (err || k == 2) {
357-
Rotate(dAngle);
358-
ConstrainSinPhi();
352+
if (prop.PropagateToXAlpha(param.rec.TrackReferenceX, Alpha, 0)) {
359353
break;
360354
}
355+
ConstrainSinPhi();
356+
if (CAMath::Abs(mP[0]) <= mX * CAMath::Tan(kSectAngle / 2.f)) {
357+
return;
358+
}
361359
}
362-
} else if (CAMath::Abs(mP[0]) > mX * CAMath::Tan(kSectAngle / 2.f)) {
360+
*this = save;
361+
Alpha = saveAlpha;
362+
}
363+
if (CAMath::Abs(mP[0]) > mX * CAMath::Tan(kSectAngle / 2.f)) {
363364
float dAngle = floor(CAMath::ATan2(mP[0], mX) / kDeg2Rad / 20.f + 0.5f) * kSectAngle;
364365
Rotate(dAngle);
365366
ConstrainSinPhi();

0 commit comments

Comments
 (0)