Skip to content

Commit

Permalink
updated etabased cuts for efficiency and easy validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragansu committed Jan 29, 2025
1 parent b75d2b2 commit ed37831
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,6 @@ class ScoreBasedAmbiguityResolution {
const OptionalCuts<typename track_container_t::ConstTrackProxy>&
optionalCuts = {}) const;

/// Get the value at a specific eta bin.
///
/// @param cuts is the input vector of cuts
/// @param etaBinSize is the size of the eta bin
/// @param binIndex is the index of the bin
/// @return the value of cut at the specific eta bin
static std::size_t getValueAtEta(std::vector<std::size_t> cuts,
std::size_t etaBinSize,
std::size_t binIndex);

private:
Config m_cfg;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ std::vector<int> Acts::ScoreBasedAmbiguityResolution::solveAmbiguity(
}

if (trackFeaturesVector[detectorId].nSharedHits >
getValueAtEta(detector.maxSharedHitsPerEta, etaBins.size(), etaBin)) {
detector.maxSharedHitsPerEta[etaBin]) {
trkCouldBeAccepted = false;
break;
}
Expand Down
27 changes: 3 additions & 24 deletions Core/src/AmbiguityResolution/ScoreBasedAmbiguityResolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@

#include "Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp"

std::size_t Acts::ScoreBasedAmbiguityResolution::getValueAtEta(
std::vector<std::size_t> cuts, std::size_t etaBinSize,
std::size_t binIndex) {
if (cuts.size() == etaBinSize - 1) {
return cuts[binIndex];
}

else if (cuts.size() == 1) {
return cuts[0];
}

else {
throw std::invalid_argument("Invalid cuts size. Expected 1 or " +
std::to_string(etaBinSize - 1) + ", got " +
std::to_string(cuts.size()));
}
}

bool Acts::ScoreBasedAmbiguityResolution::etaBasedCuts(
const DetectorConfig& detector, const TrackFeatures& trackFeatures,
const double& eta) const {
Expand All @@ -36,10 +18,7 @@ bool Acts::ScoreBasedAmbiguityResolution::etaBasedCuts(
return false; // eta out of range
}
std::size_t etaBin = std::distance(etaBins.begin(), it) - 1;
return (trackFeatures.nHits <
getValueAtEta(detector.minHitsPerEta, etaBins.size(), etaBin)) ||
(trackFeatures.nHoles >
getValueAtEta(detector.maxHolesPerEta, etaBins.size(), etaBin)) ||
(trackFeatures.nOutliers >
getValueAtEta(detector.maxOutliersPerEta, etaBins.size(), etaBin));
return (trackFeatures.nHits < detector.minHitsPerEta[etaBin] ||
trackFeatures.nHoles > detector.maxHolesPerEta[etaBin] ||
trackFeatures.nOutliers > detector.maxOutliersPerEta[etaBin]);
}
16 changes: 12 additions & 4 deletions Plugins/Json/src/AmbiguityConfigJsonConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@
#include "Acts/Plugins/Json/ActsJson.hpp"

void initializeEtaVector(std::vector<std::size_t>& target,
const std::vector<std::size_t>& source) {
target = {};
for (auto value : source) {
target.push_back(value);
const std::vector<std::size_t>& source,
int etaBinSize) {
if (source.size() == etaBinSize - 1) {
target = source; // Directly copy if sizes match
} else if (source.size() == 1) {
target.resize(etaBinSize - 1); // Resize target to the required size
std::fill(target.begin(), target.end(),
source[0]); // Fill with the single value from source
} else {
throw std::invalid_argument("Invalid cuts size. Expected 1 or " +
std::to_string(etaBinSize - 1) + ", got " +
std::to_string(source.size()));
}
}
namespace Acts {
Expand Down

0 comments on commit ed37831

Please sign in to comment.