Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Modified from_json in AmbiguityConfigJson for easier implementation in Athena #3628

Merged
merged 9 commits into from
Sep 19, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
23 changes: 17 additions & 6 deletions Plugins/Json/src/AmbiguityConfigJsonConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,26 @@ void from_json(const nlohmann::json& j, ConfigPair& p) {

detectorConfig.sharedHitsFlag = value["sharedHitsFlag"];

std::vector<double> factorHits = value["factorHits"];
std::vector<double> factorHoles = value["factorHoles"];
const std::vector<double>& goodHits = value["goodHits"];
const std::vector<double>& goodHoles = value["goodHoles"];

for (auto factor : factorHits) {
detectorConfig.factorHits.push_back(factor);
const std::vector<double>& fakeHits = value["fakeHits"];
const std::vector<double>& 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);
Expand Down
Loading