@@ -98,7 +98,7 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
9898 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 ()));
9999
100100 N = 0 ;
101- uint8_t lastUpdateRow = 255 , lastPropagateRow = 255 , lastUpdateSector = 255 ;
101+ uint8_t lastUpdateRow = 255 , lastPropagateRow = 255 , lastSector = 255 ;
102102 float lastUpdateX = -1 ;
103103 const bool inFlyDirection = iWay & 1 ;
104104 const int32_t wayDirection = (iWay & 1 ) ? -1 : 1 ;
@@ -134,7 +134,7 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
134134 uint8_t dEdxSubThresholdRow = 255 ;
135135 bool doInterpolate = param.rec .tpc .rebuildTrackInFit && (iWay == nWays - 3 || iWay == nWays - 2 );
136136 if (lastPropagateRow != 255 && CAMath::Abs (cluster.row - lastPropagateRow) > 1 ) {
137- bool dodEdx = param.dodEdxEnabled && param.rec .tpc .adddEdxSubThresholdClusters && finalFit && CAMath::Abs (cluster.row - lastUpdateRow) == 2 && cluster.sector == lastUpdateSector && currentClusterStatus == 0 ;
137+ bool dodEdx = param.dodEdxEnabled && param.rec .tpc .adddEdxSubThresholdClusters && finalFit && CAMath::Abs (cluster.row - lastUpdateRow) == 2 && cluster.sector == lastSector && currentClusterStatus == 0 ;
138138 bool doAttach = allowChangeClusters && !param.rec .tpc .rebuildTrackInFit && !(merger.Param ().rec .tpc .disableRefitAttachment & 2 );
139139 if (dodEdx || doAttach || doInterpolate) {
140140 int32_t step = cluster.row > lastPropagateRow ? 1 : -1 ;
@@ -178,9 +178,6 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
178178 break ;
179179 }
180180 auto & inter = interpolation.hit [interpolationIndex];
181- if (param.rec .tpc .mergerInterpolateErrors && iWay == nWays - 3 ) {
182- prop.InterpolateFill (&inter);
183- }
184181
185182 float uncorrectedY = -1e6f;
186183 if (param.rec .tpc .rebuildTrackInFit ) {
@@ -197,14 +194,20 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
197194 merger.GetConstantMem ()->calibObjects .fastTransformHelper ->InverseTransformYZtoNominalYZ (cluster.sector , cluster.row , mP [0 ], mP [1 ], uncorrectedY, tmpZ);
198195 }
199196
197+ HandleCrossCE (param, cluster.sector , lastSector);
198+ lastSector = cluster.sector ;
199+
200+ if (param.rec .tpc .mergerInterpolateErrors && iWay == nWays - 3 ) {
201+ prop.InterpolateFill (&inter);
202+ }
203+
200204 if (currentClusterStatus) {
201205 nMissed++;
202206 nMissed2++;
203207 continue ;
204208 }
205209
206- const bool crossCE = lastUpdateSector != 255 && ((lastUpdateSector < 18 ) ^ (clusters[ihit].sector < 18 ));
207- 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);
210+ 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);
208211 if (retValHit == 0 ) {
209212 DodEdx (dEdx, dEdxAlt, merger, finalFit, ihit, ihitMergeFirst, wayDirection, clusters, clusterState, zz, dEdxSubThresholdRow);
210213 ihitStart = ihit;
@@ -219,11 +222,10 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger& GPUrestrict() merger, int32_
219222 }
220223
221224 lastUpdateRow = cluster.row ;
222- lastUpdateSector = cluster.sector ;
223225 assert (!param.rec .tpc .mergerInterpolateErrors || rebuilt || iWay != nWays - 2 || ihit || interpolationIndex == 0 );
224226 }
225227 if (finalOutInFit && !(param.rec .tpc .disableRefitAttachment & 4 ) && lastUpdateRow != 255 ) {
226- StoreLoopPropagation (merger, lastUpdateSector , lastUpdateRow, iTrk, lastUpdateRow > clusters[(iWay & 1 ) ? (maxN - 1 ) : 0 ].row , prop.GetAlpha ());
228+ StoreLoopPropagation (merger, lastSector , lastUpdateRow, iTrk, lastUpdateRow > clusters[(iWay & 1 ) ? (maxN - 1 ) : 0 ].row , prop.GetAlpha ());
227229 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 ));
228230 }
229231 if (!(iWay & 1 ) && !finalFit && !track.CCE () && !track.Looper ()) {
@@ -287,7 +289,23 @@ GPUdii() void GPUTPCGMTrackParam::FitAddRow(const int32_t iRow, const uint8_t se
287289 }
288290}
289291
290- 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)
292+ GPUdii () void GPUTPCGMTrackParam::HandleCrossCE(const GPUParam& GPUrestrict () param, const uint8_t sector, const uint8_t& lastSector)
293+ {
294+ const bool crossCE = lastSector != 255 && ((lastSector < 18 ) ^ (sector < 18 ));
295+ if (crossCE) {
296+ if (param.rec .tpc .addErrorsCECrossing ) {
297+ if (param.rec .tpc .addErrorsCECrossing >= 2 ) {
298+ AddCovDiagErrorsWithCorrelations (param.rec .tpc .errorsCECrossing );
299+ } else {
300+ AddCovDiagErrors (param.rec .tpc .errorsCECrossing );
301+ }
302+ } else if (mC [2 ] < 0 .5f ) {
303+ mC [2 ] = 0 .5f ;
304+ }
305+ }
306+ }
307+
308+ 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)
291309{
292310 const GPUParam& GPUrestrict () param = merger.Param ();
293311 const int32_t nWays = param.rec .tpc .nWays ;
@@ -302,18 +320,6 @@ GPUdii() int32_t GPUTPCGMTrackParam::FitHit(GPUTPCGMMerger& GPUrestrict() merger
302320 return 2 ; // Propagate failed or high incl angle
303321 }
304322
305- if (crossCE) {
306- if (param.rec .tpc .addErrorsCECrossing ) {
307- if (param.rec .tpc .addErrorsCECrossing >= 2 ) {
308- AddCovDiagErrorsWithCorrelations (param.rec .tpc .errorsCECrossing );
309- } else {
310- AddCovDiagErrors (param.rec .tpc .errorsCECrossing );
311- }
312- } else if (mC [2 ] < 0 .5f ) {
313- mC [2 ] = 0 .5f ;
314- }
315- }
316-
317323 int32_t retValUpd = 0 , retValInt = 0 ;
318324 float threshold = 3 .f + (lastUpdateX >= 0 ? (CAMath::Abs (mX - lastUpdateX) / 2 ) : 0 .f );
319325 if (mNDF > (int32_t )param.rec .tpc .mergerNonInterpolateRejectMinNDF && (CAMath::Abs (yy - mP [0 ]) > threshold || CAMath::Abs (zz - mP [1 ]) > threshold)) {
0 commit comments