From b9a9f2a07271e9b2b4c964f0d94212860c080e24 Mon Sep 17 00:00:00 2001 From: Dominik Smith <smith@th.physik.uni-frankfurt.de> Date: Tue, 14 Nov 2023 13:04:57 +0100 Subject: [PATCH] Small improvements to cbm::algo::tof::Clusterizer. --- algo/detectors/tof/Clusterizer.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/algo/detectors/tof/Clusterizer.cxx b/algo/detectors/tof/Clusterizer.cxx index 1ad2d527e1..312cc160e5 100644 --- a/algo/detectors/tof/Clusterizer.cxx +++ b/algo/detectors/tof/Clusterizer.cxx @@ -54,10 +54,7 @@ namespace cbm::algo::tof // Output variables resultType result; - std::vector<Hit>& clustersOut = std::get<0>(result); // Hits - std::vector<size_t>& chanSizes = std::get<1>(result); // nClusters per channel - std::vector<u32>& chanAddresses = std::get<2>(result); // channel addresses - std::vector<int32_t>& digiIndRef = std::get<3>(result); // digi indices of clusters + auto& [clustersOut, chanSizes, chanAddresses, digiIndRef] = result; // Reference cell of a cluster TofCell* cell = nullptr; @@ -81,8 +78,11 @@ namespace cbm::algo::tof chanSizes.push_back(clustersOut.size()); chanAddresses.push_back(fParams.fChanPar[chan].address); - if (fParams.fDeadStrips & (1 << chan)) { continue; } // skip over dead channels - + // skip over dead channels + if (fParams.fDeadStrips & (1 << chan)) { + chanSizes.back() = 0; + continue; + } inputType& storDigi = input[chan]; auto digiIt = storDigi.begin(); @@ -102,7 +102,7 @@ namespace cbm::algo::tof // use local coordinates, (0,0,0) is in the center of counter ? ROOT::Math::XYZVector pos(((-(double) numChan / 2. + (double) chan) + 0.5) * cell->sizeX, 0., 0.); - double timeDif = xDigiA->GetTime() - xDigiB->GetTime(); + const double timeDif = xDigiA->GetTime() - xDigiB->GetTime(); pos.SetY(fParams.fSigVel * timeDif * 0.5); // A is the top side, B is the bottom side if (xDigiA->GetSide() != 1.) { pos.SetY(-pos.Y()); } // B is the bottom side, A is the top side @@ -132,10 +132,10 @@ namespace cbm::algo::tof continue; } // The "Strip" time is the mean time between each end - double time = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime()); + const double time = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime()); // Weight is the total charge => sum of both ends ToT - double totSum = xDigiA->GetTot() + xDigiB->GetTot(); + const double totSum = xDigiA->GetTot() + xDigiB->GetTot(); // Now check if a hit/cluster is already started if (0 < cluster.numChan()) { @@ -154,7 +154,6 @@ namespace cbm::algo::tof cluster.add(pos, time, totSum, totSum); digiIndRef.push_back(digiIt->second); digiIndRef.push_back(std::next(digiIt)->second); - digiIt += 2; lastChan = chan; -- GitLab