diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/CaruanaSTgcClusterBuilderTool.cxx index 33adb9bd1a94f6cde0d6c68b447c7a34ac857983..791c7517e4c1918c36dd5c9ffb58a852a1f4eecc 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 (auto stripCharge : elementsCharge){ + if (stripCharge > 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++){