@@ -81,6 +81,10 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
8181
8282 const int32_t nWays = param.rec .tpc .nWays ;
8383 const int32_t maxN = N;
84+ if (rebuilt && maxN > 0 && param.par .continuousTracking && !track.CCE () && !track.Looper ()) { // The rebuilt track can have other first / last clusters than the track the Z shift was computed for
85+ const float t0 = merger.GetConstantMem ()->ioPtrs .clustersNative ->clustersLinear [clusters[0 ].num ].getTime (), tN = merger.GetConstantMem ()->ioPtrs .clustersNative ->clustersLinear [clusters[maxN - 1 ].num ].getTime ();
86+ ConstrainZ (merger, clusters[0 ].sector , CAMath::Max (t0, tN), CAMath::Min (t0, tN));
87+ }
8488 int32_t ihitStart = 0 ;
8589 int32_t interpolatedStart = 0 ;
8690 float covYYUpd = 0 .f ;
@@ -1327,28 +1331,29 @@ GPUd() float GPUTPCGMTrackParam::ShiftZ(const GPUTPCGMMerger& GPUrestrict() merg
13271331 merger.GetConstantMem ()->calibObjects .fastTransform ->TransformIdealZ (sector, cltmax, basez, mTOffset );
13281332 deltaZ = basez - refZ;
13291333 }
1330- {
1331- float deltaT = merger.GetConstantMem ()->calibObjects .fastTransform ->convDeltaZtoDeltaTimeInTimeFrame (sector, deltaZ);
1334+ mTOffset += merger.GetConstantMem ()->calibObjects .fastTransform ->convDeltaZtoDeltaTimeInTimeFrame (sector, deltaZ);
1335+ return -ConstrainZ (merger, sector, cltmax, cltmin, deltaZ);
1336+ }
1337+
1338+ GPUd () float GPUTPCGMTrackParam::ConstrainZ(const GPUTPCGMMerger& GPUrestrict () merger, uint32_t sector, float cltmax, float cltmin, float deltaZ)
1339+ {
1340+ const float maxT = cltmin - merger.GetConstantMem ()->calibObjects .fastTransform ->getT0 ();
1341+ const float minT = cltmax - merger.GetConstantMem ()->calibObjects .fastTransform ->getMaxDriftTime (sector);
1342+ // printf("T Check: Clusters %f %f, min %f max %f vtx %f\n", tz1, tz2, minT, maxT, mTOffset);
1343+ float deltaT = 0 .f ;
1344+ if (mTOffset < minT) {
1345+ deltaT = minT - mTOffset ;
1346+ }
1347+ if (mTOffset + deltaT > maxT) {
1348+ deltaT = maxT - mTOffset ;
1349+ }
1350+ if (deltaT != 0 .f ) {
1351+ deltaZ += merger.GetConstantMem ()->calibObjects .fastTransform ->convDeltaTimeToDeltaZinTimeFrame (sector, deltaT);
1352+ // printf("Moving clusters to TPC Range: QPt %f, New mTOffset %f, t1 %f, t2 %f, Shift %f in Z: %f to %f --> %f to %f in T\n", mP[4], mTOffset + deltaT, tz1, tz2, deltaZ, tz2 - mTOffset, tz1 - mTOffset, tz2 - mTOffset - deltaT, tz1 - mTOffset - deltaT);
13321353 mTOffset += deltaT;
1333- const float maxT = cltmin - merger.GetConstantMem ()->calibObjects .fastTransform ->getT0 ();
1334- const float minT = cltmax - merger.GetConstantMem ()->calibObjects .fastTransform ->getMaxDriftTime (sector);
1335- // printf("T Check: Clusters %f %f, min %f max %f vtx %f\n", tz1, tz2, minT, maxT, mTOffset);
1336- deltaT = 0 .f ;
1337- if (mTOffset < minT) {
1338- deltaT = minT - mTOffset ;
1339- }
1340- if (mTOffset + deltaT > maxT) {
1341- deltaT = maxT - mTOffset ;
1342- }
1343- if (deltaT != 0 .f ) {
1344- deltaZ += merger.GetConstantMem ()->calibObjects .fastTransform ->convDeltaTimeToDeltaZinTimeFrame (sector, deltaT);
1345- // printf("Moving clusters to TPC Range: QPt %f, New mTOffset %f, t1 %f, t2 %f, Shift %f in Z: %f to %f --> %f to %f in T\n", mP[4], mTOffset + deltaT, tz1, tz2, deltaZ, tz2 - mTOffset, tz1 - mTOffset, tz2 - mTOffset - deltaT, tz1 - mTOffset - deltaT);
1346- mTOffset += deltaT;
1347- }
1348- mP [1 ] -= deltaZ;
13491354 }
1350- // printf("\n") ;
1351- return - deltaZ;
1355+ mP [ 1 ] -= deltaZ ;
1356+ return deltaZ;
13521357}
13531358
13541359GPUd () bool GPUTPCGMTrackParam::CheckCov() const
0 commit comments