From b3da92ed9de0e7f6e3b6f5c7c6745e8a472a5bd2 Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 20 Jul 2022 20:04:01 +0200 Subject: [PATCH] fix double counting of modules in TkAlBarycenters::computeBarycenters --- .../interface/AlignmentPayloadInspectorHelper.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CondCore/AlignmentPlugins/interface/AlignmentPayloadInspectorHelper.h b/CondCore/AlignmentPlugins/interface/AlignmentPayloadInspectorHelper.h index dfb6bc7704808..1397892eb18df 100644 --- a/CondCore/AlignmentPlugins/interface/AlignmentPayloadInspectorHelper.h +++ b/CondCore/AlignmentPlugins/interface/AlignmentPayloadInspectorHelper.h @@ -877,6 +877,11 @@ namespace AlignmentPI { const std::map& GPR) /*--------------------------------------------------------------------*/ { + // zero in the n. modules per partition... + for (const auto& p : PARTITIONS) { + nmodules[p] = 0.; + } + for (const auto& ali : input) { if (DetId(ali.rawId()).det() != DetId::Tracker) { edm::LogWarning("TkAlBarycenters::computeBarycenters") @@ -958,15 +963,17 @@ namespace AlignmentPI { } for (const auto& p : PARTITIONS) { + // take the arithmetic mean Xbarycenters[p] /= nmodules[p]; Ybarycenters[p] /= nmodules[p]; Zbarycenters[p] /= nmodules[p]; + // add the Tracker Global Position Record Xbarycenters[p] += GPR.at(AlignmentPI::t_x); Ybarycenters[p] += GPR.at(AlignmentPI::t_y); Zbarycenters[p] += GPR.at(AlignmentPI::t_z); - COUT << p << "|" + COUT << "Partition: " << p << " n. modules: " << nmodules[p] << "|" << " X: " << std::right << std::setw(12) << Xbarycenters[p] << " Y: " << std::right << std::setw(12) << Ybarycenters[p] << " Z: " << std::right << std::setw(12) << Zbarycenters[p] << std::endl; }