From 2bd7e5ae175c67f6b39f48196e940bc679237980 Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 7 Aug 2023 12:25:04 +0200 Subject: [PATCH] SiStripClusters2ApproxClusters: run peakFilter only if cluster is usable --- .../plugins/SiStripClusters2ApproxClusters.cc | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc index c842c384c4971..fd9a784fcb5a8 100644 --- a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc +++ b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc @@ -126,22 +126,28 @@ void SiStripClusters2ApproxClusters::produce(edm::Event& event, edm::EventSetup int hitStrips; float hitPredPos; - theFilter->getSizes(detId, cluster, lp, ldir, hitStrips, hitPredPos); - - bool peakFilter = false; - SlidingPeakFinder pf(std::max(2, std::ceil(std::abs(hitPredPos) + subclusterWindow_))); - float mipnorm = mip / std::abs(ldir.z()); - PeakFinderTest test(mipnorm, - detId, - cluster.firstStrip(), - theNoise_, - seedCutMIPs_, - seedCutSN_, - subclusterCutMIPs_, - subclusterCutSN_); - peakFilter = pf.apply(cluster.amplitudes(), test); - - ff.push_back(SiStripApproximateCluster(cluster, maxNSat, hitPredPos, peakFilter)); + bool usable = theFilter->getSizes(detId, cluster, lp, ldir, hitStrips, hitPredPos); + // (almost) same logic as in StripSubClusterShapeTrajectoryFilter + bool isTrivial = (std::abs(hitPredPos) < 2.f && hitStrips <= 2); + + if (!usable || isTrivial) { + ff.push_back(SiStripApproximateCluster(cluster, maxNSat, hitPredPos, true)); + } else { + bool peakFilter = false; + SlidingPeakFinder pf(std::max(2, std::ceil(std::abs(hitPredPos) + subclusterWindow_))); + float mipnorm = mip / std::abs(ldir.z()); + PeakFinderTest test(mipnorm, + detId, + cluster.firstStrip(), + theNoise_, + seedCutMIPs_, + seedCutSN_, + subclusterCutMIPs_, + subclusterCutSN_); + peakFilter = pf.apply(cluster.amplitudes(), test); + + ff.push_back(SiStripApproximateCluster(cluster, maxNSat, hitPredPos, peakFilter)); + } } }