Skip to content

Commit

Permalink
Merge branch 'main' into releases
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Feb 24, 2025
2 parents 09225b0 + 9cfe189 commit 5148034
Show file tree
Hide file tree
Showing 52 changed files with 1,502 additions and 488 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
5 changes: 0 additions & 5 deletions Core/include/Acts/Geometry/Blueprint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ class Blueprint : public BlueprintNode {
/// Determine how much envelope space to produce from the highest volume
/// in the geometry hierarchy and the world volume.
ExtentEnvelope envelope = ExtentEnvelope::Zero();

/// The geometry identifier hook, passed through the `TrackingGeometry`
/// constructor. This will be superseded by a more integrated approach to
/// the identification scheme
GeometryIdentifierHook geometryIdentifierHook = {};
};

/// Constructor from a config object
Expand Down
47 changes: 24 additions & 23 deletions Core/include/Acts/Geometry/GeometryHierarchyMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,19 @@ class GeometryHierarchyMap {
// NOTE this class assumes that it knows the ordering of the levels within
// the geometry id. if the geometry id changes, this code has to be
// adapted too. the asserts ensure that such a change is caught.
static_assert(GeometryIdentifier().setVolume(1).value() <
GeometryIdentifier().setVolume(1).setBoundary(1).value(),
static_assert(GeometryIdentifier().withVolume(1).value() <
GeometryIdentifier().withVolume(1).withBoundary(1).value(),
"Incompatible GeometryIdentifier hierarchy");
static_assert(GeometryIdentifier().setBoundary(1).value() <
GeometryIdentifier().setBoundary(1).setLayer(1).value(),
static_assert(GeometryIdentifier().withBoundary(1).value() <
GeometryIdentifier().withBoundary(1).withLayer(1).value(),
"Incompatible GeometryIdentifier hierarchy");
static_assert(GeometryIdentifier().setLayer(1).value() <
GeometryIdentifier().setLayer(1).setApproach(1).value(),
"Incompatible GeometryIdentifier hierarchy");
static_assert(GeometryIdentifier().setApproach(1).value() <
GeometryIdentifier().setApproach(1).setSensitive(1).value(),
static_assert(GeometryIdentifier().withLayer(1).value() <
GeometryIdentifier().withLayer(1).withApproach(1).value(),
"Incompatible GeometryIdentifier hierarchy");
static_assert(
GeometryIdentifier().withApproach(1).value() <
GeometryIdentifier().withApproach(1).withSensitive(1).value(),
"Incompatible GeometryIdentifier hierarchy");

using Identifier = GeometryIdentifier::Value;

Expand All @@ -156,31 +157,31 @@ class GeometryHierarchyMap {
/// Construct a mask where all leading non-zero levels are set.
static constexpr Identifier makeLeadingLevelsMask(GeometryIdentifier id) {
// construct id from encoded value with all bits set
auto allSet = GeometryIdentifier(~GeometryIdentifier::Value{0u});
const auto allSet = GeometryIdentifier(~GeometryIdentifier::Value{0u});
// manually iterate over identifier levels starting from the lowest
if (id.sensitive() != 0u) {
// all levels are valid; keep all bits set.
return allSet.setExtra(0u).value();
return allSet.withExtra(0u).value();
}
if (id.approach() != 0u) {
return allSet.setExtra(0u).setSensitive(0u).value();
return allSet.withExtra(0u).withSensitive(0u).value();
}
if (id.layer() != 0u) {
return allSet.setExtra(0u).setSensitive(0u).setApproach(0u).value();
return allSet.withExtra(0u).withSensitive(0u).withApproach(0u).value();
}
if (id.boundary() != 0u) {
return allSet.setExtra(0u)
.setSensitive(0u)
.setApproach(0u)
.setLayer(0u)
return allSet.withExtra(0u)
.withSensitive(0u)
.withApproach(0u)
.withLayer(0u)
.value();
}
if (id.volume() != 0u) {
return allSet.setExtra(0u)
.setSensitive(0u)
.setApproach(0u)
.setLayer(0u)
.setBoundary(0u)
return allSet.withExtra(0u)
.withSensitive(0u)
.withApproach(0u)
.withLayer(0u)
.withBoundary(0u)
.value();
}
// no valid levels; all bits are zero.
Expand All @@ -189,7 +190,7 @@ class GeometryHierarchyMap {

/// Construct a mask where only the highest level is set.
static constexpr Identifier makeHighestLevelMask() {
return makeLeadingLevelsMask(GeometryIdentifier(0u).setVolume(1u));
return makeLeadingLevelsMask(GeometryIdentifier(0u).withVolume(1u));
}

/// Compare the two identifiers only within the masked bits.
Expand Down
113 changes: 110 additions & 3 deletions Core/include/Acts/Geometry/GeometryIdentifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <cstdint>
#include <functional>
#include <iosfwd>
#include <stdexcept>

namespace Acts {

Expand Down Expand Up @@ -90,6 +91,102 @@ class GeometryIdentifier {
return setBits(kExtraMask, extra);
}

/// Return a new identifier with the volume set to @p volume
/// @param volume the new volume identifier
/// @return a new identifier with the volume set to @p volume
[[nodiscard]]
constexpr GeometryIdentifier withVolume(Value volume) const {
GeometryIdentifier id = *this;
id.setVolume(volume);
return id;
}

/// Return a new identifier with the boundary set to @p boundary
/// @param boundary the new boundary identifier
/// @return a new identifier with the boundary set to @p boundary
[[nodiscard]]
constexpr GeometryIdentifier withBoundary(Value boundary) const {
GeometryIdentifier id = *this;
id.setBoundary(boundary);
return id;
}

/// Return a new identifier with the layer set to @p layer
/// @param layer the new layer identifier
/// @return a new identifier with the layer set to @p layer
[[nodiscard]]
constexpr GeometryIdentifier withLayer(Value layer) const {
GeometryIdentifier id = *this;
id.setLayer(layer);
return id;
}

/// Return a new identifier with the approach set to @p approach
/// @param approach the new approach identifier
/// @return a new identifier with the approach set to @p approach
[[nodiscard]]
constexpr GeometryIdentifier withApproach(Value approach) const {
GeometryIdentifier id = *this;
id.setApproach(approach);
return id;
}

/// Return a new identifier with the passive set to @p passive
/// @param passive the new passive identifier
/// @return a new identifier with the passive set to @p passive
[[nodiscard]]
constexpr GeometryIdentifier withPassive(Value passive) const {
GeometryIdentifier id = *this;
id.setPassive(passive);
return id;
}

/// Return a new identifier with the sensitive set to @p sensitive
/// @param sensitive the new sensitive identifier
/// @return a new identifier with the sensitive set to @p sensitive
[[nodiscard]]
constexpr GeometryIdentifier withSensitive(Value sensitive) const {
GeometryIdentifier id = *this;
id.setSensitive(sensitive);
return id;
}

/// Return a new identifier with the extra set to @p extra
/// @param extra the new extra identifier
/// @return a new identifier with the extra set to @p extra
[[nodiscard]]
constexpr GeometryIdentifier withExtra(Value extra) const {
GeometryIdentifier id = *this;
id.setExtra(extra);
return id;
}

/// Get the maximum value for the volume identifier.
/// @return the maximum value for the volume identifier
static constexpr Value getMaxVolume() { return getMaxValue(kVolumeMask); }

/// Get the maximum value for the boundary identifier.
/// @return the maximum value for the boundary identifier
static constexpr Value getMaxBoundary() { return getMaxValue(kBoundaryMask); }

/// Get the maximum value for the layer identifier.
/// @return the maximum value for the layer identifier
static constexpr Value getMaxLayer() { return getMaxValue(kLayerMask); }

/// Get the maximum value for the approach identifier.
/// @return the maximum value for the approach identifier
static constexpr Value getMaxApproach() { return getMaxValue(kApproachMask); }

/// Get the maximum value for the sensitive identifier.
/// @return the maximum value for the sensitive identifier
static constexpr Value getMaxSensitive() {
return getMaxValue(kSensitiveMask);
}

/// Get the maximum value for the extra identifier.
/// @return the maximum value for the extra identifier
static constexpr Value getMaxExtra() { return getMaxValue(kExtraMask); }

private:
// clang-format off
/// (2^8)-1 = 255 volumes
Expand All @@ -100,7 +197,6 @@ class GeometryIdentifier {
static constexpr Value kLayerMask = 0x0000fff000000000;
/// (2^8)-1 = 255 approach surfaces
static constexpr Value kApproachMask = 0x0000000ff0000000;
static constexpr Value kPassiveMask = kApproachMask;
/// (2^20)-1 = 1048575 sensitive surfaces
static constexpr Value kSensitiveMask = 0x000000000fffff00;
/// (2^8)-1 = 255 extra values
Expand All @@ -118,14 +214,26 @@ class GeometryIdentifier {
// WARNING undefined behaviour for mask == 0 which we should not have.
return __builtin_ctzll(mask);
}

constexpr static Value getMaxValue(Value mask) {
return mask >> extractShift(mask);
}

/// Extract the masked bits from the encoded value.
constexpr Value getBits(Value mask) const {
return (m_value & mask) >> extractShift(mask);
}
/// Set the masked bits to id in the encoded value.
constexpr GeometryIdentifier& setBits(Value mask, Value id) {
if (id > getMaxValue(mask)) {
throw std::invalid_argument(
"Value " + std::to_string(id) + " exceeds maximum value " +
std::to_string(getMaxValue(mask)) + " for this field");
}

m_value = (m_value & ~mask) | ((id << extractShift(mask)) & mask);
// return *this here that we need to write fewer lines in the setXXX methods
// return *this here that we need to write fewer lines in the setXXX
// methods
return *this;
}

Expand All @@ -151,7 +259,6 @@ struct GeometryIdentifierHook {
};

} // namespace Acts

// specialize std::hash so GeometryIdentifier can be used e.g. in an
// unordered_map
namespace std {
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Geometry/GeometryObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class GeometryObject {
}

/// @return the geometry id by reference
const GeometryIdentifier& geometryId() const;
GeometryIdentifier geometryId() const;

/// Force a binning position method
///
Expand Down Expand Up @@ -77,7 +77,7 @@ class GeometryObject {
GeometryIdentifier m_geometryId;
};

inline const GeometryIdentifier& GeometryObject::geometryId() const {
inline GeometryIdentifier GeometryObject::geometryId() const {
return m_geometryId;
}

Expand Down
1 change: 1 addition & 0 deletions Core/include/Acts/Geometry/Layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class Layer : public virtual GeometryObject {
/// Declare the TrackingVolume as a friend, to be able to register previous,
/// next and set the enclosing TrackingVolume
friend class TrackingVolume;
friend class Gen1GeometryClosureVisitor;

public:
/// Default Constructor - deleted
Expand Down
Loading

0 comments on commit 5148034

Please sign in to comment.