diff --git a/GPU/GPUTracking/Merger/GPUTPCGMPropagator.cxx b/GPU/GPUTracking/Merger/GPUTPCGMPropagator.cxx index 1e02c2bc49994..01071ee0e5914 100644 --- a/GPU/GPUTracking/Merger/GPUTPCGMPropagator.cxx +++ b/GPU/GPUTracking/Merger/GPUTPCGMPropagator.cxx @@ -566,15 +566,17 @@ GPUd() int GPUTPCGMPropagator::GetPropagatedYZ(float x, float& GPUrestrict() pro float bz = GetBz(mT->X(), mT->Y(), mT->Z()); float k = mT0.QPt() * bz; float dx = x - mT->X(); - float kdx = k * dx; float ex = mT0.CosPhi(); float ey = mT0.SinPhi(); - float ey1 = kdx + ey; + float ey1 = ey - k * dx; if (CAMath::Abs(ey1) > GPUCA_MAX_SIN_PHI) { return 1; } float ss = ey + ey1; float ex1 = CAMath::Sqrt(1.f - ey1 * ey1); + if (ex < 0) { + ex1 = -ex1; + } float cc = ex + ex1; float dxcci = dx / cc; float dy = dxcci * ss; diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.cxx index 3d3a7302cfe7b..9ffea038d079c 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.cxx @@ -806,15 +806,20 @@ GPUd() int MEM_LG(GPUTPCTrackParam)::GetPropagatedYZ(float bz, float x, float& p { float k = mParam.mP[4] * bz; float dx = x - mParam.mX; - float kdx = k * dx; float ey = mParam.mP[2]; float ex = CAMath::Sqrt(1 - ey * ey); - float ey1 = kdx + ey; + if (SignCosPhi() < 0) { + ex = -ex; + } + float ey1 = ey - k * dx; if (CAMath::Abs(ey1) > GPUCA_MAX_SIN_PHI) { return 0; } float ss = ey + ey1; float ex1 = CAMath::Sqrt(1.f - ey1 * ey1); + if (SignCosPhi() < 0) { + ex1 = -ex1; + } float cc = ex + ex1; float dxcci = dx / cc; float dy = dxcci * ss;