From 971be3af6f4b36fed048dc129031fde1c79bfabc Mon Sep 17 00:00:00 2001 From: Ragansu Chakkappai <66349236+Ragansu@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:49:30 +0200 Subject: [PATCH] refactor: Modified from_json in AmbiguityConfigJson for easier implementation in Athena (#3628) This PR is to do 2 changes for easier implementation in Athena a) Change factor_hits/holes to goodhits/holes and fakehits/holes this is how config is defined in Athena b) Change ERROR to DEBUG in track state with no surface as Athena has extra trackstates which doesnt have surface. Ragansu --- .../ScoreBasedAmbiguityResolution.ipp | 2 +- .../Json/src/AmbiguityConfigJsonConverter.cpp | 23 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp b/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp index 8041188b5cf..3dcf1a20a01 100644 --- a/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp +++ b/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp @@ -46,7 +46,7 @@ ScoreBasedAmbiguityResolution::computeInitialState( for (const auto& ts : track.trackStatesReversed()) { if (!ts.hasReferenceSurface()) { - ACTS_ERROR("Track state has no reference surface"); + ACTS_DEBUG("Track state has no reference surface"); continue; } auto iVolume = ts.referenceSurface().geometryId().volume(); diff --git a/Plugins/Json/src/AmbiguityConfigJsonConverter.cpp b/Plugins/Json/src/AmbiguityConfigJsonConverter.cpp index 2542a237b52..3a4c0f44a6f 100644 --- a/Plugins/Json/src/AmbiguityConfigJsonConverter.cpp +++ b/Plugins/Json/src/AmbiguityConfigJsonConverter.cpp @@ -35,15 +35,26 @@ void from_json(const nlohmann::json& j, ConfigPair& p) { detectorConfig.sharedHitsFlag = value["sharedHitsFlag"]; - std::vector factorHits = value["factorHits"]; - std::vector factorHoles = value["factorHoles"]; + const std::vector& goodHits = value["goodHits"]; + const std::vector& goodHoles = value["goodHoles"]; - for (auto factor : factorHits) { - detectorConfig.factorHits.push_back(factor); + const std::vector& fakeHits = value["fakeHits"]; + const std::vector& fakeHoles = value["fakeHoles"]; + + if (goodHits.size() != fakeHits.size()) { + throw std::invalid_argument("goodHits and FakeHits size mismatch"); + } + + for (std::size_t i = 0; i < goodHits.size(); i++) { + detectorConfig.factorHits.push_back(goodHits[i] / fakeHits[i]); + } + + if (goodHoles.size() != fakeHoles.size()) { + throw std::invalid_argument("goodHoles and FakeHoles size mismatch"); } - for (auto factor : factorHoles) { - detectorConfig.factorHoles.push_back(factor); + for (std::size_t i = 0; i < goodHoles.size(); i++) { + detectorConfig.factorHoles.push_back(goodHoles[i] / fakeHoles[i]); } detectorConfigs.push_back(detectorConfig);