Skip to content

Commit

Permalink
Merge branch 'main' into feat-gen3-proto-axis
Browse files Browse the repository at this point in the history
  • Loading branch information
asalzburger authored Feb 25, 2025
2 parents 1142bce + d15f9a3 commit 0255d97
Show file tree
Hide file tree
Showing 69 changed files with 1,764 additions and 720 deletions.
20 changes: 16 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variables:

.ccache_base:
cache:
- key: ccache-${CI_JOB_NAME}-${CCACHE_KEY_SUFFIX}-${CLONE_URL}_${HEAD_REF}
- key: ccache-${CI_JOB_NAME}-${CCACHE_KEY_SUFFIX}-${REPO_SLUG}_${HEAD_REF}
fallback_keys:
- ccache-${CI_JOB_NAME}-${CCACHE_KEY_SUFFIX}-https://github.com/acts-project/acts.git-main
when: always
Expand Down Expand Up @@ -459,10 +459,8 @@ linux_ubuntu_2204_clang:
script:
- >
cmake -B build -S src
--preset=gitlab-ci
--preset=gitlab-ci-lcg
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
-DPython_EXECUTABLE=$(which python3)
-DACTS_BUILD_PLUGIN_GEOMODEL=OFF # GeoModel is not in LCG at this point
- ccache -z
- cmake --build build -- -j6
Expand Down Expand Up @@ -497,3 +495,17 @@ lcg_106a:
- gcc13
- gcc14
- clang16

lcg_107:
extends: .lcg_base_job

variables:
LCG_VERSION: "107"

parallel:
matrix:
- OS: [alma9]
COMPILER:
- gcc13
- gcc14
- clang19
12 changes: 10 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"ACTS_FORCE_ASSERTIONS": "ON",
"ACTS_ENABLE_LOG_FAILURE_THRESHOLD": "ON",
"ACTS_BUILD_BENCHMARKS": "ON",
"ACTS_BUILD_NONCOMPILE_TESTS": "ON",
"ACTS_BUILD_ANALYSIS_APPS": "ON",
"ACTS_BUILD_ALIGNMENT": "ON",
"ACTS_BUILD_FATRAS_GEANT4": "ON",
Expand Down Expand Up @@ -94,14 +93,23 @@
},
{
"name": "gitlab-ci-clangtidy",
"displayName": "GitLab-CI",
"displayName": "GitLab-CI clang-tidy",
"inherits": "ci-common",
"cacheVariables": {
"ACTS_BUILD_ODD": "OFF",
"ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS": "OFF",
"ACTS_RUN_CLANG_TIDY": "ON"
}
},
{
"name": "gitlab-ci-lcg",
"displayName": "GitLab-CI LCG",
"inherits": "ci-common",
"cacheVariables": {
"ACTS_USE_SYSTEM_NLOHMANN_JSON": "ON",
"ACTS_BUILD_PLUGIN_GEOMODEL": "OFF"
}
},
{
"name": "gitlab-ci-exatrkx",
"displayName": "GitLab-CI",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace Acts {
/// enough hits
/// 5) Remove tracks that are not good enough based on cuts Contains method for
/// data preparations

class ScoreBasedAmbiguityResolution {
public:
/// @brief Detector configuration struct : contains the configuration for each detector
Expand All @@ -50,11 +51,23 @@ class ScoreBasedAmbiguityResolution {
int outliersScoreWeight = 0;
int otherScoreWeight = 0;

std::size_t minHits = 0;
// the eta bins for the detector
std::vector<double> etaBins = {-5, 5};

// the minimum number of hits for each eta bin
std::vector<std::size_t> minHitsPerEta = {0};

// the maximum number of holes for each eta bin
std::vector<std::size_t> maxHolesPerEta = {0};

// the maximum number of outliers for each eta bin
std::vector<std::size_t> maxOutliersPerEta = {0};

// the maximum number of shared hits for each eta bin
std::vector<std::size_t> maxSharedHitsPerEta = {0};

std::size_t maxHits = 0;
std::size_t maxHoles = 0;
std::size_t maxOutliers = 0;
std::size_t maxSharedHits = 0;

/// if true, the shared hits are considered as bad hits for this detector
bool sharedHitsFlag = false;
Expand All @@ -63,12 +76,12 @@ class ScoreBasedAmbiguityResolution {

/// a list of values from 0 to 1, the higher number of hits, higher value
/// in the list is multiplied to ambuiguity score applied only if
/// useAmbiguityFunction is true
/// useAmbiguityScoring is true
std::vector<double> factorHits = {1.0};

/// a list of values from 0 to 1, the higher number of holes, lower value
/// in the list is multiplied to ambuiguity score applied only if
/// useAmbiguityFunction is true
/// useAmbiguityScoring is true
std::vector<double> factorHoles = {1.0};
};

Expand Down Expand Up @@ -107,28 +120,21 @@ class ScoreBasedAmbiguityResolution {
std::size_t maxSharedTracksPerMeasurement = 10;
/// maximum number of shared hit per track
std::size_t maxShared = 5;

double pTMin = 0 * UnitConstants::GeV;
double pTMax = 1e5 * UnitConstants::GeV;

double phiMin = -std::numbers::pi * UnitConstants::rad;
double phiMax = std::numbers::pi * UnitConstants::rad;

double etaMin = -5;
double etaMax = 5;
/// minimum number of unshared hits per track
std::size_t minUnshared = 5;

// if true, the ambiguity score is computed based on a different function.
bool useAmbiguityFunction = false;
bool useAmbiguityScoring = false;
};

/// @brief OptionalCuts struct : contains the optional cuts to be applied.
/// @brief Optionals struct: contains the optional cuts, weights and score to be applied.
///
/// The optional cuts,weights and score are used to remove tracks that are not
/// good enough, based on some criteria. Users are free to add their own cuts
/// with the help of this struct.
/// The default cuts and scoring has only a basic set of cuts and
/// score-modifiers. For more flexibility users can define custom cuts and
/// scores using this structure.
template <TrackProxyConcept track_proxy_t>
struct OptionalCuts {
using OptionalFilter = std::function<bool(const track_proxy_t&)>;
struct Optionals {
using OptionalCuts = std::function<bool(const track_proxy_t&)>;

using OptionalScoreModifier =
std::function<void(const track_proxy_t&, double&)>;
Expand All @@ -137,10 +143,10 @@ class ScoreBasedAmbiguityResolution {
const track_proxy_t&,
const typename track_proxy_t::ConstTrackStateProxy&, TrackStateTypes&)>;

std::vector<OptionalFilter> cuts = {};
std::vector<OptionalCuts> cuts = {};
std::vector<OptionalScoreModifier> weights = {};

/// applied only if useAmbiguityFunction is true
/// applied only if useAmbiguityScoring is true
std::vector<OptionalScoreModifier> scores = {};
std::vector<OptionalHitSelection> hitSelections = {};
};
Expand All @@ -163,27 +169,37 @@ class ScoreBasedAmbiguityResolution {
///
/// @param tracks is the input track container
/// @param trackFeaturesVectors is the trackFeatures map from detector ID to trackFeatures
/// @param optionalCuts is the user defined optional cuts to be applied.
/// @param optionals is the user defined optional cuts to be applied.
/// @return a vector of scores for each track
template <TrackContainerFrontend track_container_t>
std::vector<double> simpleScore(
const track_container_t& tracks,
const std::vector<std::vector<TrackFeatures>>& trackFeaturesVectors,
const OptionalCuts<typename track_container_t::ConstTrackProxy>&
optionalCuts = {}) const;
const Optionals<typename track_container_t::ConstTrackProxy>& optionals =
{}) const;

/// Compute the score of each track based on the ambiguity function.
///
/// @param tracks is the input track container
/// @param trackFeaturesVectors is the trackFeatures map from detector ID to trackFeatures
/// @param optionalCuts is the user defined optional cuts to be applied.
/// @param optionals is the user defined optional cuts to be applied.
/// @return a vector of scores for each track
template <TrackContainerFrontend track_container_t>
std::vector<double> ambiguityScore(
const track_container_t& tracks,
const std::vector<std::vector<TrackFeatures>>& trackFeaturesVectors,
const OptionalCuts<typename track_container_t::ConstTrackProxy>&
optionalCuts = {}) const;
const Optionals<typename track_container_t::ConstTrackProxy>& optionals =
{}) const;

/// Rejects Tracks based on eta dependent cuts.
///
/// @param detector is the detector configuration object
/// @param trackFeatures is the trackFeatures object for a specific detector
/// @param eta is the eta of the track
/// @return true if the track is rejected, false otherwise
bool etaBasedCuts(const DetectorConfig& detector,
const TrackFeatures& trackFeatures,
const double& eta) const;

/// Remove hits that are not good enough for each track and removes tracks
/// that have a score below a certain threshold or not enough hits.
Expand Down Expand Up @@ -211,15 +227,15 @@ class ScoreBasedAmbiguityResolution {
/// @param tracks is the input track container
/// @param sourceLinkHash is the source links
/// @param sourceLinkEquality is the equality function for the source links
/// @param optionalCuts is the optional cuts to be applied
/// @param optionals are the optional cuts and score modifiers to be applied
/// @return a vector of IDs of the tracks we want to keep
template <TrackContainerFrontend track_container_t,
typename source_link_hash_t, typename source_link_equality_t>
std::vector<int> solveAmbiguity(
const track_container_t& tracks, source_link_hash_t sourceLinkHash,
source_link_equality_t sourceLinkEquality,
const OptionalCuts<typename track_container_t::ConstTrackProxy>&
optionalCuts = {}) const;
const Optionals<typename track_container_t::ConstTrackProxy>& optionals =
{}) const;

private:
Config m_cfg;
Expand Down
Loading

0 comments on commit 0255d97

Please sign in to comment.