@@ -216,11 +216,15 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
216216 continue ;
217217 }
218218 } else if (allowModification && lastRow != 255 && CAMath::Abs (cluster.row - lastRow) > 1 ) {
219- bool dodEdx = param.par .dodEdx && param.dodEdxEnabled && param.rec .tpc .adddEdxSubThresholdClusters && iWay == nWays - 1 && CAMath::Abs (cluster.row - lastRow) == 2 && cluster.leg == clusters[maxN - 1 ].leg ;
220- dodEdx = AttachClustersPropagate (merger, cluster.sector , lastRow, cluster.row , iTrk, cluster.leg == clusters[maxN - 1 ].leg , prop, inFlyDirection, GPUCA_MAX_SIN_PHI, dodEdx);
221- if (dodEdx) {
222- dEdx.fillSubThreshold (lastRow - wayDirection);
223- dEdxAlt.fillSubThreshold (lastRow - wayDirection);
219+ if GPUCA_RTC_CONSTEXPR (param.par .dodEdx ) {
220+ bool dodEdx = param.dodEdxEnabled && param.rec .tpc .adddEdxSubThresholdClusters && iWay == nWays - 1 && CAMath::Abs (cluster.row - lastRow) == 2 && cluster.leg == clusters[maxN - 1 ].leg ;
221+ dodEdx = AttachClustersPropagate (merger, cluster.sector , lastRow, cluster.row , iTrk, cluster.leg == clusters[maxN - 1 ].leg , prop, inFlyDirection, GPUCA_MAX_SIN_PHI, dodEdx);
222+ if (dodEdx) {
223+ dEdx.fillSubThreshold (lastRow - wayDirection);
224+ if GPUCA_RTC_CONSTEXPR (param.rec .tpc .dEdxClusterRejectionFlagMask != param.rec .tpc .dEdxClusterRejectionFlagMaskAlt ) {
225+ dEdxAlt.fillSubThreshold (lastRow - wayDirection);
226+ }
227+ }
224228 }
225229 }
226230
@@ -367,31 +371,35 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
367371 CADEBUG (printf (" Reinit linearization\n " ));
368372 prop.SetTrack (this , prop.GetAlpha ());
369373 }
370- if (param.par .dodEdx && param.dodEdxEnabled && iWay == nWays - 1 && cluster.leg == clusters[maxN - 1 ].leg ) { // TODO: Costimize flag to remove, and option to remove double-clusters
371- bool acc = (clusterState & param.rec .tpc .dEdxClusterRejectionFlagMask ) == 0 , accAlt = (clusterState & param.rec .tpc .dEdxClusterRejectionFlagMaskAlt ) == 0 ;
372- if (acc || accAlt) {
373- float qtot = 0 , qmax = 0 , pad = 0 , relTime = 0 ;
374- const int32_t clusterCount = (ihit - ihitMergeFirst) * wayDirection + 1 ;
375- for (int32_t iTmp = ihitMergeFirst; iTmp != ihit + wayDirection; iTmp += wayDirection) {
376- if (merger->GetConstantMem ()->ioPtrs .clustersNative == nullptr ) {
377- qtot += clustersXYZ[ihit].amp ;
378- } else {
379- const ClusterNative& cl = merger->GetConstantMem ()->ioPtrs .clustersNative ->clustersLinear [cluster.num ];
380- qtot += cl.qTot ;
381- qmax = CAMath::Max<float >(qmax, cl.qMax );
382- pad += cl.getPad ();
383- relTime += cl.getTime ();
374+ if GPUCA_RTC_CONSTEXPR (param.par .dodEdx ) {
375+ if (param.dodEdxEnabled && iWay == nWays - 1 && cluster.leg == clusters[maxN - 1 ].leg ) { // TODO: Costimize flag to remove, and option to remove double-clusters
376+ bool acc = (clusterState & param.rec .tpc .dEdxClusterRejectionFlagMask ) == 0 , accAlt = (clusterState & param.rec .tpc .dEdxClusterRejectionFlagMaskAlt ) == 0 ;
377+ if (acc || accAlt) {
378+ float qtot = 0 , qmax = 0 , pad = 0 , relTime = 0 ;
379+ const int32_t clusterCount = (ihit - ihitMergeFirst) * wayDirection + 1 ;
380+ for (int32_t iTmp = ihitMergeFirst; iTmp != ihit + wayDirection; iTmp += wayDirection) {
381+ if (merger->GetConstantMem ()->ioPtrs .clustersNative == nullptr ) {
382+ qtot += clustersXYZ[ihit].amp ;
383+ } else {
384+ const ClusterNative& cl = merger->GetConstantMem ()->ioPtrs .clustersNative ->clustersLinear [cluster.num ];
385+ qtot += cl.qTot ;
386+ qmax = CAMath::Max<float >(qmax, cl.qMax );
387+ pad += cl.getPad ();
388+ relTime += cl.getTime ();
389+ }
390+ }
391+ qtot /= clusterCount; // TODO: Weighted Average
392+ pad /= clusterCount;
393+ relTime /= clusterCount;
394+ relTime = relTime - CAMath::Round (relTime);
395+ if (acc) {
396+ dEdx.fillCluster (qtot, qmax, cluster.row , cluster.sector , mP [2 ], mP [3 ], merger->GetConstantMem ()->calibObjects , zz, pad, relTime);
397+ }
398+ if GPUCA_RTC_CONSTEXPR (param.rec .tpc .dEdxClusterRejectionFlagMask != param.rec .tpc .dEdxClusterRejectionFlagMaskAlt ) {
399+ if (accAlt) {
400+ dEdxAlt.fillCluster (qtot, qmax, cluster.row , cluster.sector , mP [2 ], mP [3 ], merger->GetConstantMem ()->calibObjects , zz, pad, relTime);
401+ }
384402 }
385- }
386- qtot /= clusterCount; // TODO: Weighted Average
387- pad /= clusterCount;
388- relTime /= clusterCount;
389- relTime = relTime - CAMath::Round (relTime);
390- if (acc) {
391- dEdx.fillCluster (qtot, qmax, cluster.row , cluster.sector , mP [2 ], mP [3 ], merger->GetConstantMem ()->calibObjects , zz, pad, relTime);
392- }
393- if (accAlt) {
394- dEdxAlt.fillCluster (qtot, qmax, cluster.row , cluster.sector , mP [2 ], mP [3 ], merger->GetConstantMem ()->calibObjects , zz, pad, relTime);
395403 }
396404 }
397405 }
@@ -428,7 +436,9 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
428436
429437 if (param.par .dodEdx && param.dodEdxEnabled ) {
430438 dEdx.computedEdx (merger->OutputTracksdEdx ()[iTrk], param);
431- dEdxAlt.computedEdx (merger->OutputTracksdEdxAlt ()[iTrk], param);
439+ if GPUCA_RTC_CONSTEXPR (param.rec .tpc .dEdxClusterRejectionFlagMask != param.rec .tpc .dEdxClusterRejectionFlagMaskAlt ) {
440+ dEdxAlt.computedEdx (merger->OutputTracksdEdxAlt ()[iTrk], param);
441+ }
432442 }
433443 Alpha = prop.GetAlpha ();
434444 MoveToReference (prop, param, Alpha);
0 commit comments