@@ -97,7 +97,7 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
9797 CADEBUG (printf (" Fitting track %d way %d (sector %d, alpha %f) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n " , iTrk, iWay, CAMath::Float2IntRn (prop.GetAlpha () / GPUTPCGeometry::kSectAngle ()) + (mP [1 ] < 0 ? 18 : 0 ), prop.GetAlpha ()));
9898
9999 N = 0 ;
100- uint8_t lastUpdateRow = 255 , lastPropagateRow = 255 , lastUpdateSector = 255 ;
100+ uint8_t lastUpdateRow = 255 , lastPropagateRow = 255 , lastSector = 255 ;
101101 float lastUpdateX = -1 ;
102102 const bool inFlyDirection = iWay & 1 ;
103103 const int32_t wayDirection = (iWay & 1 ) ? -1 : 1 ;
@@ -133,7 +133,7 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
133133 uint8_t dEdxSubThresholdRow = 255 ;
134134 bool doInterpolate = param.rec .tpc .rebuildTrackInFit && (iWay == nWays - 3 || iWay == nWays - 2 );
135135 if (lastPropagateRow != 255 && CAMath::Abs (cluster.row - lastPropagateRow) > 1 ) {
136- bool dodEdx = param.dodEdxEnabled && param.rec .tpc .adddEdxSubThresholdClusters && finalFit && CAMath::Abs (cluster.row - lastUpdateRow) == 2 && cluster.sector == lastUpdateSector && currentClusterStatus == 0 ;
136+ bool dodEdx = param.dodEdxEnabled && param.rec .tpc .adddEdxSubThresholdClusters && finalFit && CAMath::Abs (cluster.row - lastUpdateRow) == 2 && cluster.sector == lastSector && currentClusterStatus == 0 ;
137137 bool doAttach = allowChangeClusters && !param.rec .tpc .rebuildTrackInFit && !(merger.Param ().rec .tpc .disableRefitAttachment & 2 );
138138 if (dodEdx || doAttach || doInterpolate) {
139139 int32_t step = cluster.row > lastPropagateRow ? 1 : -1 ;
@@ -177,9 +177,6 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
177177 break ;
178178 }
179179 auto & inter = interpolation.hit [interpolationIndex];
180- if (param.rec .tpc .mergerInterpolateErrors && iWay == nWays - 3 ) {
181- prop.InterpolateFill (&inter);
182- }
183180
184181 float uncorrectedY = -1e6f;
185182 if (param.rec .tpc .rebuildTrackInFit ) {
@@ -196,14 +193,20 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
196193 merger.GetConstantMem ()->calibObjects .fastTransform ->InverseTransformYZtoNominalYZ (cluster.sector , cluster.row , mP [0 ], mP [1 ], uncorrectedY, tmpZ);
197194 }
198195
196+ HandleCrossCE (param, cluster.sector , lastSector);
197+ lastSector = cluster.sector ;
198+
199+ if (param.rec .tpc .mergerInterpolateErrors && iWay == nWays - 3 ) {
200+ prop.InterpolateFill (&inter);
201+ }
202+
199203 if (currentClusterStatus) {
200204 nMissed++;
201205 nMissed2++;
202206 continue ;
203207 }
204208
205- const bool crossCE = lastUpdateSector != 255 && ((lastUpdateSector < 18 ) ^ (clusters[ihit].sector < 18 ));
206- int32_t retValHit = FitHit (merger, iTrk, track, xx, yy, zz, clusterState, clAlpha, iWay, inFlyDirection, crossCE, deltaZ, lastUpdateX, clusters, prop, inter, dEdx, dEdxAlt, sumInvSqrtCharge, nAvgCharge, ihit, ihitMergeFirst, allowChangeClusters, refit, finalFit, nMissed, nMissed2, resetT0, uncorrectedY);
209+ int32_t retValHit = FitHit (merger, iTrk, track, xx, yy, zz, clusterState, clAlpha, iWay, inFlyDirection, deltaZ, lastUpdateX, clusters, prop, inter, dEdx, dEdxAlt, sumInvSqrtCharge, nAvgCharge, ihit, ihitMergeFirst, allowChangeClusters, refit, finalFit, nMissed, nMissed2, resetT0, uncorrectedY);
207210 if (retValHit == 0 ) {
208211 DodEdx (dEdx, dEdxAlt, merger, finalFit, ihit, ihitMergeFirst, wayDirection, clusters, clusterState, zz, dEdxSubThresholdRow);
209212 ihitStart = ihit;
@@ -218,11 +221,10 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
218221 }
219222
220223 lastUpdateRow = cluster.row ;
221- lastUpdateSector = cluster.sector ;
222224 assert (!param.rec .tpc .mergerInterpolateErrors || rebuilt || iWay != nWays - 2 || ihit || interpolationIndex == 0 );
223225 }
224226 if (finalOutInFit && !(param.rec .tpc .disableRefitAttachment & 4 ) && lastUpdateRow != 255 ) {
225- StoreLoopPropagation (merger, lastUpdateSector , lastUpdateRow, iTrk, lastUpdateRow > clusters[(iWay & 1 ) ? (maxN - 1 ) : 0 ].row , prop.GetAlpha ());
227+ StoreLoopPropagation (merger, lastSector , lastUpdateRow, iTrk, lastUpdateRow > clusters[(iWay & 1 ) ? (maxN - 1 ) : 0 ].row , prop.GetAlpha ());
226228 CADEBUG (printf (" \t\t STORING %d lastUpdateRow %d row %d out %d\n " , iTrk, (int )lastUpdateRow, (int )clusters[(iWay & 1 ) ? (maxN - 1 ) : 0 ].row , lastUpdateRow > clusters[(iWay & 1 ) ? (maxN - 1 ) : 0 ].row ));
227229 }
228230 if (!(iWay & 1 ) && !finalFit && !track.CCE () && !track.Looper ()) {
@@ -286,7 +288,23 @@ GPUdii() void GPUTPCGMTrackParam::FitAddRow(const int32_t iRow, const uint8_t se
286288 }
287289}
288290
289- GPUdii () int32_t GPUTPCGMTrackParam::FitHit(GPUTPCGMMerger& GPUrestrict () merger, const int32_t iTrk, const GPUTPCGMMergedTrack& GPUrestrict() track, const float xx, const float yy, const float zz, const uint8_t clusterState, const float clAlpha, const int32_t iWay, const bool inFlyDirection, const bool crossCE, float& GPUrestrict() deltaZ, float& GPUrestrict() lastUpdateX, GPUTPCGMMergedTrackHit* GPUrestrict() clusters, GPUTPCGMPropagator& GPUrestrict() prop, gputpcgmmergertypes::InterpolationErrorHit& GPUrestrict() inter, GPUdEdx& GPUrestrict() dEdx, GPUdEdx& GPUrestrict() dEdxAlt, float& GPUrestrict() sumInvSqrtCharge, int32_t& GPUrestrict() nAvgCharge, const int32_t ihit, const int32_t ihitMergeFirst, const bool allowChangeClusters, const bool refit, const bool finalFit, int32_t& GPUrestrict() nMissed, int32_t& GPUrestrict() nMissed2, int32_t& GPUrestrict() resetT0, float uncorrectedY)
291+ GPUdii () void GPUTPCGMTrackParam::HandleCrossCE(const GPUParam& GPUrestrict () param, const uint8_t sector, const uint8_t& lastSector)
292+ {
293+ const bool crossCE = lastSector != 255 && ((lastSector < 18 ) ^ (sector < 18 ));
294+ if (crossCE) {
295+ if (param.rec .tpc .addErrorsCECrossing ) {
296+ if (param.rec .tpc .addErrorsCECrossing >= 2 ) {
297+ AddCovDiagErrorsWithCorrelations (param.rec .tpc .errorsCECrossing );
298+ } else {
299+ AddCovDiagErrors (param.rec .tpc .errorsCECrossing );
300+ }
301+ } else if (mC [2 ] < 0 .5f ) {
302+ mC [2 ] = 0 .5f ;
303+ }
304+ }
305+ }
306+
307+ GPUdii () int32_t GPUTPCGMTrackParam::FitHit(GPUTPCGMMerger& GPUrestrict () merger, const int32_t iTrk, const GPUTPCGMMergedTrack& GPUrestrict() track, const float xx, const float yy, const float zz, const uint8_t clusterState, const float clAlpha, const int32_t iWay, const bool inFlyDirection, float& GPUrestrict() deltaZ, float& GPUrestrict() lastUpdateX, GPUTPCGMMergedTrackHit* GPUrestrict() clusters, GPUTPCGMPropagator& GPUrestrict() prop, gputpcgmmergertypes::InterpolationErrorHit& GPUrestrict() inter, GPUdEdx& GPUrestrict() dEdx, GPUdEdx& GPUrestrict() dEdxAlt, float& GPUrestrict() sumInvSqrtCharge, int32_t& GPUrestrict() nAvgCharge, const int32_t ihit, const int32_t ihitMergeFirst, const bool allowChangeClusters, const bool refit, const bool finalFit, int32_t& GPUrestrict() nMissed, int32_t& GPUrestrict() nMissed2, int32_t& GPUrestrict() resetT0, float uncorrectedY)
290308{
291309 const GPUParam& GPUrestrict () param = merger.Param ();
292310 const int32_t nWays = param.rec .tpc .nWays ;
@@ -301,18 +319,6 @@ GPUdii() int32_t GPUTPCGMTrackParam::FitHit(GPUTPCGMMerger& GPUrestrict() merger
301319 return 2 ; // Propagate failed or high incl angle
302320 }
303321
304- if (crossCE) {
305- if (param.rec .tpc .addErrorsCECrossing ) {
306- if (param.rec .tpc .addErrorsCECrossing >= 2 ) {
307- AddCovDiagErrorsWithCorrelations (param.rec .tpc .errorsCECrossing );
308- } else {
309- AddCovDiagErrors (param.rec .tpc .errorsCECrossing );
310- }
311- } else if (mC [2 ] < 0 .5f ) {
312- mC [2 ] = 0 .5f ;
313- }
314- }
315-
316322 int32_t retValUpd = 0 , retValInt = 0 ;
317323 float threshold = 3 .f + (lastUpdateX >= 0 ? (CAMath::Abs (mX - lastUpdateX) / 2 ) : 0 .f );
318324 if (mNDF > (int32_t )param.rec .tpc .mergerNonInterpolateRejectMinNDF && (CAMath::Abs (yy - mP [0 ]) > threshold || CAMath::Abs (zz - mP [1 ]) > threshold)) {
0 commit comments