diff --git a/algo/base/RecoParams.h b/algo/base/RecoParams.h index e8093afe797539dd7299217d989e19b9ccd8c256..db747f189c96263f8dd7bc9fa1be3466c408c47e 100644 --- a/algo/base/RecoParams.h +++ b/algo/base/RecoParams.h @@ -41,6 +41,9 @@ namespace cbm::algo f32 timeCutClusterAbs; f32 timeCutClusterSig; + bool doChargeCorrelation; + f32 chargeCorrelationDelta; + struct Memory { AllocationMode allocationMode; u64 maxNDigisPerTS; @@ -86,6 +89,10 @@ namespace cbm::algo &STS::timeCutClusterSig, "timeCutClusterSig", "Time cut for clusters." " Two clusters are considered it their time difference is below 'value * sqrt(terr1**2 + terr2*+2)'"), + + yaml::Property(&STS::doChargeCorrelation, "doChargeCorrelation", + "Enable charge correlation between front+back clusters during hit finding"), + yaml::Property(&STS::chargeCorrelationDelta, "chargeCorrelationDelta", "Delta in total charge between front and back clusters to be considered for hit finding"), yaml::Property(&STS::memory, "memory", "Memory limits for STS reco")); }; diff --git a/algo/detectors/sts/Hitfinder.cxx b/algo/detectors/sts/Hitfinder.cxx index b2a9629658782dfd67576a21b6cdd8543841d219..cede2b7fdc80187a42c39b1acfedc0e9c11d5274 100644 --- a/algo/detectors/sts/Hitfinder.cxx +++ b/algo/detectors/sts/Hitfinder.cxx @@ -523,7 +523,6 @@ XPU_D void sts::Hitfinder::SortClusters(SortClusters::context& ctx) const XPU_D void sts::Hitfinder::FindHits(FindHits::context& ctx) const { - int iModule = 0; int iThread = ctx.block_dim_x() * ctx.block_idx_x() + ctx.thread_idx_x(); @@ -552,6 +551,13 @@ XPU_D void sts::Hitfinder::FindHits(FindHits::context& ctx) const int nClustersB = nClustersPerModule[iModuleB]; size_t nHitsWritten = nHitsPerModule[iModule]; + // global parameters + const RecoParams::STS& params = ctx.cmem<Params>().sts; + + const bool doChargeCorrelation = params.doChargeCorrelation; + const real ChargeDelta = params.chargeCorrelationDelta; // Allowed charge difference between clusters to create a hit + + if (nClustersF == 0 || nClustersB == 0) { return; } @@ -649,8 +655,17 @@ XPU_D void sts::Hitfinder::FindHits(FindHits::context& ctx) const break; } - float timeCut = -1.f; - const RecoParams::STS& params = ctx.cmem<Params>().sts; + // Critical to check for charge correlation AFTER time difference + // as time difference advances cluster index on back side + // reducing the combinatorics drastically + if (doChargeCorrelation) { + float chargeDiff = clsDataF.fCharge - clsDataB.fCharge; + if (xpu::abs(chargeDiff) > ChargeDelta) { + continue; + } + } + + float timeCut = -1.f; if (params.timeCutClusterAbs > 0.f) timeCut = params.timeCutClusterAbs; else if (params.timeCutClusterSig > 0.f) {