Skip to content

Commit

Permalink
refactor: Modified from_json in AmbiguityConfigJson for easier implem…
Browse files Browse the repository at this point in the history
…entation in Athena (acts-project#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
  • Loading branch information
Ragansu authored Sep 19, 2024
1 parent f4efc6f commit 971be3a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
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

0 comments on commit 971be3a

Please sign in to comment.