From c996ba830ec18c9d9eb05c4b6f167cfd3f89ff61 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Fri, 27 Aug 2021 15:34:39 +0200 Subject: [PATCH 1/2] small CPU optimization --- .../src/CaruanaSTgcClusterBuilderTool.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx index 33adb9bd1a9..2bec08d9fa1 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx @@ -107,10 +107,20 @@ StatusCode Muon::CaruanaSTgcClusterBuilderTool::getClusters(std::vector= 3), we use the Caruana method of fitting a Gaussian to the distribution bool caruanaFail = false; // If the Caruana method fails at some point this is changed to true and the reconstruction reverts to the weighted mean method - double sigmaSq = 0.0; + + // If it is a strip cluster, make sure there are 3 or more strips with non-zero charge, otherwise revert to the weighted mean method if (isStrip){ + int multiplicity = 0; + for (size_t i_strip=0; i_strip 0) multiplicity += 1; + } + if (multiplicity < 3) caruanaFail = true; + } + + double sigmaSq = 0.0; + if (isStrip && !caruanaFail){ // Here we implement the Caruana method to reconstruct the position of the cluster AmgSymMatrix(3) elementPosMatrix; for (int i=0; i<3; i++){ -- GitLab From 9dddde4af460a134e71dc4ba430345aa4247b55a Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Mon, 30 Aug 2021 17:39:29 +0200 Subject: [PATCH 2/2] modified for loop --- .../STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx index 2bec08d9fa1..791c7517e4c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx @@ -113,8 +113,8 @@ StatusCode Muon::CaruanaSTgcClusterBuilderTool::getClusters(std::vector 0) multiplicity += 1; + for (auto stripCharge : elementsCharge){ + if (stripCharge > 0) multiplicity += 1; } if (multiplicity < 3) caruanaFail = true; } -- GitLab