diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a82fc9b06f7..e7d91151ba1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,16 @@ variables: DEPENDENCY_TAG: v5 +.ccache_base: + cache: + - key: ccache-${CI_JOB_NAME}-${CCACHE_KEY_SUFFIX}-${CLONE_URL}_${HEAD_REF} + fallback_keys: + - ccache-${CI_JOB_NAME}-${CCACHE_KEY_SUFFIX}-https://github.com/acts-project/acts.git-main + when: always + paths: + - ${CCACHE_DIR} + + clang_tidy: stage: build image: ghcr.io/acts-project/ubuntu2404:63 @@ -68,12 +78,7 @@ build_exatrkx_cpu: - large cache: - key: ccache-${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CCACHE_KEY_SUFFIX} - fallback_keys: - - ccache-${CI_JOB_NAME}-${CI_DEFAULT_BRANCH}-${CCACHE_KEY_SUFFIX} - when: always - paths: - - ${CCACHE_DIR} + - !reference [.ccache_base, cache] script: - export PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH @@ -106,12 +111,7 @@ build_exatrkx: - large cache: - key: ccache-${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CCACHE_KEY_SUFFIX} - fallback_keys: - - ccache-${CI_JOB_NAME}-${CI_DEFAULT_BRANCH}-${CCACHE_KEY_SUFFIX} - when: always - paths: - - ${CCACHE_DIR} + - !reference [.ccache_base, cache] artifacts: paths: @@ -227,12 +227,7 @@ build_linux_ubuntu: DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-24.04/deps.$DEPENDENCY_TAG.tar.zst cache: - key: ccache-${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CCACHE_KEY_SUFFIX} - fallback_keys: - - ccache-${CI_JOB_NAME}-${CI_DEFAULT_BRANCH}-${CCACHE_KEY_SUFFIX} - when: always - paths: - - ${CCACHE_DIR} + - !reference [.ccache_base, cache] artifacts: paths: @@ -337,12 +332,7 @@ linux_physmon: stage: build cache: - key: ccache-${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CCACHE_KEY_SUFFIX} - fallback_keys: - - ccache-${CI_JOB_NAME}-${CI_DEFAULT_BRANCH}-${CCACHE_KEY_SUFFIX} - when: always - paths: - - ${CCACHE_DIR} + - !reference [.ccache_base, cache] script: - git clone $CLONE_URL src @@ -418,12 +408,7 @@ linux_ubuntu_2204_clang: SETUP: cache: - key: ccache-${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CCACHE_KEY_SUFFIX} - fallback_keys: - - ccache-${CI_JOB_NAME}-${CI_DEFAULT_BRANCH}-${CCACHE_KEY_SUFFIX} - when: always - paths: - - ${CCACHE_DIR} + - !reference [.ccache_base, cache] before_script: - 'echo "LCG_VERSION: ${LCG_VERSION}"' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d4c224bf3c7..87251106806 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,6 +14,7 @@ repos: - id: end-of-file-fixer exclude: \.(diff|patch)$ - id: check-yaml + exclude: \.gitlab-ci.yml$ - id: check-added-large-files diff --git a/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root b/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root index b3543963d9f..79cdb71a2cd 100644 Binary files a/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root and b/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root differ diff --git a/CMakeLists.txt b/CMakeLists.txt index 04fb58d6825..a4fd002e871 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -432,9 +432,6 @@ if(ACTS_BUILD_PLUGIN_EXATRKX) and ACTS_EXATRKX_ENABLE_TORCHSCRIPT must be enabled." ) endif() - if(ACTS_EXATRKX_ENABLE_ONNX) - find_package(cugraph REQUIRED) - endif() if(ACTS_EXATRKX_ENABLE_TORCH) find_package(TorchScatter REQUIRED) endif() diff --git a/Core/include/Acts/Detector/Blueprint.hpp b/Core/include/Acts/Detector/Blueprint.hpp index 1e3ec527674..b3724f3fec5 100644 --- a/Core/include/Acts/Detector/Blueprint.hpp +++ b/Core/include/Acts/Detector/Blueprint.hpp @@ -13,7 +13,7 @@ #include "Acts/Detector/ProtoBinning.hpp" #include "Acts/Geometry/Extent.hpp" #include "Acts/Geometry/VolumeBounds.hpp" -#include "Acts/Utilities/BinningData.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/StringHelpers.hpp" #include @@ -47,11 +47,11 @@ struct Node final { /// @param t the transform /// @param bt the boundary type /// @param bv the boundary values - /// @param bss the binning values + /// @param bss the axis directions for the binning /// @param cs the children of the node /// @param e the estimated extent of the node (optional) Node(const std::string& n, const Transform3& t, VolumeBounds::BoundsType bt, - const std::vector& bv, const std::vector& bss, + const std::vector& bv, const std::vector& bss, std::vector> cs = {}, const Extent& e = Extent()) : name(n), transform(t), @@ -96,7 +96,7 @@ struct Node final { /// Branch definitions: children std::vector> children = {}; /// Branch definition binning - std::vector binning = {}; + std::vector binning = {}; /// Portal proto material binning std::map portalMaterialBinning = {}; diff --git a/Core/include/Acts/Detector/CuboidalContainerBuilder.hpp b/Core/include/Acts/Detector/CuboidalContainerBuilder.hpp index ea5b98675cf..0a8b87acb85 100644 --- a/Core/include/Acts/Detector/CuboidalContainerBuilder.hpp +++ b/Core/include/Acts/Detector/CuboidalContainerBuilder.hpp @@ -12,7 +12,7 @@ #include "Acts/Detector/DetectorComponents.hpp" #include "Acts/Detector/interface/IDetectorComponentBuilder.hpp" #include "Acts/Geometry/GeometryContext.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -36,8 +36,8 @@ class IGeometryIdGenerator; /// @note the builder expects a fully consistent set of sub volume builders /// that will be executed in a chain /// -/// @note allowed BinningValue(s) for the cuboid container builder are -/// {binX}, {binY}, {binZ}. +/// @note allowed AxisDirection(s) for the cuboid container builder are +/// {AxisX}, {AxisY}, {AxisZ}. /// /// @note Connecting containers isn't functional yet due to the underlying /// issues in the CuboidDetectorHelper @@ -48,8 +48,8 @@ class CuboidalContainerBuilder : public IDetectorComponentBuilder { struct Config { /// The configured volume builders std::vector> builders = {}; - /// Binning prescription of attachment - BinningValue binning{}; + /// Axis direction for the binning + AxisDirection binning{}; /// The root volume finder std::shared_ptr rootVolumeFinderBuilder = nullptr; diff --git a/Core/include/Acts/Detector/CylindricalContainerBuilder.hpp b/Core/include/Acts/Detector/CylindricalContainerBuilder.hpp index 4520eea5e07..2abc41327fb 100644 --- a/Core/include/Acts/Detector/CylindricalContainerBuilder.hpp +++ b/Core/include/Acts/Detector/CylindricalContainerBuilder.hpp @@ -13,7 +13,7 @@ #include "Acts/Detector/ProtoBinning.hpp" #include "Acts/Detector/interface/IDetectorComponentBuilder.hpp" #include "Acts/Geometry/GeometryContext.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -39,17 +39,17 @@ class IGeometryIdGenerator; /// @note the builder expects a fully consistent set of sub volume builders /// that will be executed in a chain /// -/// @note allowed BinningValue(s) for the cylindrical container builder are -/// {binZ}, {binR}, {binPhi}, {binZ, binR}, whereas the last option indicates -/// a wrapping setup. +/// @note allowed AxisDirection(s) for the cylindrical container builder are +/// {AxisZ}, {AxisR}, {AxisPhi}, {AxisZ, AxisR}, whereas the last option +/// indicates a wrapping setup. class CylindricalContainerBuilder : public IDetectorComponentBuilder { public: /// Nested configuration object struct Config { /// The configured volume builders std::vector> builders = {}; - /// Binning prescription of attachment - std::vector binning = {}; + /// The axis direction for the binning + std::vector binning = {}; /// The root volume finder std::shared_ptr rootVolumeFinderBuilder = nullptr; diff --git a/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp b/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp index 64483115c61..ba67d3bd10e 100644 --- a/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp +++ b/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp @@ -11,7 +11,7 @@ #include "Acts/Detector/interface/IRootVolumeFinderBuilder.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Navigation/PortalNavigation.hpp" -#include "Acts/Utilities/BinningData.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -26,7 +26,7 @@ class IndexedRootVolumeFinderBuilder final : public IRootVolumeFinderBuilder { public: /// @brief Constructor with binning casts /// @param binning the cast values for the grid binning - IndexedRootVolumeFinderBuilder(std::vector binning); + IndexedRootVolumeFinderBuilder(std::vector binning); /// The virtual interface definition for root volume finder builders /// @@ -40,7 +40,7 @@ class IndexedRootVolumeFinderBuilder final : public IRootVolumeFinderBuilder { const final; private: - std::vector m_casts; + std::vector m_casts; }; } // namespace Acts::Experimental diff --git a/Core/include/Acts/Detector/KdtSurfacesProvider.hpp b/Core/include/Acts/Detector/KdtSurfacesProvider.hpp index 72bea84737f..74a4a195f1c 100644 --- a/Core/include/Acts/Detector/KdtSurfacesProvider.hpp +++ b/Core/include/Acts/Detector/KdtSurfacesProvider.hpp @@ -12,7 +12,7 @@ #include "Acts/Detector/detail/ReferenceGenerators.hpp" #include "Acts/Detector/interface/ISurfacesProvider.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/BinningData.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/KDTree.hpp" #include @@ -50,7 +50,7 @@ class KdtSurfaces { /// @param rgen the reference point generator KdtSurfaces(const GeometryContext& gctx, const std::vector>& surfaces, - const std::array& casts, + const std::array& casts, const reference_generator& rgen = detail::PolyhedronReferenceGenerator<1u, false>{}) : m_kdt(nullptr), m_casts(casts), m_rGenerator(rgen) { @@ -113,7 +113,7 @@ class KdtSurfaces { std::unique_ptr m_kdt = nullptr; /// Cast values that turn a global position to lookup position - std::array m_casts = {}; + std::array m_casts = {}; /// Helper to generate reference points for filling reference_generator m_rGenerator; diff --git a/Core/include/Acts/Detector/ProtoBinning.hpp b/Core/include/Acts/Detector/ProtoBinning.hpp index 3700dfc4d6f..231405d5991 100644 --- a/Core/include/Acts/Detector/ProtoBinning.hpp +++ b/Core/include/Acts/Detector/ProtoBinning.hpp @@ -10,9 +10,8 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Common.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinUtility.hpp" -#include "Acts/Utilities/BinningType.hpp" #include #include @@ -27,8 +26,8 @@ namespace Acts::Experimental { /// only for convenience that the binning can be defined and then /// translated into concrete axis types struct ProtoBinning { - /// The binning value of this - BinningValue binValue; + /// The axis direction + AxisDirection axisDir; /// The axis type: equidistant or variable Acts::AxisType axisType = Acts::AxisType::Equidistant; /// The axis boundary type: Open, Bound or Closed @@ -42,13 +41,13 @@ struct ProtoBinning { /// Convenience constructors - for variable binning /// - /// @param bValue the value/cast in which this is binned + /// @param aDir the value/cast in which this is binned /// @param bType the axis boundary type /// @param e the bin edges (variable binning) /// @param exp the expansion (in bins) - ProtoBinning(BinningValue bValue, Acts::AxisBoundaryType bType, + ProtoBinning(AxisDirection aDir, Acts::AxisBoundaryType bType, const std::vector& e, std::size_t exp = 0u) - : binValue(bValue), + : axisDir(aDir), axisType(Acts::AxisType::Variable), boundaryType(bType), edges(e), @@ -61,18 +60,18 @@ struct ProtoBinning { /// Convenience constructors - for equidistant binning /// - /// @param bValue the value/cast in which this is binned + /// @param aDir the value/cast in which this is binned /// @param bType the axis boundary type /// @param minE the lowest edge of the binning /// @param maxE the highest edge of the binning /// @param nbins the number of bins /// @param exp the expansion (in bins) - ProtoBinning(BinningValue bValue, Acts::AxisBoundaryType bType, double minE, + ProtoBinning(AxisDirection aDir, Acts::AxisBoundaryType bType, double minE, double maxE, std::size_t nbins, std::size_t exp = 0u) - : binValue(bValue), boundaryType(bType), expansion(exp) { + : axisDir(aDir), boundaryType(bType), expansion(exp) { if (minE >= maxE) { - std::string msg = "ProtoBinning: Invalid binning for value '"; - msg += binningValueName(bValue); + std::string msg = "ProtoBinning: Invalid axis range for direction '"; + msg += axisDirectionName(axisDir); msg += "', min edge (" + std::to_string(minE) + ") "; msg += " needs to be smaller than max edge ("; msg += std::to_string(maxE) + ")."; @@ -96,13 +95,13 @@ struct ProtoBinning { /// when the actual extent is not yet evaluated, only works /// for equidistant binning obviously /// - /// @param bValue the value/cast in which this is binned + /// @param aDir the value/cast in which this is binned /// @param bType the axis boundary type /// @param nbins the number of bins /// @param exp the expansion (in bins) - ProtoBinning(BinningValue bValue, Acts::AxisBoundaryType bType, + ProtoBinning(AxisDirection aDir, Acts::AxisBoundaryType bType, std::size_t nbins, std::size_t exp = 0u) - : binValue(bValue), + : axisDir(aDir), boundaryType(bType), edges(nbins + 1, 0.), expansion(exp), @@ -115,7 +114,7 @@ struct ProtoBinning { std::string toString() const { std::stringstream ss; ss << "ProtoBinning: " << bins() << " bins in " - << binningValueName(binValue); + << axisDirectionName(axisDir); ss << (axisType == Acts::AxisType::Variable ? ", variable " : ", equidistant "); if (!autorange) { @@ -165,12 +164,12 @@ struct BinningDescription { : Acts::closed; if (b.axisType == Acts::AxisType::Equidistant) { binUtility += BinUtility(b.bins(), b.edges.front(), b.edges.back(), - bOption, b.binValue); + bOption, b.axisDir); } else { std::vector edges; std::for_each(b.edges.begin(), b.edges.end(), [&](double edge) { edges.push_back(edge); }); - binUtility += BinUtility(edges, bOption, b.binValue); + binUtility += BinUtility(edges, bOption, b.axisDir); } } return binUtility; diff --git a/Core/include/Acts/Detector/ProtoDetector.hpp b/Core/include/Acts/Detector/ProtoDetector.hpp index 5e4e4d426c2..50a6797d203 100644 --- a/Core/include/Acts/Detector/ProtoDetector.hpp +++ b/Core/include/Acts/Detector/ProtoDetector.hpp @@ -98,12 +98,12 @@ struct ProtoVolume { void extendUp(ProtoVolume& ptVolume); /// Extend the tracking volume with its own constituents - /// @param bValue the binning value that is propagated - void propagateMinDown(BinningValue bValue); + /// @param aDir the axis direction that is propagated + void propagateMinDown(AxisDirection aDir); /// Extend the tracking volume with its own constituents - /// @param bValue the binning value that is propagated - void propagateMaxDown(BinningValue bValue); + /// @param aDir the axis direction that is propagated + void propagateMaxDown(AxisDirection aDir); /// Constrain the daughter volumes with this volume /// diff --git a/Core/include/Acts/Detector/ProtoSupport.hpp b/Core/include/Acts/Detector/ProtoSupport.hpp index abde3a71539..2c02bd2ba22 100644 --- a/Core/include/Acts/Detector/ProtoSupport.hpp +++ b/Core/include/Acts/Detector/ProtoSupport.hpp @@ -12,7 +12,7 @@ #include "Acts/Definitions/Common.hpp" #include "Acts/Detector/ProtoBinning.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningData.hpp" #include @@ -55,7 +55,7 @@ struct ProtoSupport { /// The internal constraint would overwrite the volume one in order to allow /// support surfaces to be fitted from global volume extensions to the /// actually contained internal objects. - std::vector internalConstraints = {}; + std::vector internalConstraints = {}; // Building instructions 2 (surface is provided): @@ -69,7 +69,7 @@ struct ProtoSupport { unsigned int splits = 1u; /// Planar placement (only valid for planar support surfaces) - BinningValue pPlacement = BinningValue::binZ; + AxisDirection pPlacement = AxisDirection::AxisZ; /// Indicate if the support surface(s) should always be addressed in /// navigation diff --git a/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp b/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp index eda1da8452b..2388e7bad06 100644 --- a/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp +++ b/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp @@ -33,7 +33,7 @@ namespace detail::CuboidalDetectorHelper { /// /// @param gctx The geometry context /// @param volumes the volumes -/// @param bValue the binning value (allowed are binX, binY, binZ) +/// @param bValue the binning value (allowed are AxisX, AxisY, AxisZ) /// @param selectedOnly switch only selected boundaries /// @param logLevel is the screen logging level /// @@ -43,7 +43,7 @@ namespace detail::CuboidalDetectorHelper { /// @return a proto container with the outside portals DetectorComponent::PortalContainer connect( const GeometryContext& gctx, - std::vector>& volumes, BinningValue bValue, + std::vector>& volumes, AxisDirection bValue, const std::vector& selectedOnly = {}, Acts::Logging::Level logLevel = Acts::Logging::INFO); @@ -51,7 +51,7 @@ DetectorComponent::PortalContainer connect( /// /// @param gctx The geometry context /// @param containers the containers -/// @param bValue the binning value (allowed are binX, binY, binZ) +/// @param bValue the binning value (allowed are AxisX, AxisY, AxisZ) /// @param selectedOnly switch only selected boundaries /// @param logLevel is the screen logging level /// @@ -62,7 +62,7 @@ DetectorComponent::PortalContainer connect( DetectorComponent::PortalContainer connect( const GeometryContext& gctx, const std::vector& containers, - BinningValue bValue, const std::vector& selectedOnly = {}, + AxisDirection bValue, const std::vector& selectedOnly = {}, Acts::Logging::Level logLevel = Acts::Logging::INFO); /// @brief Helper method to extract r,z,phi boundaries for diff --git a/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp b/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp index f4de79980f3..c02ef00a011 100644 --- a/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp +++ b/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp @@ -48,7 +48,7 @@ void checkRotationAlignment( std::vector checkCenterAlignment( const GeometryContext& gctx, const std::vector>& volumes, - BinningValue axisValue); + AxisDirection axisValue); } // namespace detail::DetectorVolumeConsistency } // namespace Acts::Experimental diff --git a/Core/include/Acts/Detector/detail/IndexedSurfacesGenerator.hpp b/Core/include/Acts/Detector/detail/IndexedSurfacesGenerator.hpp index 83dc9170208..08fc8043d99 100644 --- a/Core/include/Acts/Detector/detail/IndexedSurfacesGenerator.hpp +++ b/Core/include/Acts/Detector/detail/IndexedSurfacesGenerator.hpp @@ -38,7 +38,7 @@ struct IndexedSurfacesGenerator { // Indices of surfaces that are to be assigned to all bins std::vector assignToAll = {}; /// The binning for the indexing - std::vector bValues = {}; + std::vector bValues = {}; // Bin expansion std::vector binExpansion = {}; /// The transform into the local binning schema @@ -68,7 +68,7 @@ struct IndexedSurfacesGenerator { typename axis_generator::template grid_type>; GridType grid(std::move(aGenerator())); - std::array bvArray = {}; + std::array bvArray = {}; for (auto [ibv, bv] : enumerate(bValues)) { bvArray[ibv] = bv; } diff --git a/Core/include/Acts/Detector/detail/PortalHelper.hpp b/Core/include/Acts/Detector/detail/PortalHelper.hpp index ba54513976b..0798432c29a 100644 --- a/Core/include/Acts/Detector/detail/PortalHelper.hpp +++ b/Core/include/Acts/Detector/detail/PortalHelper.hpp @@ -34,7 +34,7 @@ class Portal; /// gathered from the sub volumes, the binning description using PortalReplacement = std::tuple, unsigned int, Direction, - std::vector, BinningValue>; + std::vector, AxisDirection>; namespace detail::PortalHelper { @@ -63,7 +63,7 @@ void attachDetectorVolumesUpdater( const GeometryContext& gctx, Portal& portal, const std::vector>& volumes, const Direction& direction, const std::vector& boundaries, - const BinningValue& binning); + const AxisDirection& binning); /// @brief Create and attach the multi link updator, the portal will get /// a volume updator attached, that points to the different sub volumes diff --git a/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp b/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp index db77685a2bc..27c2dab0cf9 100644 --- a/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp +++ b/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp @@ -41,8 +41,8 @@ struct CenterReferenceGenerator { /// /// This generator will provide only one filling point and hence /// only a single bin in the indexed grid. -template -struct BinningValueReferenceGenerator { +template +struct AxisDirectionReferenceGenerator { /// Helper to access a reference position based on binning value /// /// @param gctx the geometry context of this operation @@ -51,7 +51,7 @@ struct BinningValueReferenceGenerator { /// @return a vector of reference points for filling const std::vector references(const GeometryContext& gctx, const Surface& surface) const { - return {surface.binningPosition(gctx, bVAL)}; + return {surface.referencePosition(gctx, bVAL)}; } }; diff --git a/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp b/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp index 9c52e961498..3eef98dfd3a 100644 --- a/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp +++ b/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp @@ -95,7 +95,7 @@ struct DiscSupport { /// @brief Helper method to build planar support structure struct RectangularSupport { /// Placement - the remaining loc0, loc1 are then cyclic - BinningValue pPlacement = BinningValue::binZ; + AxisDirection pPlacement = AxisDirection::AxisZ; /// Offset in position placement double pOffset = 0.; diff --git a/Core/include/Acts/EventData/VectorMultiTrajectory.hpp b/Core/include/Acts/EventData/VectorMultiTrajectory.hpp index 8f416dd6969..4238afd88f6 100644 --- a/Core/include/Acts/EventData/VectorMultiTrajectory.hpp +++ b/Core/include/Acts/EventData/VectorMultiTrajectory.hpp @@ -192,7 +192,7 @@ class VectorMultiTrajectoryBase { TrackStatePropMask allocMask = TrackStatePropMask::None; }; - VectorMultiTrajectoryBase() = default; + VectorMultiTrajectoryBase() noexcept = default; VectorMultiTrajectoryBase(const VectorMultiTrajectoryBase& other) : m_index{other.m_index}, @@ -388,7 +388,7 @@ class VectorMultiTrajectory final VectorMultiTrajectory(const VectorMultiTrajectory& other) : VectorMultiTrajectoryBase{other} {} - VectorMultiTrajectory(VectorMultiTrajectory&& other) + VectorMultiTrajectory(VectorMultiTrajectory&& other) noexcept : VectorMultiTrajectoryBase{std::move(other)} {} Statistics statistics() const { diff --git a/Core/include/Acts/Geometry/BlueprintNode.hpp b/Core/include/Acts/Geometry/BlueprintNode.hpp index e159c463067..63a0e8b83e7 100644 --- a/Core/include/Acts/Geometry/BlueprintNode.hpp +++ b/Core/include/Acts/Geometry/BlueprintNode.hpp @@ -12,7 +12,7 @@ #include "Acts/Geometry/BlueprintOptions.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/NavigationPolicyFactory.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/TransformRange.hpp" @@ -192,7 +192,7 @@ class BlueprintNode { /// @ref Acts::CylinderVolumeStack for details. /// @param callback An optional callback that receives the node as an argument CylinderContainerBlueprintNode& addCylinderContainer( - const std::string& name, BinningValue direction, + const std::string& name, AxisDirection direction, const std::function& callback = {}); diff --git a/Core/include/Acts/Geometry/CompositePortalLink.hpp b/Core/include/Acts/Geometry/CompositePortalLink.hpp index 231af047b6c..f06144e682a 100644 --- a/Core/include/Acts/Geometry/CompositePortalLink.hpp +++ b/Core/include/Acts/Geometry/CompositePortalLink.hpp @@ -51,8 +51,8 @@ class CompositePortalLink final : public PortalLinkBase { /// @param direction The binning direction /// @param flatten If true, the composite will flatten any nested composite CompositePortalLink(std::unique_ptr a, - std::unique_ptr b, BinningValue direction, - bool flatten = true); + std::unique_ptr b, + AxisDirection direction, bool flatten = true); /// Construct a composite portal from any number of arbitrary other portal /// links. The only requirement is that the portal link surfaces are @@ -61,7 +61,7 @@ class CompositePortalLink final : public PortalLinkBase { /// @param direction The binning direction /// @param flatten If true, the composite will flatten any nested composite CompositePortalLink(std::vector> links, - BinningValue direction, bool flatten = true); + AxisDirection direction, bool flatten = true); /// Print the composite portal link /// @param os The output stream @@ -110,7 +110,7 @@ class CompositePortalLink final : public PortalLinkBase { boost::container::small_vector, 4> m_children{}; - BinningValue m_direction; + AxisDirection m_direction; }; } // namespace Acts diff --git a/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp b/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp index bc3c75ac70d..39344352eda 100644 --- a/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp @@ -11,6 +11,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/Volume.hpp" #include "Acts/Geometry/VolumeBounds.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BoundingBox.hpp" #include @@ -118,21 +119,22 @@ class CuboidVolumeBounds : public VolumeBounds { const Vector3& envelope = {0, 0, 0}, const Volume* entity = nullptr) const final; - /// Get the canonical binning values, i.e. the binning values + /// Get the canonical binning direction, i.e. the binning directions /// for that fully describe the shape's extent /// /// @return vector of canonical binning values - std::vector canonicalBinning() const override { - return {Acts::BinningValue::binX, Acts::BinningValue::binY, - Acts::BinningValue::binZ}; + std::vector canonicalAxes() const override { + using enum AxisDirection; + return {AxisX, AxisY, AxisZ}; }; /// Binning borders in double /// - /// @param bValue is the binning schema used + /// @param aDir is the axis direction for which the + /// reference border is requested /// /// @return float offset to be used for the binning - double binningBorder(BinningValue bValue) const final; + double referenceBorder(AxisDirection aDir) const final; /// Access to the bound values /// @param bValue the class nested enum for the array access diff --git a/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp b/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp index 185d55f229d..c0eb1695302 100644 --- a/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp +++ b/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp @@ -11,7 +11,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/ITrackingVolumeBuilder.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -82,7 +82,7 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder { // An optional rotation for this std::optional rotation{std::nullopt}; // Dimension for the binning - Acts::BinningValue binningDimension = Acts::BinningValue::binX; + Acts::AxisDirection binningDimension = Acts::AxisDirection::AxisX; }; /// @brief This struct stores the data for the construction of a cuboid @@ -105,7 +105,7 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder { // Material std::shared_ptr volumeMaterial = nullptr; // Dimension for the binning - Acts::BinningValue binningDimension = Acts::BinningValue::binX; + Acts::AxisDirection binningDimension = Acts::AxisDirection::AxisX; }; /// @brief This struct stores the configuration of the tracking geometry @@ -176,7 +176,7 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder { const VolumeConfig& cfg) const; void sortVolumes(std::vector>& tapVec, - BinningValue bValue) const; + AxisDirection bValue) const; /// @brief This function builds a world TrackingVolume based on a given /// configuration diff --git a/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp b/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp index 5d7278219da..c90791e376a 100644 --- a/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp @@ -11,6 +11,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/Volume.hpp" #include "Acts/Geometry/VolumeBounds.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -109,13 +110,13 @@ class CutoutCylinderVolumeBounds : public VolumeBounds { const Vector3& envelope = {0, 0, 0}, const Volume* entity = nullptr) const final; - /// Get the canonical binning values, i.e. the binning values - /// for that fully describe the shape's extent + /// Get the canonical binning direction, i.e. the axis values + /// that fully describe the shape's extent /// /// @return vector of canonical binning values - std::vector canonicalBinning() const override { - return {Acts::BinningValue::binR, Acts::BinningValue::binPhi, - Acts::BinningValue::binZ}; + std::vector canonicalAxes() const override { + using enum AxisDirection; + return {AxisR, AxisPhi, AxisZ}; }; /// Write information about this instance to an outstream diff --git a/Core/include/Acts/Geometry/CylinderContainerBlueprintNode.hpp b/Core/include/Acts/Geometry/CylinderContainerBlueprintNode.hpp index 637f1594c0c..decd92facd9 100644 --- a/Core/include/Acts/Geometry/CylinderContainerBlueprintNode.hpp +++ b/Core/include/Acts/Geometry/CylinderContainerBlueprintNode.hpp @@ -11,7 +11,7 @@ #include "Acts/Geometry/BlueprintNode.hpp" #include "Acts/Geometry/CylinderVolumeStack.hpp" #include "Acts/Geometry/PortalShell.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -36,7 +36,7 @@ class CylinderContainerBlueprintNode final : public BlueprintNode { /// @note The parameters are passed through to @ref CylinderVolumeStack, /// see documentation of that class for more information CylinderContainerBlueprintNode( - const std::string& name, BinningValue direction, + const std::string& name, AxisDirection direction, CylinderVolumeStack::AttachmentStrategy attachmentStrategy = CylinderVolumeStack::AttachmentStrategy::Midpoint, CylinderVolumeStack::ResizeStrategy resizeStrategy = @@ -95,7 +95,7 @@ class CylinderContainerBlueprintNode final : public BlueprintNode { /// Setter for the stacking direction /// @param direction The stacking direction /// @return This node for chaining - CylinderContainerBlueprintNode& setDirection(BinningValue direction); + CylinderContainerBlueprintNode& setDirection(AxisDirection direction); /// Setter for the attachment strategy /// @param attachmentStrategy The attachment strategy @@ -111,7 +111,7 @@ class CylinderContainerBlueprintNode final : public BlueprintNode { /// Accessor to the stacking direction /// @return The stacking direction - BinningValue direction() const; + AxisDirection direction() const; /// Accessor to the attachment strategy /// @return The attachment strategy @@ -136,7 +136,7 @@ class CylinderContainerBlueprintNode final : public BlueprintNode { std::string m_name; - BinningValue m_direction = BinningValue::binZ; + AxisDirection m_direction = AxisDirection::AxisZ; CylinderVolumeStack::AttachmentStrategy m_attachmentStrategy{ CylinderVolumeStack::AttachmentStrategy::Midpoint}; diff --git a/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp b/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp index 3e5d8862cd8..79916c84083 100644 --- a/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp @@ -12,7 +12,7 @@ #include "Acts/Geometry/BoundarySurfaceFace.hpp" #include "Acts/Geometry/Volume.hpp" #include "Acts/Geometry/VolumeBounds.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -172,24 +172,24 @@ class CylinderVolumeBounds : public VolumeBounds { const Vector3& envelope = {0, 0, 0}, const Volume* entity = nullptr) const final; - /// Get the canonical binning values, i.e. the binning values - /// for that fully describe the shape's extent + /// Get the canonical binning directions, i.e. the axis directions + /// that fully describe the shape's extent /// /// @return vector of canonical binning values - std::vector canonicalBinning() const override { - return {Acts::BinningValue::binR, Acts::BinningValue::binPhi, - Acts::BinningValue::binZ}; + std::vector canonicalAxes() const override { + using enum AxisDirection; + return {AxisR, AxisPhi, AxisZ}; }; /// Binning offset - overloaded for some R-binning types /// - /// @param bValue is the type used for the binning - Vector3 binningOffset(BinningValue bValue) const override; + /// @param aDir is the axis direction used for the binning + Vector3 referenceOffset(AxisDirection aDir) const override; /// Binning borders in double /// - /// @param bValue is the type used for the binning - double binningBorder(BinningValue bValue) const override; + /// @param aDir is the axis direction used for the binning + double referenceBorder(AxisDirection aDir) const override; /// Output Method for std::ostream /// @param os is the output stream diff --git a/Core/include/Acts/Geometry/CylinderVolumeHelper.hpp b/Core/include/Acts/Geometry/CylinderVolumeHelper.hpp index 6156230817d..85f20ee8ea9 100644 --- a/Core/include/Acts/Geometry/CylinderVolumeHelper.hpp +++ b/Core/include/Acts/Geometry/CylinderVolumeHelper.hpp @@ -12,7 +12,7 @@ #include "Acts/Geometry/BoundarySurfaceFace.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/ITrackingVolumeHelper.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -205,7 +205,7 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { const GeometryContext& gctx, const LayerVector& layers, std::shared_ptr& cylinderVolumeBounds, const Transform3& transform, double& rMinClean, double& rMaxClean, - double& zMinClean, double& zMaxClean, BinningValue& bValue, + double& zMinClean, double& zMaxClean, AxisDirection& bValue, BinningType bType = arbitrary) const; /// Private method - interglue all volumes contained by a TrackingVolume diff --git a/Core/include/Acts/Geometry/CylinderVolumeStack.hpp b/Core/include/Acts/Geometry/CylinderVolumeStack.hpp index 06e1e75dd58..5cfa24d0ad2 100644 --- a/Core/include/Acts/Geometry/CylinderVolumeStack.hpp +++ b/Core/include/Acts/Geometry/CylinderVolumeStack.hpp @@ -11,7 +11,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/CylinderVolumeBounds.hpp" #include "Acts/Geometry/Volume.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -73,7 +73,7 @@ class CylinderVolumeStack : public Volume { /// and cannot have a @f$\phi@f$ sector or bevels. /// @note Preconditions are checked on construction CylinderVolumeStack( - std::vector& volumes, BinningValue direction, + std::vector& volumes, AxisDirection direction, AttachmentStrategy strategy = AttachmentStrategy::Midpoint, ResizeStrategy resizeStrategy = ResizeStrategy::Expand, const Logger& logger = Acts::getDummyLogger()); @@ -108,7 +108,7 @@ class CylinderVolumeStack : public Volume { /// @param direction is the binning direction /// @param strategy is the attachment strategy /// @param logger is the logger - void initializeOuterVolume(BinningValue direction, + void initializeOuterVolume(AxisDirection direction, AttachmentStrategy strategy, const Logger& logger); struct VolumeTuple; @@ -126,7 +126,7 @@ class CylinderVolumeStack : public Volume { /// @param a is the first volume /// @param b is the second volume /// @param logger is the logger - static void overlapPrint(BinningValue direction, const VolumeTuple& a, + static void overlapPrint(AxisDirection direction, const VolumeTuple& a, const VolumeTuple& b, const Logger& logger); /// Helper function that checks if volumes are properly aligned @@ -182,7 +182,7 @@ class CylinderVolumeStack : public Volume { std::shared_ptr addGapVolume( const Transform3& transform, const std::shared_ptr& bounds); - BinningValue m_direction{}; + AxisDirection m_direction{}; ResizeStrategy m_resizeStrategy{}; Transform3 m_groupTransform{}; std::vector> m_gaps{}; diff --git a/Core/include/Acts/Geometry/Extent.hpp b/Core/include/Acts/Geometry/Extent.hpp index 840a4ef582c..f34d1de8b05 100644 --- a/Core/include/Acts/Geometry/Extent.hpp +++ b/Core/include/Acts/Geometry/Extent.hpp @@ -11,7 +11,7 @@ /// @note This file is foreseen for the `Geometry` module to replace `Extent` #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Enumerate.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/RangeXD.hpp" @@ -29,20 +29,20 @@ using Envelope = std::array; constexpr Envelope zeroEnvelope = {0, 0}; -/// This struct models a multi-dimensional enveloper along the binning values +/// This struct models a multi-dimensional enveloper along the axis directions struct ExtentEnvelope { /// Access a single envelope configuration - /// @param bValue the binning value + /// @param aDir the axis definition /// @return the envelope - Envelope& operator[](BinningValue bValue) { - return m_values.at(toUnderlying(bValue)); + Envelope& operator[](AxisDirection aDir) { + return m_values.at(toUnderlying(aDir)); } /// Access a single envelope configuration - /// @param bValue the binning value + /// @param aDir the axis direction /// @return the envelope - const Envelope& operator[](BinningValue bValue) const { - return m_values.at(toUnderlying(bValue)); + const Envelope& operator[](AxisDirection aDir) const { + return m_values.at(toUnderlying(aDir)); } /// Constructor from a single envelope that is assigned to all values @@ -77,7 +77,7 @@ struct ExtentEnvelope { Envelope r = zeroEnvelope; Envelope phi = zeroEnvelope; Envelope rPhi = zeroEnvelope; - Envelope h = zeroEnvelope; + Envelope theta = zeroEnvelope; Envelope eta = zeroEnvelope; Envelope mag = zeroEnvelope; }; @@ -85,15 +85,15 @@ struct ExtentEnvelope { /// Constructor using a helper struct for designated initializaion /// @param args the arguments constexpr explicit ExtentEnvelope(Arguments&& args) { - using enum BinningValue; - m_values[toUnderlying(binX)] = args.x; - m_values[toUnderlying(binY)] = args.y; - m_values[toUnderlying(binZ)] = args.z; - m_values[toUnderlying(binR)] = args.r; - m_values[toUnderlying(binPhi)] = args.phi; - m_values[toUnderlying(binH)] = args.h; - m_values[toUnderlying(binEta)] = args.eta; - m_values[toUnderlying(binMag)] = args.mag; + using enum AxisDirection; + m_values[toUnderlying(AxisX)] = args.x; + m_values[toUnderlying(AxisY)] = args.y; + m_values[toUnderlying(AxisZ)] = args.z; + m_values[toUnderlying(AxisR)] = args.r; + m_values[toUnderlying(AxisPhi)] = args.phi; + m_values[toUnderlying(AxisTheta)] = args.theta; + m_values[toUnderlying(AxisEta)] = args.eta; + m_values[toUnderlying(AxisMag)] = args.mag; } /// Comparison operator between envelope sets @@ -105,11 +105,11 @@ struct ExtentEnvelope { } private: - std::array m_values{}; + std::array m_values{}; }; /// A class representing the geometric extent of an object in its possible -/// dimensions, these can be all dimensions that are described as BinningValues +/// dimensions, these can be all dimensions that are described as AxisDirections /// /// The extent object can have an optional envelope in all of those values /// @note that the consistency of the different envelopes is not checked @@ -125,28 +125,28 @@ class Extent { /// Extend with a position vertex /// /// @param vtx the vertex to be used for extending - /// @param bValues the binning values + /// @param aDirs the axis directions /// @param applyEnv boolean to steer if envelope should be applied /// @param fillHistograms is a boolean flag to steer whether the values /// to fill this extent should be stored void extend(const Vector3& vtx, - const std::vector& bValues = allBinningValues(), + const std::vector& aDirs = allAxisDirections(), bool applyEnv = true, bool fillHistograms = false); /// Extend with a set of vectors by iterators /// /// @param start the start iterator of the loop /// @param end the end iterator of the loop - /// @param bValues the binning values + /// @param aDirs the axis directions /// @param applyEnv boolean to steer if envelope should be applied /// @param fillHistograms is a boolean flag to steer whether the values /// to fill this extent should be stored template void extend(const vector_iterator_t& start, const vector_iterator_t& end, - const std::vector& bValues = allBinningValues(), + const std::vector& aDirs = allAxisDirections(), bool applyEnv = true, bool fillHistograms = false) { for (vector_iterator_t vIt = start; vIt < end; ++vIt) { - extend(*vIt, bValues, applyEnv, fillHistograms); + extend(*vIt, aDirs, applyEnv, fillHistograms); } } @@ -158,14 +158,14 @@ class Extent { /// which then is applied to the current one /// /// @param rhs is the other source Extent - /// @param bValues the binning values + /// @param aDirs the axis directions /// @param applyEnv boolean to steer if envelope should be applied /// on the constraint values, if only an envelope is given /// but the value not constraint, then it is always applied /// /// @note that the histogram values can not be filled in this call void extend(const Extent& rhs, - const std::vector& bValues = allBinningValues(), + const std::vector& aDirs = allAxisDirections(), bool applyEnv = true); /// Constrain an extent by another one, this is @@ -180,22 +180,22 @@ class Extent { /// Set a range for a dedicated binning value /// - /// @param bValue the binning identification + /// @param aDir the axis direction /// @param min the minimum parameter /// @param max the maximum parameter - void set(BinningValue bValue, double min, double max); + void set(AxisDirection aDir, double min, double max); /// Set a min value for a dedicated binning value /// - /// @param bValue the binning identification + /// @param aDir the axis direction /// @param min the minimum parameter - void setMin(BinningValue bValue, double min); + void setMin(AxisDirection aDir, double min); /// Set a max value for a dedicated binning value /// - /// @param bValue the binning identification + /// @param aDir the axis direction /// @param max the maximum parameter - void setMax(BinningValue bValue, double max); + void setMax(AxisDirection aDir, double max); /// (re-)Set the envelope /// @@ -204,31 +204,31 @@ class Extent { /// Return the individual 1-dimensional range /// - /// @param bValue is the binning value to be returned + /// @param aDir is the axis direction to be returned /// /// @return a one dimensional arrange - auto range(BinningValue bValue) { return m_range[toUnderlying(bValue)]; } + auto range(AxisDirection aDir) { return m_range[toUnderlying(aDir)]; } /// Return the individual 1-dimensional range /// - /// @param bValue is the binning value to be returned + /// @param aDir is the axis direction to be returned /// /// @return a one dimensional arrange - Range1D range(BinningValue bValue) const; + Range1D range(AxisDirection aDir) const; /// Return the N-dimension range - const RangeXD& range() const; + const RangeXD& range() const; /// Return an D-dimensional sub range according to the /// the given binvalues /// @tparam kSUBDIM the number of sub dimensions - /// @param binValues the binning values + /// @param axisDirections the axis directions /// @return the sub range template RangeXD range( - const std::array& binValues) const { + const std::array& axisDirections) const { RangeXD rRange; - for (auto [i, v] : enumerate(binValues)) { + for (auto [i, v] : enumerate(axisDirections)) { rRange[i] = range(v); } return rRange; @@ -243,47 +243,47 @@ class Extent { /// Return the histogram store /// /// The histogram store can be used for automated binning detection - const std::array, numBinningValues()>& valueHistograms() + const std::array, numAxisDirections()>& valueHistograms() const; /// Access the minimum parameter /// - /// @param bValue the binning identification - double min(BinningValue bValue) const { - return m_range[toUnderlying(bValue)].min(); + /// @param aDir the axis direction + double min(AxisDirection aDir) const { + return m_range[toUnderlying(aDir)].min(); } /// Access the maximum parameter /// - /// @param bValue the binning identification - double max(BinningValue bValue) const { - return m_range[toUnderlying(bValue)].max(); + /// @param aDir the axis direction + double max(AxisDirection aDir) const { + return m_range[toUnderlying(aDir)].max(); } /// Access the midpoint /// - /// @param bValue the binning identification - double medium(BinningValue bValue) const { - return 0.5 * (m_range[toUnderlying(bValue)].min() + - m_range[toUnderlying(bValue)].max()); + /// @param aDir the axis direction + double medium(AxisDirection aDir) const { + return 0.5 * (m_range[toUnderlying(aDir)].min() + + m_range[toUnderlying(aDir)].max()); } /// Access the parameter interval (i.e. the range span) /// - /// @param bValue the binning identification - double interval(BinningValue bValue) const { - return m_range[toUnderlying(bValue)].size(); + /// @param aDir the axis direction + double interval(AxisDirection aDir) const { + return m_range[toUnderlying(aDir)].size(); } /// Contains check /// /// @param rhs the extent that is check if it is contained - /// @param bValue is the binning value, if set to nullopt + /// @param aDir is the axis direction, if set to nullopt /// the check on all is done /// /// @return true if the rhs is contained bool contains(const Extent& rhs, - std::optional bValue = std::nullopt) const; + std::optional aDir = std::nullopt) const; /// Contains check for a single point /// @@ -295,17 +295,17 @@ class Extent { /// Intersection checks /// /// @param rhs the extent that is check for intersection - /// @param bValue is the binning value, if set to nulloptr + /// @param aDir is the axis direction, if set to nulloptr /// the check on all is done /// /// @return true if the rhs intersects bool intersects(const Extent& rhs, - std::optional bValue = std::nullopt) const; + std::optional aDir = std::nullopt) const; /// Check if this object constrains a given direction /// - /// @param bValue is the binning value - bool constrains(BinningValue bValue) const; + /// @param aDir is the axis direction + bool constrains(AxisDirection aDir) const; /// Check if this object constrains any direction bool constrains() const; @@ -317,20 +317,20 @@ class Extent { private: /// A bitset that remembers the constraint values - std::bitset m_constrains{0}; + std::bitset m_constrains{0}; /// The actual range store - RangeXD m_range; + RangeXD m_range; /// A potential envelope ExtentEnvelope m_envelope = ExtentEnvelope::Zero(); /// (Optional) Value histograms for bin detection - std::array, numBinningValues()> m_valueHistograms; + std::array, numAxisDirections()> m_valueHistograms; }; -inline Range1D Acts::Extent::range(BinningValue bValue) const { - return m_range[toUnderlying(bValue)]; +inline Range1D Acts::Extent::range(AxisDirection aDir) const { + return m_range[toUnderlying(aDir)]; } -inline const RangeXD& Extent::range() const { +inline const RangeXD& Extent::range() const { return m_range; } @@ -342,7 +342,7 @@ inline const ExtentEnvelope& Extent::envelope() const { return m_envelope; } -inline const std::array, numBinningValues()>& +inline const std::array, numAxisDirections()>& Extent::valueHistograms() const { return m_valueHistograms; } diff --git a/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp b/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp index 5f063a62842..93ebeaa828b 100644 --- a/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp @@ -89,13 +89,13 @@ class GenericCuboidVolumeBounds : public VolumeBounds { const Vector3& envelope = {0, 0, 0}, const Volume* entity = nullptr) const final; - /// Get the canonical binning values, i.e. the binning values - /// for that fully describe the shape's extent + /// Get the canonical direction values, i.e. the axis directions + /// that fully describe the shape's extent /// /// @return vector of canonical binning values - std::vector canonicalBinning() const override { - return {Acts::BinningValue::binX, Acts::BinningValue::binY, - Acts::BinningValue::binZ}; + std::vector canonicalAxes() const override { + using enum AxisDirection; + return {AxisX, AxisY, AxisZ}; }; /// @param sl is the output stream to be written into diff --git a/Core/include/Acts/Geometry/GeometryHierarchyMap.hpp b/Core/include/Acts/Geometry/GeometryHierarchyMap.hpp index 3bdfc63425b..61cdcdb5e6d 100644 --- a/Core/include/Acts/Geometry/GeometryHierarchyMap.hpp +++ b/Core/include/Acts/Geometry/GeometryHierarchyMap.hpp @@ -79,10 +79,10 @@ class GeometryHierarchyMap { // defaulted constructors and assignment operators GeometryHierarchyMap() = default; GeometryHierarchyMap(const GeometryHierarchyMap&) = default; - GeometryHierarchyMap(GeometryHierarchyMap&&) = default; + GeometryHierarchyMap(GeometryHierarchyMap&&) noexcept = default; ~GeometryHierarchyMap() = default; GeometryHierarchyMap& operator=(const GeometryHierarchyMap&) = default; - GeometryHierarchyMap& operator=(GeometryHierarchyMap&&) = default; + GeometryHierarchyMap& operator=(GeometryHierarchyMap&&) noexcept = default; /// Return an iterator pointing to the beginning of the stored values. Iterator begin() const { return m_values.begin(); } diff --git a/Core/include/Acts/Geometry/GeometryObject.hpp b/Core/include/Acts/Geometry/GeometryObject.hpp index a3754996a1e..191d2234cd5 100644 --- a/Core/include/Acts/Geometry/GeometryObject.hpp +++ b/Core/include/Acts/Geometry/GeometryObject.hpp @@ -12,7 +12,7 @@ #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/Geometry/Polyhedron.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/VectorHelpers.hpp" namespace Acts { @@ -20,7 +20,7 @@ namespace Acts { /// Base class to provide GeometryIdentifier interface: /// - simple set and get /// -/// It also provides the binningPosition method for +/// It also provides the referencePosition method for /// Geometry geometrical object to be binned in BinnedArrays /// class GeometryObject { @@ -53,20 +53,20 @@ class GeometryObject { /// Force a binning position method /// /// @param gctx The current geometry context object, e.g. alignment - /// @param bValue is the value in which you want to bin + /// @param aDir is the value for which the reference position is requesed /// /// @return vector 3D used for the binning schema - virtual Vector3 binningPosition(const GeometryContext& gctx, - BinningValue bValue) const = 0; + virtual Vector3 referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const = 0; /// Implement the binningValue /// /// @param gctx The current geometry context object, e.g. alignment - /// @param bValue is the dobule in which you want to bin + /// @param aDir is the dobule in which you want to bin /// /// @return float to be used for the binning schema - virtual double binningPositionValue(const GeometryContext& gctx, - BinningValue bValue) const; + virtual double referencePositionValue(const GeometryContext& gctx, + AxisDirection aDir) const; /// Set the value /// @@ -86,9 +86,9 @@ inline void GeometryObject::assignGeometryId( m_geometryId = geometryId; } -inline double GeometryObject::binningPositionValue(const GeometryContext& gctx, - BinningValue bValue) const { - return VectorHelpers::cast(binningPosition(gctx, bValue), bValue); +inline double GeometryObject::referencePositionValue( + const GeometryContext& gctx, AxisDirection aDir) const { + return VectorHelpers::cast(referencePosition(gctx, aDir), aDir); } } // namespace Acts diff --git a/Core/include/Acts/Geometry/GeometryObjectSorter.hpp b/Core/include/Acts/Geometry/GeometryObjectSorter.hpp index 5783103d6af..6de46fbb86a 100644 --- a/Core/include/Acts/Geometry/GeometryObjectSorter.hpp +++ b/Core/include/Acts/Geometry/GeometryObjectSorter.hpp @@ -15,6 +15,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/GeometryContext.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/VectorHelpers.hpp" #include @@ -27,8 +28,8 @@ class ObjectSorterT { public: /// Constructor from a binning value /// - /// @param bValue is the value in which the binning is done - ObjectSorterT(BinningValue bValue) : m_binningValue(bValue) {} + /// @param aDir is the direction in which the sorting is done + explicit ObjectSorterT(AxisDirection aDir) : m_sortingDirection(aDir) {} /// Comparison operator /// @@ -37,32 +38,33 @@ class ObjectSorterT { /// /// @return boolean indicator bool operator()(T one, T two) const { - using Acts::VectorHelpers::eta; - using Acts::VectorHelpers::perp; - using Acts::VectorHelpers::phi; - switch (m_binningValue) { + using VectorHelpers::eta; + using VectorHelpers::perp; + using VectorHelpers::phi; + using enum AxisDirection; + switch (m_sortingDirection) { // compare on x - case BinningValue::binX: { + case AxisX: { return one.x() < two.x(); } // compare on y - case BinningValue::binY: { + case AxisY: { return one.y() < two.y(); } // compare on z - case BinningValue::binZ: { + case AxisZ: { return one.z() < two.z(); } // compare on r - case BinningValue::binR: { + case AxisR: { return perp(one) < perp(two); } // compare on phi - case BinningValue::binPhi: { + case AxisPhi: { return phi(one) < phi(two); } // compare on eta - case BinningValue::binEta: { + case AxisEta: { return eta(one) < eta(two); } // default for the moment @@ -72,10 +74,10 @@ class ObjectSorterT { } } - BinningValue binningValue() const { return m_binningValue; } + AxisDirection sortingDirection() const { return m_sortingDirection; } private: - BinningValue m_binningValue; ///< the binning value + AxisDirection m_sortingDirection; ///< the binning value }; /// This will check on absolute distance @@ -84,10 +86,10 @@ class DistanceSorterT { public: /// Constructor from a binning value /// - /// @param bValue is the value in which the binning is done + /// @param aDir is the value in which the sorting is done /// @param reference is the reference point - DistanceSorterT(BinningValue bValue, Vector3 reference) - : m_binningValue(bValue), + DistanceSorterT(AxisDirection aDir, Vector3 reference) + : m_sortingDirection(aDir), m_reference(reference), m_refR(VectorHelpers::perp(reference)), m_refPhi(VectorHelpers::phi(reference)), @@ -103,41 +105,41 @@ class DistanceSorterT { using Acts::VectorHelpers::eta; using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; - // switch the binning value - // - binX, binY, binZ, binR, binPhi, binRPhi, binH, binEta - switch (m_binningValue) { + // switch the sorting value + // - AxisX, AxisY, AxisZ, AxisR, AxisPhi, AxisRPhi, AxisTheta, AxisEta + switch (m_sortingDirection) { // compare on diff x - case BinningValue::binX: { + case AxisDirection::AxisX: { double diffOneX = one.x() - m_reference.x(); double diffTwoX = two.x() - m_reference.x(); return std::abs(diffOneX) < std::abs(diffTwoX); } // compare on diff y - case BinningValue::binY: { + case AxisDirection::AxisY: { double diffOneY = one.y() - m_reference.y(); double diffTwoY = two.y() - m_reference.y(); return std::abs(diffOneY) < std::abs(diffTwoY); } // compare on diff z - case BinningValue::binZ: { + case AxisDirection::AxisZ: { double diffOneZ = one.z() - m_reference.z(); double diffTwoZ = two.z() - m_reference.z(); return std::abs(diffOneZ) < std::abs(diffTwoZ); } // compare on r - case BinningValue::binR: { + case AxisDirection::AxisR: { double diffOneR = perp(one) - m_refR; double diffTwoR = perp(two) - m_refR; return std::abs(diffOneR) < std::abs(diffTwoR); } // compare on phi /// @todo add cyclic value - case BinningValue::binPhi: { + case AxisDirection::AxisPhi: { double diffOnePhi = phi(one) - m_refPhi; double diffTwoPhi = phi(two) - m_refPhi; return std::abs(diffOnePhi) < std::abs(diffTwoPhi); } // compare on eta - case BinningValue::binEta: { + case AxisDirection::AxisEta: { double diffOneEta = eta(one) - m_refEta; double diffTwoEta = eta(two) - m_refEta; return std::abs(diffOneEta) < std::abs(diffTwoEta); @@ -152,7 +154,7 @@ class DistanceSorterT { } private: - BinningValue m_binningValue; ///< the binning value + AxisDirection m_sortingDirection; ///< the sorting direction T m_reference; double m_refR; double m_refPhi; @@ -162,35 +164,37 @@ class DistanceSorterT { template class GeometryObjectSorterT { public: - /// Constructor from a binning value + /// Constructor from a sorting direction /// /// @param gctx The geometry context to use - /// @param bValue is the value in which the binning is done + /// @param aDir is the direction in which the sorting is done /// @param transform is an optional transform to be performed - GeometryObjectSorterT(const GeometryContext& gctx, BinningValue bValue, + GeometryObjectSorterT(const GeometryContext& gctx, AxisDirection aDir, std::shared_ptr transform = nullptr) : m_context(gctx), - m_objectSorter(bValue), + m_objectSorter(aDir), m_transform(std::move(transform)) {} /// Comparison operator /// - /// @tparam one first object - /// @tparam two second object + /// @tparam one is the first object + /// @tparam two is the second object /// /// @return boolean indicator bool operator()(T one, T two) const { // get the pos one / pos two - Vector3 posOne = - m_transform - ? m_transform->inverse() * - one->binningPosition(m_context, m_objectSorter.binningValue()) - : one->binningPosition(m_context, m_objectSorter.binningValue()); - Vector3 posTwo = - m_transform - ? m_transform->inverse() * - two->binningPosition(m_context, m_objectSorter.binningValue()) - : two->binningPosition(m_context, m_objectSorter.binningValue()); + Vector3 posOne = m_transform + ? m_transform->inverse() * + one->referencePosition( + m_context, m_objectSorter.sortingDirection()) + : one->referencePosition( + m_context, m_objectSorter.sortingDirection()); + Vector3 posTwo = m_transform + ? m_transform->inverse() * + two->referencePosition( + m_context, m_objectSorter.sortingDirection()) + : two->referencePosition( + m_context, m_objectSorter.sortingDirection()); // now call the distance sorter return m_objectSorter.operator()(posOne, posTwo); } diff --git a/Core/include/Acts/Geometry/GridPortalLink.hpp b/Core/include/Acts/Geometry/GridPortalLink.hpp index 94e98867905..7ba790b4d82 100644 --- a/Core/include/Acts/Geometry/GridPortalLink.hpp +++ b/Core/include/Acts/Geometry/GridPortalLink.hpp @@ -15,6 +15,7 @@ #include "Acts/Surfaces/CylinderSurface.hpp" #include "Acts/Surfaces/DiscSurface.hpp" #include "Acts/Surfaces/PlaneSurface.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/Logger.hpp" @@ -42,7 +43,7 @@ class GridPortalLink : public PortalLinkBase { /// @param surface The surface /// @param direction The binning direction GridPortalLink(std::shared_ptr surface, - BinningValue direction) + AxisDirection direction) : PortalLinkBase(std::move(surface)), m_direction(direction) {} public: @@ -56,15 +57,15 @@ class GridPortalLink : public PortalLinkBase { /// @return A unique pointer to the grid portal link template static std::unique_ptr> make( - std::shared_ptr surface, BinningValue direction, + std::shared_ptr surface, AxisDirection direction, axis_t&& axis) { - using enum BinningValue; + using enum AxisDirection; if (dynamic_cast(surface.get()) != nullptr) { - if (direction != binZ && direction != binRPhi) { + if (direction != AxisZ && direction != AxisRPhi) { throw std::invalid_argument{"Invalid binning direction"}; } } else if (dynamic_cast(surface.get()) != nullptr && - direction != binR && direction != binPhi) { + direction != AxisR && direction != AxisPhi) { throw std::invalid_argument{"Invalid binning direction"}; } @@ -84,11 +85,11 @@ class GridPortalLink : public PortalLinkBase { template static std::unique_ptr> make( std::shared_ptr surface, axis_1_t axis1, axis_2_t axis2) { - std::optional direction; + std::optional direction; if (dynamic_cast(surface.get()) != nullptr) { - direction = BinningValue::binRPhi; + direction = AxisDirection::AxisRPhi; } else if (dynamic_cast(surface.get()) != nullptr) { - direction = BinningValue::binR; + direction = AxisDirection::AxisR; } return std::make_unique>( @@ -102,7 +103,7 @@ class GridPortalLink : public PortalLinkBase { /// @return A unique pointer to the grid portal link static std::unique_ptr make( const std::shared_ptr& surface, TrackingVolume& volume, - BinningValue direction); + AxisDirection direction); /// Merge two grid portal links into a single one. The routine can merge /// one-dimenaional, tow-dimensional and mixed links. The merge will try to @@ -297,7 +298,7 @@ class GridPortalLink : public PortalLinkBase { /// to be handled by th caller! Invalid input is handled /// via exceptions. static std::unique_ptr merge( - const GridPortalLink& a, const GridPortalLink& b, BinningValue direction, + const GridPortalLink& a, const GridPortalLink& b, AxisDirection direction, const Logger& logger = getDummyLogger()); /// Return the associated grid in a type-erased form @@ -324,7 +325,7 @@ class GridPortalLink : public PortalLinkBase { /// @note For 2D grids, this will always be the loc0 /// direction, depending on the surface type. /// @return The binning direction - BinningValue direction() const { return m_direction; } + AxisDirection direction() const { return m_direction; } /// Helper function to fill the bin contents after merging. /// This called by the merging routine, and requires access to the internal @@ -335,7 +336,7 @@ class GridPortalLink : public PortalLinkBase { /// @param direction The merging direction /// @param logger The logger to use for messages static void fillMergedGrid(const GridPortalLink& a, const GridPortalLink& b, - GridPortalLink& merged, BinningValue direction, + GridPortalLink& merged, AxisDirection direction, const Logger& logger); /// Helper function that prints a textual representation of the grid with the @@ -401,7 +402,7 @@ class GridPortalLink : public PortalLinkBase { virtual const TrackingVolume* atLocalBins(IndexType indices) const = 0; private: - BinningValue m_direction; + AxisDirection m_direction; }; /// Concrete class deriving from @c GridPortalLink that boxes a concrete grid for lookup. @@ -422,19 +423,19 @@ class GridPortalLinkT : public GridPortalLink { /// @param axes The axes for the grid /// @note The axes are checked for consistency with the bounds of @p surface. GridPortalLinkT(std::shared_ptr surface, - BinningValue direction, Axes&&... axes) + AxisDirection direction, Axes&&... axes) : GridPortalLink(std::move(surface), direction), m_grid(std::tuple{std::move(axes)...}) { - using enum BinningValue; + using enum AxisDirection; if (const auto* cylinder = dynamic_cast(m_surface.get())) { checkConsistency(*cylinder); - if (direction == binRPhi) { - m_projection = &projection; - } else if (direction == binZ) { - m_projection = &projection; + if (direction == AxisRPhi) { + m_projection = &projection; + } else if (direction == AxisZ) { + m_projection = &projection; } else { throw std::invalid_argument{"Invalid binning direction"}; } @@ -443,10 +444,10 @@ class GridPortalLinkT : public GridPortalLink { dynamic_cast(m_surface.get())) { checkConsistency(*disc); - if (direction == binR) { - m_projection = &projection; - } else if (direction == BinningValue::binPhi) { - m_projection = &projection; + if (direction == AxisR) { + m_projection = &projection; + } else if (direction == AxisDirection::AxisPhi) { + m_projection = &projection; } else { throw std::invalid_argument{"Invalid binning direction"}; } @@ -580,37 +581,37 @@ class GridPortalLinkT : public GridPortalLink { private: /// Helper function that's assigned to project from the 2D local position to a /// possible 1D grid. - template + template static ActsVector projection(const Vector2& position) { - using enum BinningValue; + using enum AxisDirection; if constexpr (DIM == 2) { return position; } else { if constexpr (std::is_same_v) { - static_assert(direction == binRPhi || direction == binZ, + static_assert(direction == AxisRPhi || direction == AxisZ, "Invalid binning direction"); - if constexpr (direction == binRPhi) { + if constexpr (direction == AxisRPhi) { return ActsVector<1>{position[0]}; - } else if constexpr (direction == binZ) { + } else if constexpr (direction == AxisZ) { return ActsVector<1>{position[1]}; } } else if constexpr (std::is_same_v) { - static_assert(direction == binR || direction == binPhi, + static_assert(direction == AxisR || direction == AxisPhi, "Invalid binning direction"); - if constexpr (direction == binR) { + if constexpr (direction == AxisR) { return ActsVector<1>{position[0]}; - } else if constexpr (direction == binPhi) { + } else if constexpr (direction == AxisPhi) { return ActsVector<1>{position[1]}; } } else if constexpr (std::is_same_v) { - static_assert(direction == binX || direction == binY, + static_assert(direction == AxisX || direction == AxisY, "Invalid binning direction"); - if constexpr (direction == binX) { + if constexpr (direction == AxisX) { return ActsVector<1>{position[0]}; - } else if constexpr (direction == binY) { + } else if constexpr (direction == AxisY) { return ActsVector<1>{position[1]}; } } diff --git a/Core/include/Acts/Geometry/ILayerArrayCreator.hpp b/Core/include/Acts/Geometry/ILayerArrayCreator.hpp index d2011c89a21..b36291438cc 100644 --- a/Core/include/Acts/Geometry/ILayerArrayCreator.hpp +++ b/Core/include/Acts/Geometry/ILayerArrayCreator.hpp @@ -50,6 +50,6 @@ class ILayerArrayCreator { virtual std::unique_ptr layerArray( const GeometryContext& gctx, const LayerVector& layers, double min, double max, BinningType btype = arbitrary, - BinningValue bvalue = BinningValue::binX) const = 0; + AxisDirection bvalue = AxisDirection::AxisX) const = 0; }; } // namespace Acts diff --git a/Core/include/Acts/Geometry/ITrackingVolumeArrayCreator.hpp b/Core/include/Acts/Geometry/ITrackingVolumeArrayCreator.hpp index 01a8efd850a..615ac487577 100644 --- a/Core/include/Acts/Geometry/ITrackingVolumeArrayCreator.hpp +++ b/Core/include/Acts/Geometry/ITrackingVolumeArrayCreator.hpp @@ -9,8 +9,8 @@ #pragma once #include "Acts/Geometry/GeometryContext.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinnedArray.hpp" -#include "Acts/Utilities/BinningType.hpp" #include #include @@ -50,11 +50,11 @@ class ITrackingVolumeArrayCreator { /// /// @param [in] gctx the geometry context for this building /// @param vols are the TrackingVolumes ordered in a tracker - /// @param bVal is the binning value for the volume binning + /// @param aDir is the axis direction for the volume binning /// /// @return shared pointer to a new TrackingVolumeArray virtual std::shared_ptr trackingVolumeArray( const GeometryContext& gctx, const TrackingVolumeVector& vols, - BinningValue bVal) const = 0; + AxisDirection aDir) const = 0; }; } // namespace Acts diff --git a/Core/include/Acts/Geometry/LayerArrayCreator.hpp b/Core/include/Acts/Geometry/LayerArrayCreator.hpp index 5358483cdde..dfccc615f3d 100644 --- a/Core/include/Acts/Geometry/LayerArrayCreator.hpp +++ b/Core/include/Acts/Geometry/LayerArrayCreator.hpp @@ -10,7 +10,7 @@ #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/ILayerArrayCreator.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -54,13 +54,13 @@ class LayerArrayCreator : public ILayerArrayCreator { /// @param min is the minimum value for binning /// @param max is the maximum value for binning /// @param bType is the binning type - /// @param bValue is the value in which the binning should be done + /// @param aDir is the axis direction for the layer binning /// /// @return unique pointer to a newly created LayerArray std::unique_ptr layerArray( const GeometryContext& gctx, const LayerVector& layersInput, double min, double max, BinningType bType = arbitrary, - BinningValue bValue = BinningValue::binX) const override; + AxisDirection aDir = AxisDirection::AxisX) const override; /// set logging instance void setLogger(std::unique_ptr logger) { @@ -79,11 +79,11 @@ class LayerArrayCreator : public ILayerArrayCreator { /// @param layer object and thus needs the /// @param gctx geometry context. /// - /// @param bValue is the Binning value for the layer array + /// @param aDir is the axis direction for the binning /// @param offset is the sift for the navigation layer std::shared_ptr createNavigationSurface(const GeometryContext& gctx, const Layer& layer, - BinningValue bValue, + AxisDirection aDir, double offset) const; }; diff --git a/Core/include/Acts/Geometry/LayerCreator.hpp b/Core/include/Acts/Geometry/LayerCreator.hpp index b7996f68912..04a864f8055 100644 --- a/Core/include/Acts/Geometry/LayerCreator.hpp +++ b/Core/include/Acts/Geometry/LayerCreator.hpp @@ -13,6 +13,7 @@ #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/ProtoLayer.hpp" #include "Acts/Surfaces/SurfaceArray.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Logger.hpp" @@ -174,7 +175,7 @@ class LayerCreator { /// bValue /// @param [in] bins2 is the number of bins in the orthogonal direction to @p /// bValue - /// @param [in] bValue Direction of the aligned surfaces + /// @param [in] aDir Direction of the aligned surfaces /// @param [in] transform is the (optional) transform of the layer /// @param [in] _protoLayer (optional) proto layer specifying the dimensions /// and @@ -187,7 +188,7 @@ class LayerCreator { MutableLayerPtr planeLayer( const GeometryContext& gctx, std::vector> surfaces, std::size_t bins1, - std::size_t bins2, BinningValue bValue, + std::size_t bins2, AxisDirection aDir, std::optional _protoLayer = std::nullopt, const Transform3& transform = Transform3::Identity(), std::unique_ptr ad = nullptr) const; diff --git a/Core/include/Acts/Geometry/NavigationLayer.hpp b/Core/include/Acts/Geometry/NavigationLayer.hpp index 6c80477d98a..63536280a5a 100644 --- a/Core/include/Acts/Geometry/NavigationLayer.hpp +++ b/Core/include/Acts/Geometry/NavigationLayer.hpp @@ -13,7 +13,7 @@ #include "Acts/Geometry/Layer.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -44,12 +44,12 @@ class NavigationLayer : public Layer { /// The binning position method /// /// @param gctx The current geometry context object, e.g. alignment - /// @param bValue is the value for which the binning position is requested + /// @param aDir is the axis direction for which the reference position is requested /// - as default the center is given, but may be overloaded /// /// @return The return vector can be used for binning in a TrackingVolume - Vector3 binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + Vector3 referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const final; /// Default Constructor - deleted NavigationLayer() = delete; @@ -117,9 +117,9 @@ inline Surface& NavigationLayer::surfaceRepresentation() { return *(const_cast(m_surfaceRepresentation.get())); } -inline Vector3 NavigationLayer::binningPosition(const GeometryContext& gctx, - BinningValue bValue) const { - return m_surfaceRepresentation->binningPosition(gctx, bValue); +inline Vector3 NavigationLayer::referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const { + return m_surfaceRepresentation->referencePosition(gctx, aDir); } inline bool NavigationLayer::isOnLayer( diff --git a/Core/include/Acts/Geometry/Portal.hpp b/Core/include/Acts/Geometry/Portal.hpp index 3d1a065026f..de2018a79d4 100644 --- a/Core/include/Acts/Geometry/Portal.hpp +++ b/Core/include/Acts/Geometry/Portal.hpp @@ -10,7 +10,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Direction.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Result.hpp" @@ -163,7 +163,7 @@ class Portal { /// @param direction The direction of the merge (e.g. along z) /// @param logger The logger to push output to static Portal merge(const GeometryContext& gctx, Portal& aPortal, - Portal& bPortal, BinningValue direction, + Portal& bPortal, AxisDirection direction, const Logger& logger = getDummyLogger()); /// Resolve the volume for a 3D position and a direction diff --git a/Core/include/Acts/Geometry/PortalLinkBase.hpp b/Core/include/Acts/Geometry/PortalLinkBase.hpp index 2f8273f10b5..1d872f38562 100644 --- a/Core/include/Acts/Geometry/PortalLinkBase.hpp +++ b/Core/include/Acts/Geometry/PortalLinkBase.hpp @@ -10,7 +10,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Result.hpp" @@ -75,7 +75,7 @@ class PortalLinkBase { /// @return The merged portal link static std::unique_ptr merge( std::unique_ptr a, std::unique_ptr b, - BinningValue direction, const Logger& logger = getDummyLogger()); + AxisDirection direction, const Logger& logger = getDummyLogger()); /// Stream output function /// @param os The output stream @@ -111,7 +111,7 @@ class PortalLinkBase { /// executed. static void checkMergePreconditions(const PortalLinkBase& a, const PortalLinkBase& b, - BinningValue direction); + AxisDirection direction); std::shared_ptr m_surface; }; diff --git a/Core/include/Acts/Geometry/PortalShell.hpp b/Core/include/Acts/Geometry/PortalShell.hpp index fe9f606c576..b587af89cce 100644 --- a/Core/include/Acts/Geometry/PortalShell.hpp +++ b/Core/include/Acts/Geometry/PortalShell.hpp @@ -9,7 +9,7 @@ #pragma once #include "Acts/Geometry/CylinderVolumeBounds.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -179,7 +179,7 @@ class CylinderStackPortalShell : public CylinderPortalShell { /// @param logger A logging instance for debugging CylinderStackPortalShell(const GeometryContext& gctx, std::vector shells, - BinningValue direction, + AxisDirection direction, const Logger& logger = getDummyLogger()); /// @copydoc PortalShellBase::size @@ -205,7 +205,7 @@ class CylinderStackPortalShell : public CylinderPortalShell { std::string label() const override; private: - BinningValue m_direction; + AxisDirection m_direction; std::vector m_shells; bool m_hasInnerCylinder{true}; }; diff --git a/Core/include/Acts/Geometry/ProtoLayer.hpp b/Core/include/Acts/Geometry/ProtoLayer.hpp index cf33f255e15..93ea871eb55 100644 --- a/Core/include/Acts/Geometry/ProtoLayer.hpp +++ b/Core/include/Acts/Geometry/ProtoLayer.hpp @@ -11,7 +11,7 @@ #include "Acts/Geometry/Extent.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -79,24 +79,24 @@ struct ProtoLayer { ProtoLayer() = default; /// Get the parameters : min - /// @param bval The accessed binning value + /// @param aDir The accessed axis direction /// @param addenv The steering if enevlope is added or not - double min(BinningValue bval, bool addenv = true) const; + double min(AxisDirection aDir, bool addenv = true) const; // Get the parameters : max - /// @param bval The accessed binning value + /// @param aDir The accessed axis direction /// @param addenv The steering if enevlope is added or not - double max(BinningValue bval, bool addenv = true) const; + double max(AxisDirection aDir, bool addenv = true) const; // Get the parameters : max - /// @param bval The accessed binning value + /// @param aDir The accessed axis direction /// @param addenv The steering if enevlope is added or not - double medium(BinningValue bval, bool addenv = true) const; + double medium(AxisDirection aDir, bool addenv = true) const; // Get the parameters : max - /// @param bval The accessed binning value + /// @param aDir The accessed axis direction /// @param addenv The steering if enevlope is added or not - double range(BinningValue bval, bool addenv = true) const; + double range(AxisDirection aDir, bool addenv = true) const; /// Output to ostream /// @param sl the input ostream diff --git a/Core/include/Acts/Geometry/ProtoLayerHelper.hpp b/Core/include/Acts/Geometry/ProtoLayerHelper.hpp index 33ca14718b4..fe187954903 100644 --- a/Core/include/Acts/Geometry/ProtoLayerHelper.hpp +++ b/Core/include/Acts/Geometry/ProtoLayerHelper.hpp @@ -10,7 +10,7 @@ #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/ProtoLayer.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -30,7 +30,7 @@ struct ProtoLayer; /// @todo write more documentation on how this is done class ProtoLayerHelper { public: - using SortingConfig = std::pair; + using SortingConfig = std::pair; struct Config {}; diff --git a/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp b/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp index 9906fda7939..a1076f8c6ba 100644 --- a/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp +++ b/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp @@ -14,7 +14,7 @@ #include "Acts/Geometry/ProtoLayer.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceArray.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Logger.hpp" @@ -36,8 +36,9 @@ namespace Test { struct SurfaceArrayCreatorFixture; } -using SurfaceMatcher = std::function; +using SurfaceMatcher = + std::function; using SurfaceVector = std::vector; using SurfaceMatrix = std::vector; @@ -59,7 +60,7 @@ class SurfaceArrayCreator { struct ProtoAxis { BinningType bType = BinningType::equidistant; - BinningValue bValue = BinningValue::binX; + AxisDirection axisDir = AxisDirection::AxisX; std::size_t nBins = 0; AxisScalar min = 0; AxisScalar max = 0; @@ -216,10 +217,10 @@ class SurfaceArrayCreator { /// @warning This function requires the plane aligned with either the x-, y- /// or z-axis /// @param [in] bins1 is the number of bins in the orthogonal direction to @p - /// bValue + /// aDir /// @param [in] bins2 is the number of bins in the orthogonal direction to @p - /// bValue - /// @param [in] bValue Direction of the aligned surfaces + /// aDir + /// @param [in] aDir Direction of the aligned surfaces /// @param [in] protoLayerOpt Optional @c ProtoLayer instance /// @param [in] transform is the (optional) additional transform applied /// @@ -227,26 +228,26 @@ class SurfaceArrayCreator { std::unique_ptr surfaceArrayOnPlane( const GeometryContext& gctx, std::vector> surfaces, std::size_t bins1, - std::size_t bins2, BinningValue bValue, + std::size_t bins2, AxisDirection aDir, std::optional protoLayerOpt = std::nullopt, const Transform3& transform = Transform3::Identity()) const; /// Static check function for surface equivalent /// /// @param [in] gctx the geometry context for this check - /// @param bValue the binning value for the binning + /// @param aDir the axis direction for the binning /// @param a first surface for checking /// @param b second surface for checking static bool isSurfaceEquivalent(const GeometryContext& gctx, - BinningValue bValue, const Surface* a, + AxisDirection aDir, const Surface* a, const Surface* b) { using namespace UnitLiterals; using VectorHelpers::perp; - if (bValue == Acts::BinningValue::binPhi) { + if (aDir == Acts::AxisDirection::AxisPhi) { // Take the two binning positions - auto pos1 = a->binningPosition(gctx, BinningValue::binR), - pos2 = b->binningPosition(gctx, BinningValue::binR); + Vector3 pos1 = a->referencePosition(gctx, AxisDirection::AxisR); + Vector3 pos2 = b->referencePosition(gctx, AxisDirection::AxisR); // Project them on the (x, y) plane, where Phi angles are calculated auto proj1 = pos1.head<2>(), proj2 = pos2.head<2>(); @@ -261,15 +262,15 @@ class SurfaceArrayCreator { return std::abs(dPhi) < std::numbers::pi / 180.; } - if (bValue == Acts::BinningValue::binZ) { - return (std::abs(a->binningPosition(gctx, BinningValue::binR).z() - - b->binningPosition(gctx, BinningValue::binR).z()) < + if (aDir == Acts::AxisDirection::AxisZ) { + return (std::abs(a->referencePosition(gctx, AxisDirection::AxisR).z() - + b->referencePosition(gctx, AxisDirection::AxisR).z()) < 1_um); } - if (bValue == Acts::BinningValue::binR) { - return (std::abs(perp(a->binningPosition(gctx, BinningValue::binR)) - - perp(b->binningPosition(gctx, BinningValue::binR))) < + if (aDir == Acts::AxisDirection::AxisR) { + return (std::abs(perp(a->referencePosition(gctx, AxisDirection::AxisR)) - + perp(b->referencePosition(gctx, AxisDirection::AxisR))) < 1_um); } @@ -295,7 +296,7 @@ class SurfaceArrayCreator { std::size_t determineBinCount(const GeometryContext& gctx, const std::vector& surfaces, - BinningValue bValue) const; + AxisDirection aDir) const; /// SurfaceArrayCreator internal method /// Creates a variable @c ProtoAxis from a vector of (unsorted) surfaces with @@ -311,8 +312,8 @@ class SurfaceArrayCreator { /// @todo implement for x,y binning /// @param [in] gctx the geometry context for this call /// @param surfaces are the sensitive surfaces to be - /// @param bValue the BinningValue in which direction should be binned - /// (currently possible: binPhi, binR, binZ) + /// @param aDir the AxisDirection in which direction should be binned + /// (currently possible: AxisPhi, AxisR, AxisZ) /// @param protoLayer Instance of @c ProtoLayer holding generic layer info /// @param transform is the (optional) additional transform applied /// @return Instance of @c ProtoAxis containing determined properties @@ -320,8 +321,7 @@ class SurfaceArrayCreator { /// into an actual @c Axis object to be used ProtoAxis createVariableAxis(const GeometryContext& gctx, const std::vector& surfaces, - BinningValue bValue, - const ProtoLayer& protoLayer, + AxisDirection aDir, const ProtoLayer& protoLayer, Transform3& transform) const; /// SurfaceArrayCreator internal method @@ -338,8 +338,8 @@ class SurfaceArrayCreator { /// @todo implement for x,y binning /// @param [in] gctx the geometry context for this call /// @param surfaces are the sensitive surfaces to be - /// @param bValue the BinningValue in which direction should be binned - /// (currently possible: binPhi, binR, binZ) + /// @param aDir the AxisDirection in which direction should be binned + /// (currently possible: AxisPhi, AxisR, AxisZ) /// @param protoLayer Instance of @c ProtoLayer holding generic layer info /// @param transform is the (optional) additional transform applied /// @param nBins Number of bins to use, 0 means determine automatically @@ -348,7 +348,7 @@ class SurfaceArrayCreator { /// into an actual @c Axis object to be used ProtoAxis createEquidistantAxis(const GeometryContext& gctx, const std::vector& surfaces, - BinningValue bValue, + AxisDirection aDir, const ProtoLayer& protoLayer, Transform3& transform, std::size_t nBins = 0) const; @@ -382,7 +382,7 @@ class SurfaceArrayCreator { using SGL = SurfaceArray::SurfaceGridLookup; ptr = std::make_unique( - globalToLocal, localToGlobal, std::pair{axisA, axisB}, std::vector{pAxisA.bValue, pAxisB.bValue}); + globalToLocal, localToGlobal, std::pair{axisA, axisB}, std::vector{pAxisA.axisDir, pAxisB.axisDir}); } else if (pAxisA.bType == equidistant && pAxisB.bType == arbitrary) { @@ -391,7 +391,7 @@ class SurfaceArrayCreator { using SGL = SurfaceArray::SurfaceGridLookup; ptr = std::make_unique( - globalToLocal, localToGlobal, std::pair{axisA, axisB}, std::vector{pAxisA.bValue, pAxisB.bValue}); + globalToLocal, localToGlobal, std::pair{axisA, axisB}, std::vector{pAxisA.axisDir, pAxisB.axisDir}); } else if (pAxisA.bType == arbitrary && pAxisB.bType == equidistant) { @@ -400,7 +400,7 @@ class SurfaceArrayCreator { using SGL = SurfaceArray::SurfaceGridLookup; ptr = std::make_unique( - globalToLocal, localToGlobal, std::pair{axisA, axisB}, std::vector{pAxisA.bValue, pAxisB.bValue}); + globalToLocal, localToGlobal, std::pair{axisA, axisB}, std::vector{pAxisA.axisDir, pAxisB.axisDir}); } else /*if (pAxisA.bType == arbitrary && pAxisB.bType == arbitrary)*/ { @@ -409,7 +409,7 @@ class SurfaceArrayCreator { using SGL = SurfaceArray::SurfaceGridLookup; ptr = std::make_unique( - globalToLocal, localToGlobal, std::pair{axisA, axisB}, std::vector{pAxisA.bValue, pAxisB.bValue}); + globalToLocal, localToGlobal, std::pair{axisA, axisB}, std::vector{pAxisA.axisDir, pAxisB.axisDir}); } // clang-format on diff --git a/Core/include/Acts/Geometry/SurfaceBinningMatcher.hpp b/Core/include/Acts/Geometry/SurfaceBinningMatcher.hpp index c15928ee1dc..3dae7b47932 100644 --- a/Core/include/Acts/Geometry/SurfaceBinningMatcher.hpp +++ b/Core/include/Acts/Geometry/SurfaceBinningMatcher.hpp @@ -20,7 +20,8 @@ namespace Acts { struct SurfaceBinningMatcher { /// The binning tolerance parameters using Range = std::pair; - std::vector tolerances{static_cast(numBinningValues()), {0., 0.}}; + std::vector tolerances{static_cast(numAxisDirections()), + {0., 0.}}; SurfaceBinningMatcher() = default; @@ -30,10 +31,10 @@ struct SurfaceBinningMatcher { /// Check function for surface equivalent /// /// @param gctx [in] gctx the geometry context for this check - /// @param bValue the binning value for the binning + /// @param aDir the axis direction value for the binning /// @param one first surface for checking /// @param other second surface for checking - bool operator()(const Acts::GeometryContext& gctx, Acts::BinningValue bValue, + bool operator()(const Acts::GeometryContext& gctx, Acts::AxisDirection aDir, const Acts::Surface* one, const Acts::Surface* other) const { // Fast exit if (one == other) { @@ -43,15 +44,15 @@ struct SurfaceBinningMatcher { auto oneExt = one->polyhedronRepresentation(gctx, 1).extent(); auto otherExt = other->polyhedronRepresentation(gctx, 1).extent(); - double oneMin = oneExt.min(bValue); - double oneMax = oneExt.max(bValue); + double oneMin = oneExt.min(aDir); + double oneMax = oneExt.max(aDir); - double otherMin = otherExt.min(bValue); - double otherMax = otherExt.max(bValue); + double otherMin = otherExt.min(aDir); + double otherMax = otherExt.max(aDir); return ( - std::abs(oneMin - otherMin) <= tolerances[toUnderlying(bValue)].first && - std::abs(oneMax - otherMax) <= tolerances[toUnderlying(bValue)].second); + std::abs(oneMin - otherMin) <= tolerances[toUnderlying(aDir)].first && + std::abs(oneMax - otherMax) <= tolerances[toUnderlying(aDir)].second); } }; diff --git a/Core/include/Acts/Geometry/TrackingVolumeArrayCreator.hpp b/Core/include/Acts/Geometry/TrackingVolumeArrayCreator.hpp index fe951f61dc0..be59b61e3ec 100644 --- a/Core/include/Acts/Geometry/TrackingVolumeArrayCreator.hpp +++ b/Core/include/Acts/Geometry/TrackingVolumeArrayCreator.hpp @@ -11,7 +11,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/ITrackingVolumeArrayCreator.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -45,12 +45,12 @@ class TrackingVolumeArrayCreator : public ITrackingVolumeArrayCreator { /// /// @param [in] gctx the geometry context for this building /// @param [in] tVolumes is the vector of TrackingVolumes to be - /// @param [in] bValue is the binning value + /// @param [in] aDir is the axis direction /// /// @return new created volume array std::shared_ptr trackingVolumeArray( const GeometryContext& gctx, const TrackingVolumeVector& tVolumes, - BinningValue bValue) const override; + AxisDirection aDir) const override; /// Set logging instance /// diff --git a/Core/include/Acts/Geometry/TrivialPortalLink.hpp b/Core/include/Acts/Geometry/TrivialPortalLink.hpp index f68a7e326c6..8876696f5db 100644 --- a/Core/include/Acts/Geometry/TrivialPortalLink.hpp +++ b/Core/include/Acts/Geometry/TrivialPortalLink.hpp @@ -10,6 +10,7 @@ #include "Acts/Definitions/Tolerance.hpp" #include "Acts/Geometry/PortalLinkBase.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" namespace Acts { @@ -29,9 +30,9 @@ class TrivialPortalLink final : public PortalLinkBase { /// Make a 1D grid portal link from this trivial portal link /// The grid size is automatically determined from the surface bounds. - /// @param direction The binning direction + /// @param direction The axis direction of the grid /// @return A grid - std::unique_ptr makeGrid(BinningValue direction) const; + std::unique_ptr makeGrid(AxisDirection direction) const; /// Print the portal link to a stream /// @param os output stream diff --git a/Core/include/Acts/Geometry/Volume.hpp b/Core/include/Acts/Geometry/Volume.hpp index 92085819676..0d10cfa977b 100644 --- a/Core/include/Acts/Geometry/Volume.hpp +++ b/Core/include/Acts/Geometry/Volume.hpp @@ -11,7 +11,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/GeometryObject.hpp" -#include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/BoundingBox.hpp" #include "Acts/Utilities/Logger.hpp" @@ -112,11 +111,10 @@ class Volume : public GeometryObject { /// - as default the center is given, but may be overloaded /// /// @param gctx The current geometry context object, e.g. alignment - /// @param bValue is the binning value schema - /// + /// @param aDir is the axis direction for the reference position /// @return vector 3D that can be used for the binning - Vector3 binningPosition(const GeometryContext& gctx, - BinningValue bValue) const override; + Vector3 referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const override; bool operator==(const Volume& other) const; diff --git a/Core/include/Acts/Geometry/VolumeBounds.hpp b/Core/include/Acts/Geometry/VolumeBounds.hpp index 28bcc029166..a207b1699c4 100644 --- a/Core/include/Acts/Geometry/VolumeBounds.hpp +++ b/Core/include/Acts/Geometry/VolumeBounds.hpp @@ -12,7 +12,7 @@ #include "Acts/Definitions/Direction.hpp" #include "Acts/Geometry/Volume.hpp" #include "Acts/Surfaces/RegularSurface.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -121,32 +121,32 @@ class VolumeBounds { const Transform3* trf = nullptr, const Vector3& envelope = {0, 0, 0}, const Volume* entity = nullptr) const = 0; - /// Get the canonical binning values, i.e. the binning values - /// for that fully describe the shape's extent + /// Get the canonical axis direction + /// that fully describe the shape's extent /// - /// @return vector of canonical binning values + /// @return vector of canonical axis directions /// /// @note This is the default implementation that /// returns the bounding box binning. Individual shapes /// should override this method - virtual std::vector canonicalBinning() const { - return {Acts::BinningValue::binX, Acts::BinningValue::binY, - Acts::BinningValue::binZ}; + virtual std::vector canonicalAxes() const { + using enum AxisDirection; + return {AxisX, AxisY, AxisZ}; }; /// Binning offset - overloaded for some R-binning types /// - /// @param bValue is the binning schema used + /// @param aDir is the binning schema used /// /// @return vector 3D to be used for the binning - virtual Vector3 binningOffset(BinningValue bValue) const; + virtual Vector3 referenceOffset(AxisDirection aDir) const; /// Binning borders in double /// - /// @param bValue is the binning schema used + /// @param aDir is the binning schema used /// /// @return float offset to be used for the binning - virtual double binningBorder(BinningValue bValue) const; + virtual double referenceBorder(AxisDirection aDir) const; /// Output Method for std::ostream, to be overloaded by child classes /// @@ -155,12 +155,12 @@ class VolumeBounds { }; /// Binning offset - overloaded for some R-binning types -inline Vector3 VolumeBounds::binningOffset( - BinningValue /*bValue*/) const { // standard offset is 0.,0.,0. +inline Vector3 VolumeBounds::referenceOffset( + AxisDirection /*aDir*/) const { // standard offset is 0.,0.,0. return Vector3(0., 0., 0.); } -inline double VolumeBounds::binningBorder(BinningValue /*bValue*/) const { +inline double VolumeBounds::referenceBorder(AxisDirection /*aDir*/) const { return 0.; } diff --git a/Core/include/Acts/MagneticField/BFieldMapUtils.hpp b/Core/include/Acts/MagneticField/BFieldMapUtils.hpp index ff46acfa78e..ec3d7f0e701 100644 --- a/Core/include/Acts/MagneticField/BFieldMapUtils.hpp +++ b/Core/include/Acts/MagneticField/BFieldMapUtils.hpp @@ -11,7 +11,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Units.hpp" #include "Acts/MagneticField/InterpolatedBFieldMap.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include diff --git a/Core/include/Acts/Material/MaterialGridHelper.hpp b/Core/include/Acts/Material/MaterialGridHelper.hpp index 0f68a86c3b3..955a9245e73 100644 --- a/Core/include/Acts/Material/MaterialGridHelper.hpp +++ b/Core/include/Acts/Material/MaterialGridHelper.hpp @@ -12,7 +12,7 @@ #include "Acts/Material/AccumulatedVolumeMaterial.hpp" #include "Acts/Material/Material.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinUtility.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Grid.hpp" @@ -71,7 +71,7 @@ Grid3D createGrid(MaterialGridAxisData gridAxis1, /// /// @return a coordinate transform function std::function globalToLocalFromBin( - Acts::BinningValue& type); + Acts::AxisDirection& type); /// @brief Create a 2DGrid using a BinUtility. /// Also determine the corresponding global to local transform and grid mapping diff --git a/Core/include/Acts/Material/MaterialMapUtils.hpp b/Core/include/Acts/Material/MaterialMapUtils.hpp index 8cacb23eb20..16523c03f70 100644 --- a/Core/include/Acts/Material/MaterialMapUtils.hpp +++ b/Core/include/Acts/Material/MaterialMapUtils.hpp @@ -12,7 +12,7 @@ #include "Acts/Definitions/Units.hpp" #include "Acts/Material/InterpolatedMaterialMap.hpp" #include "Acts/Material/Material.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include diff --git a/Core/include/Acts/Navigation/DetectorNavigator.hpp b/Core/include/Acts/Navigation/DetectorNavigator.hpp index 56f588dfb47..60d86960040 100644 --- a/Core/include/Acts/Navigation/DetectorNavigator.hpp +++ b/Core/include/Acts/Navigation/DetectorNavigator.hpp @@ -14,6 +14,7 @@ #include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/Geometry/Layer.hpp" #include "Acts/Navigation/NavigationState.hpp" +#include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/NavigatorOptions.hpp" #include "Acts/Propagator/NavigatorStatistics.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" @@ -213,7 +214,7 @@ class DetectorNavigator { auto surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, c.objectIntersection.index(), state.options.direction, c.boundaryTolerance, - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, logger()); ACTS_VERBOSE(volInfo(state) << posInfo(state, stepper) << "surface status is " << surfaceStatus); @@ -284,7 +285,7 @@ class DetectorNavigator { state.stepping, *nextSurface, nState.surfaceCandidate().objectIntersection.index(), state.options.direction, boundaryTolerance, - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, logger()); // Check if we are at a surface if (surfaceStatus == IntersectionStatus::onSurface) { diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index 7a56086971a..82dc94f7eb3 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -12,6 +12,7 @@ #include "Acts/Navigation/NavigationDelegates.hpp" #include "Acts/Navigation/NavigationStateFillers.hpp" #include "Acts/Navigation/NavigationStateUpdaters.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/VectorHelpers.hpp" #include @@ -34,7 +35,7 @@ class MultiLayerNavigation : public IInternalNavigation { path_generator pgenerator; /// These are the cast parameters - copied from constructor - std::array casts{}; + std::array casts{}; /// An inverse transform to be applied to the position Transform3 transform = Transform3::Identity(); @@ -44,7 +45,7 @@ class MultiLayerNavigation : public IInternalNavigation { /// @param icasts is the cast values array /// @param itr a transform applied to the global position MultiLayerNavigation(grid_type igrid, - const std::array& icasts, + const std::array& icasts, const Transform3& itr = Transform3::Identity()) : grid(std::move(igrid)), casts(icasts), transform(itr) {} diff --git a/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp b/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp index 83b7bfd5016..664c9c99166 100644 --- a/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp +++ b/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp @@ -14,7 +14,7 @@ #include "Acts/Navigation/NavigationDelegates.hpp" #include "Acts/Navigation/NavigationState.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Enumerate.hpp" #include "Acts/Utilities/GridAccessHelpers.hpp" #include "Acts/Utilities/IAxis.hpp" @@ -195,7 +195,7 @@ class IndexedGridNavigation : public navigation_type { grid_type grid; /// These are the cast parameters - copied from constructor - std::array casts{}; + std::array casts{}; /// A transform to be applied to the position Transform3 transform = Transform3::Identity(); @@ -205,7 +205,7 @@ class IndexedGridNavigation : public navigation_type { /// @param icasts is the cast values array /// @param itr a transform applied to the global position IndexedGridNavigation(grid_type&& igrid, - const std::array& icasts, + const std::array& icasts, const Transform3& itr = Transform3::Identity()) : grid(std::move(igrid)), casts(icasts), transform(itr) {} diff --git a/Core/include/Acts/Navigation/PortalNavigation.hpp b/Core/include/Acts/Navigation/PortalNavigation.hpp index b810e179c69..b5ed5ca8a50 100644 --- a/Core/include/Acts/Navigation/PortalNavigation.hpp +++ b/Core/include/Acts/Navigation/PortalNavigation.hpp @@ -14,6 +14,7 @@ #include "Acts/Navigation/NavigationStateFillers.hpp" #include "Acts/Navigation/NavigationStateUpdaters.hpp" #include "Acts/Utilities/Axis.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include @@ -86,7 +87,7 @@ struct BoundVolumesGrid1Navigation : public IExternalNavigation { /// @param cVolumes the contained volumes /// @param bTransform is the optional transform BoundVolumesGrid1Navigation( - const std::vector& gBoundaries, BinningValue bValue, + const std::vector& gBoundaries, AxisDirection bValue, const std::vector& cVolumes, const Transform3& bTransform = Transform3::Identity()) noexcept(false) : indexedUpdater(IndexedUpdater(VariableBoundIndexGrid1(std::make_tuple( diff --git a/Core/include/Acts/Propagator/AtlasStepper.hpp b/Core/include/Acts/Propagator/AtlasStepper.hpp index 0dd90197ef5..da832863fdb 100644 --- a/Core/include/Acts/Propagator/AtlasStepper.hpp +++ b/Core/include/Acts/Propagator/AtlasStepper.hpp @@ -407,15 +407,16 @@ class AtlasStepper { /// @param [in] navDir The navigation direction /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection + /// @param [in] stype The step size type to be set /// @param [in] logger Logger instance to use IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance, ConstrainedStep::Type stype, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, logger); } /// Update step size @@ -425,11 +426,14 @@ class AtlasStepper { /// /// @param state [in,out] The stepping state (thread-local cache) /// @param oIntersection [in] The ObjectIntersection to layer, boundary, etc - /// @param release [in] boolean to trigger step size release + /// @param direction [in] The propagation direction + /// @param stype [in] The step size type to be set template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction /*direction*/, bool release = true) const { - detail::updateSingleStepSize(state, oIntersection, release); + Direction direction, ConstrainedStep::Type stype) const { + (void)direction; + double stepSize = oIntersection.pathLength(); + updateStepSize(state, stepSize, stype); } /// Update step size - explicitly with a double @@ -437,19 +441,10 @@ class AtlasStepper { /// @param [in,out] state The stepping state (thread-local cache) /// @param [in] stepSize The step size value /// @param [in] stype The step size type to be set - /// @param release [in] Do we release the step size? void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype, bool release = true) const { + ConstrainedStep::Type stype) const { state.previousStepSize = state.stepSize.value(); - state.stepSize.update(stepSize, stype, release); - } - - /// Get the step size - /// - /// @param state [in] The stepping state (thread-local cache) - /// @param stype [in] The step size type to be returned - double getStepSize(const State& state, ConstrainedStep::Type stype) const { - return state.stepSize.value(stype); + state.stepSize.update(stepSize, stype); } /// Release the Step size @@ -460,6 +455,14 @@ class AtlasStepper { state.stepSize.release(stype); } + /// Get the step size + /// + /// @param state [in] The stepping state (thread-local cache) + /// @param stype [in] The step size type to be returned + double getStepSize(const State& state, ConstrainedStep::Type stype) const { + return state.stepSize.value(stype); + } + /// Output the Step Size - single component /// /// @param [in,out] state The stepping state (thread-local cache) diff --git a/Core/include/Acts/Propagator/ConstrainedStep.hpp b/Core/include/Acts/Propagator/ConstrainedStep.hpp index 412f308bac9..58198ca14a1 100644 --- a/Core/include/Acts/Propagator/ConstrainedStep.hpp +++ b/Core/include/Acts/Propagator/ConstrainedStep.hpp @@ -8,8 +8,6 @@ #pragma once -#include "Acts/Definitions/Algebra.hpp" - #include #include #include @@ -44,10 +42,10 @@ namespace Acts { class ConstrainedStep { public: /// the types of constraints - /// from actor - this would be a typical navigation step - /// from aborter - this would be a target condition - /// from user - this is user given for what reason ever - enum Type : int { actor = 0, aborter = 1, user = 2 }; + /// from navigator - this would be a navigation step + /// from actor - this would be an actor condition + /// from user - this is user given for what reason ever + enum Type : int { navigator = 0, actor = 1, user = 2 }; constexpr ConstrainedStep() = default; @@ -108,11 +106,7 @@ class ConstrainedStep { /// /// @param value is the new value to be updated /// @param type is the constraint type - /// @param releaseStep Allow step size to increase again - constexpr void update(double value, Type type, bool releaseStep = false) { - if (releaseStep) { - release(type); - } + constexpr void update(double value, Type type) { // check the current value and set it if appropriate // this will also allow signed values due to overstepping if (std::abs(value) < std::abs(m_values[type])) { @@ -137,9 +131,9 @@ class ConstrainedStep { os << "("; streamValue(m_accuracy); os << ", "; - streamValue(value(actor)); + streamValue(value(navigator)); os << ", "; - streamValue(value(aborter)); + streamValue(value(actor)); os << ", "; streamValue(value(user)); os << ")"; diff --git a/Core/include/Acts/Propagator/DirectNavigator.hpp b/Core/include/Acts/Propagator/DirectNavigator.hpp index d2f66468168..fd85f71af91 100644 --- a/Core/include/Acts/Propagator/DirectNavigator.hpp +++ b/Core/include/Acts/Propagator/DirectNavigator.hpp @@ -232,7 +232,7 @@ class DirectNavigator { // Set the navigation break ACTS_VERBOSE("End of surfaces reached, navigation break."); state.navigation.navigationBreak = true; - stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); + stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); // If no externally provided target is given, the target is reached if (state.navigation.options.targetSurface == nullptr) { state.navigation.targetReached = true; @@ -256,7 +256,7 @@ class DirectNavigator { auto surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, index, state.options.direction, BoundaryTolerance::Infinite(), state.options.surfaceTolerance, - *m_logger); + ConstrainedStep::navigator, *m_logger); if (surfaceStatus == IntersectionStatus::unreachable) { ACTS_VERBOSE( "Surface not reachable anymore, switching to next one in " @@ -310,7 +310,7 @@ class DirectNavigator { auto surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, index, state.options.direction, BoundaryTolerance::Infinite(), state.options.surfaceTolerance, - *m_logger); + ConstrainedStep::navigator, *m_logger); if (surfaceStatus == IntersectionStatus::onSurface) { // Set the current surface state.navigation.currentSurface = state.navigation.navSurface(); diff --git a/Core/include/Acts/Propagator/EigenStepper.hpp b/Core/include/Acts/Propagator/EigenStepper.hpp index 1200636c5ad..b1ed263d3fc 100644 --- a/Core/include/Acts/Propagator/EigenStepper.hpp +++ b/Core/include/Acts/Propagator/EigenStepper.hpp @@ -12,7 +12,6 @@ #include "Acts/Utilities/detail/ReferenceWrapperAnyCompat.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/Tolerance.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp" #include "Acts/MagneticField/MagneticFieldProvider.hpp" @@ -239,15 +238,16 @@ class EigenStepper { /// @param [in] navDir The navigation direction /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection + /// @param [in] stype The step size type to be set /// @param [in] logger A @c Logger instance IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance, ConstrainedStep::Type stype, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, logger); } /// Update step size @@ -259,11 +259,14 @@ class EigenStepper { /// /// @param state [in,out] The stepping state (thread-local cache) /// @param oIntersection [in] The ObjectIntersection to layer, boundary, etc - /// @param release [in] boolean to trigger step size release + /// @param direction [in] The propagation direction + /// @param stype [in] The step size type to be set template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction /*direction*/, bool release = true) const { - detail::updateSingleStepSize(state, oIntersection, release); + Direction direction, ConstrainedStep::Type stype) const { + (void)direction; + double stepSize = oIntersection.pathLength(); + updateStepSize(state, stepSize, stype); } /// Update step size - explicitly with a double @@ -271,11 +274,10 @@ class EigenStepper { /// @param state [in,out] The stepping state (thread-local cache) /// @param stepSize [in] The step size value /// @param stype [in] The step size type to be set - /// @param release [in] Do we release the step size? void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype, bool release = true) const { + ConstrainedStep::Type stype) const { state.previousStepSize = state.stepSize.value(); - state.stepSize.update(stepSize, stype, release); + state.stepSize.update(stepSize, stype); } /// Get the step size diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp index 4e481ea5d2d..5c4eaa87da6 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp @@ -499,11 +499,12 @@ class MultiEigenStepperLoop : public EigenStepper { /// @param [in] navDir The navigation direction /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection + /// @param [in] stype The step size type to be set /// @param [in] logger A @c Logger instance IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance, ConstrainedStep::Type stype, const Logger& logger = getDummyLogger()) const { using Status = IntersectionStatus; @@ -512,7 +513,7 @@ class MultiEigenStepperLoop : public EigenStepper { for (auto& component : state.components) { component.status = detail::updateSingleSurfaceStatus( *this, component.state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, logger); ++counts[static_cast(component.status)]; } @@ -576,10 +577,10 @@ class MultiEigenStepperLoop : public EigenStepper { /// @param state [in,out] The stepping state (thread-local cache) /// @param oIntersection [in] The ObjectIntersection to layer, boundary, etc /// @param direction [in] The propagation direction - /// @param release [in] boolean to trigger step size release + /// @param stype [in] The step size type to be set template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction direction, bool release = true) const { + Direction direction, ConstrainedStep::Type stype) const { const Surface& surface = *oIntersection.object(); for (auto& component : state.components) { @@ -590,7 +591,7 @@ class MultiEigenStepperLoop : public EigenStepper { BoundaryTolerance::None())[oIntersection.index()]; SingleStepper::updateStepSize(component.state, intersection, direction, - release); + stype); } } @@ -599,11 +600,10 @@ class MultiEigenStepperLoop : public EigenStepper { /// @param state [in,out] The stepping state (thread-local cache) /// @param stepSize [in] The step size value /// @param stype [in] The step size type to be set - /// @param release [in] Do we release the step size? void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype, bool release = true) const { + ConstrainedStep::Type stype) const { for (auto& component : state.components) { - SingleStepper::updateStepSize(component.state, stepSize, stype, release); + SingleStepper::updateStepSize(component.state, stepSize, stype); } } diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp index a09e35b9a18..01b392dbf2a 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp @@ -116,15 +116,18 @@ Result MultiEigenStepperLoop::step( } } - removeMissedComponents(stepping); - reweightComponents(stepping); - ACTS_VERBOSE("Stepper performed " << m_stepLimitAfterFirstComponentOnSurface - << " after the first component hit a surface."); + << " steps after the first component hit a surface."); ACTS_VERBOSE( "-> remove all components not on a surface, perform no step"); + removeMissedComponents(stepping); + reweightComponents(stepping); + + ACTS_VERBOSE(components.size() + << " components left after removing missed components"); + stepping.stepCounterAfterFirstComponentOnSurface.reset(); return 0.0; @@ -184,7 +187,7 @@ Result MultiEigenStepperLoop::step( }; // Loop over components and remove errorous components - stepping.components.erase( + components.erase( std::remove_if(components.begin(), components.end(), errorInStep), components.end()); @@ -218,10 +221,15 @@ Result MultiEigenStepperLoop::step( } // Return error if there is no ok result - if (stepping.components.empty()) { + if (components.empty()) { return MultiStepperError::AllComponentsSteppingError; } + // Invalidate the component status after each step + for (auto& cmp : components) { + cmp.status = Status::unreachable; + } + // Return the weighted accumulated path length of all successful steps stepping.pathAccumulated += accumulatedPathLength; return accumulatedPathLength; diff --git a/Core/include/Acts/Propagator/MultiStepperAborters.hpp b/Core/include/Acts/Propagator/MultiStepperAborters.hpp index e42d3387e2f..577c9c7e43f 100644 --- a/Core/include/Acts/Propagator/MultiStepperAborters.hpp +++ b/Core/include/Acts/Propagator/MultiStepperAborters.hpp @@ -13,7 +13,7 @@ namespace Acts { -struct MultiStepperSurfaceReached : public SurfaceReached { +struct MultiStepperSurfaceReached : public ForcedSurfaceReached { /// If this is set, we are also happy if the mean of the components is on the /// surface. How the averaging is performed depends on the stepper /// implementation @@ -25,7 +25,6 @@ struct MultiStepperSurfaceReached : public SurfaceReached { double averageOnSurfaceTolerance = 0.2; MultiStepperSurfaceReached() = default; - explicit MultiStepperSurfaceReached(double oLimit) : SurfaceReached(oLimit) {} /// boolean operator for abort condition without using the result /// @@ -82,9 +81,8 @@ struct MultiStepperSurfaceReached : public SurfaceReached { auto singleState = cmp.singleState(state); const auto& singleStepper = cmp.singleStepper(stepper); - if (!SurfaceReached::checkAbort(singleState, singleStepper, navigator, - logger)) { - cmp.status() = Acts::IntersectionStatus::reachable; + if (!ForcedSurfaceReached::checkAbort(singleState, singleStepper, + navigator, logger)) { reached = false; } else { cmp.status() = Acts::IntersectionStatus::onSurface; diff --git a/Core/include/Acts/Propagator/Navigator.hpp b/Core/include/Acts/Propagator/Navigator.hpp index 504912b507f..d1df6025717 100644 --- a/Core/include/Acts/Propagator/Navigator.hpp +++ b/Core/include/Acts/Propagator/Navigator.hpp @@ -442,7 +442,7 @@ class Navigator { ACTS_VERBOSE(volInfo(state) << "No volume found, stop navigation."); // Set navigation break and release the navigation step size state.navigation.navigationBreak = true; - stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); + stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); return; } @@ -461,7 +461,7 @@ class Navigator { "really lost! Stop navigation."); // Set navigation break and release the navigation step size state.navigation.navigationBreak = true; - stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); + stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); } /// @brief Navigator post step call @@ -568,7 +568,7 @@ class Navigator { << "No more volume to progress to, stopping navigation."); // Navigation break & release navigation stepping state.navigation.navigationBreak = true; - stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); + stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); return; } else { ACTS_VERBOSE(volInfo(state) << "Volume updated."); @@ -648,7 +648,8 @@ class Navigator { // it the current one to pass it to the other actors auto surfaceStatus = stepper.updateSurfaceStatus( state.stepping, *surface, intersection.index(), state.options.direction, - BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); + BoundaryTolerance::None(), state.options.surfaceTolerance, + ConstrainedStep::navigator, logger()); if (surfaceStatus == IntersectionStatus::onSurface) { ACTS_VERBOSE(volInfo(state) << "Status Surface successfully hit, storing it."); @@ -724,7 +725,7 @@ class Navigator { auto surfaceStatus = stepper.updateSurfaceStatus( state.stepping, *surface, intersection.index(), state.options.direction, boundaryTolerance, - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, logger()); if (surfaceStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << "Surface reachable, step size updated to " @@ -814,7 +815,7 @@ class Navigator { auto layerStatus = stepper.updateSurfaceStatus( state.stepping, *layerSurface, intersection.index(), state.options.direction, BoundaryTolerance::None(), - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, logger()); if (layerStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << "Layer reachable, step size updated to " << stepper.outputStepSize(state.stepping)); @@ -866,7 +867,7 @@ class Navigator { ACTS_VERBOSE(volInfo(state) << "No sufficient information to resolve boundary, " "stopping navigation."); - stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); + stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); return false; } @@ -878,7 +879,7 @@ class Navigator { navOpts.startObject = state.navigation.currentSurface; navOpts.nearLimit = state.options.surfaceTolerance; navOpts.farLimit = - stepper.getStepSize(state.stepping, ConstrainedStep::aborter); + stepper.getStepSize(state.stepping, ConstrainedStep::actor); ACTS_VERBOSE(volInfo(state) << "Try to find boundaries, we are at: " @@ -911,9 +912,9 @@ class Navigator { state.navigation.navBoundaryIndex = 0; if (!state.navigation.navBoundaries.empty()) { // Set to the first and return to the stepper - stepper.updateStepSize(state.stepping, - state.navigation.navBoundary().first, - state.options.direction, true); + stepper.updateStepSize( + state.stepping, state.navigation.navBoundary().first, + state.options.direction, ConstrainedStep::navigator); ACTS_VERBOSE(volInfo(state) << "Navigation stepSize updated to " << stepper.outputStepSize(state.stepping)); return true; @@ -936,7 +937,7 @@ class Navigator { auto boundaryStatus = stepper.updateSurfaceStatus( state.stepping, *boundarySurface, intersection.index(), state.options.direction, BoundaryTolerance::None(), - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, logger()); if (boundaryStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << "Boundary reachable, step size updated to " @@ -1006,7 +1007,7 @@ class Navigator { navOpts.nearLimit = state.options.surfaceTolerance; navOpts.farLimit = - stepper.getStepSize(state.stepping, ConstrainedStep::aborter); + stepper.getStepSize(state.stepping, ConstrainedStep::actor); // get the surfaces state.navigation.navSurfaces = currentLayer->compatibleSurfaces( @@ -1032,7 +1033,8 @@ class Navigator { state.navigation.navSurfaceIndex = 0; // The stepper updates the step size ( single / multi component) stepper.updateStepSize(state.stepping, state.navigation.navSurface(), - state.options.direction, true); + state.options.direction, + ConstrainedStep::navigator); ACTS_VERBOSE(volInfo(state) << "Navigation stepSize updated to " << stepper.outputStepSize(state.stepping)); return true; @@ -1071,7 +1073,7 @@ class Navigator { navOpts.startObject = state.navigation.currentLayer; navOpts.nearLimit = state.options.surfaceTolerance; navOpts.farLimit = - stepper.getStepSize(state.stepping, ConstrainedStep::aborter); + stepper.getStepSize(state.stepping, ConstrainedStep::actor); // Request the compatible layers state.navigation.navLayers = @@ -1103,7 +1105,8 @@ class Navigator { ACTS_VERBOSE(volInfo(state) << "Target at layer."); // The stepper updates the step size ( single / multi component) stepper.updateStepSize(state.stepping, state.navigation.navLayer().first, - state.options.direction, true); + state.options.direction, + ConstrainedStep::navigator); ACTS_VERBOSE(volInfo(state) << "Navigation stepSize updated to " << stepper.outputStepSize(state.stepping)); return true; @@ -1115,7 +1118,7 @@ class Navigator { // Screen output - no layer candidates found ACTS_VERBOSE(volInfo(state) << "No compatible layer candidates found."); // Release the step size - stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); + stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); return false; } @@ -1158,7 +1161,7 @@ class Navigator { auto targetStatus = stepper.updateSurfaceStatus( state.stepping, *state.navigation.targetSurface, 0, state.options.direction, BoundaryTolerance::None(), - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, logger()); // the only advance could have been to the target if (targetStatus == IntersectionStatus::onSurface) { // set the target surface diff --git a/Core/include/Acts/Propagator/Propagator.ipp b/Core/include/Acts/Propagator/Propagator.ipp index 3475bc7175f..37814e9a4fc 100644 --- a/Core/include/Acts/Propagator/Propagator.ipp +++ b/Core/include/Acts/Propagator/Propagator.ipp @@ -67,8 +67,8 @@ auto Acts::Propagator::propagate(propagator_state_t& state) const return res.error(); } // release actor and aborter constrains after step was performed + m_stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); m_stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); - m_stepper.releaseStepSize(state.stepping, ConstrainedStep::aborter); // Post-stepping: // navigator post step call - actor list act - actor list check state.stage = PropagatorStage::postStep; diff --git a/Core/include/Acts/Propagator/StandardAborters.hpp b/Core/include/Acts/Propagator/StandardAborters.hpp index 271ebd85239..8aa49982965 100644 --- a/Core/include/Acts/Propagator/StandardAborters.hpp +++ b/Core/include/Acts/Propagator/StandardAborters.hpp @@ -55,8 +55,7 @@ struct PathLimitReached { << distance); return true; } - stepper.updateStepSize(state.stepping, distance, ConstrainedStep::aborter, - false); + stepper.updateStepSize(state.stepping, distance, ConstrainedStep::actor); ACTS_VERBOSE("PathLimit aborter | " << "Target stepSize (path limit) updated to " << stepper.outputStepSize(state.stepping)); @@ -134,7 +133,7 @@ struct SurfaceReached { detail::checkPathLength(intersection.pathLength(), nearLimit, farLimit, logger)) { stepper.updateStepSize(state.stepping, intersection.pathLength(), - ConstrainedStep::aborter, false); + ConstrainedStep::actor); ACTS_VERBOSE( "SurfaceReached aborter | " "Target stepSize (surface) updated to " diff --git a/Core/include/Acts/Propagator/StepperConcept.hpp b/Core/include/Acts/Propagator/StepperConcept.hpp index fb4ea187bcd..3e45382fa3c 100644 --- a/Core/include/Acts/Propagator/StepperConcept.hpp +++ b/Core/include/Acts/Propagator/StepperConcept.hpp @@ -10,13 +10,11 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" -#include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Concepts.hpp" -#include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Logger.hpp" namespace Acts { @@ -54,15 +52,16 @@ concept CommonStepper = requires { }; requires requires(const Surface& sf, std::uint8_t ui, Direction d, - const BoundaryTolerance& bt, double sc, const Logger& l) { - { s.updateSurfaceStatus(t, sf, ui, d, bt, sc, l) }; + const BoundaryTolerance& bt, double sc, + ConstrainedStep::Type st, const Logger& l) { + { s.updateSurfaceStatus(t, sf, ui, d, bt, sc, st, l) }; }; requires requires(const ConstrainedStep::Type st) { { s.releaseStepSize(t, st) } -> std::same_as; - requires requires(double d, bool b) { - { s.updateStepSize(t, d, st, b) } -> std::same_as; + requires requires(double d) { + { s.updateStepSize(t, d, st) } -> std::same_as; }; }; }; diff --git a/Core/include/Acts/Propagator/StraightLineStepper.hpp b/Core/include/Acts/Propagator/StraightLineStepper.hpp index 4bbb5a4295a..29b73edac26 100644 --- a/Core/include/Acts/Propagator/StraightLineStepper.hpp +++ b/Core/include/Acts/Propagator/StraightLineStepper.hpp @@ -233,15 +233,16 @@ class StraightLineStepper { /// @param [in] navDir The navigation direction /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection + /// @param [in] stype The step size type to be set /// @param [in] logger A logger instance IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance, ConstrainedStep::Type stype, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, logger); } /// Update step size @@ -251,12 +252,14 @@ class StraightLineStepper { /// /// @param state [in,out] The stepping state (thread-local cache) /// @param oIntersection [in] The ObjectIntersection to layer, boundary, etc - /// @param release [in] boolean to trigger step size release + /// @param direction [in] The propagation direction + /// @param stype [in] The step size type to be set template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction /*direction*/, bool release = true) const { - detail::updateSingleStepSize(state, oIntersection, - release); + Direction direction, ConstrainedStep::Type stype) const { + (void)direction; + double stepSize = oIntersection.pathLength(); + updateStepSize(state, stepSize, stype); } /// Update step size - explicitly with a double @@ -264,12 +267,10 @@ class StraightLineStepper { /// @param state [in,out] The stepping state (thread-local cache) /// @param stepSize [in] The step size value /// @param stype [in] The step size type to be set - /// @param release [in] Do we release the step size? void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype = ConstrainedStep::actor, - bool release = true) const { + ConstrainedStep::Type stype) const { state.previousStepSize = state.stepSize.value(); - state.stepSize.update(stepSize, stype, release); + state.stepSize.update(stepSize, stype); } /// Get the step size diff --git a/Core/include/Acts/Propagator/SympyStepper.hpp b/Core/include/Acts/Propagator/SympyStepper.hpp index b5f24fb6eaf..4105e79d7f4 100644 --- a/Core/include/Acts/Propagator/SympyStepper.hpp +++ b/Core/include/Acts/Propagator/SympyStepper.hpp @@ -13,7 +13,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Direction.hpp" -#include "Acts/Definitions/Tolerance.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp" #include "Acts/MagneticField/MagneticFieldProvider.hpp" @@ -207,15 +206,16 @@ class SympyStepper { /// @param [in] navDir The navigation direction /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection + /// @param [in] stype The step size type to be set /// @param [in] logger A @c Logger instance IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance, ConstrainedStep::Type stype, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, logger); } /// Update step size @@ -227,11 +227,14 @@ class SympyStepper { /// /// @param state [in,out] The stepping state (thread-local cache) /// @param oIntersection [in] The ObjectIntersection to layer, boundary, etc - /// @param release [in] boolean to trigger step size release + /// @param direction [in] The propagation direction + /// @param stype [in] The step size type to be set template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction /*direction*/, bool release = true) const { - detail::updateSingleStepSize(state, oIntersection, release); + Direction direction, ConstrainedStep::Type stype) const { + (void)direction; + double stepSize = oIntersection.pathLength(); + updateStepSize(state, stepSize, stype); } /// Update step size - explicitly with a double @@ -239,11 +242,10 @@ class SympyStepper { /// @param state [in,out] The stepping state (thread-local cache) /// @param stepSize [in] The step size value /// @param stype [in] The step size type to be set - /// @param release [in] Do we release the step size? void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype, bool release = true) const { + ConstrainedStep::Type stype) const { state.previousStepSize = state.stepSize.value(); - state.stepSize.update(stepSize, stype, release); + state.stepSize.update(stepSize, stype); } /// Get the step size diff --git a/Core/include/Acts/Propagator/TryAllNavigator.hpp b/Core/include/Acts/Propagator/TryAllNavigator.hpp index 7470fa0da0c..f34dd9b5982 100644 --- a/Core/include/Acts/Propagator/TryAllNavigator.hpp +++ b/Core/include/Acts/Propagator/TryAllNavigator.hpp @@ -372,7 +372,7 @@ class TryAllNavigator : public TryAllNavigatorBase { auto surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, boundaryTolerance, - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, logger()); if (surfaceStatus == IntersectionStatus::onSurface) { ACTS_ERROR(volInfo(state) @@ -392,7 +392,7 @@ class TryAllNavigator : public TryAllNavigatorBase { } if (!intersectionFound) { - stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); + stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); ACTS_VERBOSE(volInfo(state) << "no intersections found. advance without " "constraints. step size is " @@ -437,7 +437,7 @@ class TryAllNavigator : public TryAllNavigatorBase { IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::Infinite(), - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, logger()); if (surfaceStatus != IntersectionStatus::onSurface) { break; @@ -466,7 +466,7 @@ class TryAllNavigator : public TryAllNavigatorBase { IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::None(), - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, logger()); if (surfaceStatus != IntersectionStatus::onSurface) { continue; @@ -665,7 +665,7 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { auto surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, boundaryTolerance, - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, logger()); if (surfaceStatus == IntersectionStatus::onSurface) { ACTS_ERROR(volInfo(state) @@ -692,7 +692,7 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { state.navigation.activeCandidates.size()) { state.navigation.lastPosition = stepper.position(state.stepping); - stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); + stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); ACTS_VERBOSE(volInfo(state) << "blindly step forwards. step size updated to " @@ -791,7 +791,8 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::Infinite(), - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, + logger()); if (surfaceStatus != IntersectionStatus::onSurface) { break; @@ -818,7 +819,8 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::None(), - state.options.surfaceTolerance, logger()); + state.options.surfaceTolerance, ConstrainedStep::navigator, + logger()); if (surfaceStatus != IntersectionStatus::onSurface) { continue; diff --git a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp index 48eaaffb2cf..ca5acaaf8da 100644 --- a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp +++ b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp @@ -26,40 +26,48 @@ namespace Acts::detail { /// returns the status of the intersection to trigger onSurface in case /// the surface is reached. /// +/// @tparam stepper_t The type of stepper used for the propagation +/// +/// @param stepper [in] The stepper in use /// @param state [in,out] The stepping state (thread-local cache) /// @param surface [in] The surface provided +/// @param index [in] The surface intersection index +/// @param direction [in] The propagation direction /// @param boundaryTolerance [in] The boundary check for this status update +/// @param surfaceTolerance [in] Surface tolerance used for intersection +/// @param stype [in] The step size type to be set +/// @param logger [in] A @c Logger instance template Acts::IntersectionStatus updateSingleSurfaceStatus( const stepper_t& stepper, typename stepper_t::State& state, - const Surface& surface, std::uint8_t index, Direction navDir, + const Surface& surface, std::uint8_t index, Direction direction, const BoundaryTolerance& boundaryTolerance, double surfaceTolerance, - const Logger& logger) { + ConstrainedStep::Type stype, const Logger& logger) { ACTS_VERBOSE("Update single surface status for surface: " << surface.geometryId() << " index " << static_cast(index)); auto sIntersection = surface.intersect(state.options.geoContext, stepper.position(state), - navDir * stepper.direction(state), boundaryTolerance, + direction * stepper.direction(state), boundaryTolerance, surfaceTolerance)[index]; // The intersection is on surface already if (sIntersection.status() == IntersectionStatus::onSurface) { // Release navigation step size - state.stepSize.release(ConstrainedStep::actor); + state.stepSize.release(stype); ACTS_VERBOSE("Intersection: state is ON SURFACE"); return IntersectionStatus::onSurface; } const double nearLimit = std::numeric_limits::lowest(); - const double farLimit = state.stepSize.value(ConstrainedStep::aborter); + const double farLimit = state.stepSize.value(ConstrainedStep::actor); if (sIntersection.isValid() && detail::checkPathLength(sIntersection.pathLength(), nearLimit, farLimit, logger)) { ACTS_VERBOSE("Surface is reachable"); - stepper.updateStepSize(state, sIntersection.pathLength(), - ConstrainedStep::actor); + stepper.releaseStepSize(state, stype); + stepper.updateStepSize(state, sIntersection.pathLength(), stype); return IntersectionStatus::reachable; } @@ -67,20 +75,4 @@ Acts::IntersectionStatus updateSingleSurfaceStatus( return IntersectionStatus::unreachable; } -/// Update the Step size - single component -/// -/// It takes a (valid) object intersection from the compatibleX(...) -/// calls in the geometry and updates the step size -/// -/// @param state [in,out] The stepping state (thread-local cache) -/// @param oIntersection [in] The object that yielded this step size -/// @param release [in] A release flag -template -void updateSingleStepSize(typename stepper_t::State& state, - const object_intersection_t& oIntersection, - bool release = true) { - double stepSize = oIntersection.pathLength(); - state.stepSize.update(stepSize, ConstrainedStep::actor, release); -} - } // namespace Acts::detail diff --git a/Core/include/Acts/Seeding/BinnedGroupIterator.ipp b/Core/include/Acts/Seeding/BinnedGroupIterator.ipp index 8bcd0ac04b8..13427525f6c 100644 --- a/Core/include/Acts/Seeding/BinnedGroupIterator.ipp +++ b/Core/include/Acts/Seeding/BinnedGroupIterator.ipp @@ -85,7 +85,8 @@ void Acts::BinnedGroupIterator::findNotEmptyBin() { passesMask = m_group->mask().at(m_gridItr.globalBinIndex()); } // loop and only stop when we find a non-empty bin which is not masked - while ((dimCollection == 0ul || !passesMask) && ++m_gridItr != m_gridItrEnd) { + while ((dimCollection == 0ul || !passesMask) && + (++m_gridItr != m_gridItrEnd)) { dimCollection = (*m_gridItr).size(); if (dimCollection == 0ul) { continue; diff --git a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp index a725d68e92d..9af243aa01a 100644 --- a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp +++ b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp @@ -11,7 +11,7 @@ #include "Acts/Seeding/SeedFinder.hpp" #include "Acts/Seeding/SeedFinderOrthogonalConfig.hpp" #include "Acts/Seeding/SeedFinderUtils.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -756,9 +756,9 @@ void SeedFinderOrthogonal::createSeeds( // variable middle SP radial region of interest const Acts::Range1D rMiddleSPRange( - std::floor(rRangeSPExtent.min(Acts::BinningValue::binR) / 2) * 2 + + std::floor(rRangeSPExtent.min(Acts::AxisDirection::AxisR) / 2) * 2 + m_config.deltaRMiddleMinSPRange, - std::floor(rRangeSPExtent.max(Acts::BinningValue::binR) / 2) * 2 - + std::floor(rRangeSPExtent.max(Acts::AxisDirection::AxisR) / 2) * 2 - m_config.deltaRMiddleMaxSPRange); /* diff --git a/Core/include/Acts/Surfaces/ConeSurface.hpp b/Core/include/Acts/Surfaces/ConeSurface.hpp index 34ebaf49694..6f7886e2063 100644 --- a/Core/include/Acts/Surfaces/ConeSurface.hpp +++ b/Core/include/Acts/Surfaces/ConeSurface.hpp @@ -18,7 +18,7 @@ #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceConcept.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Result.hpp" #include "Acts/Utilities/detail/RealQuadraticEquation.hpp" @@ -90,11 +90,11 @@ class ConeSurface : public RegularSurface { /// The binning position method - is overloaded for r-type binning /// /// @param gctx The current geometry context object, e.g. alignment - /// @param bValue defines the type of binning applied in the global frame + /// @param aDir defines the direction of binning applied in the global frame /// /// @return The return type is a vector for positioning in the global frame - Vector3 binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + Vector3 referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const final; /// Return the surface type SurfaceType type() const override; diff --git a/Core/include/Acts/Surfaces/CylinderSurface.hpp b/Core/include/Acts/Surfaces/CylinderSurface.hpp index 2f64852dbee..aa21bc667ad 100644 --- a/Core/include/Acts/Surfaces/CylinderSurface.hpp +++ b/Core/include/Acts/Surfaces/CylinderSurface.hpp @@ -18,7 +18,7 @@ #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceConcept.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Result.hpp" #include "Acts/Utilities/detail/RealQuadraticEquation.hpp" @@ -95,11 +95,11 @@ class CylinderSurface : public RegularSurface { /// The binning position method - is overloaded for r-type binning /// /// @param gctx The current geometry context object, e.g. alignment - /// @param bValue is the type of global binning to be done + /// @param aDir is the axis Direction of global binning to be done /// /// @return is the global position to be used for binning - Vector3 binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + Vector3 referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const final; /// Return the measurement frame - this is needed for alignment, in particular /// The measurement frame of a cylinder is the tangential plane at a given @@ -254,14 +254,14 @@ class CylinderSurface : public RegularSurface { /// @note The surfaces need to be *compatible*, i.e. have cylinder bounds /// that align, and have the same radius /// @param other The other cylinder surface to merge with - /// @param direction The binning direction: either @c binZ or @c binRPhi + /// @param direction The axis direction: either @c AxisZ or @c AxisRPhi /// @param externalRotation If true, any phi rotation is done in the transform /// @param logger The logger to use /// @return The merged cylinder surface and a boolean indicating if surfaces are reversed /// @note The returned boolean is `false` if `this` is *left* or /// *counter-clockwise* of @p other, and `true` if not. std::pair, bool> mergedWith( - const CylinderSurface& other, BinningValue direction, + const CylinderSurface& other, AxisDirection direction, bool externalRotation, const Logger& logger = getDummyLogger()) const; protected: diff --git a/Core/include/Acts/Surfaces/DiscSurface.hpp b/Core/include/Acts/Surfaces/DiscSurface.hpp index 01e6bbd297c..f9d34b590a7 100644 --- a/Core/include/Acts/Surfaces/DiscSurface.hpp +++ b/Core/include/Acts/Surfaces/DiscSurface.hpp @@ -18,7 +18,7 @@ #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceConcept.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Result.hpp" #include @@ -141,15 +141,24 @@ class DiscSurface : public RegularSurface { /// @return The normal vector Vector3 normal(const GeometryContext& gctx) const; - /// The binning position The position calculated - /// for a certain binning type + /// A reference position for a given axis direction /// /// @param gctx The current geometry context object, e.g. alignment - /// @param bValue The binning type to be used - /// + /// @param aDir The axis direction for the reference position request /// @return position that can beused for this binning - Vector3 binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + Vector3 referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const final; + + /// A reference position value for a given axis direction + /// + /// @param gctx The current geometry context object, e.g. alignment + /// @param aDir the value generated for the reference position + /// + /// @note This calls the parent method except for AxisR + /// + /// @return float to be used for the binning schema + double referencePositionValue(const GeometryContext& gctx, + AxisDirection aDir) const final; /// This method returns the bounds by reference const SurfaceBounds& bounds() const final; @@ -290,17 +299,6 @@ class DiscSurface : public RegularSurface { BoundaryTolerance::Infinite(), double tolerance = s_onSurfaceTolerance) const final; - /// Implement the binningValue - /// - /// @param gctx The current geometry context object, e.g. alignment - /// @param bValue is the dobule in which you want to bin - /// - /// @note This calls the parent method except for binR - /// - /// @return float to be used for the binning schema - double binningPositionValue(const GeometryContext& gctx, - BinningValue bValue) const final; - /// Return properly formatted class name for screen output std::string name() const override; @@ -330,14 +328,14 @@ class DiscSurface : public RegularSurface { /// @note The surfaces need to be *compatible*, i.e. have disc bounds /// that align /// @param other The other disc surface to merge with - /// @param direction The binning direction: either @c binR or @c binPhi + /// @param direction The binning direction: either @c AxisR or @c AxisPhi /// @param externalRotation If true, any phi rotation is done in the transform /// @param logger The logger to use /// @return The merged disc surface and a boolean indicating if surfaces are reversed /// @note The returned boolean is `false` if `this` is *left* or /// *counter-clockwise* of @p other, and `true` if not. std::pair, bool> mergedWith( - const DiscSurface& other, BinningValue direction, bool externalRotation, + const DiscSurface& other, AxisDirection direction, bool externalRotation, const Logger& logger = getDummyLogger()) const; protected: diff --git a/Core/include/Acts/Surfaces/LineSurface.hpp b/Core/include/Acts/Surfaces/LineSurface.hpp index 79660e17dca..2b1175c25b1 100644 --- a/Core/include/Acts/Surfaces/LineSurface.hpp +++ b/Core/include/Acts/Surfaces/LineSurface.hpp @@ -16,7 +16,7 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/LineBounds.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Result.hpp" #include @@ -91,11 +91,11 @@ class LineSurface : public Surface { /// for a certain binning type /// /// @param gctx The current geometry context object, e.g. alignment - /// @param bValue is the binning type to be used + /// @param aDir is the axis direction for the reference position request /// /// @return position that can beused for this binning - Vector3 binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + Vector3 referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const final; /// Return the measurement frame - this is needed for alignment, in particular /// diff --git a/Core/include/Acts/Surfaces/PlaneSurface.hpp b/Core/include/Acts/Surfaces/PlaneSurface.hpp index ddf968da2ea..a2d57f349a3 100644 --- a/Core/include/Acts/Surfaces/PlaneSurface.hpp +++ b/Core/include/Acts/Surfaces/PlaneSurface.hpp @@ -17,7 +17,7 @@ #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceConcept.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Result.hpp" #include @@ -106,11 +106,11 @@ class PlaneSurface : public RegularSurface { /// for a certain binning type /// /// @param gctx The current geometry context object, e.g. alignment - /// @param bValue is the binning type to be used + /// @param aDir is the axis direction of reference position request /// /// @return position that can beused for this binning - Vector3 binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + Vector3 referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const final; /// Return the surface type SurfaceType type() const override; diff --git a/Core/include/Acts/Surfaces/SurfaceArray.hpp b/Core/include/Acts/Surfaces/SurfaceArray.hpp index ee40434f102..06212a90eec 100644 --- a/Core/include/Acts/Surfaces/SurfaceArray.hpp +++ b/Core/include/Acts/Surfaces/SurfaceArray.hpp @@ -11,7 +11,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/IAxis.hpp" @@ -107,7 +107,7 @@ class SurfaceArray { /// @brief The binning values described by this surface grid lookup /// They are in order of the axes (optional) and empty for eingle lookups - virtual std::vector binningValues() const { return {}; }; + virtual std::vector binningValues() const { return {}; }; /// Pure virtual destructor virtual ~ISurfaceGridLookup() = 0; @@ -139,7 +139,7 @@ class SurfaceArray { SurfaceGridLookup(std::function globalToLocal, std::function localToGlobal, std::tuple axes, - std::vector bValues = {}) + std::vector bValues = {}) : m_globalToLocal(std::move(globalToLocal)), m_localToGlobal(std::move(localToGlobal)), m_grid(std::move(axes)), @@ -149,7 +149,7 @@ class SurfaceArray { /// @brief Fill provided surfaces into the contained @c Grid. /// - /// This is done by iterating, accessing the binningPosition, lookup + /// This is done by iterating, accessing the referencePosition, lookup /// and append. /// Also populates the neighbor map by combining the filled bins of /// all bins around a given one. @@ -159,7 +159,7 @@ class SurfaceArray { void fill(const GeometryContext& gctx, const SurfaceVector& surfaces) override { for (const auto& srf : surfaces) { - Vector3 pos = srf->binningPosition(gctx, BinningValue::binR); + Vector3 pos = srf->referencePosition(gctx, AxisDirection::AxisR); lookup(pos).push_back(srf); } @@ -195,7 +195,8 @@ class SurfaceArray { minPath = std::numeric_limits::max(); for (const auto& srf : surfaces) { curPath = - (binCtr - srf->binningPosition(gctx, BinningValue::binR)).norm(); + (binCtr - srf->referencePosition(gctx, AxisDirection::AxisR)) + .norm(); if (curPath < minPath) { minPath = curPath; @@ -257,7 +258,7 @@ class SurfaceArray { /// @brief The binning values described by this surface grid lookup /// They are in order of the axes - std::vector binningValues() const override { + std::vector binningValues() const override { return m_binValues; } @@ -347,7 +348,7 @@ class SurfaceArray { std::function m_globalToLocal; std::function m_localToGlobal; Grid_t m_grid; - std::vector m_binValues; + std::vector m_binValues; std::vector m_neighborMap; }; @@ -519,7 +520,7 @@ class SurfaceArray { /// @brief The binning values described by this surface grid lookup /// They are in order of the axes - std::vector binningValues() const { + std::vector binningValues() const { return p_gridLookup->binningValues(); }; diff --git a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp index e2ffcf9bc11..d991f2532c0 100644 --- a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp +++ b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp @@ -622,7 +622,7 @@ class CombinatorialKalmanFilter { boundParams.referenceSurface().getSharedPtr()); } - stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); + stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); } // Record the active branch and remove it from the list diff --git a/Core/include/Acts/Utilities/Any.hpp b/Core/include/Acts/Utilities/Any.hpp index 337dafb2c24..bf04ec47ca7 100644 --- a/Core/include/Acts/Utilities/Any.hpp +++ b/Core/include/Acts/Utilities/Any.hpp @@ -213,7 +213,7 @@ class AnyBase : public AnyBaseAll { return *this; } - AnyBase(AnyBase&& other) { + AnyBase(AnyBase&& other) noexcept { _ACTS_ANY_VERBOSE("Move construct (this=" << this << ") at: " << static_cast(m_data.data())); if (m_handler == nullptr && other.m_handler == nullptr) { diff --git a/Core/include/Acts/Utilities/Axis.hpp b/Core/include/Acts/Utilities/Axis.hpp index 758a8c2ec3c..c6d5b53a541 100644 --- a/Core/include/Acts/Utilities/Axis.hpp +++ b/Core/include/Acts/Utilities/Axis.hpp @@ -8,7 +8,7 @@ #pragma once -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/IAxis.hpp" #include diff --git a/Core/include/Acts/Utilities/AxisFwd.hpp b/Core/include/Acts/Utilities/AxisDefinitions.hpp similarity index 66% rename from Core/include/Acts/Utilities/AxisFwd.hpp rename to Core/include/Acts/Utilities/AxisDefinitions.hpp index ce31ff3f7b6..a048693c518 100644 --- a/Core/include/Acts/Utilities/AxisFwd.hpp +++ b/Core/include/Acts/Utilities/AxisDefinitions.hpp @@ -13,6 +13,54 @@ #include namespace Acts { + +/// @enum AxisDirection to specify a local axis direction +enum class AxisDirection : int { + /// AxisX, AxisY, AxisZ are the cartesian directions in the local frame + AxisX = 0, + AxisY = 1, + AxisZ = 2, + /// AxisR is a radial direction + AxisR = 3, + /// AxisPhi is the azimuthal direction + AxisPhi = 4, + /// AxisRPhi is the radial-azimuthal direction + AxisRPhi = 5, + /// AxisTheta is the polar angle direction + AxisTheta = 6, + /// AxisEta is the pseudorapidity direction + AxisEta = 7, + /// AxisMag is the magnitude of the vector + AxisMag = 8 +}; + +/// Get all possible axis directions +/// @return a vector of all possible axis directions +const std::vector& allAxisDirections(); + +/// Returns the total number of axis directions +/// @return the number of axis directions +constexpr std::size_t numAxisDirections() { + return 9; +} + +/// Get an axis direction from its string name +/// +/// @param name is the name of the axis direction +/// @return the axis direction +AxisDirection axisDirectionFromName(const std::string& name); + +/// Get the name of a binning value as a string +/// @param aDir is the binning value +/// @return the name of the binning value +const std::string& axisDirectionName(AxisDirection aDir); + +/// Output stream operator for @c AxisDirection +/// @param os is the output stream +/// @param aDir is the axis direction +/// @return the output stream +std::ostream& operator<<(std::ostream& os, AxisDirection aDir); + /// Enum which determines how the axis handle its outer boundaries /// possible values values enum class AxisBoundaryType { @@ -38,14 +86,15 @@ constexpr auto AxisBound = AxisBoundaryTypeTag{}; constexpr auto AxisClosed = AxisBoundaryTypeTag{}; inline std::ostream& operator<<(std::ostream& os, AxisBoundaryType bdt) { + using enum AxisBoundaryType; switch (bdt) { - case AxisBoundaryType::Open: + case Open: os << "Open"; break; - case AxisBoundaryType::Bound: + case Bound: os << "Bound"; break; - case AxisBoundaryType::Closed: + case Closed: os << "Closed"; break; } diff --git a/Core/include/Acts/Utilities/BinAdjustment.hpp b/Core/include/Acts/Utilities/BinAdjustment.hpp index 6424276c5cf..05de674ee42 100644 --- a/Core/include/Acts/Utilities/BinAdjustment.hpp +++ b/Core/include/Acts/Utilities/BinAdjustment.hpp @@ -6,10 +6,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -/////////////////////////////////////////////////////////////////// -// BinAdjustment.hpp, Acts project -/////////////////////////////////////////////////////////////////// - #pragma once #include "Acts/Definitions/Algebra.hpp" @@ -18,6 +14,7 @@ #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/TrapezoidBounds.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinUtility.hpp" #include @@ -49,18 +46,18 @@ static inline BinUtility adjustBinUtility(const BinUtility& bu, // Loop over the binning data and adjust the dimensions for (auto& bd : bData) { // The binning value - BinningValue bval = bd.binvalue; + AxisDirection bval = bd.binvalue; // Throw exceptions is stuff doesn't make sense: // - not the right binning value // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != BinningValue::binR && bval != BinningValue::binPhi) { + } else if (bval != AxisDirection::AxisR && bval != AxisDirection::AxisPhi) { throw std::invalid_argument("Disc binning must be: phi, r"); } float min = 0., max = 0.; // Perform the value adjustment - if (bval == BinningValue::binPhi) { + if (bval == AxisDirection::AxisPhi) { min = minPhi; max = maxPhi; } else { @@ -100,22 +97,22 @@ static inline BinUtility adjustBinUtility(const BinUtility& bu, // Loop over the binning data and adjust the dimensions for (auto& bd : bData) { // The binning value - BinningValue bval = bd.binvalue; + AxisDirection bval = bd.binvalue; // Throw exceptions if stuff doesn't make sense: // - not the right binning value // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != BinningValue::binRPhi && bval != BinningValue::binPhi && - bval != BinningValue::binZ) { + } else if (bval != AxisDirection::AxisRPhi && + bval != AxisDirection::AxisPhi && bval != AxisDirection::AxisZ) { throw std::invalid_argument("Cylinder binning must be: rphi, phi, z"); } float min = 0., max = 0.; // Perform the value adjustment - if (bval == BinningValue::binPhi) { + if (bval == AxisDirection::AxisPhi) { min = minPhi; max = maxPhi; - } else if (bval == BinningValue::binRPhi) { + } else if (bval == AxisDirection::AxisRPhi) { min = cR * minPhi; max = cR * maxPhi; } else { @@ -153,18 +150,18 @@ static inline BinUtility adjustBinUtility(const BinUtility& bu, // Loop over the binning data and adjust the dimensions for (auto& bd : bData) { // The binning value - BinningValue bval = bd.binvalue; + AxisDirection bval = bd.binvalue; // Throw exceptions if stuff doesn't make sense: // - not the right binning value // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != BinningValue::binX && bval != BinningValue::binY) { + } else if (bval != AxisDirection::AxisX && bval != AxisDirection::AxisY) { throw std::invalid_argument("Rectangle binning must be: x, y. "); } float min = 0., max = 0.; // Perform the value adjustment - if (bval == BinningValue::binX) { + if (bval == AxisDirection::AxisX) { min = minX; max = maxX; } else { @@ -203,18 +200,18 @@ static inline BinUtility adjustBinUtility(const BinUtility& bu, // Loop over the binning data and adjust the dimensions for (auto& bd : bData) { // The binning value - BinningValue bval = bd.binvalue; + AxisDirection bval = bd.binvalue; // Throw exceptions if stuff doesn't make sense: // - not the right binning value // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != BinningValue::binX && bval != BinningValue::binY) { + } else if (bval != AxisDirection::AxisX && bval != AxisDirection::AxisY) { throw std::invalid_argument("Rectangle binning must be: x, y. "); } float min = 0., max = 0.; // Perform the value adjustment - if (bval == BinningValue::binX) { + if (bval == AxisDirection::AxisX) { min = -1 * halfX; max = halfX; } else { diff --git a/Core/include/Acts/Utilities/BinAdjustmentVolume.hpp b/Core/include/Acts/Utilities/BinAdjustmentVolume.hpp index bef7bff3e83..e2ce50180fc 100644 --- a/Core/include/Acts/Utilities/BinAdjustmentVolume.hpp +++ b/Core/include/Acts/Utilities/BinAdjustmentVolume.hpp @@ -6,10 +6,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -/////////////////////////////////////////////////////////////////// -// BinAdjustment.hpp, Acts project -/////////////////////////////////////////////////////////////////// - #pragma once #include "Acts/Definitions/Algebra.hpp" @@ -17,6 +13,7 @@ #include "Acts/Geometry/CutoutCylinderVolumeBounds.hpp" #include "Acts/Geometry/CylinderVolumeBounds.hpp" #include "Acts/Geometry/Volume.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinUtility.hpp" #include @@ -48,26 +45,26 @@ BinUtility adjustBinUtility(const BinUtility& bu, // Loop over the binning data and adjust the dimensions for (auto& bd : bData) { // The binning value - BinningValue bval = bd.binvalue; + AxisDirection bval = bd.binvalue; // Throw exceptions is stuff doesn't make sense: // - not the right binning value // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != BinningValue::binR && bval != BinningValue::binPhi && - bval != BinningValue::binZ) { + } else if (bval != AxisDirection::AxisR && bval != AxisDirection::AxisPhi && + bval != AxisDirection::AxisZ) { throw std::invalid_argument("Cylinder volume binning must be: phi, r, z"); } float min = 0; float max = 0; // Perform the value adjustment - if (bval == BinningValue::binPhi) { + if (bval == AxisDirection::AxisPhi) { min = minPhi; max = maxPhi; - } else if (bval == BinningValue::binR) { + } else if (bval == AxisDirection::AxisR) { min = minR; max = maxR; - } else if (bval == BinningValue::binZ) { + } else if (bval == AxisDirection::AxisZ) { min = minZ; max = maxZ; } @@ -104,27 +101,27 @@ BinUtility adjustBinUtility(const BinUtility& bu, // Loop over the binning data and adjust the dimensions for (auto& bd : bData) { // The binning value - BinningValue bval = bd.binvalue; + AxisDirection bval = bd.binvalue; // Throw exceptions is stuff doesn't make sense: // - not the right binning value // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != BinningValue::binR && bval != BinningValue::binPhi && - bval != BinningValue::binZ) { + } else if (bval != AxisDirection::AxisR && bval != AxisDirection::AxisPhi && + bval != AxisDirection::AxisZ) { throw std::invalid_argument( "Cutout cylinder volume binning must be: phi, r, z"); } float min = 0; float max = 0; // Perform the value adjustment - if (bval == BinningValue::binPhi) { + if (bval == AxisDirection::AxisPhi) { min = minPhi; max = maxPhi; - } else if (bval == BinningValue::binR) { + } else if (bval == AxisDirection::AxisR) { min = minR; max = maxR; - } else if (bval == BinningValue::binZ) { + } else if (bval == AxisDirection::AxisZ) { min = minZ; max = maxZ; } @@ -160,26 +157,26 @@ BinUtility adjustBinUtility(const BinUtility& bu, // Loop over the binning data and adjust the dimensions for (auto& bd : bData) { // The binning value - BinningValue bval = bd.binvalue; + AxisDirection bval = bd.binvalue; // Throw exceptions is stuff doesn't make sense: // - not the right binning value // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != BinningValue::binX && bval != BinningValue::binY && - bval != BinningValue::binZ) { + } else if (bval != AxisDirection::AxisX && bval != AxisDirection::AxisY && + bval != AxisDirection::AxisZ) { throw std::invalid_argument("Cylinder volume binning must be: x, y, z"); } float min = 0; float max = 0; // Perform the value adjustment - if (bval == BinningValue::binX) { + if (bval == AxisDirection::AxisX) { min = minX; max = maxX; - } else if (bval == BinningValue::binY) { + } else if (bval == AxisDirection::AxisY) { min = minY; max = maxY; - } else if (bval == BinningValue::binZ) { + } else if (bval == AxisDirection::AxisZ) { min = minZ; max = maxZ; } diff --git a/Core/include/Acts/Utilities/BinUtility.hpp b/Core/include/Acts/Utilities/BinUtility.hpp index a1213ddd8ec..79d59ddadfa 100644 --- a/Core/include/Acts/Utilities/BinUtility.hpp +++ b/Core/include/Acts/Utilities/BinUtility.hpp @@ -9,6 +9,7 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningData.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Enumerate.hpp" @@ -56,8 +57,8 @@ class BinUtility { /// /// @param bData is the provided binning data /// @param tForm is the (optional) transform - BinUtility(const BinningData& bData, - const Transform3& tForm = Transform3::Identity()) + explicit BinUtility(const BinningData& bData, + const Transform3& tForm = Transform3::Identity()) : m_binningData(), m_transform(tForm), m_itransform(tForm.inverse()) { m_binningData.reserve(3); m_binningData.push_back(bData); @@ -69,10 +70,10 @@ class BinUtility { /// @param min in the minimal value /// @param max is the maximal value /// @param opt is the binning option : open, closed - /// @param value is the binninb value : binX, binY, binZ, etc. + /// @param value is the axis direction : AxisX, AxisY, AxisZ, etc. /// @param tForm is the (optional) transform BinUtility(std::size_t bins, float min, float max, BinningOption opt = open, - BinningValue value = BinningValue::binX, + AxisDirection value = AxisDirection::AxisX, const Transform3& tForm = Transform3::Identity()) : m_binningData(), m_transform(tForm), m_itransform(tForm.inverse()) { m_binningData.reserve(3); @@ -83,10 +84,10 @@ class BinUtility { /// /// @param bValues is the boundary values of the binning /// @param opt is the binning option : open, closed - /// @param value is the binninb value : binX, binY, binZ, etc. + /// @param value is the axis direction : AxisX, AxisY, AxisZ, etc. /// @param tForm is the (optional) transform BinUtility(std::vector& bValues, BinningOption opt = open, - BinningValue value = BinningValue::binPhi, + AxisDirection value = AxisDirection::AxisPhi, const Transform3& tForm = Transform3::Identity()) : m_binningData(), m_transform(tForm), m_itransform(tForm.inverse()) { m_binningData.reserve(3); @@ -267,7 +268,7 @@ class BinUtility { /// @param ba is the binaccessor /// /// @return the binning value of the accessor entry - BinningValue binningValue(std::size_t ba = 0) const { + AxisDirection binningValue(std::size_t ba = 0) const { if (ba >= m_binningData.size()) { throw std::runtime_error{"Dimension out of bounds"}; } diff --git a/Core/include/Acts/Utilities/BinnedArray.hpp b/Core/include/Acts/Utilities/BinnedArray.hpp index 7a13c16ae58..7cceb24270d 100644 --- a/Core/include/Acts/Utilities/BinnedArray.hpp +++ b/Core/include/Acts/Utilities/BinnedArray.hpp @@ -6,10 +6,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -/////////////////////////////////////////////////////////////////// -// BinnedArray.h, Acts project -/////////////////////////////////////////////////////////////////// - #pragma once #include "Acts/Definitions/Algebra.hpp" diff --git a/Core/include/Acts/Utilities/BinningData.hpp b/Core/include/Acts/Utilities/BinningData.hpp index 553ab10b2a9..904429f64be 100644 --- a/Core/include/Acts/Utilities/BinningData.hpp +++ b/Core/include/Acts/Utilities/BinningData.hpp @@ -9,6 +9,7 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/ThrowAssert.hpp" @@ -41,13 +42,13 @@ namespace Acts { /// class BinningData { public: - BinningType type{}; ///< binning type: equidistant, arbitrary - BinningOption option{}; ///< binning option: open, closed - BinningValue binvalue{}; ///< binning value: binX, binY, binZ, binR ... - float min{}; ///< minimum value - float max{}; ///< maximum value - float step{}; ///< binning step - bool zdim{}; ///< zero dimensional binning : direct access + BinningType type{}; ///< binning type: equidistant, arbitrary + BinningOption option{}; ///< binning option: open, closed + AxisDirection binvalue{}; ///< axis direction: AxisX, AxisY, AxisZ, ... + float min{}; ///< minimum value + float max{}; ///< maximum value + float step{}; ///< binning step + bool zdim{}; ///< zero dimensional binning : direct access /// sub structure: describe some sub binning std::unique_ptr subBinningData; @@ -56,10 +57,10 @@ class BinningData { /// Constructor for 0D binning /// - /// @param bValue is the binning value: binX, binY, etc. + /// @param bValue is the axis direction AxisX, AxisY, etc. /// @param bMin is the minimum value /// @param bMax is the maximum value - BinningData(BinningValue bValue, float bMin, float bMax) + BinningData(AxisDirection bValue, float bMin, float bMax) : type(equidistant), option(open), binvalue(bValue), @@ -79,13 +80,13 @@ class BinningData { /// multiplicative or additive /// /// @param bOption is the binning option : open, closed - /// @param bValue is the binning value: binX, binY, etc. + /// @param bValue is the axis direction: Axis, AxisY, etc. /// @param bBins is number of equidistant bins /// @param bMin is the minimum value /// @param bMax is the maximum value /// @param sBinData is (optional) sub structure /// @param sBinAdditive is the prescription for the sub structure - BinningData(BinningOption bOption, BinningValue bValue, std::size_t bBins, + BinningData(BinningOption bOption, AxisDirection bValue, std::size_t bBins, float bMin, float bMax, std::unique_ptr sBinData = nullptr, bool sBinAdditive = false) @@ -116,10 +117,10 @@ class BinningData { /// Constructor for non-equidistant binning /// /// @param bOption is the binning option : open / closed - /// @param bValue is the binning value : binX, binY, etc. + /// @param bValue is the axis direction : AxisX, AxisY, etc. /// @param bBoundaries are the bin boundaries /// @param sBinData is (optional) sub structure - BinningData(BinningOption bOption, BinningValue bValue, + BinningData(BinningOption bOption, AxisDirection bValue, const std::vector& bBoundaries, std::unique_ptr sBinData = nullptr) : type(arbitrary), @@ -241,8 +242,10 @@ class BinningData { /// @return float value according to the binning setup float value(const Vector2& lposition) const { // ordered after occurrence - if (binvalue == BinningValue::binR || binvalue == BinningValue::binRPhi || - binvalue == BinningValue::binX || binvalue == BinningValue::binH) { + if (binvalue == AxisDirection::AxisR || + binvalue == AxisDirection::AxisRPhi || + binvalue == AxisDirection::AxisX || + binvalue == AxisDirection::AxisTheta) { return lposition[0]; } @@ -259,13 +262,14 @@ class BinningData { using VectorHelpers::perp; using VectorHelpers::phi; // ordered after occurrence - if (binvalue == BinningValue::binR || binvalue == BinningValue::binH) { + if (binvalue == AxisDirection::AxisR || + binvalue == AxisDirection::AxisTheta) { return (perp(position)); } - if (binvalue == BinningValue::binRPhi) { + if (binvalue == AxisDirection::AxisRPhi) { return (perp(position) * phi(position)); } - if (binvalue == BinningValue::binEta) { + if (binvalue == AxisDirection::AxisEta) { return (eta(position)); } if (toUnderlying(binvalue) < 3) { diff --git a/Core/include/Acts/Utilities/BinningType.hpp b/Core/include/Acts/Utilities/BinningType.hpp index 90e90b5a2ad..d58730dec85 100644 --- a/Core/include/Acts/Utilities/BinningType.hpp +++ b/Core/include/Acts/Utilities/BinningType.hpp @@ -25,7 +25,7 @@ namespace Acts { /// open: [0,max] /// closed: 0 -> nextbin -> max -> 0 /// -/// - BinningValue +/// - AxisDirection /// necessary access to global positions /// enum BinningType { equidistant, arbitrary }; @@ -33,43 +33,4 @@ enum BinningType { equidistant, arbitrary }; /// @brief flag for open/closed bins enum BinningOption { open, closed }; -/// @enum BinningValue how to take the global / local position -enum class BinningValue : int { - binX = 0, - binY = 1, - binZ = 2, - binR = 3, - binPhi = 4, - binRPhi = 5, - binH = 6, - binEta = 7, - binMag = 8 -}; - -/// Get all possible binning values -/// @return the binning values -const std::vector& allBinningValues(); - -/// Returns the total number of binningvalues -/// @return the number of binning values -constexpr std::size_t numBinningValues() { - return 9; -} - -/// Get the binning value from a name -/// @param name is the name of the binning value -/// @return the binning value -BinningValue binningValueFromName(const std::string& name); - -/// Get the name of a binning value as a string -/// @param bValue is the binning value -/// @return the name of the binning value -const std::string& binningValueName(BinningValue bValue); - -/// Output stream operator for @c BinningValue -/// @param os is the output stream -/// @param bValue is the binning value -/// @return the output stream -std::ostream& operator<<(std::ostream& os, BinningValue bValue); - } // namespace Acts diff --git a/Core/include/Acts/Utilities/GridAccessHelpers.hpp b/Core/include/Acts/Utilities/GridAccessHelpers.hpp index df8f46ed39b..a358c50af8b 100644 --- a/Core/include/Acts/Utilities/GridAccessHelpers.hpp +++ b/Core/include/Acts/Utilities/GridAccessHelpers.hpp @@ -9,7 +9,7 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Delegate.hpp" #include "Acts/Utilities/VectorHelpers.hpp" @@ -141,7 +141,7 @@ class Affine3Transformed : public IGlobalToGridLocal { /// @brief A global (potentially casted) sub space of a global /// position /// @tparam ...Args -template +template class GlobalSubspace : public IGlobalToGridLocal { public: using grid_local_t = std::array; @@ -157,8 +157,8 @@ class GlobalSubspace : public IGlobalToGridLocal { // Constructor GlobalSubspace() = default; - /// The binning values - static constexpr std::array bValues = { + /// The axis directions of the subspace + static constexpr std::array axisDirs = { Args...}; /// Transform in to the local frame, then the grid local position @@ -170,7 +170,7 @@ class GlobalSubspace : public IGlobalToGridLocal { // Fill the grid point from global grid_local_t glocal{}; GridAccessHelpers::fillCasts( - position, bValues, glocal, + position, axisDirs, glocal, std::make_integer_sequence{}); return glocal; } diff --git a/Core/include/Acts/Utilities/IAxis.hpp b/Core/include/Acts/Utilities/IAxis.hpp index 09c9fbd3a56..6be294246b1 100644 --- a/Core/include/Acts/Utilities/IAxis.hpp +++ b/Core/include/Acts/Utilities/IAxis.hpp @@ -9,7 +9,7 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -63,6 +63,7 @@ class IAxis { /// with a const reference to the concrete axis type. /// @tparam callable_t the callable type /// @param callable the callable object + /// @return the value returned by the callable template decltype(auto) visit(const callable_t& callable) const { auto switchOnType = diff --git a/Core/include/Acts/Utilities/MultiIndex.hpp b/Core/include/Acts/Utilities/MultiIndex.hpp index f809771fd60..ca7d330ba6b 100644 --- a/Core/include/Acts/Utilities/MultiIndex.hpp +++ b/Core/include/Acts/Utilities/MultiIndex.hpp @@ -70,7 +70,7 @@ class MultiIndex { MultiIndex(const MultiIndex&) = default; MultiIndex(MultiIndex&) = default; MultiIndex& operator=(const MultiIndex&) = default; - MultiIndex& operator=(MultiIndex&&) = default; + MultiIndex& operator=(MultiIndex&&) noexcept = default; /// Allow setting the MultiIndex from an already encoded value. constexpr MultiIndex& operator=(Value encoded) { m_value = encoded; diff --git a/Core/include/Acts/Utilities/Result.hpp b/Core/include/Acts/Utilities/Result.hpp index 475019fc99b..c71836cc788 100644 --- a/Core/include/Acts/Utilities/Result.hpp +++ b/Core/include/Acts/Utilities/Result.hpp @@ -43,12 +43,12 @@ class Result { Result& operator=(const Result& other) = delete; /// Move construction is allowed - Result(Result&& other) : m_var(std::move(other.m_var)) {} + Result(Result&& other) noexcept : m_var(std::move(other.m_var)) {} /// Move assignment is allowed /// @param other The other result instance, rvalue reference /// @return The assigned instance - Result& operator=(Result&& other) { + Result& operator=(Result&& other) noexcept { m_var = std::move(other.m_var); return *this; } @@ -357,7 +357,7 @@ class Result { /// Move constructor /// @param other The other result object, rvalue ref - Result(Result&& other) : m_opt(std::move(other.m_opt)) {} + Result(Result&& other) noexcept : m_opt(std::move(other.m_opt)) {} /// Move assignment operator /// @param other The other result object, rvalue ref diff --git a/Core/include/Acts/Utilities/VectorHelpers.hpp b/Core/include/Acts/Utilities/VectorHelpers.hpp index e2c78619a3f..c48ffa2be71 100644 --- a/Core/include/Acts/Utilities/VectorHelpers.hpp +++ b/Core/include/Acts/Utilities/VectorHelpers.hpp @@ -11,7 +11,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Common.hpp" #include "Acts/Definitions/TrackParametrization.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -145,29 +145,35 @@ inline std::array evaluateTrigonomics(const Vector3& direction) { /// Helper method to extract the binning value from a 3D vector. /// /// For this method a 3D vector is required to guarantee all potential -/// binning values. -inline double cast(const Vector3& position, BinningValue bval) { - switch (bval) { - case BinningValue::binX: +/// axis directions to be casted from +/// +/// @param position is the position in global +/// @param aDir is the axis direction to be extracted +/// +/// @return the value of the binning direction +inline double cast(const Vector3& position, AxisDirection aDir) { + using enum AxisDirection; + switch (aDir) { + case AxisX: return position[0]; - case BinningValue::binY: + case AxisY: return position[1]; - case BinningValue::binZ: + case AxisZ: return position[2]; - case BinningValue::binR: + case AxisR: return perp(position); - case BinningValue::binPhi: + case AxisPhi: return phi(position); - case BinningValue::binRPhi: + case AxisRPhi: return perp(position) * phi(position); - case BinningValue::binH: + case AxisTheta: return theta(position); - case BinningValue::binEta: + case AxisEta: return eta(position); - case BinningValue::binMag: + case AxisMag: return position.norm(); default: - assert(false && "Invalid BinningValue enum value"); + assert(false && "Invalid AxisDirection enum value"); return std::numeric_limits::quiet_NaN(); } } diff --git a/Core/src/Detector/CuboidalContainerBuilder.cpp b/Core/src/Detector/CuboidalContainerBuilder.cpp index 47533bc4a11..c7390e0c862 100644 --- a/Core/src/Detector/CuboidalContainerBuilder.cpp +++ b/Core/src/Detector/CuboidalContainerBuilder.cpp @@ -35,13 +35,14 @@ Acts::Experimental::CuboidalContainerBuilder::CuboidalContainerBuilder( "CuboidalContainerBuilder: no sub builders provided."); } // Check if binning value is correctly chosen - if (m_cfg.binning != Acts::BinningValue::binX && - m_cfg.binning != Acts::BinningValue::binY && - m_cfg.binning != Acts::BinningValue::binZ) { + if (m_cfg.binning != Acts::AxisDirection::AxisX && + m_cfg.binning != Acts::AxisDirection::AxisY && + m_cfg.binning != Acts::AxisDirection::AxisZ) { throw std::invalid_argument( "CuboidalContainerBuilder: Invalid binning value. Only " - "Acts::BinningValue::binX, " - "Acts::BinningValue::binY, Acts::BinningValue::binZ are supported."); + "Acts::AxisDirection::AxisX, " + "Acts::AxisDirection::AxisY, Acts::AxisDirection::AxisZ are " + "supported."); } } @@ -94,13 +95,14 @@ Acts::Experimental::CuboidalContainerBuilder::CuboidalContainerBuilder( } m_cfg.binning = bpNode.binning.at(0); // Check if binning value is correctly chosen - if (m_cfg.binning != Acts::BinningValue::binX && - m_cfg.binning != Acts::BinningValue::binY && - m_cfg.binning != Acts::BinningValue::binZ) { + if (m_cfg.binning != Acts::AxisDirection::AxisX && + m_cfg.binning != Acts::AxisDirection::AxisY && + m_cfg.binning != Acts::AxisDirection::AxisZ) { throw std::invalid_argument( "CuboidalContainerBuilder: Invalid binning value. Only " - "Acts::BinningValue::binX, " - "Acts::BinningValue::binY, Acts::BinningValue::binZ are supported."); + "Acts::AxisDirection::AxisX, " + "Acts::AxisDirection::AxisY, Acts::AxisDirection::AxisZ are " + "supported."); } m_cfg.auxiliary = "*** acts auto-generated from proxy ***"; diff --git a/Core/src/Detector/CylindricalContainerBuilder.cpp b/Core/src/Detector/CylindricalContainerBuilder.cpp index 8441dc93762..86dcdb08a16 100644 --- a/Core/src/Detector/CylindricalContainerBuilder.cpp +++ b/Core/src/Detector/CylindricalContainerBuilder.cpp @@ -44,25 +44,25 @@ namespace { template Acts::Experimental::DetectorComponent::PortalContainer connect( const Acts::GeometryContext& gctx, object_collection& objects, - const std::vector& binning, + const std::vector& binning, Acts::Logging::Level logLevel) { // Return container object Acts::Experimental::DetectorComponent::PortalContainer portalContainer; if (binning.size() == 1u) { - Acts::BinningValue bv = binning.front(); + Acts::AxisDirection bv = binning.front(); // 1-dimensional binning options switch (bv) { - case Acts::BinningValue::binR: { + case Acts::AxisDirection::AxisR: { portalContainer = Acts::Experimental::detail::CylindricalDetectorHelper::connectInR( gctx, objects, {}, logLevel); } break; - case Acts::BinningValue::binZ: { + case Acts::AxisDirection::AxisZ: { portalContainer = Acts::Experimental::detail::CylindricalDetectorHelper::connectInZ( gctx, objects, {}, logLevel); } break; - case Acts::BinningValue::binPhi: { + case Acts::AxisDirection::AxisPhi: { portalContainer = Acts::Experimental::detail::CylindricalDetectorHelper::connectInPhi( gctx, objects, {}, logLevel); @@ -71,8 +71,8 @@ Acts::Experimental::DetectorComponent::PortalContainer connect( break; } } else if (binning == - std::vector{Acts::BinningValue::binZ, - Acts::BinningValue::binR} && + std::vector{Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR} && objects.size() == 2u) { portalContainer = Acts::Experimental::detail::CylindricalDetectorHelper::wrapInZR( @@ -95,8 +95,8 @@ Acts::Experimental::CylindricalContainerBuilder::CylindricalContainerBuilder( if (m_cfg.binning.size() == 1u) { // 1-dimensional case auto b = m_cfg.binning.front(); - if (b != Acts::BinningValue::binR && b != Acts::BinningValue::binZ && - b != Acts::BinningValue::binPhi) { + if (b != Acts::AxisDirection::AxisR && b != Acts::AxisDirection::AxisZ && + b != Acts::AxisDirection::AxisPhi) { throw std::invalid_argument( "CylindricalContainerBuilder: 1D binning only supported in z, r, or " "phi"); @@ -104,8 +104,8 @@ Acts::Experimental::CylindricalContainerBuilder::CylindricalContainerBuilder( } else if (m_cfg.binning.size() == 2u) { // 2-dimensional case, this is for wrapping if (m_cfg.binning != - std::vector{Acts::BinningValue::binZ, - Acts::BinningValue::binR}) { + std::vector{Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR}) { throw std::invalid_argument( "CylindricalContainerBuilder: 2D binning only supports wrapping in " "z-r."); @@ -168,8 +168,8 @@ Acts::Experimental::CylindricalContainerBuilder::CylindricalContainerBuilder( if (m_cfg.binning.size() == 1u) { // 1-dimensional case auto b = m_cfg.binning.front(); - if (b != Acts::BinningValue::binR && b != Acts::BinningValue::binZ && - b != Acts::BinningValue::binPhi) { + if (b != Acts::AxisDirection::AxisR && b != Acts::AxisDirection::AxisZ && + b != Acts::AxisDirection::AxisPhi) { throw std::invalid_argument( "CylindricalContainerBuilder: 1D binning only supported in z, r, or " "phi"); @@ -177,8 +177,8 @@ Acts::Experimental::CylindricalContainerBuilder::CylindricalContainerBuilder( } else if (m_cfg.binning.size() == 2u) { // 2-dimensional case, this is for wrapping if (m_cfg.binning != - std::vector{Acts::BinningValue::binZ, - Acts::BinningValue::binR}) { + std::vector{Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR}) { throw std::invalid_argument( "CylindricalContainerBuilder: 2D binning only supports wrapping in " "z-r."); diff --git a/Core/src/Detector/DetectorVolume.cpp b/Core/src/Detector/DetectorVolume.cpp index 6cd8d189298..eb74a2b8b57 100644 --- a/Core/src/Detector/DetectorVolume.cpp +++ b/Core/src/Detector/DetectorVolume.cpp @@ -261,7 +261,7 @@ bool Acts::Experimental::DetectorVolume::checkContainment( // We don't have a logging instance here // so can't throw a warning for shapes that are // using the bounding box - auto binningValues = volumeBounds().canonicalBinning(); + auto binningValues = volumeBounds().canonicalAxes(); // Create the volume extent auto volumeExtent = extent(gctx, nseg); diff --git a/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp b/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp index ae1bee83e5d..527a81a80a6 100644 --- a/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp +++ b/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp @@ -22,7 +22,7 @@ void fillGridIndices2D( const std::vector>& rootVolumes, const std::array, 2u>& boundaries, - const std::array& casts) { + const std::array& casts) { // Brute force loop over all bins & all volumes for (const auto [ic0, c0] : Acts::enumerate(boundaries[0u])) { if (ic0 > 0) { @@ -31,8 +31,8 @@ void fillGridIndices2D( if (ic1 > 0) { double v1 = 0.5 * (c1 + boundaries[1u][ic1 - 1]); if (casts == - std::array{Acts::BinningValue::binZ, - Acts::BinningValue::binR}) { + std::array{Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR}) { Acts::Vector3 zrPosition{v1, 0., v0}; for (const auto [iv, v] : Acts::enumerate(rootVolumes)) { if (v->inside(gctx, zrPosition)) { @@ -49,10 +49,10 @@ void fillGridIndices2D( } // namespace Acts::Experimental::IndexedRootVolumeFinderBuilder:: - IndexedRootVolumeFinderBuilder(std::vector binning) + IndexedRootVolumeFinderBuilder(std::vector binning) : m_casts(std::move(binning)) { - if (m_casts != std::vector{Acts::BinningValue::binZ, - Acts::BinningValue::binR}) { + if (m_casts != std::vector{Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR}) { throw std::invalid_argument("Online (z,r) binning is currently supported."); } } @@ -72,7 +72,7 @@ Acts::Experimental::IndexedRootVolumeFinderBuilder::construct( using GridType = typename AxesGeneratorType::template grid_type; GridType grid(zrAxes()); - auto casts = std::array{m_casts[0u], m_casts[1u]}; + auto casts = std::array{m_casts[0u], m_casts[1u]}; auto boundaries = std::array, 2u>{rzphis[1], rzphis[0]}; fillGridIndices2D(gctx, grid, rootVolumes, boundaries, casts); diff --git a/Core/src/Detector/LayerStructureBuilder.cpp b/Core/src/Detector/LayerStructureBuilder.cpp index 76092582eea..5b63b40ba39 100644 --- a/Core/src/Detector/LayerStructureBuilder.cpp +++ b/Core/src/Detector/LayerStructureBuilder.cpp @@ -18,7 +18,7 @@ #include "Acts/Navigation/DetectorVolumeFinders.hpp" #include "Acts/Navigation/NavigationDelegates.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningData.hpp" #include "Acts/Utilities/Enumerate.hpp" #include "Acts/Utilities/Grid.hpp" @@ -53,8 +53,8 @@ void adaptBinningRange(std::vector& pBinning, // Get the number of bins std::size_t nBins = pb.bins(); // Check if extent overwrites that - if (extent.constrains(pb.binValue)) { - const auto& range = extent.range(pb.binValue); + if (extent.constrains(pb.axisDir)) { + const auto& range = extent.range(pb.axisDir); // Patch the edges values from the range vmin = range.min(); vmax = range.max(); @@ -99,7 +99,7 @@ Acts::Experimental::InternalNavigationDelegate createUpdater( decltype(lSurfaces), Acts::Experimental::IndexedSurfacesNavigation> isg{std::move(lSurfaces), std::move(assignToAll), - {binning.binValue}, + {binning.axisDir}, {binning.expansion}}; if (binning.axisType == Acts::AxisType::Equidistant) { // Equidistant @@ -141,7 +141,7 @@ Acts::Experimental::InternalNavigationDelegate createUpdater( decltype(lSurfaces), Acts::Experimental::IndexedSurfacesNavigation> isg{lSurfaces, assignToAll, - {aBinning.binValue, bBinning.binValue}, + {aBinning.axisDir, bBinning.axisDir}, {aBinning.expansion, bBinning.expansion}}; // Run through the cases if (aBinning.axisType == Acts::AxisType::Equidistant && @@ -242,11 +242,11 @@ Acts::Experimental::LayerStructureBuilder::construct( Extent supportExtent; // Let us start with an eventually existing volume extent, but only pick // the binning value that are not constrained by the internal surfaces - for (const auto& bv : allBinningValues()) { + for (const auto& bv : allAxisDirections()) { if (support.volumeExtent.constrains(bv) && !rangeContainsValue(support.internalConstraints, bv)) { ACTS_VERBOSE(" Support surface is constrained by volume extent in " - << binningValueName(bv)); + << axisDirectionName(bv)); supportExtent.set(bv, support.volumeExtent.min(bv), support.volumeExtent.max(bv)); } @@ -266,27 +266,27 @@ Acts::Experimental::LayerStructureBuilder::construct( // Add cylindrical support if (support.type == Surface::SurfaceType::Cylinder) { detail::SupportSurfacesHelper::CylindricalSupport cSupport{ - support.offset, support.volumeClearance[BinningValue::binZ], - support.volumeClearance[BinningValue::binPhi]}; + support.offset, support.volumeClearance[AxisDirection::AxisZ], + support.volumeClearance[AxisDirection::AxisPhi]}; detail::SupportSurfacesHelper::addSupport(internalSurfaces, assignToAll, supportExtent, cSupport, support.splits); } else if (support.type == Surface::SurfaceType::Disc) { // Add disc support detail::SupportSurfacesHelper::DiscSupport dSupport{ - support.offset, support.volumeClearance[BinningValue::binR], - support.volumeClearance[BinningValue::binPhi]}; + support.offset, support.volumeClearance[AxisDirection::AxisR], + support.volumeClearance[AxisDirection::AxisPhi]}; detail::SupportSurfacesHelper::addSupport(internalSurfaces, assignToAll, supportExtent, dSupport, support.splits); } else if (support.type == Surface::SurfaceType::Plane) { // Set the local coordinates - cyclic permutation - std::array locals = {BinningValue::binX, - BinningValue::binY}; - if (support.pPlacement == BinningValue::binX) { - locals = {BinningValue::binY, BinningValue::binZ}; - } else if (support.pPlacement == BinningValue::binY) { - locals = {BinningValue::binZ, BinningValue::binX}; + std::array locals = {AxisDirection::AxisX, + AxisDirection::AxisY}; + if (support.pPlacement == AxisDirection::AxisX) { + locals = {AxisDirection::AxisY, AxisDirection::AxisZ}; + } else if (support.pPlacement == AxisDirection::AxisY) { + locals = {AxisDirection::AxisZ, AxisDirection::AxisX}; } // Add rectangular support detail::SupportSurfacesHelper::RectangularSupport rSupport{ @@ -340,7 +340,7 @@ Acts::Experimental::LayerStructureBuilder::construct( adaptBinningRange(binnings, m_cfg.extent.value()); } // Sort the binning for conventions - std::ranges::sort(binnings, {}, [](const auto& b) { return b.binValue; }); + std::ranges::sort(binnings, {}, [](const auto& b) { return b.axisDir; }); ACTS_DEBUG("- 2-dimensional surface binning detected."); // Capture the binnings diff --git a/Core/src/Detector/MultiWireStructureBuilder.cpp b/Core/src/Detector/MultiWireStructureBuilder.cpp index 59f87a7e3c8..6ff673f958a 100644 --- a/Core/src/Detector/MultiWireStructureBuilder.cpp +++ b/Core/src/Detector/MultiWireStructureBuilder.cpp @@ -72,7 +72,7 @@ class MultiWireInternalStructureBuilder Acts::Experimental::MultiLayerSurfacesNavigation> isg{internalSurfaces, {}, - {m_cfg.binning[0u].binValue, m_cfg.binning[1u].binValue}, + {m_cfg.binning[0u].axisDir, m_cfg.binning[1u].axisDir}, {m_cfg.binning[0u].expansion, m_cfg.binning[1u].expansion}, m_cfg.transform}; Acts::Experimental::detail::CenterReferenceGenerator rGenerator; diff --git a/Core/src/Detector/ProtoDetector.cpp b/Core/src/Detector/ProtoDetector.cpp index a1ec0009c57..ef8087c46e8 100644 --- a/Core/src/Detector/ProtoDetector.cpp +++ b/Core/src/Detector/ProtoDetector.cpp @@ -24,20 +24,20 @@ void Acts::ProtoVolume::extendUp(Acts::ProtoVolume& ptVolume) { } } -void Acts::ProtoVolume::propagateMinDown(BinningValue bValue) { +void Acts::ProtoVolume::propagateMinDown(AxisDirection aDir) { if (container.has_value()) { for (auto& cv : container.value().constituentVolumes) { - cv.extent.set(bValue, extent.min(bValue), cv.extent.max(bValue)); - cv.propagateMinDown(bValue); + cv.extent.set(aDir, extent.min(aDir), cv.extent.max(aDir)); + cv.propagateMinDown(aDir); } } } -void Acts::ProtoVolume::propagateMaxDown(BinningValue bValue) { +void Acts::ProtoVolume::propagateMaxDown(AxisDirection aDir) { if (container.has_value()) { for (auto& cv : container.value().constituentVolumes) { - cv.extent.set(bValue, cv.extent.min(bValue), extent.max(bValue)); - cv.propagateMaxDown(bValue); + cv.extent.set(aDir, cv.extent.min(aDir), extent.max(aDir)); + cv.propagateMaxDown(aDir); } } } @@ -52,7 +52,7 @@ void Acts::ProtoVolume::constrainDown(const Acts::ProtoVolume& ptVolume) { } void Acts::ProtoVolume::harmonize(bool legacy) { - std::vector otherConstrains; + std::vector otherConstrains; // Deal with the constituents if (container.has_value() && !container.value().constituentVolumes.empty()) { @@ -82,9 +82,9 @@ void Acts::ProtoVolume::harmonize(bool legacy) { std::vector borders = {}; // The volumes should be harmonized in all other constraining values - for (auto obValue : allBinningValues()) { - if (obValue != binValue && extent.constrains(obValue)) { - otherConstrains.push_back(obValue); + for (auto oaDir : allAxisDirections()) { + if (oaDir != binValue && extent.constrains(oaDir)) { + otherConstrains.push_back(oaDir); } } diff --git a/Core/src/Detector/VolumeStructureBuilder.cpp b/Core/src/Detector/VolumeStructureBuilder.cpp index 9103164ad58..7f16cb0d4aa 100644 --- a/Core/src/Detector/VolumeStructureBuilder.cpp +++ b/Core/src/Detector/VolumeStructureBuilder.cpp @@ -74,15 +74,16 @@ Acts::Experimental::VolumeStructureBuilder::construct( if (boundValues.empty() && m_cfg.extent.has_value()) { ACTS_VERBOSE("Cuboid: estimate parameters from Extent."); const auto& vExtent = m_cfg.extent.value(); - if (vExtent.constrains(BinningValue::binX) && - vExtent.constrains(BinningValue::binY) && - vExtent.constrains(BinningValue::binZ)) { - eTransform.pretranslate(Vector3(vExtent.medium(BinningValue::binX), - vExtent.medium(BinningValue::binY), - vExtent.medium(BinningValue::binZ))); - boundValues = {0.5 * vExtent.interval(BinningValue::binX), - 0.5 * vExtent.interval(BinningValue::binY), - 0.5 * vExtent.interval(BinningValue::binZ)}; + if (vExtent.constrains(AxisDirection::AxisX) && + vExtent.constrains(AxisDirection::AxisY) && + vExtent.constrains(AxisDirection::AxisZ)) { + eTransform.pretranslate( + Vector3(vExtent.medium(AxisDirection::AxisX), + vExtent.medium(AxisDirection::AxisY), + vExtent.medium(AxisDirection::AxisZ))); + boundValues = {0.5 * vExtent.interval(AxisDirection::AxisX), + 0.5 * vExtent.interval(AxisDirection::AxisY), + 0.5 * vExtent.interval(AxisDirection::AxisZ)}; } else { throw std::runtime_error( @@ -119,16 +120,17 @@ Acts::Experimental::VolumeStructureBuilder::construct( if (boundValues.empty() && m_cfg.extent.has_value()) { ACTS_VERBOSE("Cylinder: estimate parameters from Extent."); const auto& vExtent = m_cfg.extent.value(); - if (vExtent.constrains(BinningValue::binR) && - vExtent.constrains(BinningValue::binZ)) { + if (vExtent.constrains(AxisDirection::AxisR) && + vExtent.constrains(AxisDirection::AxisZ)) { eTransform.pretranslate( - Vector3(0., 0., vExtent.medium(BinningValue::binZ))); - boundValues = {vExtent.min(BinningValue::binR), - vExtent.max(BinningValue::binR), - 0.5 * vExtent.interval(BinningValue::binZ)}; - if (vExtent.constrains(BinningValue::binPhi)) { - boundValues.push_back(0.5 * vExtent.interval(BinningValue::binPhi)); - boundValues.push_back(vExtent.medium(BinningValue::binPhi)); + Vector3(0., 0., vExtent.medium(AxisDirection::AxisZ))); + boundValues = {vExtent.min(AxisDirection::AxisR), + vExtent.max(AxisDirection::AxisR), + 0.5 * vExtent.interval(AxisDirection::AxisZ)}; + if (vExtent.constrains(AxisDirection::AxisPhi)) { + boundValues.push_back(0.5 * + vExtent.interval(AxisDirection::AxisPhi)); + boundValues.push_back(vExtent.medium(AxisDirection::AxisPhi)); } } else { throw std::runtime_error( diff --git a/Core/src/Detector/detail/BlueprintHelper.cpp b/Core/src/Detector/detail/BlueprintHelper.cpp index b0167188021..c67782ed757 100644 --- a/Core/src/Detector/detail/BlueprintHelper.cpp +++ b/Core/src/Detector/detail/BlueprintHelper.cpp @@ -18,16 +18,16 @@ namespace { std::array endPointsXYZ( - const Acts::Experimental::Blueprint::Node& node, Acts::BinningValue bVal) { + const Acts::Experimental::Blueprint::Node& node, Acts::AxisDirection bVal) { unsigned int bIdx = 0; switch (bVal) { - case Acts::BinningValue::binX: + case Acts::AxisDirection::AxisX: bIdx = 0; break; - case Acts::BinningValue::binY: + case Acts::AxisDirection::AxisY: bIdx = 1; break; - case Acts::BinningValue::binZ: + case Acts::AxisDirection::AxisZ: bIdx = 2; break; default: @@ -52,14 +52,14 @@ void Acts::Experimental::detail::BlueprintHelper::sort(Blueprint::Node& node, if (node.binning.size() == 1) { auto bVal = node.binning.front(); // x,y,z binning along the axis - if (bVal == BinningValue::binX || bVal == BinningValue::binY || - bVal == BinningValue::binZ) { + if (bVal == AxisDirection::AxisX || bVal == AxisDirection::AxisY || + bVal == AxisDirection::AxisZ) { Vector3 nodeCenter = node.transform.translation(); Vector3 nodeSortAxis = node.transform.rotation().col(toUnderlying(bVal)); std::ranges::sort(node.children, {}, [&](const auto& c) { return (c->transform.translation() - nodeCenter).dot(nodeSortAxis); }); - } else if (bVal == BinningValue::binR && + } else if (bVal == AxisDirection::AxisR && node.boundsType == VolumeBounds::eCylinder) { std::ranges::sort(node.children, {}, [](const auto& c) { return c->boundaryValues[0] + c->boundaryValues[1]; @@ -108,7 +108,7 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCylindrical( std::vector> gaps; // Only 1D binning implemented for the moment - if (BinningValue bVal = node.binning.front(); bVal == BinningValue::binZ) { + if (AxisDirection bVal = node.binning.front(); bVal == AxisDirection::AxisZ) { // adjust inner/outer radius if (adjustToParent) { std::for_each(node.children.begin(), node.children.end(), @@ -152,7 +152,7 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCylindrical( gaps.push_back(std::move(gap)); } - } else if (bVal == BinningValue::binR) { + } else if (bVal == AxisDirection::AxisR) { // We have binning in R present if (adjustToParent) { std::for_each(node.children.begin(), node.children.end(), @@ -208,8 +208,8 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCuboidal( sort(node, false); // Cuboidal detector binnings - std::array allowedBinVals = { - BinningValue::binX, BinningValue::binY, BinningValue::binZ}; + std::array allowedBinVals = { + AxisDirection::AxisX, AxisDirection::AxisY, AxisDirection::AxisZ}; std::vector> gaps; auto binVal = node.binning.front(); diff --git a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp index cda12f02de2..aef8d2a5c02 100644 --- a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp @@ -28,23 +28,23 @@ Acts::Experimental::DetectorComponent::PortalContainer Acts::Experimental::detail::CuboidalDetectorHelper::connect( const GeometryContext& gctx, std::vector>& volumes, - BinningValue bValue, const std::vector& selectedOnly, + AxisDirection bValue, const std::vector& selectedOnly, Acts::Logging::Level logLevel) { ACTS_LOCAL_LOGGER(getDefaultLogger("CuboidalDetectorHelper", logLevel)); ACTS_DEBUG("Connect " << volumes.size() << " detector volumes in " - << binningValueName(bValue) << "."); + << axisDirectionName(bValue) << "."); // Check transform for consistency auto centerDistances = DetectorVolumeConsistency::checkCenterAlignment(gctx, volumes, bValue); // Assign the portal indices according to the volume bounds definition - std::array possibleValues = { - BinningValue::binX, BinningValue::binY, BinningValue::binZ}; - // 1 -> [ 2,3 ] for binX connection (cylclic one step) - // 2 -> [ 4,5 ] for binY connection (cylclic two steps) - // 0 -> [ 0,1 ] for binZ connection (to be in line with cylinder covnention) + std::array possibleValues = { + AxisDirection::AxisX, AxisDirection::AxisY, AxisDirection::AxisZ}; + // 1 -> [ 2,3 ] for AxisX connection (cylclic one step) + // 2 -> [ 4,5 ] for AxisY connection (cylclic two steps) + // 0 -> [ 0,1 ] for AxisZ connection (to be in line with cylinder covnention) using PortalSet = std::array; std::vector portalSets = { {PortalSet{2, 3}, PortalSet{4, 5}, PortalSet{0, 1}}}; @@ -61,7 +61,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( }; // Pick the counter part value - auto counterPart = [&](BinningValue mValue) -> BinningValue { + auto counterPart = [&](AxisDirection mValue) -> AxisDirection { for (auto cValue : possibleValues) { if (cValue != mValue && cValue != bValue) { return cValue; @@ -169,14 +169,14 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( // - this is an anticyclic swap bool mergedInX = true; switch (bValue) { - case BinningValue::binZ: { - mergedInX = (mergeValue == BinningValue::binY); + case AxisDirection::AxisZ: { + mergedInX = (mergeValue == AxisDirection::AxisY); } break; - case BinningValue::binY: { - mergedInX = (mergeValue == BinningValue::binX); + case AxisDirection::AxisY: { + mergedInX = (mergeValue == AxisDirection::AxisX); } break; - case BinningValue::binX: { - mergedInX = (mergeValue == BinningValue::binZ); + case AxisDirection::AxisX: { + mergedInX = (mergeValue == AxisDirection::AxisZ); } break; default: break; @@ -213,7 +213,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( // Make the stitch boundaries pReplacements.push_back(PortalReplacement( portal, index, dir, stitchBoundaries, - (mergedInX ? BinningValue::binX : BinningValue::binY))); + (mergedInX ? AxisDirection::AxisX : AxisDirection::AxisY))); } } @@ -243,20 +243,20 @@ Acts::Experimental::DetectorComponent::PortalContainer Acts::Experimental::detail::CuboidalDetectorHelper::connect( const GeometryContext& /*gctx*/, const std::vector& containers, - BinningValue bValue, const std::vector& /*unused */, + AxisDirection bValue, const std::vector& /*unused */, Acts::Logging::Level logLevel) noexcept(false) { // The local logger ACTS_LOCAL_LOGGER(getDefaultLogger("CuboidalDetectorHelper", logLevel)); ACTS_DEBUG("Connect " << containers.size() << " containers in " - << binningValueName(bValue) << "."); + << axisDirectionName(bValue) << "."); // Return the new container DetectorComponent::PortalContainer dShell; // The possible bin values - std::array possibleValues = { - BinningValue::binX, BinningValue::binY, BinningValue::binZ}; + std::array possibleValues = { + AxisDirection::AxisX, AxisDirection::AxisY, AxisDirection::AxisZ}; // And their associated portal sets, see above using PortalSet = std::array; std::vector portalSets = { diff --git a/Core/src/Detector/detail/CylindricalDetectorHelper.cpp b/Core/src/Detector/detail/CylindricalDetectorHelper.cpp index 545e0947797..2d1c021bbe6 100644 --- a/Core/src/Detector/detail/CylindricalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CylindricalDetectorHelper.cpp @@ -84,9 +84,9 @@ Acts::Experimental::PortalReplacement createDiscReplacement( const std::vector& phiBoundaries, unsigned int index, Acts::Direction dir) { // Autodetector stitch value - Acts::BinningValue stitchValue = phiBoundaries.size() == 2u - ? Acts::BinningValue::binR - : Acts::BinningValue::binPhi; + Acts::AxisDirection stitchValue = phiBoundaries.size() == 2u + ? Acts::AxisDirection::AxisR + : Acts::AxisDirection::AxisPhi; // Estimate ranges auto [minRit, maxRit] = std::ranges::minmax_element(rBoundaries); auto [sectorPhi, avgPhi] = Acts::range_medium(phiBoundaries); @@ -99,7 +99,7 @@ Acts::Experimental::PortalReplacement createDiscReplacement( transform, std::move(bounds)); // Make a portal and indicate the new link direction const auto& stitchBoundaries = - (stitchValue == Acts::BinningValue::binR) ? rBoundaries : phiBoundaries; + (stitchValue == Acts::AxisDirection::AxisR) ? rBoundaries : phiBoundaries; return Acts::Experimental::PortalReplacement( std::make_shared(surface), index, dir, stitchBoundaries, stitchValue); @@ -121,9 +121,9 @@ Acts::Experimental::PortalReplacement createCylinderReplacement( const std::vector& phiBoundaries, unsigned int index, Acts::Direction dir) { // Autodetector stitch value - Acts::BinningValue stitchValue = phiBoundaries.size() == 2u - ? Acts::BinningValue::binZ - : Acts::BinningValue::binPhi; + Acts::AxisDirection stitchValue = phiBoundaries.size() == 2u + ? Acts::AxisDirection::AxisZ + : Acts::AxisDirection::AxisPhi; auto [lengthZ, medZ] = Acts::range_medium(zBoundaries); auto [sectorPhi, avgPhi] = Acts::range_medium(phiBoundaries); @@ -136,7 +136,7 @@ Acts::Experimental::PortalReplacement createCylinderReplacement( // A make a portal and indicate the new link direction const auto& stitchBoundaries = - (stitchValue == Acts::BinningValue::binZ) ? zBoundaries : phiBoundaries; + (stitchValue == Acts::AxisDirection::AxisZ) ? zBoundaries : phiBoundaries; return Acts::Experimental::PortalReplacement( std::make_shared(surface), index, dir, stitchBoundaries, stitchValue); @@ -155,7 +155,7 @@ Acts::Experimental::PortalReplacement createCylinderReplacement( Acts::Experimental::PortalReplacement createSectorReplacement( const Acts::GeometryContext& gctx, const Acts::Vector3& volumeCenter, const Acts::Surface& refSurface, const std::vector& boundaries, - Acts::BinningValue binning, unsigned int index, Acts::Direction dir) { + Acts::AxisDirection binning, unsigned int index, Acts::Direction dir) { // Get a reference transform const auto& refTransform = refSurface.transform(gctx); auto refRotation = refTransform.rotation(); @@ -165,7 +165,7 @@ Acts::Experimental::PortalReplacement createSectorReplacement( // Create a new transform Acts::Transform3 transform = Acts::Transform3::Identity(); - if (binning == Acts::BinningValue::binR) { + if (binning == Acts::AxisDirection::AxisR) { // Range and center-r calculation auto [range, medium] = Acts::range_medium(boundaries); // New joint center: @@ -179,7 +179,7 @@ Acts::Experimental::PortalReplacement createSectorReplacement( boundValues[Acts::RectangleBounds::BoundValues::eMinX]); // New joint bounds bounds = std::make_unique(halfX, 0.5 * range); - } else if (binning == Acts::BinningValue::binZ) { + } else if (binning == Acts::AxisDirection::AxisZ) { // Range and medium z alculation auto [range, medium] = Acts::range_medium(boundaries); // Center R calculation, using projection onto vector @@ -396,9 +396,9 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInR( // As it is r-wrapping, the inner tube is guaranteed const Surface& refSurface = volumes[volumes.size() - 1u]->portals()[iu + 4u]->surface(); - pReplacements.push_back( - createSectorReplacement(gctx, vCenter, refSurface, rBoundaries, - Acts::BinningValue::binR, iu + 4ul, idir)); + pReplacements.push_back(createSectorReplacement( + gctx, vCenter, refSurface, rBoundaries, Acts::AxisDirection::AxisR, + iu + 4ul, idir)); } } } else { @@ -598,7 +598,7 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInZ( volumes[0u]->portals()[iu + iSecOffset]->surface(); pReplacements.push_back(createSectorReplacement( gctx, combinedCenter, refSurface, zBoundaries, - Acts::BinningValue::binZ, iu + 4ul, idir)); + Acts::AxisDirection::AxisZ, iu + 4ul, idir)); } } } else { diff --git a/Core/src/Detector/detail/DetectorVolumeConsistency.cpp b/Core/src/Detector/detail/DetectorVolumeConsistency.cpp index 999fe5fe6a8..ec8778de96b 100644 --- a/Core/src/Detector/detail/DetectorVolumeConsistency.cpp +++ b/Core/src/Detector/detail/DetectorVolumeConsistency.cpp @@ -39,7 +39,7 @@ std::vector Acts::Experimental::detail::DetectorVolumeConsistency::checkCenterAlignment( const GeometryContext& gctx, const std::vector>& volumes, - BinningValue axisValue) { + AxisDirection axisValue) { std::vector distances = {}; // First it needs to surfive the rotation check checkRotationAlignment(gctx, volumes); diff --git a/Core/src/Detector/detail/PortalHelper.cpp b/Core/src/Detector/detail/PortalHelper.cpp index a24b74308cf..40a418f4e4d 100644 --- a/Core/src/Detector/detail/PortalHelper.cpp +++ b/Core/src/Detector/detail/PortalHelper.cpp @@ -36,7 +36,7 @@ void Acts::Experimental::detail::PortalHelper::attachDetectorVolumesUpdater( const GeometryContext& gctx, Portal& portal, const std::vector>& volumes, const Direction& direction, const std::vector& boundaries, - const BinningValue& binning) { + const AxisDirection& binning) { // Check if the boundaries need a transform const auto pTransform = portal.surface().transform(gctx); // Creating a link to the mother diff --git a/Core/src/Detector/detail/ProtoMaterialHelper.cpp b/Core/src/Detector/detail/ProtoMaterialHelper.cpp index af5b96b187e..5cb3ad59c6f 100644 --- a/Core/src/Detector/detail/ProtoMaterialHelper.cpp +++ b/Core/src/Detector/detail/ProtoMaterialHelper.cpp @@ -25,8 +25,8 @@ Acts::Experimental::detail::ProtoMaterialHelper::attachProtoMaterial( ProtoBinning fBinning = b; // Check if the binning needs to be fixed if (fBinning.autorange) { - auto range = sExtent.range(b.binValue); - fBinning = ProtoBinning(b.binValue, b.boundaryType, range.min(), + auto range = sExtent.range(b.axisDir); + fBinning = ProtoBinning(b.axisDir, b.boundaryType, range.min(), range.max(), b.bins(), b.expansion); } fbDescription.binning.push_back(fBinning); diff --git a/Core/src/Detector/detail/SupportSurfacesHelper.cpp b/Core/src/Detector/detail/SupportSurfacesHelper.cpp index 1d06294e6a3..60f55b5ae74 100644 --- a/Core/src/Detector/detail/SupportSurfacesHelper.cpp +++ b/Core/src/Detector/detail/SupportSurfacesHelper.cpp @@ -28,26 +28,26 @@ Acts::Experimental::detail::SupportSurfacesHelper::SupportSurfaceComponents Acts::Experimental::detail::SupportSurfacesHelper::CylindricalSupport:: operator()(const Extent& lExtent) const { // Bail out if you have no measure of R, Z - if (!lExtent.constrains(BinningValue::binZ) || - !lExtent.constrains(BinningValue::binR)) { + if (!lExtent.constrains(AxisDirection::AxisZ) || + !lExtent.constrains(AxisDirection::AxisR)) { throw std::invalid_argument( "SupportSurfacesHelper::CylindricalSupport::operator() - z or " "r are not constrained."); } // Min / Max z with clearances adapted - double minZ = lExtent.min(BinningValue::binZ) + std::abs(zClearance[0u]); - double maxZ = lExtent.max(BinningValue::binZ) - std::abs(zClearance[1u]); + double minZ = lExtent.min(AxisDirection::AxisZ) + std::abs(zClearance[0u]); + double maxZ = lExtent.max(AxisDirection::AxisZ) - std::abs(zClearance[1u]); // Phi sector double hPhiSector = std::numbers::pi; double avgPhi = 0.; - if (lExtent.constrains(BinningValue::binPhi)) { + if (lExtent.constrains(AxisDirection::AxisPhi)) { // Min / Max phi with clearances adapted double minPhi = - lExtent.min(BinningValue::binPhi) + std::abs(phiClearance[0u]); + lExtent.min(AxisDirection::AxisPhi) + std::abs(phiClearance[0u]); double maxPhi = - lExtent.max(BinningValue::binPhi) - std::abs(phiClearance[1u]); + lExtent.max(AxisDirection::AxisPhi) - std::abs(phiClearance[1u]); hPhiSector = 0.5 * (maxPhi - minPhi); avgPhi = 0.5 * (minPhi + maxPhi); } @@ -58,10 +58,10 @@ operator()(const Extent& lExtent) const { } // The Radius estimation - double r = rOffset < 0 ? lExtent.min(BinningValue::binR) + rOffset - : lExtent.max(BinningValue::binR) + rOffset; + double r = rOffset < 0 ? lExtent.min(AxisDirection::AxisR) + rOffset + : lExtent.max(AxisDirection::AxisR) + rOffset; if (rOffset == 0.) { - r = lExtent.medium(BinningValue::binR); + r = lExtent.medium(AxisDirection::AxisR); } // Components are resolved and returned as a tuple return { @@ -72,35 +72,35 @@ Acts::Experimental::detail::SupportSurfacesHelper::SupportSurfaceComponents Acts::Experimental::detail::SupportSurfacesHelper::DiscSupport::operator()( const Extent& lExtent) const { // Bail out if you have no measure of R, Z - if (!lExtent.constrains(BinningValue::binZ) || - !lExtent.constrains(BinningValue::binR)) { + if (!lExtent.constrains(AxisDirection::AxisZ) || + !lExtent.constrains(AxisDirection::AxisR)) { throw std::invalid_argument( "SupportSurfacesHelper::DiscSupport::operator() - z or " "r are not constrained."); } // Min / Max r with clearances adapted - double minR = lExtent.min(BinningValue::binR) + std::abs(rClearance[0u]); - double maxR = lExtent.max(BinningValue::binR) - std::abs(rClearance[1u]); + double minR = lExtent.min(AxisDirection::AxisR) + std::abs(rClearance[0u]); + double maxR = lExtent.max(AxisDirection::AxisR) - std::abs(rClearance[1u]); // Phi sector double hPhiSector = std::numbers::pi; double avgPhi = 0.; - if (lExtent.constrains(BinningValue::binPhi)) { + if (lExtent.constrains(AxisDirection::AxisPhi)) { // Min / Max phi with clearances adapted double minPhi = - lExtent.min(BinningValue::binPhi) + std::abs(phiClearance[0u]); + lExtent.min(AxisDirection::AxisPhi) + std::abs(phiClearance[0u]); double maxPhi = - lExtent.max(BinningValue::binPhi) - std::abs(phiClearance[1u]); + lExtent.max(AxisDirection::AxisPhi) - std::abs(phiClearance[1u]); hPhiSector = 0.5 * (maxPhi - minPhi); avgPhi = 0.5 * (minPhi + maxPhi); } // The z position estimate - double z = zOffset < 0 ? lExtent.min(BinningValue::binZ) + zOffset - : lExtent.max(BinningValue::binZ) + zOffset; + double z = zOffset < 0 ? lExtent.min(AxisDirection::AxisZ) + zOffset + : lExtent.max(AxisDirection::AxisZ) + zOffset; if (zOffset == 0.) { - z = lExtent.medium(BinningValue::binZ); + z = lExtent.medium(AxisDirection::AxisZ); } Transform3 transform = Transform3::Identity(); @@ -114,20 +114,21 @@ Acts::Experimental::detail::SupportSurfacesHelper::SupportSurfaceComponents Acts::Experimental::detail::SupportSurfacesHelper::RectangularSupport:: operator()(const Extent& lExtent) const { // Bail out if you have no measure of X, Y, Z - if (!(lExtent.constrains(BinningValue::binX) && - lExtent.constrains(BinningValue::binY) && - lExtent.constrains(BinningValue::binZ))) { + if (!(lExtent.constrains(AxisDirection::AxisX) && + lExtent.constrains(AxisDirection::AxisY) && + lExtent.constrains(AxisDirection::AxisZ))) { throw std::invalid_argument( "SupportSurfacesHelper::RectangularSupport::operator() - x, y or " "z are not constrained."); } // Set the local coordinates - cyclic permutation - std::array locals = {BinningValue::binX, BinningValue::binY}; - if (pPlacement == BinningValue::binX) { - locals = {BinningValue::binY, BinningValue::binZ}; - } else if (pPlacement == BinningValue::binY) { - locals = {BinningValue::binZ, BinningValue::binX}; + std::array locals = {AxisDirection::AxisX, + AxisDirection::AxisY}; + if (pPlacement == AxisDirection::AxisX) { + locals = {AxisDirection::AxisY, AxisDirection::AxisZ}; + } else if (pPlacement == AxisDirection::AxisY) { + locals = {AxisDirection::AxisZ, AxisDirection::AxisX}; } // Make the rectangular shape diff --git a/Core/src/Geometry/Blueprint.cpp b/Core/src/Geometry/Blueprint.cpp index f4531acaa2f..a35de4a58f0 100644 --- a/Core/src/Geometry/Blueprint.cpp +++ b/Core/src/Geometry/Blueprint.cpp @@ -58,7 +58,7 @@ void Blueprint::addToGraphviz(std::ostream &os) const { std::unique_ptr Blueprint::construct( const BlueprintOptions &options, const GeometryContext &gctx, const Logger &logger) { - using enum BinningValue; + using enum AxisDirection; ACTS_INFO(prefix() << "Building tracking geometry from blueprint tree"); @@ -94,7 +94,7 @@ std::unique_ptr Blueprint::construct( // Make a copy that we'll modify auto newBounds = std::make_shared(*cyl); - const auto &zEnv = m_cfg.envelope[binZ]; + const auto &zEnv = m_cfg.envelope[AxisZ]; if (zEnv[0] != zEnv[1]) { ACTS_ERROR( prefix() << "Root node cylinder envelope for z must be symmetric"); @@ -103,7 +103,7 @@ std::unique_ptr Blueprint::construct( "symmetric"); } - const auto &rEnv = m_cfg.envelope[binR]; + const auto &rEnv = m_cfg.envelope[AxisR]; newBounds->set({ {eHalfLengthZ, newBounds->get(eHalfLengthZ) + zEnv[0]}, diff --git a/Core/src/Geometry/BlueprintNode.cpp b/Core/src/Geometry/BlueprintNode.cpp index 13c03495494..601fc6d2628 100644 --- a/Core/src/Geometry/BlueprintNode.cpp +++ b/Core/src/Geometry/BlueprintNode.cpp @@ -114,7 +114,7 @@ StaticBlueprintNode& BlueprintNode::addStaticVolume( } CylinderContainerBlueprintNode& BlueprintNode::addCylinderContainer( - const std::string& name, BinningValue direction, + const std::string& name, AxisDirection direction, const std::function& callback) { auto cylinder = diff --git a/Core/src/Geometry/CompositePortalLink.cpp b/Core/src/Geometry/CompositePortalLink.cpp index 108db95c192..19d9ea3c02a 100644 --- a/Core/src/Geometry/CompositePortalLink.cpp +++ b/Core/src/Geometry/CompositePortalLink.cpp @@ -30,7 +30,7 @@ namespace Acts { namespace { std::shared_ptr mergedSurface(const Surface& a, const Surface& b, - BinningValue direction) { + AxisDirection direction) { if (a.type() != b.type()) { throw std::invalid_argument{"Cannot merge surfaces of different types"}; } @@ -56,7 +56,7 @@ std::shared_ptr mergedSurface(const Surface& a, std::shared_ptr mergePortalLinks( const std::vector>& links, - BinningValue direction) { + AxisDirection direction) { assert(std::ranges::all_of(links, [](const auto& link) { return link != nullptr; })); assert(!links.empty()); @@ -73,7 +73,7 @@ std::shared_ptr mergePortalLinks( CompositePortalLink::CompositePortalLink(std::unique_ptr a, std::unique_ptr b, - BinningValue direction, bool flatten) + AxisDirection direction, bool flatten) : PortalLinkBase(mergedSurface(a->surface(), b->surface(), direction)), m_direction{direction} { if (!flatten) { @@ -99,7 +99,7 @@ CompositePortalLink::CompositePortalLink(std::unique_ptr a, } CompositePortalLink::CompositePortalLink( - std::vector> links, BinningValue direction, + std::vector> links, AxisDirection direction, bool flatten) : PortalLinkBase(mergePortalLinks(links, direction)), m_direction(direction) { @@ -207,7 +207,7 @@ std::unique_ptr CompositePortalLink::makeGrid( if (surface().type() == Surface::SurfaceType::Cylinder) { ACTS_VERBOSE("Combining composite into cylinder grid"); - if (m_direction != BinningValue::binZ) { + if (m_direction != AxisDirection::AxisZ) { ACTS_ERROR("Cylinder grid only supports binning in Z direction"); throw std::runtime_error{"Unsupported binning direction"}; } @@ -251,7 +251,7 @@ std::unique_ptr CompositePortalLink::makeGrid( } else if (surface().type() == Surface::SurfaceType::Disc) { ACTS_VERBOSE("Combining composite into disc grid"); - if (m_direction != BinningValue::binR) { + if (m_direction != AxisDirection::AxisR) { ACTS_ERROR("Disc grid only supports binning in R direction"); throw std::runtime_error{"Unsupported binning direction"}; } diff --git a/Core/src/Geometry/CuboidVolumeBounds.cpp b/Core/src/Geometry/CuboidVolumeBounds.cpp index a8b1729c74a..29e7714fedf 100644 --- a/Core/src/Geometry/CuboidVolumeBounds.cpp +++ b/Core/src/Geometry/CuboidVolumeBounds.cpp @@ -104,15 +104,15 @@ void CuboidVolumeBounds::buildSurfaceBounds() { get(eHalfLengthX)); } -double CuboidVolumeBounds::binningBorder(BinningValue bValue) const { - if (bValue <= BinningValue::binZ) { - return m_values[toUnderlying(bValue)]; +double CuboidVolumeBounds::referenceBorder(AxisDirection aDir) const { + if (aDir <= AxisDirection::AxisZ) { + return m_values[toUnderlying(aDir)]; } - if (bValue == BinningValue::binR) { - return std::sqrt(m_values[toUnderlying(BinningValue::binX)] * - m_values[toUnderlying(BinningValue::binX)] + - m_values[toUnderlying(BinningValue::binY)] * - m_values[toUnderlying(BinningValue::binY)]); + if (aDir == AxisDirection::AxisR) { + return std::sqrt(m_values[toUnderlying(AxisDirection::AxisX)] * + m_values[toUnderlying(AxisDirection::AxisX)] + + m_values[toUnderlying(AxisDirection::AxisY)] * + m_values[toUnderlying(AxisDirection::AxisY)]); } return 0.0; } diff --git a/Core/src/Geometry/CuboidVolumeBuilder.cpp b/Core/src/Geometry/CuboidVolumeBuilder.cpp index 614ce28a67f..90c9df756ae 100644 --- a/Core/src/Geometry/CuboidVolumeBuilder.cpp +++ b/Core/src/Geometry/CuboidVolumeBuilder.cpp @@ -93,9 +93,9 @@ std::shared_ptr Acts::CuboidVolumeBuilder::buildLayer( lCfg.surfaceArrayCreator = std::make_shared(); LayerCreator layerCreator(lCfg); ProtoLayer pl{gctx, cfg.surfaces}; - pl.envelope[BinningValue::binX] = cfg.envelopeX; - pl.envelope[BinningValue::binY] = cfg.envelopeY; - pl.envelope[BinningValue::binZ] = cfg.envelopeZ; + pl.envelope[AxisDirection::AxisX] = cfg.envelopeX; + pl.envelope[AxisDirection::AxisY] = cfg.envelopeY; + pl.envelope[AxisDirection::AxisZ] = cfg.envelopeZ; return layerCreator.planeLayer(gctx, cfg.surfaces, cfg.binsY, cfg.binsZ, cfg.binningDimension, pl, trafo); } @@ -249,7 +249,7 @@ Acts::MutableTrackingVolumePtr Acts::CuboidVolumeBuilder::trackingVolume( } // Build binning - BinningData binData(BinningOption::open, BinningValue::binX, binBoundaries); + BinningData binData(BinningOption::open, AxisDirection::AxisX, binBoundaries); auto bu = std::make_unique(binData); // Build TrackingVolume array diff --git a/Core/src/Geometry/CylinderContainerBlueprintNode.cpp b/Core/src/Geometry/CylinderContainerBlueprintNode.cpp index 284b30949ac..0da0e409c0b 100644 --- a/Core/src/Geometry/CylinderContainerBlueprintNode.cpp +++ b/Core/src/Geometry/CylinderContainerBlueprintNode.cpp @@ -23,7 +23,7 @@ namespace Acts { CylinderContainerBlueprintNode::CylinderContainerBlueprintNode( - const std::string& name, BinningValue direction, + const std::string& name, AxisDirection direction, CylinderVolumeStack::AttachmentStrategy attachmentStrategy, CylinderVolumeStack::ResizeStrategy resizeStrategy) : m_name(name), @@ -197,7 +197,7 @@ bool CylinderContainerBlueprintNode::isGapVolume(const Volume& volume) const { } CylinderContainerBlueprintNode& CylinderContainerBlueprintNode::setDirection( - BinningValue direction) { + AxisDirection direction) { if (m_stack != nullptr) { throw std::runtime_error("Cannot change direction after build"); } @@ -240,7 +240,7 @@ void CylinderContainerBlueprintNode::addToGraphviz(std::ostream& os) const { } } -BinningValue CylinderContainerBlueprintNode::direction() const { +AxisDirection CylinderContainerBlueprintNode::direction() const { return m_direction; } diff --git a/Core/src/Geometry/CylinderVolumeBounds.cpp b/Core/src/Geometry/CylinderVolumeBounds.cpp index 00a4c71f882..f6e37230943 100644 --- a/Core/src/Geometry/CylinderVolumeBounds.cpp +++ b/Core/src/Geometry/CylinderVolumeBounds.cpp @@ -232,23 +232,23 @@ bool CylinderVolumeBounds::inside(const Vector3& pos, double tol) const { return (insideZ && insideR && insidePhi); } -Vector3 CylinderVolumeBounds::binningOffset(BinningValue bValue) +Vector3 CylinderVolumeBounds::referenceOffset(AxisDirection aDir) const { // the medium radius is taken for r-type binning - if (bValue == Acts::BinningValue::binR || - bValue == Acts::BinningValue::binRPhi) { + if (aDir == Acts::AxisDirection::AxisR || + aDir == Acts::AxisDirection::AxisRPhi) { return Vector3(0.5 * (get(eMinR) + get(eMaxR)), 0., 0.); } - return VolumeBounds::binningOffset(bValue); + return VolumeBounds::referenceOffset(aDir); } -double CylinderVolumeBounds::binningBorder(BinningValue bValue) const { - if (bValue == Acts::BinningValue::binR) { +double CylinderVolumeBounds::referenceBorder(AxisDirection aDir) const { + if (aDir == Acts::AxisDirection::AxisR) { return 0.5 * (get(eMaxR) - get(eMinR)); } - if (bValue == Acts::BinningValue::binZ) { + if (aDir == Acts::AxisDirection::AxisZ) { return get(eHalfLengthZ); } - return VolumeBounds::binningBorder(bValue); + return VolumeBounds::referenceBorder(aDir); } std::vector CylinderVolumeBounds::values() const { diff --git a/Core/src/Geometry/CylinderVolumeBuilder.cpp b/Core/src/Geometry/CylinderVolumeBuilder.cpp index 4f99a77eabd..0956db85752 100644 --- a/Core/src/Geometry/CylinderVolumeBuilder.cpp +++ b/Core/src/Geometry/CylinderVolumeBuilder.cpp @@ -351,8 +351,8 @@ Acts::CylinderVolumeBuilder::trackingVolume( // Filling loop for (const auto& elay : endcapConfig.layers) { // Getting the reference radius - double test = elay->surfaceRepresentation().binningPositionValue( - gctx, BinningValue::binR); + double test = elay->surfaceRepresentation().referencePositionValue( + gctx, AxisDirection::AxisR); // Find the right bin auto ringVolume = std::ranges::find_if(volumeRminRmax, [&](const auto& vrr) { diff --git a/Core/src/Geometry/CylinderVolumeHelper.cpp b/Core/src/Geometry/CylinderVolumeHelper.cpp index 77d9dcaee8f..380072b437e 100644 --- a/Core/src/Geometry/CylinderVolumeHelper.cpp +++ b/Core/src/Geometry/CylinderVolumeHelper.cpp @@ -102,7 +102,7 @@ Acts::CylinderVolumeHelper::createTrackingVolume( double zMinRaw = 0.; double zMaxRaw = 0.; - BinningValue bValue = BinningValue::binR; + AxisDirection bValue = AxisDirection::AxisR; // check the dimension and fill raw data if (!estimateAndCheckDimension(gctx, layers, cylinderBounds, transform, @@ -139,7 +139,7 @@ Acts::CylinderVolumeHelper::createTrackingVolume( << bValue); // create the Layer Array - layerArray = (bValue == BinningValue::binR) + layerArray = (bValue == AxisDirection::AxisR) ? m_cfg.layerArrayCreator->layerArray(gctx, layers, rMin, rMax, bType, bValue) : m_cfg.layerArrayCreator->layerArray(gctx, layers, zMin, @@ -383,9 +383,9 @@ Acts::CylinderVolumeHelper::createContainerTrackingVolume( // create the volume array with the ITrackingVolumeArrayCreator std::shared_ptr volumeArray = (rCase) ? m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, volumes, BinningValue::binR) + gctx, volumes, AxisDirection::AxisR) : m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, volumes, BinningValue::binZ); + gctx, volumes, AxisDirection::AxisZ); if (volumeArray == nullptr) { ACTS_WARNING( "Creation of TrackingVolume array did not succeed - returning 0 "); @@ -417,7 +417,7 @@ bool Acts::CylinderVolumeHelper::estimateAndCheckDimension( const GeometryContext& gctx, const LayerVector& layers, std::shared_ptr& cylinderVolumeBounds, const Transform3& transform, double& rMinClean, double& rMaxClean, - double& zMinClean, double& zMaxClean, BinningValue& bValue, + double& zMinClean, double& zMaxClean, AxisDirection& bValue, BinningType /*bType*/) const { // some verbose output @@ -490,7 +490,7 @@ bool Acts::CylinderVolumeHelper::estimateAndCheckDimension( } // set the binning value - bValue = radial ? BinningValue::binR : BinningValue::binZ; + bValue = radial ? AxisDirection::AxisR : AxisDirection::AxisZ; ACTS_VERBOSE( "Estimate/check CylinderVolumeBounds from/w.r.t. enclosed " @@ -681,7 +681,7 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr glueVolumesNegativeFaceArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, glueVolumesNegativeFace, BinningValue::binR); + gctx, glueVolumesNegativeFace, AxisDirection::AxisR); // register the glue voluems glueDescr.registerGlueVolumes(negativeFaceXY, glueVolumesNegativeFaceArray); @@ -690,7 +690,7 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr glueVolumesPositiveFaceArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, glueVolumesPositiveFace, BinningValue::binR); + gctx, glueVolumesPositiveFace, AxisDirection::AxisR); // register the glue voluems glueDescr.registerGlueVolumes(positiveFaceXY, glueVolumesPositiveFaceArray); @@ -699,7 +699,7 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr glueVolumesInnerTubeArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, glueVolumesInnerTube, BinningValue::binZ); + gctx, glueVolumesInnerTube, AxisDirection::AxisZ); // register the glue voluems glueDescr.registerGlueVolumes(tubeInnerCover, glueVolumesInnerTubeArray); } @@ -707,7 +707,7 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr glueVolumesOuterTubeArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, glueVolumesOuterTube, BinningValue::binZ); + gctx, glueVolumesOuterTube, AxisDirection::AxisZ); // register the glue voluems glueDescr.registerGlueVolumes(tubeOuterCover, glueVolumesOuterTubeArray); } @@ -961,7 +961,7 @@ Acts::CylinderVolumeHelper::createCylinderLayer(double z, double r, // z-binning BinUtility layerBinUtility(binsZ, z - halflengthZ, z + halflengthZ, open, - BinningValue::binZ); + AxisDirection::AxisZ); if (binsPhi == 1) { // the BinUtility for the material // ---------------------> create material for the layer surface @@ -972,7 +972,7 @@ Acts::CylinderVolumeHelper::createCylinderLayer(double z, double r, // update the BinUtility: local position on Cylinder is rPhi, z BinUtility layerBinUtilityPhiZ(binsPhi, -r * std::numbers::pi, r * std::numbers::pi, closed, - BinningValue::binPhi); + AxisDirection::AxisPhi); layerBinUtilityPhiZ += layerBinUtility; // ---------------------> create material for the layer surface ACTS_VERBOSE(" -> Preparing the binned material with " @@ -997,7 +997,7 @@ std::shared_ptr Acts::CylinderVolumeHelper::createDiscLayer( const Transform3 transform(Translation3(0., 0., z)); // R is the primary binning for the material - BinUtility materialBinUtility(binsR, rMin, rMax, open, BinningValue::binR); + BinUtility materialBinUtility(binsR, rMin, rMax, open, AxisDirection::AxisR); if (binsPhi == 1) { ACTS_VERBOSE(" -> Preparing the binned material with " << binsR << " bins in R. "); @@ -1005,7 +1005,7 @@ std::shared_ptr Acts::CylinderVolumeHelper::createDiscLayer( // also binning in phi chosen materialBinUtility += BinUtility(binsPhi, -std::numbers::pi_v, - std::numbers::pi_v, closed, BinningValue::binPhi); + std::numbers::pi_v, closed, AxisDirection::AxisPhi); ACTS_VERBOSE(" -> Preparing the binned material with " << binsPhi << " / " << binsR << " bins in phi / R. "); } diff --git a/Core/src/Geometry/CylinderVolumeStack.cpp b/Core/src/Geometry/CylinderVolumeStack.cpp index 5350c3e764e..61696bd61af 100644 --- a/Core/src/Geometry/CylinderVolumeStack.cpp +++ b/Core/src/Geometry/CylinderVolumeStack.cpp @@ -85,7 +85,7 @@ struct CylinderVolumeStack::VolumeTuple { }; CylinderVolumeStack::CylinderVolumeStack(std::vector& volumes, - BinningValue direction, + AxisDirection direction, AttachmentStrategy strategy, ResizeStrategy resizeStrategy, const Logger& logger) @@ -105,20 +105,20 @@ Volume& CylinderVolumeStack::initialVolume( return *volumes.front(); } -void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, +void CylinderVolumeStack::initializeOuterVolume(AxisDirection direction, AttachmentStrategy strategy, const Logger& logger) { ACTS_DEBUG("Creating CylinderVolumeStack from " << m_volumes.size() << " volumes in direction " - << binningValueName(direction)); + << axisDirectionName(direction)); if (m_volumes.empty()) { throw std::invalid_argument( "CylinderVolumeStack requires at least one volume"); } - if (direction != Acts::BinningValue::binZ && - direction != Acts::BinningValue::binR) { - throw std::invalid_argument(binningValueName(direction) + + if (direction != Acts::AxisDirection::AxisZ && + direction != Acts::AxisDirection::AxisR) { + throw std::invalid_argument(axisDirectionName(direction) + " is not supported "); } @@ -161,7 +161,7 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, ACTS_VERBOSE("Checking volume alignment"); checkVolumeAlignment(volumeTuples, logger); - if (direction == Acts::BinningValue::binZ) { + if (direction == Acts::AxisDirection::AxisZ) { ACTS_VERBOSE("Sorting by volume z position"); std::ranges::sort(volumeTuples, {}, [](const auto& v) { return v.localTransform.translation()[eZ]; @@ -222,7 +222,7 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, // @TODO: We probably can reuse m_transform m_groupTransform = m_transform; - } else if (direction == Acts::BinningValue::binR) { + } else if (direction == Acts::AxisDirection::AxisR) { ACTS_VERBOSE("Sorting by volume r middle point"); std::ranges::sort(volumeTuples, {}, [](const auto& v) { return v.midR(); }); @@ -280,15 +280,15 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, m_groupTransform = m_transform; } else { - ACTS_ERROR("Binning in " << binningValueName(direction) + ACTS_ERROR("Binning in " << axisDirectionName(direction) << " is not supported"); - throw std::invalid_argument(binningValueName(direction) + + throw std::invalid_argument(axisDirectionName(direction) + " is not supported "); } } void CylinderVolumeStack::overlapPrint( - BinningValue direction, const CylinderVolumeStack::VolumeTuple& a, + AxisDirection direction, const CylinderVolumeStack::VolumeTuple& a, const CylinderVolumeStack::VolumeTuple& b, const Logger& logger) { if (logger().doPrint(Acts::Logging::DEBUG)) { std::stringstream ss; @@ -299,7 +299,7 @@ void CylinderVolumeStack::overlapPrint( int w = 9; ACTS_VERBOSE("Checking overlap between"); - if (direction == BinningValue::binZ) { + if (direction == AxisDirection::AxisZ) { ss << " - " << " z: [ " << std::setw(w) << a.minZ() << " <- " << std::setw(w) << a.midZ() << " -> " << std::setw(w) << a.maxZ() << " ]"; @@ -336,7 +336,7 @@ CylinderVolumeStack::checkOverlapAndAttachInZ( auto& a = volumes.at(i); auto& b = volumes.at(j); - overlapPrint(BinningValue::binZ, a, b, logger); + overlapPrint(AxisDirection::AxisZ, a, b, logger); if (a.maxZ() > b.minZ()) { ACTS_ERROR(" -> Overlap in z"); @@ -470,7 +470,7 @@ CylinderVolumeStack::checkOverlapAndAttachInR( auto& a = volumes.at(i); auto& b = volumes.at(j); - overlapPrint(BinningValue::binR, a, b, logger); + overlapPrint(AxisDirection::AxisR, a, b, logger); if (a.maxR() > b.minR()) { ACTS_ERROR(" -> Overlap in r"); @@ -758,7 +758,7 @@ void CylinderVolumeStack::update(std::shared_ptr volbounds, m_gaps, [&](const auto& gap) { return vol == gap.get(); }); }; - if (m_direction == BinningValue::binZ) { + if (m_direction == AxisDirection::AxisZ) { ACTS_VERBOSE("Stack direction is z"); std::vector volumeTuples; @@ -920,7 +920,7 @@ void CylinderVolumeStack::update(std::shared_ptr volbounds, m_volumes.push_back(vt.volume); } - } else if (m_direction == BinningValue::binR) { + } else if (m_direction == AxisDirection::AxisR) { ACTS_VERBOSE("Stack direction is r"); std::vector volumeTuples; diff --git a/Core/src/Geometry/Extent.cpp b/Core/src/Geometry/Extent.cpp index 8dfc33c1203..33aea5fb1d7 100644 --- a/Core/src/Geometry/Extent.cpp +++ b/Core/src/Geometry/Extent.cpp @@ -19,103 +19,103 @@ Acts::Extent::Extent(const ExtentEnvelope& envelope) : m_constrains(0), m_envelope(envelope) { - m_range[toUnderlying(BinningValue::binR)] = + m_range[toUnderlying(AxisDirection::AxisR)] = Range1D(0., std::numeric_limits::max()); - m_range[toUnderlying(BinningValue::binPhi)] = + m_range[toUnderlying(AxisDirection::AxisPhi)] = Range1D(-std::numbers::pi, std::numbers::pi); - m_range[toUnderlying(BinningValue::binRPhi)] = + m_range[toUnderlying(AxisDirection::AxisRPhi)] = Range1D(0., std::numeric_limits::max()); - m_range[toUnderlying(BinningValue::binMag)] = + m_range[toUnderlying(AxisDirection::AxisMag)] = Range1D(0., std::numeric_limits::max()); } void Acts::Extent::extend(const Vector3& vtx, - const std::vector& bValues, + const std::vector& aDirs, bool applyEnv, bool fillHistograms) { - for (auto bValue : bValues) { + for (auto aDir : aDirs) { // Get the casted value given the binning value description - double cValue = VectorHelpers::cast(vtx, bValue); + double cValue = VectorHelpers::cast(vtx, aDir); if (fillHistograms) { - m_valueHistograms[toUnderlying(bValue)].push_back(cValue); + m_valueHistograms[toUnderlying(aDir)].push_back(cValue); } // Apply envelope as suggested - double lEnv = applyEnv ? m_envelope[bValue][0] : 0.; - double hEnv = applyEnv ? m_envelope[bValue][1] : 0.; + double lEnv = applyEnv ? m_envelope[aDir][0] : 0.; + double hEnv = applyEnv ? m_envelope[aDir][1] : 0.; double mValue = cValue - lEnv; // Special protection for radial value - if (bValue == BinningValue::binR && mValue < 0.) { + if (aDir == AxisDirection::AxisR && mValue < 0.) { mValue = std::max(mValue, 0.); } - if (constrains(bValue)) { - m_range[toUnderlying(bValue)].expand(mValue, cValue + hEnv); + if (constrains(aDir)) { + m_range[toUnderlying(aDir)].expand(mValue, cValue + hEnv); } else { - m_range[toUnderlying(bValue)].shrink(mValue, cValue + hEnv); + m_range[toUnderlying(aDir)].shrink(mValue, cValue + hEnv); } - m_constrains.set(toUnderlying(bValue)); + m_constrains.set(toUnderlying(aDir)); } } void Acts::Extent::extend(const Extent& rhs, - const std::vector& bValues, + const std::vector& aDirs, bool applyEnv) { - for (auto bValue : bValues) { + for (auto aDir : aDirs) { // The value is constraint, envelope can be optional - if (rhs.constrains(bValue)) { - double lEnv = applyEnv ? m_envelope[bValue][0] : 0.; - double hEnv = applyEnv ? m_envelope[bValue][1] : 0.; - if (constrains(bValue)) { - m_range[toUnderlying(bValue)].expand( - rhs.range()[toUnderlying(bValue)].min() - lEnv, - rhs.range()[toUnderlying(bValue)].max() + hEnv); + if (rhs.constrains(aDir)) { + double lEnv = applyEnv ? m_envelope[aDir][0] : 0.; + double hEnv = applyEnv ? m_envelope[aDir][1] : 0.; + if (constrains(aDir)) { + m_range[toUnderlying(aDir)].expand( + rhs.range()[toUnderlying(aDir)].min() - lEnv, + rhs.range()[toUnderlying(aDir)].max() + hEnv); } else { - m_range[toUnderlying(bValue)].shrink( - rhs.range()[toUnderlying(bValue)].min() - lEnv, - rhs.range()[toUnderlying(bValue)].max() + hEnv); + m_range[toUnderlying(aDir)].shrink( + rhs.range()[toUnderlying(aDir)].min() - lEnv, + rhs.range()[toUnderlying(aDir)].max() + hEnv); } - m_constrains.set(toUnderlying(bValue)); - } else if (rhs.envelope()[bValue] != zeroEnvelope) { + m_constrains.set(toUnderlying(aDir)); + } else if (rhs.envelope()[aDir] != zeroEnvelope) { // Only an envelope given, but value is not constraint -> apply envelope - m_range[toUnderlying(bValue)].expand( - m_range[toUnderlying(bValue)].min() - rhs.envelope()[bValue][0], - m_range[toUnderlying(bValue)].max() + rhs.envelope()[bValue][1]); - m_constrains.set(toUnderlying(bValue)); + m_range[toUnderlying(aDir)].expand( + m_range[toUnderlying(aDir)].min() - rhs.envelope()[aDir][0], + m_range[toUnderlying(aDir)].max() + rhs.envelope()[aDir][1]); + m_constrains.set(toUnderlying(aDir)); } } } void Acts::Extent::addConstrain(const Acts::Extent& rhs, const ExtentEnvelope& envelope) { - for (const auto& bValue : allBinningValues()) { - if (rhs.constrains(bValue) && !constrains(bValue)) { - const auto& cRange = rhs.range(bValue); - m_range[toUnderlying(bValue)].setMin(cRange.min() - envelope[bValue][0u]); - m_range[toUnderlying(bValue)].setMax(cRange.max() + envelope[bValue][1u]); - m_constrains.set(toUnderlying(bValue)); + for (const auto& aDir : allAxisDirections()) { + if (rhs.constrains(aDir) && !constrains(aDir)) { + const auto& cRange = rhs.range(aDir); + m_range[toUnderlying(aDir)].setMin(cRange.min() - envelope[aDir][0u]); + m_range[toUnderlying(aDir)].setMax(cRange.max() + envelope[aDir][1u]); + m_constrains.set(toUnderlying(aDir)); } } } -void Acts::Extent::set(BinningValue bValue, double min, double max) { +void Acts::Extent::set(AxisDirection aDir, double min, double max) { double minval = min; - if (bValue == BinningValue::binR && minval < 0.) { + if (aDir == AxisDirection::AxisR && minval < 0.) { minval = 0.; } - m_range[toUnderlying(bValue)] = Range1D{minval, max}; - m_constrains.set(toUnderlying(bValue)); + m_range[toUnderlying(aDir)] = Range1D{minval, max}; + m_constrains.set(toUnderlying(aDir)); } -void Acts::Extent::setMin(BinningValue bValue, double min) { +void Acts::Extent::setMin(AxisDirection aDir, double min) { double minval = min; - if (bValue == BinningValue::binR && minval < 0.) { + if (aDir == AxisDirection::AxisR && minval < 0.) { minval = 0.; } - m_range[toUnderlying(bValue)].setMin(0u, minval); - m_constrains.set(toUnderlying(bValue)); + m_range[toUnderlying(aDir)].setMin(0u, minval); + m_constrains.set(toUnderlying(aDir)); } -void Acts::Extent::setMax(BinningValue bValue, double max) { - m_range[toUnderlying(bValue)].setMax(0u, max); - m_constrains.set(toUnderlying(bValue)); +void Acts::Extent::setMax(AxisDirection aDir, double max) { + m_range[toUnderlying(aDir)].setMax(0u, max); + m_constrains.set(toUnderlying(aDir)); } void Acts::Extent::setEnvelope(const ExtentEnvelope& envelope) { @@ -124,7 +124,7 @@ void Acts::Extent::setEnvelope(const ExtentEnvelope& envelope) { bool Acts::Extent::contains(const Vector3& vtx) const { Extent checkExtent; - for (const auto& bv : allBinningValues()) { + for (const auto& bv : allAxisDirections()) { if (constrains(bv)) { double vtxVal = VectorHelpers::cast(vtx, bv); checkExtent.set(bv, vtxVal, vtxVal); @@ -134,9 +134,9 @@ bool Acts::Extent::contains(const Vector3& vtx) const { } bool Acts::Extent::contains(const Extent& rhs, - std::optional bValue) const { + std::optional aDir) const { // Helper to check including a constraint bit set check - auto checkContainment = [&](BinningValue bvc) -> bool { + auto checkContainment = [&](AxisDirection bvc) -> bool { if (!constrains(bvc)) { return true; } @@ -144,17 +144,17 @@ bool Acts::Extent::contains(const Extent& rhs, }; // Check all - if (!bValue.has_value()) { - return std::ranges::all_of(allBinningValues(), checkContainment); + if (!aDir.has_value()) { + return std::ranges::all_of(allAxisDirections(), checkContainment); } // Check specific - return checkContainment(bValue.value()); + return checkContainment(aDir.value()); } bool Acts::Extent::intersects(const Extent& rhs, - std::optional bValue) const { + std::optional aDir) const { // Helper to check including a constraint bit set check - auto checkIntersect = [&](BinningValue bvc) -> bool { + auto checkIntersect = [&](AxisDirection bvc) -> bool { if (!constrains(bvc) || !rhs.constrains(bvc)) { return false; } @@ -162,15 +162,15 @@ bool Acts::Extent::intersects(const Extent& rhs, }; // Check all - if (!bValue.has_value()) { - return std::ranges::any_of(allBinningValues(), checkIntersect); + if (!aDir.has_value()) { + return std::ranges::any_of(allAxisDirections(), checkIntersect); } // Check specific - return checkIntersect(bValue.value()); + return checkIntersect(aDir.value()); } -bool Acts::Extent::constrains(BinningValue bValue) const { - return m_constrains.test(static_cast(bValue)); +bool Acts::Extent::constrains(AxisDirection aDir) const { + return m_constrains.test(static_cast(aDir)); } bool Acts::Extent::constrains() const { @@ -196,9 +196,9 @@ bool Acts::Extent::operator==(const Extent& e) const { std::string Acts::Extent::toString(const std::string& indent) const { std::stringstream sl; sl << indent << "Extent in space :" << std::endl; - for (const auto& bv : allBinningValues()) { + for (const auto& bv : allAxisDirections()) { if (constrains(bv)) { - sl << indent << " - value :" << std::setw(10) << binningValueName(bv) + sl << indent << " - value :" << std::setw(10) << axisDirectionName(bv) << " | range = [" << m_range[toUnderlying(bv)].min() << ", " << m_range[toUnderlying(bv)].max() << "]" << std::endl; } diff --git a/Core/src/Geometry/GridPortalLink.cpp b/Core/src/Geometry/GridPortalLink.cpp index ae6168e11cf..a0e429708d2 100644 --- a/Core/src/Geometry/GridPortalLink.cpp +++ b/Core/src/Geometry/GridPortalLink.cpp @@ -17,13 +17,13 @@ namespace Acts { std::unique_ptr GridPortalLink::make( const std::shared_ptr& surface, TrackingVolume& volume, - BinningValue direction) { + AxisDirection direction) { std::unique_ptr grid; if (const auto* cylinder = dynamic_cast(surface.get()); cylinder != nullptr) { - if (direction == BinningValue::binRPhi) { + if (direction == AxisDirection::AxisRPhi) { double r = cylinder->bounds().get(CylinderBounds::eR); if (cylinder->bounds().coversFullAzimuth()) { grid = GridPortalLink::make( @@ -35,7 +35,7 @@ std::unique_ptr GridPortalLink::make( grid = GridPortalLink::make(surface, direction, Axis{AxisBound, -hlPhi * r, hlPhi * r, 1}); } - } else if (direction == BinningValue::binZ) { + } else if (direction == AxisDirection::AxisZ) { double hlZ = cylinder->bounds().get(CylinderBounds::eHalfLengthZ); grid = GridPortalLink::make(surface, direction, Axis{AxisBound, -hlZ, hlZ, 1}); @@ -45,12 +45,12 @@ std::unique_ptr GridPortalLink::make( } else if (const auto* disc = dynamic_cast(surface.get()); disc != nullptr) { const auto& bounds = dynamic_cast(disc->bounds()); - if (direction == BinningValue::binR) { + if (direction == AxisDirection::AxisR) { double minR = bounds.get(RadialBounds::eMinR); double maxR = bounds.get(RadialBounds::eMaxR); grid = GridPortalLink::make(surface, direction, Axis{AxisBound, minR, maxR, 1}); - } else if (direction == BinningValue::binPhi) { + } else if (direction == AxisDirection::AxisPhi) { if (bounds.coversFullAzimuth()) { grid = GridPortalLink::make( surface, direction, @@ -126,7 +126,7 @@ void GridPortalLink::checkConsistency(const CylinderSurface& cyl) const { if (dim() == 1) { const IAxis& axisLoc0 = *grid().axes().front(); - if (direction() == BinningValue::binRPhi) { + if (direction() == AxisDirection::AxisRPhi) { checkRPhi(axisLoc0); } else { checkZ(axisLoc0); @@ -188,7 +188,7 @@ void GridPortalLink::checkConsistency(const DiscSurface& disc) const { if (dim() == 1) { const IAxis& axisLoc0 = *grid().axes().front(); - if (direction() == BinningValue::binR) { + if (direction() == AxisDirection::AxisR) { checkR(axisLoc0); } else { checkPhi(axisLoc0); @@ -222,15 +222,15 @@ void GridPortalLink::printContents(std::ostream& os) const { if (surface().type() == Surface::Cylinder) { loc0 = "rPhi"; loc1 = "z"; - flipped = direction() != BinningValue::binRPhi; + flipped = direction() != AxisDirection::AxisRPhi; } else if (surface().type() == Surface::Disc) { loc0 = "r"; loc1 = "phi"; - flipped = direction() != BinningValue::binR; + flipped = direction() != AxisDirection::AxisR; } else if (surface().type() == Surface::Plane) { loc0 = "x"; loc1 = "y"; - flipped = direction() != BinningValue::binX; + flipped = direction() != AxisDirection::AxisX; } else { throw std::invalid_argument{"Unsupported surface type"}; } @@ -318,9 +318,9 @@ void GridPortalLink::fillGrid1dTo2d(FillDirection dir, std::unique_ptr GridPortalLink::extendTo2dImpl( const std::shared_ptr& surface, const IAxis* other) const { assert(dim() == 1); - if (direction() == BinningValue::binRPhi) { + if (direction() == AxisDirection::AxisRPhi) { const auto& axisRPhi = *grid().axes().front(); - // 1D direction is binRPhi, so add a Z axis + // 1D direction is AxisRPhi, so add a Z axis double hlZ = surface->bounds().get(CylinderBounds::eHalfLengthZ); auto grid = axisRPhi.visit([&](const auto& axis0) { @@ -338,7 +338,7 @@ std::unique_ptr GridPortalLink::extendTo2dImpl( } else { const auto& axisZ = *grid().axes().front(); - // 1D direction is binZ, so add an rPhi axis + // 1D direction is AxisZ, so add an rPhi axis double r = surface->bounds().get(CylinderBounds::eR); double hlPhi = surface->bounds().get(CylinderBounds::eHalfPhiSector); double hlRPhi = r * hlPhi; @@ -375,9 +375,9 @@ std::unique_ptr GridPortalLink::extendTo2dImpl( "GridPortalLink: DiscBounds: invalid bounds type."); } - if (direction() == BinningValue::binR) { + if (direction() == AxisDirection::AxisR) { const auto& axisR = *grid().axes().front(); - // 1D direction is binR, so add a phi axis + // 1D direction is AxisR, so add a phi axis double hlPhi = bounds->get(RadialBounds::eHalfPhiSector); auto makeGrid = [&](auto bdt) { @@ -401,7 +401,7 @@ std::unique_ptr GridPortalLink::extendTo2dImpl( } } else { const auto& axisPhi = *grid().axes().front(); - // 1D direction is binPhi, so add an R axis + // 1D direction is AxisPhi, so add an R axis double rMin = bounds->get(RadialBounds::eMinR); double rMax = bounds->get(RadialBounds::eMaxR); diff --git a/Core/src/Geometry/GridPortalLinkMerging.cpp b/Core/src/Geometry/GridPortalLinkMerging.cpp index f475822876b..ae49bedfa46 100644 --- a/Core/src/Geometry/GridPortalLinkMerging.cpp +++ b/Core/src/Geometry/GridPortalLinkMerging.cpp @@ -26,7 +26,7 @@ namespace { template std::unique_ptr makeGrid( - const std::shared_ptr& surface, BinningValue direction, + const std::shared_ptr& surface, AxisDirection direction, const Logger& logger, std::tuple args, const IAxis* otherAxis, bool prepend) { // @TODO: PlaneSurface support @@ -65,7 +65,8 @@ std::unique_ptr makeGrid( // Check if we're in the cylinder or disc case, and the resulting bounds wrap // around and should have closed binning - if (direction == BinningValue::binPhi || direction == BinningValue::binRPhi) { + if (direction == AxisDirection::AxisPhi || + direction == AxisDirection::AxisRPhi) { if (const auto* cylinder = dynamic_cast(surface.get()); cylinder != nullptr) { @@ -88,7 +89,7 @@ std::unique_ptr makeGrid( std::unique_ptr mergeVariable( const std::shared_ptr& mergedSurface, const IAxis& axisA, - const IAxis& axisB, double /*tolerance*/, BinningValue direction, + const IAxis& axisB, double /*tolerance*/, AxisDirection direction, const Logger& logger, const IAxis* otherAxis, bool prepend) { ACTS_VERBOSE("Variable merge: direction is " << direction); @@ -101,7 +102,7 @@ std::unique_ptr mergeVariable( auto edgesA = axisA.getBinEdges(); - if (direction == BinningValue::binR) { + if (direction == AxisDirection::AxisR) { ACTS_VERBOSE("Performing asymmetric merge"); std::ranges::copy(edgesA, std::back_inserter(binEdges)); @@ -131,7 +132,7 @@ std::unique_ptr mergeVariable( std::unique_ptr mergeEquidistant( const std::shared_ptr& mergedSurface, const IAxis& axisA, - const IAxis& axisB, double tolerance, BinningValue direction, + const IAxis& axisB, double tolerance, AxisDirection direction, const Logger& logger, const IAxis* otherAxis, bool prepend) { ACTS_VERBOSE("===> potentially equidistant merge: checking bin widths"); @@ -151,7 +152,7 @@ std::unique_ptr mergeEquidistant( double min = std::numeric_limits::signaling_NaN(); double max = std::numeric_limits::signaling_NaN(); - if (direction == BinningValue::binR) { + if (direction == AxisDirection::AxisR) { ACTS_VERBOSE("Performing asymmetric merge"); min = axisA.getMin(); max = axisB.getMax(); @@ -183,7 +184,7 @@ std::unique_ptr mergeEquidistant( std::unique_ptr colinearMerge( const std::shared_ptr& mergedSurface, const IAxis& axisA, - const IAxis& axisB, double tolerance, BinningValue direction, + const IAxis& axisB, double tolerance, AxisDirection direction, const Logger& logger, const IAxis* otherAxis, bool prepend) { AxisType aType = axisA.getType(); AxisType bType = axisB.getType(); @@ -226,7 +227,7 @@ std::unique_ptr colinearMerge( std::unique_ptr mergeGridPortals( const GridPortalLink* a, const GridPortalLink* b, const RegularSurface* surfaceA, const RegularSurface* surfaceB, - BinningValue loc0, BinningValue loc1, BinningValue direction, + AxisDirection loc0, AxisDirection loc1, AxisDirection direction, const Logger& logger) { assert(surfaceA != nullptr); assert(surfaceB != nullptr); @@ -425,9 +426,9 @@ std::unique_ptr mergeGridPortals( std::unique_ptr mergeGridPortals(const GridPortalLink* a, const GridPortalLink* b, - BinningValue direction, + AxisDirection direction, const Logger& logger) { - using enum BinningValue; + using enum AxisDirection; assert(a->dim() == 2 || a->dim() == 1); assert(b->dim() == 2 || b->dim() == 1); @@ -448,11 +449,11 @@ std::unique_ptr mergeGridPortals(const GridPortalLink* a, if (cylinder != nullptr) { return mergeGridPortals( a, b, cylinder, &dynamic_cast(b->surface()), - binRPhi, binZ, direction, logger); + AxisRPhi, AxisZ, direction, logger); } else if (disc != nullptr) { return mergeGridPortals(a, b, disc, &dynamic_cast(b->surface()), - binR, binPhi, direction, logger); + AxisR, AxisPhi, direction, logger); } else { // @TODO: Support PlaneSurface ACTS_VERBOSE("Surface type is not supported here, falling back"); @@ -467,11 +468,11 @@ std::unique_ptr mergeGridPortals(const GridPortalLink* a, ACTS_VERBOSE("~> Adding complementary axis"); if (cylinder != nullptr) { - otherAxis = direction == binRPhi ? a->grid().axes().back() - : a->grid().axes().front(); + otherAxis = direction == AxisRPhi ? a->grid().axes().back() + : a->grid().axes().front(); } else if (disc != nullptr) { - otherAxis = direction == binR ? a->grid().axes().back() - : a->grid().axes().front(); + otherAxis = direction == AxisR ? a->grid().axes().back() + : a->grid().axes().front(); } else { ACTS_VERBOSE("Surface type is not supported here, falling back"); return nullptr; @@ -491,7 +492,7 @@ std::unique_ptr mergeGridPortals(const GridPortalLink* a, void GridPortalLink::fillMergedGrid(const GridPortalLink& a, const GridPortalLink& b, GridPortalLink& merged, - BinningValue direction, + AxisDirection direction, const Logger& logger) { ACTS_VERBOSE("Filling merged grid"); assert(a.dim() == b.dim()); @@ -554,7 +555,7 @@ void GridPortalLink::fillMergedGrid(const GridPortalLink& a, std::unique_ptr GridPortalLink::merge(const GridPortalLink& a, const GridPortalLink& b, - BinningValue direction, + AxisDirection direction, const Logger& logger) { ACTS_VERBOSE("Merging two GridPortalLinks"); diff --git a/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp b/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp index c0a45763372..8a0e086aaff 100644 --- a/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp +++ b/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp @@ -51,10 +51,10 @@ Acts::KDTreeTrackingGeometryBuilder::trackingGeometry( surfacesMeasured.reserve(m_cfg.surfaces.size()); for (auto& s : m_cfg.surfaces) { auto ext = s->polyhedronRepresentation(gctx, 1u).extent(); - surfacesMeasured.push_back( - MeasuredSurface{std::array{ext.medium(BinningValue::binZ), - ext.medium(BinningValue::binR)}, - s}); + surfacesMeasured.push_back(MeasuredSurface{ + std::array{ext.medium(AxisDirection::AxisZ), + ext.medium(AxisDirection::AxisR)}, + s}); } // Create the KDTree @@ -84,8 +84,8 @@ Acts::KDTreeTrackingGeometryBuilder::translateVolume( std::vector> translatedVolumes = {}; // Volume extent - auto rangeR = ptVolume.extent.range(Acts::BinningValue::binR); - auto rangeZ = ptVolume.extent.range(Acts::BinningValue::binZ); + auto rangeR = ptVolume.extent.range(Acts::AxisDirection::AxisR); + auto rangeZ = ptVolume.extent.range(Acts::AxisDirection::AxisZ); // Simple gap volume if (!ptVolume.container.has_value()) { @@ -158,8 +158,8 @@ Acts::KDTreeTrackingGeometryBuilder::translateLayer( // Try to pull from the kd tree RangeXD<2u, double> zrRange; - zrRange[0u] = plVolume.extent.range(Acts::BinningValue::binZ); - zrRange[1u] = plVolume.extent.range(Acts::BinningValue::binR); + zrRange[0u] = plVolume.extent.range(Acts::AxisDirection::AxisZ); + zrRange[1u] = plVolume.extent.range(Acts::AxisDirection::AxisR); auto layerSurfaces = kdt.rangeSearchWithKey(zrRange); ACTS_VERBOSE(indent + ">> looking z/r range = " << zrRange.toString()); diff --git a/Core/src/Geometry/LayerArrayCreator.cpp b/Core/src/Geometry/LayerArrayCreator.cpp index e8b972cb6d1..40149e05a13 100644 --- a/Core/src/Geometry/LayerArrayCreator.cpp +++ b/Core/src/Geometry/LayerArrayCreator.cpp @@ -30,18 +30,18 @@ std::unique_ptr Acts::LayerArrayCreator::layerArray( const GeometryContext& gctx, const LayerVector& layersInput, double min, - double max, BinningType bType, BinningValue bValue) const { + double max, BinningType bType, AxisDirection aDir) const { ACTS_VERBOSE("Build LayerArray with " << layersInput.size() << " layers at input."); ACTS_VERBOSE(" min/max provided : " << min << " / " << max); ACTS_VERBOSE(" binning type : " << bType); - ACTS_VERBOSE(" binning value : " << bValue); + ACTS_VERBOSE(" binning value : " << aDir); // create a local copy of the layer vector LayerVector layers(layersInput); // sort it accordingly to the binning value - GeometryObjectSorterT> layerSorter(gctx, bValue); + GeometryObjectSorterT> layerSorter(gctx, aDir); std::ranges::sort(layers, layerSorter); // useful typedef using LayerOrderPosition = std::pair, Vector3>; @@ -57,13 +57,13 @@ std::unique_ptr Acts::LayerArrayCreator::layerArray( // loop over layers and put them in for (auto& layIter : layers) { ACTS_VERBOSE("equidistant : registering a Layer at binning position : " - << (layIter->binningPosition(gctx, bValue))); + << (layIter->referencePosition(gctx, aDir))); layerOrderVector.push_back(LayerOrderPosition( - layIter, layIter->binningPosition(gctx, bValue))); + layIter, layIter->referencePosition(gctx, aDir))); } // create the binUitlity binUtility = std::make_unique(layers.size(), min, max, - open, bValue); + open, aDir); ACTS_VERBOSE("equidistant : created a BinUtility as " << *binUtility); } break; @@ -80,7 +80,7 @@ std::unique_ptr Acts::LayerArrayCreator::layerArray( for (auto& layIter : layers) { // estimate the offset layerThickness = layIter->thickness(); - layerValue = layIter->binningPositionValue(gctx, bValue); + layerValue = layIter->referencePositionValue(gctx, aDir); // register the new boundaries in the step vector boundaries.push_back(layerValue - 0.5 * layerThickness); boundaries.push_back(layerValue + 0.5 * layerThickness); @@ -107,25 +107,25 @@ std::unique_ptr Acts::LayerArrayCreator::layerArray( // create the navigation layer surface from the layer std::shared_ptr navLayerSurface = - createNavigationSurface(gctx, *layIter, bValue, + createNavigationSurface(gctx, *layIter, aDir, -std::abs(layerValue - navigationValue)); ACTS_VERBOSE( "arbitrary : creating a NavigationLayer at " - << (navLayerSurface->binningPosition(gctx, bValue)).x() << ", " - << (navLayerSurface->binningPosition(gctx, bValue)).y() << ", " - << (navLayerSurface->binningPosition(gctx, bValue)).z()); + << (navLayerSurface->referencePosition(gctx, aDir)).x() << ", " + << (navLayerSurface->referencePosition(gctx, aDir)).y() << ", " + << (navLayerSurface->referencePosition(gctx, aDir)).z()); navLayer = NavigationLayer::create(std::move(navLayerSurface)); // push the navigation layer in layerOrderVector.push_back(LayerOrderPosition( - navLayer, navLayer->binningPosition(gctx, bValue))); + navLayer, navLayer->referencePosition(gctx, aDir))); // push the original layer in layerOrderVector.push_back(LayerOrderPosition( - layIter, layIter->binningPosition(gctx, bValue))); + layIter, layIter->referencePosition(gctx, aDir))); ACTS_VERBOSE("arbitrary : registering MaterialLayer at " - << (layIter->binningPosition(gctx, bValue)).x() << ", " - << (layIter->binningPosition(gctx, bValue)).y() << ", " - << (layIter->binningPosition(gctx, bValue)).z()); + << (layIter->referencePosition(gctx, aDir)).x() << ", " + << (layIter->referencePosition(gctx, aDir)).y() << ", " + << (layIter->referencePosition(gctx, aDir)).z()); // remember the last lastLayer = layIter; } @@ -137,17 +137,17 @@ std::unique_ptr Acts::LayerArrayCreator::layerArray( if (navigationValue != max && lastLayer != nullptr) { // create the navigation layer surface from the layer std::shared_ptr navLayerSurface = - createNavigationSurface(gctx, *lastLayer, bValue, + createNavigationSurface(gctx, *lastLayer, aDir, navigationValue - layerValue); ACTS_VERBOSE( "arbitrary : creating a NavigationLayer at " - << (navLayerSurface->binningPosition(gctx, bValue)).x() << ", " - << (navLayerSurface->binningPosition(gctx, bValue)).y() << ", " - << (navLayerSurface->binningPosition(gctx, bValue)).z()); + << (navLayerSurface->referencePosition(gctx, aDir)).x() << ", " + << (navLayerSurface->referencePosition(gctx, aDir)).y() << ", " + << (navLayerSurface->referencePosition(gctx, aDir)).z()); navLayer = NavigationLayer::create(std::move(navLayerSurface)); // push the navigation layer in layerOrderVector.push_back(LayerOrderPosition( - navLayer, navLayer->binningPosition(gctx, bValue))); + navLayer, navLayer->referencePosition(gctx, aDir))); } // now close the boundaries boundaries.push_back(max); @@ -155,7 +155,7 @@ std::unique_ptr Acts::LayerArrayCreator::layerArray( ACTS_VERBOSE(layerOrderVector.size() << " Layers (material + navigation) built. "); // create the BinUtility - binUtility = std::make_unique(boundaries, open, bValue); + binUtility = std::make_unique(boundaries, open, aDir); ACTS_VERBOSE("arbitrary : created a BinUtility as " << *binUtility); } break; @@ -170,28 +170,28 @@ std::unique_ptr Acts::LayerArrayCreator::layerArray( } std::shared_ptr Acts::LayerArrayCreator::createNavigationSurface( - const GeometryContext& gctx, const Layer& layer, BinningValue bValue, + const GeometryContext& gctx, const Layer& layer, AxisDirection aDir, double offset) const { // surface reference const Surface& layerSurface = layer.surfaceRepresentation(); // translation to be applied Vector3 translation(0., 0., 0.); // switching he binnig values - switch (bValue) { + switch (aDir) { // case x - case BinningValue::binX: { + case AxisDirection::AxisX: { translation = Vector3(offset, 0., 0.); } break; // case y - case BinningValue::binY: { + case AxisDirection::AxisY: { translation = Vector3(0., offset, 0.); } break; // case z - case BinningValue::binZ: { + case AxisDirection::AxisZ: { translation = Vector3(0., 0., offset); } break; // case R - case BinningValue::binR: { + case AxisDirection::AxisR: { // binning in R and cylinder surface means something different if (layerSurface.type() == Surface::Cylinder) { break; diff --git a/Core/src/Geometry/LayerBlueprintNode.cpp b/Core/src/Geometry/LayerBlueprintNode.cpp index de2e2cdb8cd..dc0f5ce7fd2 100644 --- a/Core/src/Geometry/LayerBlueprintNode.cpp +++ b/Core/src/Geometry/LayerBlueprintNode.cpp @@ -52,23 +52,23 @@ Volume& LayerBlueprintNode::build(const BlueprintOptions& options, void LayerBlueprintNode::buildVolume(const Extent& extent, const Logger& logger) { ACTS_VERBOSE(prefix() << "Building volume for layer " << name()); - using enum BinningValue; + using enum AxisDirection; using enum LayerType; std::shared_ptr bounds; switch (m_layerType) { case Cylinder: case Disc: { - double minR = extent.min(binR); - double maxR = extent.max(binR); - double hlZ = extent.interval(binZ) / 2.0; + double minR = extent.min(AxisR); + double maxR = extent.max(AxisR); + double hlZ = extent.interval(AxisZ) / 2.0; bounds = std::make_shared(minR, maxR, hlZ); break; } case Plane: { - double hlX = extent.interval(binX) / 2.0; - double hlY = extent.interval(binY) / 2.0; - double hlZ = extent.interval(binZ) / 2.0; + double hlX = extent.interval(AxisX) / 2.0; + double hlY = extent.interval(AxisY) / 2.0; + double hlZ = extent.interval(AxisZ) / 2.0; bounds = std::make_shared(hlX, hlY, hlZ); break; } @@ -80,7 +80,7 @@ void LayerBlueprintNode::buildVolume(const Extent& extent, Transform3 transform = m_transform; transform.translation() = - Vector3{extent.medium(binX), extent.medium(binY), extent.medium(binZ)}; + Vector3{extent.medium(AxisX), extent.medium(AxisY), extent.medium(AxisZ)}; ACTS_VERBOSE(prefix() << " -> adjusted transform:\n" << transform.matrix()); diff --git a/Core/src/Geometry/LayerCreator.cpp b/Core/src/Geometry/LayerCreator.cpp index e24ff8e0661..69694741a82 100644 --- a/Core/src/Geometry/LayerCreator.cpp +++ b/Core/src/Geometry/LayerCreator.cpp @@ -59,26 +59,26 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); // Remaining layer parameters - they include the envelopes - double layerR = protoLayer.medium(BinningValue::binR); - double layerZ = protoLayer.medium(BinningValue::binZ); - double layerHalfZ = 0.5 * protoLayer.range(BinningValue::binZ); - double layerThickness = protoLayer.range(BinningValue::binR); + double layerR = protoLayer.medium(AxisDirection::AxisR); + double layerZ = protoLayer.medium(AxisDirection::AxisZ); + double layerHalfZ = 0.5 * protoLayer.range(AxisDirection::AxisZ); + double layerThickness = protoLayer.range(AxisDirection::AxisR); ACTS_VERBOSE("Creating a cylindrical Layer:"); ACTS_VERBOSE(" - with layer R = " << layerR); ACTS_VERBOSE(" - from R min/max = " - << protoLayer.min(BinningValue::binR, false) << " / " - << protoLayer.max(BinningValue::binR, false)); + << protoLayer.min(AxisDirection::AxisR, false) << " / " + << protoLayer.max(AxisDirection::AxisR, false)); ACTS_VERBOSE(" - with R thickness = " << layerThickness); ACTS_VERBOSE(" - incl envelope = " - << protoLayer.envelope[BinningValue::binR][0u] << " / " - << protoLayer.envelope[BinningValue::binR][1u]); + << protoLayer.envelope[AxisDirection::AxisR][0u] << " / " + << protoLayer.envelope[AxisDirection::AxisR][1u]); ACTS_VERBOSE(" - with z min/max = " - << protoLayer.min(BinningValue::binZ, false) << " (-" - << protoLayer.envelope[BinningValue::binZ][0u] << ") / " - << protoLayer.max(BinningValue::binZ, false) << " (+" - << protoLayer.envelope[BinningValue::binZ][1u] << ")"); + << protoLayer.min(AxisDirection::AxisZ, false) << " (-" + << protoLayer.envelope[AxisDirection::AxisZ][0u] << ") / " + << protoLayer.max(AxisDirection::AxisZ, false) << " (+" + << protoLayer.envelope[AxisDirection::AxisZ][1u] << ")"); ACTS_VERBOSE(" - z center = " << layerZ); ACTS_VERBOSE(" - halflength z = " << layerHalfZ); @@ -93,8 +93,8 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( } ACTS_VERBOSE(" - with phi min/max = " - << protoLayer.min(BinningValue::binPhi, false) << " / " - << protoLayer.max(BinningValue::binPhi, false)); + << protoLayer.min(AxisDirection::AxisPhi, false) << " / " + << protoLayer.max(AxisDirection::AxisPhi, false)); ACTS_VERBOSE(" - # of modules = " << surfaces.size() << " ordered in ( " << binsPhi << " x " << binsZ << ")"); std::unique_ptr sArray; @@ -132,26 +132,26 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); // remaining layer parameters - double layerR = protoLayer.medium(BinningValue::binR); - double layerZ = protoLayer.medium(BinningValue::binZ); - double layerHalfZ = 0.5 * protoLayer.range(BinningValue::binZ); - double layerThickness = protoLayer.range(BinningValue::binR); + double layerR = protoLayer.medium(AxisDirection::AxisR); + double layerZ = protoLayer.medium(AxisDirection::AxisZ); + double layerHalfZ = 0.5 * protoLayer.range(AxisDirection::AxisZ); + double layerThickness = protoLayer.range(AxisDirection::AxisR); // adjust the layer radius ACTS_VERBOSE("Creating a cylindrical Layer:"); ACTS_VERBOSE(" - with layer R = " << layerR); ACTS_VERBOSE(" - from R min/max = " - << protoLayer.min(BinningValue::binR, false) << " / " - << protoLayer.max(BinningValue::binR, false)); + << protoLayer.min(AxisDirection::AxisR, false) << " / " + << protoLayer.max(AxisDirection::AxisR, false)); ACTS_VERBOSE(" - with R thickness = " << layerThickness); ACTS_VERBOSE(" - incl envelope = " - << protoLayer.envelope[BinningValue::binR][0u] << " / " - << protoLayer.envelope[BinningValue::binR][1u]); + << protoLayer.envelope[AxisDirection::AxisR][0u] << " / " + << protoLayer.envelope[AxisDirection::AxisR][1u]); ACTS_VERBOSE(" - with z min/max = " - << protoLayer.min(BinningValue::binZ, false) << " (-" - << protoLayer.envelope[BinningValue::binZ][0u] << ") / " - << protoLayer.max(BinningValue::binZ, false) << " (+" - << protoLayer.envelope[BinningValue::binZ][1u] << ")"); + << protoLayer.min(AxisDirection::AxisZ, false) << " (-" + << protoLayer.envelope[AxisDirection::AxisZ][0u] << ") / " + << protoLayer.max(AxisDirection::AxisZ, false) << " (+" + << protoLayer.envelope[AxisDirection::AxisZ][1u] << ")"); ACTS_VERBOSE(" - z center = " << layerZ); ACTS_VERBOSE(" - halflength z = " << layerHalfZ); @@ -166,8 +166,8 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( } ACTS_VERBOSE(" - with phi min/max = " - << protoLayer.min(BinningValue::binPhi, false) << " / " - << protoLayer.max(BinningValue::binPhi, false)); + << protoLayer.min(AxisDirection::AxisPhi, false) << " / " + << protoLayer.max(AxisDirection::AxisPhi, false)); ACTS_VERBOSE(" - # of modules = " << surfaces.size() << ""); // create the surface array @@ -205,27 +205,27 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( ProtoLayer protoLayer = _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); - double layerZ = protoLayer.medium(BinningValue::binZ); - double layerThickness = protoLayer.range(BinningValue::binZ); + double layerZ = protoLayer.medium(AxisDirection::AxisZ); + double layerThickness = protoLayer.range(AxisDirection::AxisZ); // adjust the layer radius ACTS_VERBOSE("Creating a disk Layer:"); ACTS_VERBOSE(" - at Z position = " << layerZ); ACTS_VERBOSE(" - from Z min/max = " - << protoLayer.min(BinningValue::binZ, false) << " / " - << protoLayer.max(BinningValue::binZ, false)); + << protoLayer.min(AxisDirection::AxisZ, false) << " / " + << protoLayer.max(AxisDirection::AxisZ, false)); ACTS_VERBOSE(" - with Z thickness = " << layerThickness); ACTS_VERBOSE(" - incl envelope = " - << protoLayer.envelope[BinningValue::binZ][0u] << " / " - << protoLayer.envelope[BinningValue::binZ][1u]); + << protoLayer.envelope[AxisDirection::AxisZ][0u] << " / " + << protoLayer.envelope[AxisDirection::AxisZ][1u]); ACTS_VERBOSE(" - with R min/max = " - << protoLayer.min(BinningValue::binR, false) << " (-" - << protoLayer.envelope[BinningValue::binR][0u] << ") / " - << protoLayer.max(BinningValue::binR, false) << " (+" - << protoLayer.envelope[BinningValue::binR][1u] << ")"); + << protoLayer.min(AxisDirection::AxisR, false) << " (-" + << protoLayer.envelope[AxisDirection::AxisR][0u] << ") / " + << protoLayer.max(AxisDirection::AxisR, false) << " (+" + << protoLayer.envelope[AxisDirection::AxisR][1u] << ")"); ACTS_VERBOSE(" - with phi min/max = " - << protoLayer.min(BinningValue::binPhi, false) << " / " - << protoLayer.max(BinningValue::binPhi, false)); + << protoLayer.min(AxisDirection::AxisPhi, false) << " / " + << protoLayer.max(AxisDirection::AxisPhi, false)); ACTS_VERBOSE(" - # of modules = " << surfaces.size() << " ordered in ( " << binsR << " x " << binsPhi << ")"); @@ -245,7 +245,8 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( // create the share disc bounds auto dBounds = std::make_shared( - protoLayer.min(BinningValue::binR), protoLayer.max(BinningValue::binR)); + protoLayer.min(AxisDirection::AxisR), + protoLayer.max(AxisDirection::AxisR)); // create the layers // we use the same transform here as for the layer itself @@ -270,27 +271,27 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( ProtoLayer protoLayer = _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); - double layerZ = protoLayer.medium(BinningValue::binZ); - double layerThickness = protoLayer.range(BinningValue::binZ); + double layerZ = protoLayer.medium(AxisDirection::AxisZ); + double layerThickness = protoLayer.range(AxisDirection::AxisZ); // adjust the layer radius ACTS_VERBOSE("Creating a disk Layer:"); ACTS_VERBOSE(" - at Z position = " << layerZ); ACTS_VERBOSE(" - from Z min/max = " - << protoLayer.min(BinningValue::binZ, false) << " / " - << protoLayer.max(BinningValue::binZ, false)); + << protoLayer.min(AxisDirection::AxisZ, false) << " / " + << protoLayer.max(AxisDirection::AxisZ, false)); ACTS_VERBOSE(" - with Z thickness = " << layerThickness); ACTS_VERBOSE(" - incl envelope = " - << protoLayer.envelope[BinningValue::binZ][0u] << " / " - << protoLayer.envelope[BinningValue::binZ][1u]); + << protoLayer.envelope[AxisDirection::AxisZ][0u] << " / " + << protoLayer.envelope[AxisDirection::AxisZ][1u]); ACTS_VERBOSE(" - with R min/max = " - << protoLayer.min(BinningValue::binR, false) << " (-" - << protoLayer.envelope[BinningValue::binR][0u] << ") / " - << protoLayer.max(BinningValue::binR, false) << " (+" - << protoLayer.envelope[BinningValue::binR][1u] << ")"); + << protoLayer.min(AxisDirection::AxisR, false) << " (-" + << protoLayer.envelope[AxisDirection::AxisR][0u] << ") / " + << protoLayer.max(AxisDirection::AxisR, false) << " (+" + << protoLayer.envelope[AxisDirection::AxisR][1u] << ")"); ACTS_VERBOSE(" - with phi min/max = " - << protoLayer.min(BinningValue::binPhi, false) << " / " - << protoLayer.max(BinningValue::binPhi, false)); + << protoLayer.min(AxisDirection::AxisPhi, false) << " / " + << protoLayer.max(AxisDirection::AxisPhi, false)); ACTS_VERBOSE(" - # of modules = " << surfaces.size()); // create the layer transforms if not given @@ -310,7 +311,8 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( // create the shared disc bounds auto dBounds = std::make_shared( - protoLayer.min(BinningValue::binR), protoLayer.max(BinningValue::binR)); + protoLayer.min(AxisDirection::AxisR), + protoLayer.max(AxisDirection::AxisR)); // create the layers MutableLayerPtr dLayer = @@ -327,7 +329,7 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( const GeometryContext& gctx, std::vector> surfaces, std::size_t bins1, - std::size_t bins2, BinningValue bValue, + std::size_t bins2, AxisDirection aDir, std::optional _protoLayer, const Transform3& transform, std::unique_ptr ad) const { ProtoLayer protoLayer = @@ -335,58 +337,58 @@ Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( // remaining layer parameters double layerHalf1 = 0, layerHalf2 = 0, layerThickness = 0; - switch (bValue) { - case BinningValue::binX: { - layerHalf1 = 0.5 * (protoLayer.max(BinningValue::binY) - - protoLayer.min(BinningValue::binY)); - layerHalf2 = 0.5 * (protoLayer.max(BinningValue::binZ) - - protoLayer.min(BinningValue::binZ)); - layerThickness = (protoLayer.max(BinningValue::binX) - - protoLayer.min(BinningValue::binX)); + switch (aDir) { + case AxisDirection::AxisX: { + layerHalf1 = 0.5 * (protoLayer.max(AxisDirection::AxisY) - + protoLayer.min(AxisDirection::AxisY)); + layerHalf2 = 0.5 * (protoLayer.max(AxisDirection::AxisZ) - + protoLayer.min(AxisDirection::AxisZ)); + layerThickness = (protoLayer.max(AxisDirection::AxisX) - + protoLayer.min(AxisDirection::AxisX)); break; } - case BinningValue::binY: { - layerHalf1 = 0.5 * (protoLayer.max(BinningValue::binX) - - protoLayer.min(BinningValue::binX)); - layerHalf2 = 0.5 * (protoLayer.max(BinningValue::binZ) - - protoLayer.min(BinningValue::binZ)); - layerThickness = (protoLayer.max(BinningValue::binY) - - protoLayer.min(BinningValue::binY)); + case AxisDirection::AxisY: { + layerHalf1 = 0.5 * (protoLayer.max(AxisDirection::AxisX) - + protoLayer.min(AxisDirection::AxisX)); + layerHalf2 = 0.5 * (protoLayer.max(AxisDirection::AxisZ) - + protoLayer.min(AxisDirection::AxisZ)); + layerThickness = (protoLayer.max(AxisDirection::AxisY) - + protoLayer.min(AxisDirection::AxisY)); break; } - case BinningValue::binZ: { - layerHalf1 = 0.5 * (protoLayer.max(BinningValue::binX) - - protoLayer.min(BinningValue::binX)); - layerHalf2 = 0.5 * (protoLayer.max(BinningValue::binY) - - protoLayer.min(BinningValue::binY)); - layerThickness = (protoLayer.max(BinningValue::binZ) - - protoLayer.min(BinningValue::binZ)); + case AxisDirection::AxisZ: { + layerHalf1 = 0.5 * (protoLayer.max(AxisDirection::AxisX) - + protoLayer.min(AxisDirection::AxisX)); + layerHalf2 = 0.5 * (protoLayer.max(AxisDirection::AxisY) - + protoLayer.min(AxisDirection::AxisY)); + layerThickness = (protoLayer.max(AxisDirection::AxisZ) - + protoLayer.min(AxisDirection::AxisZ)); break; } default: throw std::invalid_argument("Invalid binning value"); } - double centerX = 0.5 * (protoLayer.max(BinningValue::binX) + - protoLayer.min(BinningValue::binX)); - double centerY = 0.5 * (protoLayer.max(BinningValue::binY) + - protoLayer.min(BinningValue::binY)); - double centerZ = 0.5 * (protoLayer.max(BinningValue::binZ) + - protoLayer.min(BinningValue::binZ)); + double centerX = 0.5 * (protoLayer.max(AxisDirection::AxisX) + + protoLayer.min(AxisDirection::AxisX)); + double centerY = 0.5 * (protoLayer.max(AxisDirection::AxisY) + + protoLayer.min(AxisDirection::AxisY)); + double centerZ = 0.5 * (protoLayer.max(AxisDirection::AxisZ) + + protoLayer.min(AxisDirection::AxisZ)); ACTS_VERBOSE("Creating a plane Layer:"); ACTS_VERBOSE(" - with layer center = " << "(" << centerX << ", " << centerY << ", " << centerZ << ")"); - ACTS_VERBOSE(" - from X min/max = " << protoLayer.min(BinningValue::binX) - << " / " - << protoLayer.max(BinningValue::binX)); - ACTS_VERBOSE(" - from Y min/max = " << protoLayer.min(BinningValue::binY) - << " / " - << protoLayer.max(BinningValue::binY)); + ACTS_VERBOSE(" - from X min/max = " + << protoLayer.min(AxisDirection::AxisX) << " / " + << protoLayer.max(AxisDirection::AxisX)); + ACTS_VERBOSE(" - from Y min/max = " + << protoLayer.min(AxisDirection::AxisY) << " / " + << protoLayer.max(AxisDirection::AxisY)); ACTS_VERBOSE(" - with Z thickness = " << layerThickness); - ACTS_VERBOSE(" - incl envelope = " << protoLayer.envelope[bValue][0u] + ACTS_VERBOSE(" - incl envelope = " << protoLayer.envelope[aDir][0u] << " / " - << protoLayer.envelope[bValue][1u]); + << protoLayer.envelope[aDir][1u]); // create the layer transforms if not given // we need to transform in case centerX/centerY/centerZ != 0, so that the @@ -401,7 +403,7 @@ Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( std::unique_ptr sArray; if (!surfaces.empty()) { sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnPlane( - gctx, std::move(surfaces), bins1, bins2, bValue, protoLayer, transform); + gctx, std::move(surfaces), bins1, bins2, aDir, protoLayer, transform); checkBinning(gctx, *sArray); } @@ -488,8 +490,8 @@ bool Acts::LayerCreator::checkBinning(const GeometryContext& gctx, // print all inaccessibles ACTS_ERROR(" -- Inaccessible surfaces: "); for (const auto& srf : diff) { - // have to choose BinningValue here - Vector3 ctr = srf->binningPosition(gctx, BinningValue::binR); + // have to choose AxisDirection here + Vector3 ctr = srf->referencePosition(gctx, AxisDirection::AxisR); ACTS_ERROR(" Surface(x=" << ctr.x() << ", y=" << ctr.y() << ", z=" << ctr.z() << ", r=" << perp(ctr) << ", phi=" << phi(ctr) << ")"); diff --git a/Core/src/Geometry/MaterialDesignatorBlueprintNode.cpp b/Core/src/Geometry/MaterialDesignatorBlueprintNode.cpp index 0e89b65d6e3..4bf4c3f8445 100644 --- a/Core/src/Geometry/MaterialDesignatorBlueprintNode.cpp +++ b/Core/src/Geometry/MaterialDesignatorBlueprintNode.cpp @@ -56,23 +56,23 @@ void MaterialDesignatorBlueprintNode::handleCylinderBinning( for (auto& [face, loc0, loc1] : binning) { if (face == OuterCylinder || face == InnerCylinder) { - if (loc0.binValue != BinningValue::binRPhi) { + if (loc0.axisDir != AxisDirection::AxisRPhi) { ACTS_ERROR(prefix() << "Binning is not in RPhi"); throw std::runtime_error("Binning is not in RPhi"); } - if (loc1.binValue != BinningValue::binZ) { + if (loc1.axisDir != AxisDirection::AxisZ) { ACTS_ERROR(prefix() << "Binning is not in Z"); throw std::runtime_error("Binning is not in Z"); } } if (face == PositiveDisc || face == NegativeDisc) { - if (loc0.binValue != BinningValue::binR) { + if (loc0.axisDir != AxisDirection::AxisR) { ACTS_ERROR(prefix() << "Binning is not in R"); throw std::runtime_error("Binning is not in R"); } - if (loc1.binValue != BinningValue::binPhi) { + if (loc1.axisDir != AxisDirection::AxisPhi) { ACTS_ERROR(prefix() << "Binning is not in Phi"); throw std::runtime_error("Binning is not in Phi"); } @@ -164,8 +164,8 @@ void MaterialDesignatorBlueprintNode::addToGraphviz(std::ostream& os) const { Experimental::ProtoBinning>>& binning) { for (const auto& [face, loc0, loc1] : binning) { ss << "
" << face; - ss << ": " << loc0.binValue << "=" << loc0.bins(); - ss << ", " << loc1.binValue << "=" << loc1.bins(); + ss << ": " << loc0.axisDir << "=" << loc0.bins(); + ss << ", " << loc1.axisDir << "=" << loc1.bins(); } }, [](const auto& /*binning*/) { diff --git a/Core/src/Geometry/Polyhedron.cpp b/Core/src/Geometry/Polyhedron.cpp index 5f7336ca3fc..38d9a44d3b1 100644 --- a/Core/src/Geometry/Polyhedron.cpp +++ b/Core/src/Geometry/Polyhedron.cpp @@ -50,11 +50,11 @@ Acts::Extent Acts::Polyhedron::extent(const Transform3& transform) const { return (vt); }); - // Special checks of BinningValue::binR for hyper plane surfaces + // Special checks of AxisDirection::AxisR for hyper plane surfaces if (detail::VerticesHelper::onHyperPlane(vtxs)) { // Check inclusion of origin (i.e. convex around origin) Vector3 origin = - transform * Vector3(0., 0., extent.medium(BinningValue::binZ)); + transform * Vector3(0., 0., extent.medium(AxisDirection::AxisZ)); for (const auto& face : faces) { std::vector tface; tface.reserve(face.size()); @@ -62,8 +62,8 @@ Acts::Extent Acts::Polyhedron::extent(const Transform3& transform) const { tface.push_back(vtxs[f]); } if (detail::VerticesHelper::isInsidePolygon(origin, tface)) { - extent.range(BinningValue::binR).setMin(0.); - extent.range(BinningValue::binPhi) + extent.range(AxisDirection::AxisR).setMin(0.); + extent.range(AxisDirection::AxisPhi) .set(-std::numbers::pi, std::numbers::pi); break; } @@ -93,7 +93,7 @@ Acts::Extent Acts::Polyhedron::extent(const Transform3& transform) const { for (std::size_t iv = 1; iv < vtxs.size() + 1; ++iv) { std::size_t fpoint = iv < vtxs.size() ? iv : 0; double testR = radialDistance(vtxs[fpoint], vtxs[iv - 1]); - extent.range(BinningValue::binR).expandMin(testR); + extent.range(AxisDirection::AxisR).expandMin(testR); } } } diff --git a/Core/src/Geometry/Portal.cpp b/Core/src/Geometry/Portal.cpp index 69cab13b8e0..0244b4c648e 100644 --- a/Core/src/Geometry/Portal.cpp +++ b/Core/src/Geometry/Portal.cpp @@ -182,7 +182,7 @@ RegularSurface& Portal::surface() { } Portal Portal::merge(const GeometryContext& gctx, Portal& aPortal, - Portal& bPortal, BinningValue direction, + Portal& bPortal, AxisDirection direction, const Logger& logger) { ACTS_VERBOSE("Merging two portals along " << direction); diff --git a/Core/src/Geometry/PortalLinkBase.cpp b/Core/src/Geometry/PortalLinkBase.cpp index f558fe19238..16826172a2d 100644 --- a/Core/src/Geometry/PortalLinkBase.cpp +++ b/Core/src/Geometry/PortalLinkBase.cpp @@ -21,7 +21,7 @@ namespace Acts { void PortalLinkBase::checkMergePreconditions(const PortalLinkBase& a, const PortalLinkBase& b, - BinningValue direction) { + AxisDirection direction) { const auto& surfaceA = a.surface(); const auto& surfaceB = b.surface(); @@ -40,17 +40,17 @@ void PortalLinkBase::checkMergePreconditions(const PortalLinkBase& a, throw_assert(cylB != nullptr, "Cannot merge CylinderSurface with " "non-CylinderSurface"); - throw_assert( - direction == BinningValue::binZ || direction == BinningValue::binRPhi, - "Invalid binning direction: " + binningValueName(direction)); + throw_assert(direction == AxisDirection::AxisZ || + direction == AxisDirection::AxisRPhi, + "Invalid binning direction: " + axisDirectionName(direction)); } else if (const auto* discA = dynamic_cast(&surfaceA); discA != nullptr) { const auto* discB = dynamic_cast(&surfaceB); throw_assert(discB != nullptr, "Cannot merge DiscSurface with non-DiscSurface"); - throw_assert( - direction == BinningValue::binR || direction == BinningValue::binPhi, - "Invalid binning direction: " + binningValueName(direction)); + throw_assert(direction == AxisDirection::AxisR || + direction == AxisDirection::AxisPhi, + "Invalid binning direction: " + axisDirectionName(direction)); throw_assert(dynamic_cast(&discA->bounds()) && dynamic_cast(&discB->bounds()), @@ -63,7 +63,7 @@ void PortalLinkBase::checkMergePreconditions(const PortalLinkBase& a, std::unique_ptr PortalLinkBase::merge( std::unique_ptr a, std::unique_ptr b, - BinningValue direction, const Logger& logger) { + AxisDirection direction, const Logger& logger) { ACTS_VERBOSE("Merging two arbitrary portals"); ACTS_VERBOSE(" - a: " << *a); diff --git a/Core/src/Geometry/PortalShell.cpp b/Core/src/Geometry/PortalShell.cpp index 5b2d8e167c8..dbd9e4e8e0d 100644 --- a/Core/src/Geometry/PortalShell.cpp +++ b/Core/src/Geometry/PortalShell.cpp @@ -134,7 +134,7 @@ std::string SingleCylinderPortalShell::label() const { CylinderStackPortalShell::CylinderStackPortalShell( const GeometryContext& gctx, std::vector shells, - BinningValue direction, const Logger& logger) + AxisDirection direction, const Logger& logger) : m_direction{direction}, m_shells{std::move(shells)} { ACTS_VERBOSE("Making cylinder stack shell in " << m_direction << " direction"); @@ -198,7 +198,7 @@ CylinderStackPortalShell::CylinderStackPortalShell( } }; - if (direction == BinningValue::binR) { + if (direction == AxisDirection::AxisR) { ACTS_VERBOSE("Merging portals at positive and negative discs"); merge(PositiveDisc); merge(NegativeDisc); @@ -206,7 +206,7 @@ CylinderStackPortalShell::CylinderStackPortalShell( ACTS_VERBOSE("Fusing portals at outer and inner cylinders"); fuse(OuterCylinder, InnerCylinder); - } else if (direction == BinningValue::binZ) { + } else if (direction == AxisDirection::AxisZ) { bool allHaveInnerCylinders = std::ranges::all_of( m_shells, [](const auto* shell) { return shell->size() == 4; }); @@ -250,7 +250,7 @@ Portal* CylinderStackPortalShell::portal(Face face) { } std::shared_ptr CylinderStackPortalShell::portalPtr(Face face) { - if (m_direction == BinningValue::binR) { + if (m_direction == AxisDirection::AxisR) { switch (face) { case NegativeDisc: return m_shells.front()->portalPtr(NegativeDisc); @@ -296,7 +296,7 @@ void CylinderStackPortalShell::setPortal(std::shared_ptr portal, Face face) { assert(portal != nullptr); - if (m_direction == BinningValue::binR) { + if (m_direction == AxisDirection::AxisR) { switch (face) { case NegativeDisc: [[fallthrough]]; diff --git a/Core/src/Geometry/ProtoLayer.cpp b/Core/src/Geometry/ProtoLayer.cpp index c8f190d4293..2956e6a2788 100644 --- a/Core/src/Geometry/ProtoLayer.cpp +++ b/Core/src/Geometry/ProtoLayer.cpp @@ -44,26 +44,26 @@ ProtoLayer::ProtoLayer(const GeometryContext& gctx, measure(gctx, m_surfaces); } -double ProtoLayer::min(BinningValue bval, bool addenv) const { +double ProtoLayer::min(AxisDirection aDir, bool addenv) const { if (addenv) { - return extent.min(bval) - envelope[bval][0u]; + return extent.min(aDir) - envelope[aDir][0u]; } - return extent.min(bval); + return extent.min(aDir); } -double ProtoLayer::max(BinningValue bval, bool addenv) const { +double ProtoLayer::max(AxisDirection aDir, bool addenv) const { if (addenv) { - return extent.max(bval) + envelope[bval][1u]; + return extent.max(aDir) + envelope[aDir][1u]; } - return extent.max(bval); + return extent.max(aDir); } -double ProtoLayer::medium(BinningValue bval, bool addenv) const { - return 0.5 * (min(bval, addenv) + max(bval, addenv)); +double ProtoLayer::medium(AxisDirection aDir, bool addenv) const { + return 0.5 * (min(aDir, addenv) + max(aDir, addenv)); } -double ProtoLayer::range(BinningValue bval, bool addenv) const { - return std::abs(max(bval, addenv) - min(bval, addenv)); +double ProtoLayer::range(AxisDirection aDir, bool addenv) const { + return std::abs(max(aDir, addenv) - min(aDir, addenv)); } std::ostream& ProtoLayer::toStream(std::ostream& sl) const { diff --git a/Core/src/Geometry/ProtoLayerHelper.cpp b/Core/src/Geometry/ProtoLayerHelper.cpp index ae3dfc4896b..4a779988e9c 100644 --- a/Core/src/Geometry/ProtoLayerHelper.cpp +++ b/Core/src/Geometry/ProtoLayerHelper.cpp @@ -69,7 +69,7 @@ std::vector Acts::ProtoLayerHelper::protoLayers( std::vector> sortSurfaces = {surfaces}; for (const auto& sorting : sortings) { ACTS_VERBOSE("-> Sorting a set of " << sortSurfaces.size() << " in " - << binningValueName(sorting.first)); + << axisDirectionName(sorting.first)); std::vector> subSurfaces; for (const auto& ssurfaces : sortSurfaces) { ACTS_VERBOSE("-> Surfaces for this sorting step: " << ssurfaces.size()); diff --git a/Core/src/Geometry/SurfaceArrayCreator.cpp b/Core/src/Geometry/SurfaceArrayCreator.cpp index 3ec85b020f6..514618281b3 100644 --- a/Core/src/Geometry/SurfaceArrayCreator.cpp +++ b/Core/src/Geometry/SurfaceArrayCreator.cpp @@ -44,12 +44,13 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( << binsPhi * binsZ << " bins."); Transform3 ftransform = transform; - ProtoAxis pAxisPhi = createEquidistantAxis( - gctx, surfacesRaw, BinningValue::binPhi, protoLayer, ftransform, binsPhi); + ProtoAxis pAxisPhi = + createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisPhi, + protoLayer, ftransform, binsPhi); ProtoAxis pAxisZ = createEquidistantAxis( - gctx, surfacesRaw, BinningValue::binZ, protoLayer, ftransform, binsZ); + gctx, surfacesRaw, AxisDirection::AxisZ, protoLayer, ftransform, binsZ); - double R = protoLayer.medium(BinningValue::binR, true); + double R = protoLayer.medium(AxisDirection::AxisR, true); Transform3 itransform = ftransform.inverse(); // Transform lambda captures the transform matrix @@ -85,7 +86,7 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( ProtoLayer protoLayer = protoLayerOpt ? *protoLayerOpt : ProtoLayer(gctx, surfacesRaw); - double R = protoLayer.medium(BinningValue::binR, true); + double R = protoLayer.medium(AxisDirection::AxisR, true); ProtoAxis pAxisPhi; ProtoAxis pAxisZ; @@ -93,18 +94,18 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( Transform3 ftransform = transform; if (bTypePhi == equidistant) { - pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, BinningValue::binPhi, + pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisPhi, protoLayer, ftransform, 0); } else { - pAxisPhi = createVariableAxis(gctx, surfacesRaw, BinningValue::binPhi, + pAxisPhi = createVariableAxis(gctx, surfacesRaw, AxisDirection::AxisPhi, protoLayer, ftransform); } if (bTypeZ == equidistant) { - pAxisZ = createEquidistantAxis(gctx, surfacesRaw, BinningValue::binZ, + pAxisZ = createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisZ, protoLayer, ftransform); } else { - pAxisZ = createVariableAxis(gctx, surfacesRaw, BinningValue::binZ, + pAxisZ = createVariableAxis(gctx, surfacesRaw, AxisDirection::AxisZ, protoLayer, ftransform); } @@ -155,11 +156,12 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( Transform3 ftransform = transform; ProtoAxis pAxisR = createEquidistantAxis( - gctx, surfacesRaw, BinningValue::binR, protoLayer, ftransform, binsR); - ProtoAxis pAxisPhi = createEquidistantAxis( - gctx, surfacesRaw, BinningValue::binPhi, protoLayer, ftransform, binsPhi); + gctx, surfacesRaw, AxisDirection::AxisR, protoLayer, ftransform, binsR); + ProtoAxis pAxisPhi = + createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisPhi, + protoLayer, ftransform, binsPhi); - double Z = protoLayer.medium(BinningValue::binZ, true); + double Z = protoLayer.medium(AxisDirection::AxisZ, true); ACTS_VERBOSE("- z-position of disk estimated as " << Z); Transform3 itransform = transform.inverse(); @@ -212,10 +214,10 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( Transform3 ftransform = transform; if (bTypeR == equidistant) { - pAxisR = createEquidistantAxis(gctx, surfacesRaw, BinningValue::binR, + pAxisR = createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisR, protoLayer, ftransform); } else { - pAxisR = createVariableAxis(gctx, surfacesRaw, BinningValue::binR, + pAxisR = createVariableAxis(gctx, surfacesRaw, AxisDirection::AxisR, protoLayer, ftransform); } @@ -226,7 +228,7 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( // this FORCES equidistant binning std::vector> phiModules(pAxisR.nBins); for (const auto& srf : surfacesRaw) { - Vector3 bpos = srf->binningPosition(gctx, BinningValue::binR); + Vector3 bpos = srf->referencePosition(gctx, AxisDirection::AxisR); std::size_t bin = pAxisR.getBin(perp(bpos)); phiModules.at(bin).push_back(srf); } @@ -234,7 +236,7 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( std::vector nPhiModules; auto matcher = m_cfg.surfaceMatcher; auto equal = [&gctx, &matcher](const Surface* a, const Surface* b) { - return matcher(gctx, BinningValue::binPhi, a, b); + return matcher(gctx, AxisDirection::AxisPhi, a, b); }; std::transform( @@ -252,21 +254,21 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( // @TODO: check in extrapolation std::size_t nBinsPhi = (*std::min_element(nPhiModules.begin(), nPhiModules.end())); - pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, BinningValue::binPhi, + pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisPhi, protoLayer, ftransform, nBinsPhi); } else { // use regular determination if (bTypePhi == equidistant) { - pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, BinningValue::binPhi, - protoLayer, ftransform, 0); + pAxisPhi = createEquidistantAxis( + gctx, surfacesRaw, AxisDirection::AxisPhi, protoLayer, ftransform, 0); } else { - pAxisPhi = createVariableAxis(gctx, surfacesRaw, BinningValue::binPhi, + pAxisPhi = createVariableAxis(gctx, surfacesRaw, AxisDirection::AxisPhi, protoLayer, ftransform); } } - double Z = protoLayer.medium(BinningValue::binZ, true); + double Z = protoLayer.medium(AxisDirection::AxisZ, true); ACTS_VERBOSE("- z-position of disk estimated as " << Z); Transform3 itransform = ftransform.inverse(); @@ -306,7 +308,7 @@ std::unique_ptr Acts::SurfaceArrayCreator::surfaceArrayOnPlane( const GeometryContext& gctx, std::vector> surfaces, std::size_t bins1, - std::size_t bins2, BinningValue bValue, + std::size_t bins2, AxisDirection aDir, std::optional protoLayerOpt, const Transform3& transform) const { std::vector surfacesRaw = unpack_shared_vector(surfaces); @@ -332,32 +334,38 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( std::unique_ptr sl; // Axis along the binning - switch (bValue) { - case BinningValue::binX: { - ProtoAxis pAxis1 = createEquidistantAxis( - gctx, surfacesRaw, BinningValue::binY, protoLayer, ftransform, bins1); - ProtoAxis pAxis2 = createEquidistantAxis( - gctx, surfacesRaw, BinningValue::binZ, protoLayer, ftransform, bins2); + switch (aDir) { + case AxisDirection::AxisX: { + ProtoAxis pAxis1 = + createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisY, + protoLayer, ftransform, bins1); + ProtoAxis pAxis2 = + createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisZ, + protoLayer, ftransform, bins2); sl = makeSurfaceGridLookup2D( globalToLocal, localToGlobal, pAxis1, pAxis2); break; } - case BinningValue::binY: { - ProtoAxis pAxis1 = createEquidistantAxis( - gctx, surfacesRaw, BinningValue::binX, protoLayer, ftransform, bins1); - ProtoAxis pAxis2 = createEquidistantAxis( - gctx, surfacesRaw, BinningValue::binZ, protoLayer, ftransform, bins2); + case AxisDirection::AxisY: { + ProtoAxis pAxis1 = + createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisX, + protoLayer, ftransform, bins1); + ProtoAxis pAxis2 = + createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisZ, + protoLayer, ftransform, bins2); sl = makeSurfaceGridLookup2D( globalToLocal, localToGlobal, pAxis1, pAxis2); break; } - case BinningValue::binZ: { - ProtoAxis pAxis1 = createEquidistantAxis( - gctx, surfacesRaw, BinningValue::binX, protoLayer, ftransform, bins1); - ProtoAxis pAxis2 = createEquidistantAxis( - gctx, surfacesRaw, BinningValue::binY, protoLayer, ftransform, bins2); + case AxisDirection::AxisZ: { + ProtoAxis pAxis1 = + createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisX, + protoLayer, ftransform, bins1); + ProtoAxis pAxis2 = + createEquidistantAxis(gctx, surfacesRaw, AxisDirection::AxisY, + protoLayer, ftransform, bins2); sl = makeSurfaceGridLookup2D( globalToLocal, localToGlobal, pAxis1, pAxis2); @@ -401,10 +409,10 @@ std::vector Acts::SurfaceArrayCreator::findKeySurfaces( std::size_t Acts::SurfaceArrayCreator::determineBinCount( const GeometryContext& gctx, const std::vector& surfaces, - BinningValue bValue) const { + AxisDirection aDir) const { auto matcher = m_cfg.surfaceMatcher; - auto equal = [&gctx, &bValue, &matcher](const Surface* a, const Surface* b) { - return matcher(gctx, bValue, a, b); + auto equal = [&gctx, &aDir, &matcher](const Surface* a, const Surface* b) { + return matcher(gctx, aDir, a, b); }; std::vector keys = findKeySurfaces(surfaces, equal); @@ -414,7 +422,7 @@ std::size_t Acts::SurfaceArrayCreator::determineBinCount( Acts::SurfaceArrayCreator::ProtoAxis Acts::SurfaceArrayCreator::createVariableAxis( const GeometryContext& gctx, const std::vector& surfaces, - BinningValue bValue, const ProtoLayer& protoLayer, + AxisDirection aDir, const ProtoLayer& protoLayer, Transform3& transform) const { if (surfaces.empty()) { throw std::logic_error( @@ -426,44 +434,45 @@ Acts::SurfaceArrayCreator::createVariableAxis( // bind matcher with binning type auto matcher = m_cfg.surfaceMatcher; // find the key surfaces - auto equal = [&gctx, &bValue, &matcher](const Surface* a, const Surface* b) { - return matcher(gctx, bValue, a, b); + auto equal = [&gctx, &aDir, &matcher](const Surface* a, const Surface* b) { + return matcher(gctx, aDir, a, b); }; std::vector keys = findKeySurfaces(surfaces, equal); - std::vector bValues; - if (bValue == Acts::BinningValue::binPhi) { + std::vector aDirs; + if (aDir == Acts::AxisDirection::AxisPhi) { std::stable_sort( keys.begin(), keys.end(), [&gctx](const Acts::Surface* a, const Acts::Surface* b) { - return (phi(a->binningPosition(gctx, BinningValue::binPhi)) < - phi(b->binningPosition(gctx, BinningValue::binPhi))); + return (phi(a->referencePosition(gctx, AxisDirection::AxisPhi)) < + phi(b->referencePosition(gctx, AxisDirection::AxisPhi))); }); AxisScalar maxPhi = - 0.5 * (phi(keys.at(0)->binningPosition(gctx, BinningValue::binPhi)) + - phi(keys.at(1)->binningPosition(gctx, BinningValue::binPhi))); + 0.5 * + (phi(keys.at(0)->referencePosition(gctx, AxisDirection::AxisPhi)) + + phi(keys.at(1)->referencePosition(gctx, AxisDirection::AxisPhi))); // create rotation, so that maxPhi is +pi AxisScalar angle = -(std::numbers::pi + maxPhi); transform = (transform)*AngleAxis3(angle, Vector3::UnitZ()); - // iterate over all key surfaces, and use their mean position as bValues, + // iterate over all key surfaces, and use their mean position as aDirs, // but // rotate using transform from before AxisScalar previous = - phi(keys.at(0)->binningPosition(gctx, BinningValue::binPhi)); + phi(keys.at(0)->referencePosition(gctx, AxisDirection::AxisPhi)); // go through key surfaces for (std::size_t i = 1; i < keys.size(); i++) { const Surface* surface = keys.at(i); // create central binning values which is the mean of the center // positions in the binning direction of the current and previous // surface - AxisScalar edge = 0.5 * (previous + phi(surface->binningPosition( - gctx, BinningValue::binPhi))) + + AxisScalar edge = 0.5 * (previous + phi(surface->referencePosition( + gctx, AxisDirection::AxisPhi))) + angle; - bValues.push_back(edge); - previous = phi(surface->binningPosition(gctx, BinningValue::binPhi)); + aDirs.push_back(edge); + previous = phi(surface->referencePosition(gctx, AxisDirection::AxisPhi)); } // segments @@ -487,71 +496,73 @@ Acts::SurfaceArrayCreator::createVariableAxis( return phi(a) < phi(b); })); - bValues.push_back(maxBValue); + aDirs.push_back(maxBValue); - bValues.push_back(std::numbers::pi_v); + aDirs.push_back(std::numbers::pi_v); - } else if (bValue == Acts::BinningValue::binZ) { + } else if (aDir == Acts::AxisDirection::AxisZ) { std::stable_sort( keys.begin(), keys.end(), [&gctx](const Acts::Surface* a, const Acts::Surface* b) { - return (a->binningPosition(gctx, BinningValue::binZ).z() < - b->binningPosition(gctx, BinningValue::binZ).z()); + return (a->referencePosition(gctx, AxisDirection::AxisZ).z() < + b->referencePosition(gctx, AxisDirection::AxisZ).z()); }); - bValues.push_back(protoLayer.min(BinningValue::binZ)); - bValues.push_back(protoLayer.max(BinningValue::binZ)); + aDirs.push_back(protoLayer.min(AxisDirection::AxisZ)); + aDirs.push_back(protoLayer.max(AxisDirection::AxisZ)); // the z-center position of the previous surface AxisScalar previous = - keys.front()->binningPosition(gctx, BinningValue::binZ).z(); + keys.front()->referencePosition(gctx, AxisDirection::AxisZ).z(); // go through key surfaces for (auto surface = keys.begin() + 1; surface != keys.end(); surface++) { // create central binning values which is the mean of the center // positions in the binning direction of the current and previous // surface - bValues.push_back( - 0.5 * (previous + - (*surface)->binningPosition(gctx, BinningValue::binZ).z())); - previous = (*surface)->binningPosition(gctx, BinningValue::binZ).z(); + aDirs.push_back( + 0.5 * + (previous + + (*surface)->referencePosition(gctx, AxisDirection::AxisZ).z())); + previous = (*surface)->referencePosition(gctx, AxisDirection::AxisZ).z(); } - } else { // BinningValue::binR + } else { // AxisDirection::AxisR std::stable_sort( keys.begin(), keys.end(), [&gctx](const Acts::Surface* a, const Acts::Surface* b) { - return (perp(a->binningPosition(gctx, BinningValue::binR)) < - perp(b->binningPosition(gctx, BinningValue::binR))); + return (perp(a->referencePosition(gctx, AxisDirection::AxisR)) < + perp(b->referencePosition(gctx, AxisDirection::AxisR))); }); - bValues.push_back(protoLayer.min(BinningValue::binR)); - bValues.push_back(protoLayer.max(BinningValue::binR)); + aDirs.push_back(protoLayer.min(AxisDirection::AxisR)); + aDirs.push_back(protoLayer.max(AxisDirection::AxisR)); // the r-center position of the previous surface AxisScalar previous = - perp(keys.front()->binningPosition(gctx, BinningValue::binR)); + perp(keys.front()->referencePosition(gctx, AxisDirection::AxisR)); // go through key surfaces for (auto surface = keys.begin() + 1; surface != keys.end(); surface++) { // create central binning values which is the mean of the center // positions in the binning direction of the current and previous // surface - bValues.push_back(0.5 * (previous + perp((*surface)->binningPosition( - gctx, BinningValue::binR)))); - previous = perp((*surface)->binningPosition(gctx, BinningValue::binR)); + aDirs.push_back(0.5 * (previous + perp((*surface)->referencePosition( + gctx, AxisDirection::AxisR)))); + previous = + perp((*surface)->referencePosition(gctx, AxisDirection::AxisR)); } } - std::ranges::sort(bValues); + std::ranges::sort(aDirs); ACTS_VERBOSE("Create variable binning Axis for binned SurfaceArray"); - ACTS_VERBOSE(" BinningValue: " << bValue); - ACTS_VERBOSE(" Number of bins: " << (bValues.size() - 1)); - ACTS_VERBOSE(" (Min/Max) = (" << bValues.front() << "/" - << bValues.back() << ")"); + ACTS_VERBOSE(" AxisDirection: " << aDir); + ACTS_VERBOSE(" Number of bins: " << (aDirs.size() - 1)); + ACTS_VERBOSE(" (Min/Max) = (" << aDirs.front() << "/" << aDirs.back() + << ")"); ProtoAxis pAxis; pAxis.bType = arbitrary; - pAxis.bValue = bValue; - pAxis.binEdges = bValues; - pAxis.nBins = bValues.size() - 1; + pAxis.axisDir = aDir; + pAxis.binEdges = aDirs; + pAxis.nBins = aDirs.size() - 1; return pAxis; } @@ -559,7 +570,7 @@ Acts::SurfaceArrayCreator::createVariableAxis( Acts::SurfaceArrayCreator::ProtoAxis Acts::SurfaceArrayCreator::createEquidistantAxis( const GeometryContext& gctx, const std::vector& surfaces, - BinningValue bValue, const ProtoLayer& protoLayer, Transform3& transform, + AxisDirection aDir, const ProtoLayer& protoLayer, Transform3& transform, std::size_t nBins) const { if (surfaces.empty()) { throw std::logic_error( @@ -580,7 +591,7 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( std::size_t binNumber = 0; if (nBins == 0) { // determine bin count - binNumber = determineBinCount(gctx, surfaces, bValue); + binNumber = determineBinCount(gctx, surfaces, aDir); } else { // use bin count binNumber = nBins; @@ -590,7 +601,7 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( auto matcher = m_cfg.surfaceMatcher; // now check the binning value - if (bValue == BinningValue::binPhi) { + if (aDir == AxisDirection::AxisPhi) { if (m_cfg.doPhiBinningOptimization) { // Phi binning // set the binning option for phi @@ -598,14 +609,14 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( const Acts::Surface* maxElem = *std::max_element( surfaces.begin(), surfaces.end(), [&gctx](const Acts::Surface* a, const Acts::Surface* b) { - return phi(a->binningPosition(gctx, BinningValue::binR)) < - phi(b->binningPosition(gctx, BinningValue::binR)); + return phi(a->referencePosition(gctx, AxisDirection::AxisR)) < + phi(b->referencePosition(gctx, AxisDirection::AxisR)); }); // get the key surfaces at the different phi positions - auto equal = [&gctx, &bValue, &matcher](const Surface* a, - const Surface* b) { - return matcher(gctx, bValue, a, b); + auto equal = [&gctx, &aDir, &matcher](const Surface* a, + const Surface* b) { + return matcher(gctx, aDir, a, b); }; keys = findKeySurfaces(surfaces, equal); @@ -621,15 +632,16 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( // rotate to max phi module plus one half step // this should make sure that phi wrapping at +- pi // never falls on a module center - double max = phi(maxElem->binningPosition(gctx, BinningValue::binR)); + double max = + phi(maxElem->referencePosition(gctx, AxisDirection::AxisR)); double angle = std::numbers::pi - (max + 0.5 * step); // replace given transform ref transform = (transform)*AngleAxis3(angle, Vector3::UnitZ()); } else { - minimum = protoLayer.min(BinningValue::binPhi, true); - maximum = protoLayer.max(BinningValue::binPhi, true); + minimum = protoLayer.min(AxisDirection::AxisPhi, true); + maximum = protoLayer.max(AxisDirection::AxisPhi, true); // we do not need a transform in this case } } else { @@ -637,13 +649,13 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( maximum = std::numbers::pi; } } else { - maximum = protoLayer.max(bValue, false); - minimum = protoLayer.min(bValue, false); + maximum = protoLayer.max(aDir, false); + minimum = protoLayer.min(aDir, false); } // assign the bin size ACTS_VERBOSE("Create equidistant binning Axis for binned SurfaceArray"); - ACTS_VERBOSE(" BinningValue: " << bValue); + ACTS_VERBOSE(" AxisDirection: " << aDir); ACTS_VERBOSE(" Number of bins: " << binNumber); ACTS_VERBOSE(" (Min/Max) = (" << minimum << "/" << maximum << ")"); @@ -651,7 +663,7 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( pAxis.max = maximum; pAxis.min = minimum; pAxis.bType = equidistant; - pAxis.bValue = bValue; + pAxis.axisDir = aDir; pAxis.nBins = binNumber; return pAxis; diff --git a/Core/src/Geometry/TrackingVolume.cpp b/Core/src/Geometry/TrackingVolume.cpp index 6d3880bd4db..21c22fa8c8d 100644 --- a/Core/src/Geometry/TrackingVolume.cpp +++ b/Core/src/Geometry/TrackingVolume.cpp @@ -177,11 +177,11 @@ void TrackingVolume::glueTrackingVolume(const GeometryContext& gctx, BoundarySurfaceFace bsfMine, TrackingVolume* neighbor, BoundarySurfaceFace bsfNeighbor) { - // Find the connection of the two tracking volumes: BinningValue::binR returns - // the center except for cylindrical volumes - Vector3 bPosition(binningPosition(gctx, BinningValue::binR)); - Vector3 distance = - Vector3(neighbor->binningPosition(gctx, BinningValue::binR) - bPosition); + // Find the connection of the two tracking volumes: AxisDirection::AxisR + // returns the center except for cylindrical volumes + Vector3 bPosition(referencePosition(gctx, AxisDirection::AxisR)); + Vector3 distance = Vector3( + neighbor->referencePosition(gctx, AxisDirection::AxisR) - bPosition); // glue to the face std::shared_ptr> bSurfaceMine = boundarySurfaces().at(bsfMine); @@ -221,13 +221,13 @@ void TrackingVolume::glueTrackingVolumes( const GeometryContext& gctx, BoundarySurfaceFace bsfMine, const std::shared_ptr& neighbors, BoundarySurfaceFace bsfNeighbor) { - // find the connection of the two tracking volumes : BinningValue::binR + // find the connection of the two tracking volumes : AxisDirection::AxisR // returns the center except for cylindrical volumes std::shared_ptr nRefVolume = neighbors->arrayObjects().at(0); // get the distance - Vector3 bPosition(binningPosition(gctx, BinningValue::binR)); - Vector3 distance(nRefVolume->binningPosition(gctx, BinningValue::binR) - + Vector3 bPosition(referencePosition(gctx, AxisDirection::AxisR)); + Vector3 distance(nRefVolume->referencePosition(gctx, AxisDirection::AxisR) - bPosition); // take the normal at the binning positio std::shared_ptr> bSurfaceMine = diff --git a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp index 61727f9dee0..a280c036872 100644 --- a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp +++ b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp @@ -21,14 +21,14 @@ std::shared_ptr Acts::TrackingVolumeArrayCreator::trackingVolumeArray( const GeometryContext& gctx, const TrackingVolumeVector& tVolumes, - BinningValue bValue) const { + AxisDirection aDir) const { // MSG_VERBOSE("Create VolumeArray of "<< tVolumes.size() << " TrackingVolumes - // with binning in : " << binningValueName(bValue) ); + // with binning in : " << axisDirectionName(aDir) ); // let's copy and sort TrackingVolumeVector volumes(tVolumes); // sort it accordingly to the binning value GeometryObjectSorterT> volumeSorter( - gctx, bValue); + gctx, aDir); std::ranges::sort(volumes, volumeSorter); // prepare what we need : @@ -41,24 +41,23 @@ Acts::TrackingVolumeArrayCreator::trackingVolumeArray( // let's loop over the (sorted) volumes for (auto& tVolume : volumes) { // get the binning position - Vector3 binningPosition = tVolume->binningPosition(gctx, bValue); - double binningBorder = tVolume->volumeBounds().binningBorder(bValue); + Vector3 referencePosition = tVolume->referencePosition(gctx, aDir); + double referenceBorder = tVolume->volumeBounds().referenceBorder(aDir); // get the center value according to the bin - double value = tVolume->binningPositionValue(gctx, bValue); + double value = tVolume->referencePositionValue(gctx, aDir); // for the first one take low and high boundary if (boundaries.empty()) { - boundaries.push_back(value - binningBorder); + boundaries.push_back(value - referenceBorder); } // always take the high boundary - boundaries.push_back(value + binningBorder); + boundaries.push_back(value + referenceBorder); // record the volume to be ordered tVolumesOrdered.push_back( - TrackingVolumeOrderPosition(tVolume, binningPosition)); + TrackingVolumeOrderPosition(tVolume, referencePosition)); } // now create the bin utility - auto binUtility = - std::make_unique(boundaries, open, bValue); + auto binUtility = std::make_unique(boundaries, open, aDir); // and return the newly created binned array return std::make_shared>( diff --git a/Core/src/Geometry/TrivialPortalLink.cpp b/Core/src/Geometry/TrivialPortalLink.cpp index 6976388dbc0..5e3b3ad5023 100644 --- a/Core/src/Geometry/TrivialPortalLink.cpp +++ b/Core/src/Geometry/TrivialPortalLink.cpp @@ -16,7 +16,7 @@ namespace Acts { std::unique_ptr TrivialPortalLink::makeGrid( - BinningValue direction) const { + AxisDirection direction) const { return GridPortalLink::make(m_surface, *m_volume, direction); } diff --git a/Core/src/Geometry/Volume.cpp b/Core/src/Geometry/Volume.cpp index 7aac6f8b9d6..674c3123340 100644 --- a/Core/src/Geometry/Volume.cpp +++ b/Core/src/Geometry/Volume.cpp @@ -33,13 +33,13 @@ Volume::Volume(const Volume& vol, const Transform3& shift) m_center(m_transform.translation()), m_volumeBounds(vol.m_volumeBounds) {} -Vector3 Volume::binningPosition(const GeometryContext& /*gctx*/, - BinningValue bValue) const { +Vector3 Volume::referencePosition(const GeometryContext& /*gctx*/, + AxisDirection aDir) const { // for most of the binning types it is actually the center, // just for R-binning types the - if (bValue == BinningValue::binR || bValue == BinningValue::binRPhi) { + if (aDir == AxisDirection::AxisR || aDir == AxisDirection::AxisRPhi) { // the binning Position for R-type may have an offset - return (center() + m_volumeBounds->binningOffset(bValue)); + return (center() + m_volumeBounds->referenceOffset(aDir)); } // return the center return center(); diff --git a/Core/src/Material/MaterialGridHelper.cpp b/Core/src/Material/MaterialGridHelper.cpp index 83c7946f77c..e4dbab79164 100644 --- a/Core/src/Material/MaterialGridHelper.cpp +++ b/Core/src/Material/MaterialGridHelper.cpp @@ -84,44 +84,44 @@ Acts::Grid3D Acts::createGrid(Acts::MaterialGridAxisData gridAxis1, } std::function Acts::globalToLocalFromBin( - Acts::BinningValue& type) { + Acts::AxisDirection& type) { std::function transfoGlobalToLocal; switch (type) { - case Acts::BinningValue::binX: + case Acts::AxisDirection::AxisX: transfoGlobalToLocal = [](const Acts::Vector3& pos) -> double { return (pos.x()); }; break; - case Acts::BinningValue::binY: + case Acts::AxisDirection::AxisY: transfoGlobalToLocal = [](const Acts::Vector3& pos) -> double { return (pos.y()); }; break; - case Acts::BinningValue::binR: + case Acts::AxisDirection::AxisR: transfoGlobalToLocal = [](const Acts::Vector3& pos) -> double { return (Acts::VectorHelpers::perp(pos)); }; break; - case Acts::BinningValue::binPhi: + case Acts::AxisDirection::AxisPhi: transfoGlobalToLocal = [](const Acts::Vector3& pos) -> double { return (Acts::VectorHelpers::phi(pos)); }; break; - case Acts::BinningValue::binZ: + case Acts::AxisDirection::AxisZ: transfoGlobalToLocal = [](const Acts::Vector3& pos) -> double { return (pos.z()); }; break; - // case Acts::BinningValue::binRPhi: - // case Acts::BinningValue::binEta: - // case Acts::BinningValue::binH: - // case Acts::BinningValue::binMag: + // case Acts::AxisDirection::AxisRPhi: + // case Acts::AxisDirection::AxisEta: + // case Acts::AxisDirection::AxisTheta: + // case Acts::AxisDirection::AxisMag: default: throw std::invalid_argument("Incorrect bin, should be x,y,z,r,phi"); } @@ -137,12 +137,12 @@ Acts::Grid2D Acts::createGrid2D( bool isCylindrical = false; for (std::size_t b = 0; b < bu.size(); b++) { - if (bu[b].binvalue == Acts::BinningValue::binX || - bu[b].binvalue == Acts::BinningValue::binY) { + if (bu[b].binvalue == Acts::AxisDirection::AxisX || + bu[b].binvalue == Acts::AxisDirection::AxisY) { isCartesian = true; } - if (bu[b].binvalue == Acts::BinningValue::binR || - bu[b].binvalue == Acts::BinningValue::binPhi) { + if (bu[b].binvalue == Acts::AxisDirection::AxisR || + bu[b].binvalue == Acts::AxisDirection::AxisPhi) { isCylindrical = true; } } @@ -177,12 +177,12 @@ Acts::Grid3D Acts::createGrid3D( bool isCylindrical = false; for (std::size_t b = 0; b < bu.size(); b++) { - if (bu[b].binvalue == Acts::BinningValue::binX || - bu[b].binvalue == Acts::BinningValue::binY) { + if (bu[b].binvalue == Acts::AxisDirection::AxisX || + bu[b].binvalue == Acts::AxisDirection::AxisY) { isCartesian = true; } - if (bu[b].binvalue == Acts::BinningValue::binR || - bu[b].binvalue == Acts::BinningValue::binPhi) { + if (bu[b].binvalue == Acts::AxisDirection::AxisR || + bu[b].binvalue == Acts::AxisDirection::AxisPhi) { isCylindrical = true; } } diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index bb8f8ed4cf4..1b9c1906856 100644 --- a/Core/src/Surfaces/ConeSurface.cpp +++ b/Core/src/Surfaces/ConeSurface.cpp @@ -61,19 +61,19 @@ ConeSurface::ConeSurface(const Transform3& transform, throw_assert(m_bounds, "ConeBounds must not be nullptr"); } -Vector3 ConeSurface::binningPosition(const GeometryContext& gctx, - BinningValue bValue) const { +Vector3 ConeSurface::referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const { const Vector3& sfCenter = center(gctx); // special binning type for R-type methods - if (bValue == BinningValue::binR || bValue == BinningValue::binRPhi) { + if (aDir == AxisDirection::AxisR || aDir == AxisDirection::AxisRPhi) { return Vector3(sfCenter.x() + bounds().r(sfCenter.z()), sfCenter.y(), sfCenter.z()); } // give the center as default for all of these binning types - // BinningValue::binX, BinningValue::binY, BinningValue::binZ, - // BinningValue::binR, BinningValue::binPhi, BinningValue::binRPhi, - // BinningValue::binH, BinningValue::binEta + // AxisDirection::AxisX, AxisDirection::AxisY, AxisDirection::AxisZ, + // AxisDirection::AxisR, AxisDirection::AxisPhi, AxisDirection::AxisRPhi, + // AxisDirection::AxisTheta, AxisDirection::AxisEta return sfCenter; } diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index 7990b4fd8d2..45ec85ae1a8 100644 --- a/Core/src/Surfaces/CylinderSurface.cpp +++ b/Core/src/Surfaces/CylinderSurface.cpp @@ -76,18 +76,18 @@ CylinderSurface& CylinderSurface::operator=(const CylinderSurface& other) { } // return the binning position for ordering in the BinnedArray -Vector3 CylinderSurface::binningPosition(const GeometryContext& gctx, - BinningValue bValue) const { +Vector3 CylinderSurface::referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const { // special binning type for R-type methods - if (bValue == BinningValue::binR || bValue == BinningValue::binRPhi) { + if (aDir == AxisDirection::AxisR || aDir == AxisDirection::AxisRPhi) { double R = bounds().get(CylinderBounds::eR); double phi = bounds().get(CylinderBounds::eAveragePhi); return localToGlobal(gctx, Vector2{phi * R, 0}, Vector3{}); } // give the center as default for all of these binning types - // BinningValue::binX, BinningValue::binY, BinningValue::binZ, - // BinningValue::binR, BinningValue::binPhi, BinningValue::binRPhi, - // BinningValue::binH, BinningValue::binEta + // AxisDirection::AxisX, AxisDirection::AxisY, AxisDirection::AxisZ, + // AxisDirection::AxisR, AxisDirection::AxisPhi, AxisDirection::AxisRPhi, + // AxisDirection::AxisTheta, AxisDirection::AxisEta return center(gctx); } @@ -355,11 +355,11 @@ ActsMatrix<2, 3> CylinderSurface::localCartesianToBoundLocalDerivative( } std::pair, bool> CylinderSurface::mergedWith( - const CylinderSurface& other, BinningValue direction, bool externalRotation, - const Logger& logger) const { + const CylinderSurface& other, AxisDirection direction, + bool externalRotation, const Logger& logger) const { using namespace UnitLiterals; - ACTS_VERBOSE("Merging cylinder surfaces in " << binningValueName(direction) + ACTS_VERBOSE("Merging cylinder surfaces in " << axisDirectionName(direction) << " direction"); if (m_associatedDetElement != nullptr || @@ -448,7 +448,7 @@ std::pair, bool> CylinderSurface::mergedWith( double otherHlPhi = other.bounds().get(CylinderBounds::eHalfPhiSector); double otherAvgPhi = other.bounds().get(CylinderBounds::eAveragePhi); - if (direction == BinningValue::binZ) { + if (direction == AxisDirection::AxisZ) { // z shift must match the bounds if (std::abs(otherLocal.linear().col(eY)[eX]) >= tolerance && @@ -495,7 +495,7 @@ std::pair, bool> CylinderSurface::mergedWith( return {Surface::makeShared(newTransform, newBounds), zShift < 0}; - } else if (direction == BinningValue::binRPhi) { + } else if (direction == AxisDirection::AxisRPhi) { // no z shift is allowed if (std::abs(translation[2]) > tolerance) { ACTS_ERROR( @@ -555,7 +555,7 @@ std::pair, bool> CylinderSurface::mergedWith( } else { throw SurfaceMergingException(getSharedPtr(), other.getSharedPtr(), "CylinderSurface::merge: invalid direction " + - binningValueName(direction)); + axisDirectionName(direction)); } } diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index 8981bb24c5e..99d2f21885d 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -337,9 +337,9 @@ Vector3 DiscSurface::normal(const GeometryContext& gctx) const { return Vector3(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); } -Vector3 DiscSurface::binningPosition(const GeometryContext& gctx, - BinningValue bValue) const { - if (bValue == BinningValue::binR || bValue == BinningValue::binPhi) { +Vector3 DiscSurface::referencePosition(const GeometryContext& gctx, + AxisDirection aDir) const { + if (aDir == AxisDirection::AxisR || aDir == AxisDirection::AxisPhi) { double r = m_bounds->binningValueR(); double phi = m_bounds->binningValuePhi(); return localToGlobal(gctx, Vector2{r, phi}, Vector3{}); @@ -347,16 +347,16 @@ Vector3 DiscSurface::binningPosition(const GeometryContext& gctx, return center(gctx); } -double DiscSurface::binningPositionValue(const GeometryContext& gctx, - BinningValue bValue) const { - if (bValue == BinningValue::binR) { - return VectorHelpers::perp(binningPosition(gctx, bValue)); +double DiscSurface::referencePositionValue(const GeometryContext& gctx, + AxisDirection aDir) const { + if (aDir == AxisDirection::AxisR) { + return VectorHelpers::perp(referencePosition(gctx, aDir)); } - if (bValue == BinningValue::binPhi) { - return VectorHelpers::phi(binningPosition(gctx, bValue)); + if (aDir == AxisDirection::AxisPhi) { + return VectorHelpers::phi(referencePosition(gctx, aDir)); } - return GeometryObject::binningPositionValue(gctx, bValue); + return GeometryObject::referencePositionValue(gctx, aDir); } double DiscSurface::pathCorrection(const GeometryContext& gctx, @@ -367,7 +367,7 @@ double DiscSurface::pathCorrection(const GeometryContext& gctx, } std::pair, bool> DiscSurface::mergedWith( - const DiscSurface& other, BinningValue direction, bool externalRotation, + const DiscSurface& other, AxisDirection direction, bool externalRotation, const Logger& logger) const { using namespace UnitLiterals; @@ -443,7 +443,7 @@ std::pair, bool> DiscSurface::mergedWith( << otherAvgPhi / 1_degree << " +- " << otherHlPhi / 1_degree); - if (direction == BinningValue::binR) { + if (direction == AxisDirection::AxisR) { if (std::abs(otherLocal.linear().col(eY)[eX]) >= tolerance && (!bounds->coversFullAzimuth() || !otherBounds->coversFullAzimuth())) { throw SurfaceMergingException(getSharedPtr(), other.getSharedPtr(), @@ -483,7 +483,7 @@ std::pair, bool> DiscSurface::mergedWith( return {Surface::makeShared(*m_transform, newBounds), minR > otherMinR}; - } else if (direction == BinningValue::binPhi) { + } else if (direction == AxisDirection::AxisPhi) { if (std::abs(maxR - otherMaxR) > tolerance || std::abs(minR - otherMinR) > tolerance) { ACTS_ERROR("DiscSurface::merge: surfaces don't have same r bounds"); @@ -535,9 +535,9 @@ std::pair, bool> DiscSurface::mergedWith( } else { ACTS_ERROR("DiscSurface::merge: invalid direction " << direction); - throw SurfaceMergingException( - getSharedPtr(), other.getSharedPtr(), - "DiscSurface::merge: invalid direction " + binningValueName(direction)); + throw SurfaceMergingException(getSharedPtr(), other.getSharedPtr(), + "DiscSurface::merge: invalid direction " + + axisDirectionName(direction)); } } diff --git a/Core/src/Surfaces/LineSurface.cpp b/Core/src/Surfaces/LineSurface.cpp index 68957d5824b..6f6350625d6 100644 --- a/Core/src/Surfaces/LineSurface.cpp +++ b/Core/src/Surfaces/LineSurface.cpp @@ -119,8 +119,8 @@ double LineSurface::pathCorrection(const GeometryContext& /*gctx*/, return 1.; } -Vector3 LineSurface::binningPosition(const GeometryContext& gctx, - BinningValue /*bValue*/) const { +Vector3 LineSurface::referencePosition(const GeometryContext& gctx, + AxisDirection /*aDir*/) const { return center(gctx); } diff --git a/Core/src/Surfaces/PlaneSurface.cpp b/Core/src/Surfaces/PlaneSurface.cpp index aebc75315ef..80967a8d78a 100644 --- a/Core/src/Surfaces/PlaneSurface.cpp +++ b/Core/src/Surfaces/PlaneSurface.cpp @@ -145,8 +145,8 @@ Vector3 PlaneSurface::normal(const GeometryContext& gctx) const { return transform(gctx).linear().col(2); } -Vector3 PlaneSurface::binningPosition(const GeometryContext& gctx, - BinningValue /*bValue*/) const { +Vector3 PlaneSurface::referencePosition(const GeometryContext& gctx, + AxisDirection /*aDir*/) const { return center(gctx); } diff --git a/Core/src/Utilities/AxisDefinitions.cpp b/Core/src/Utilities/AxisDefinitions.cpp new file mode 100644 index 00000000000..e7adf5347c6 --- /dev/null +++ b/Core/src/Utilities/AxisDefinitions.cpp @@ -0,0 +1,66 @@ +// This file is part of the ACTS project. +// +// Copyright (C) 2016 CERN for the benefit of the ACTS project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +#include "Acts/Utilities/AxisDefinitions.hpp" + +#include +#include +#include + +namespace Acts { + +namespace { + +// Legacy binning value names +// +// NOTE: this should be removed once the BinUtility is removed +const std::vector s_legacyBinningValueNames = { + "binX", "binY", "binZ", "binR", "binPhi", + "binRPhi", "binH", "binEta", "binMag"}; +// end of legacy binning values + +const std::vector s_axisDirectionNames = { + "AxisX", "AxisY", "AxisZ", "AxisR", "AxisPhi", + "AxisRPhi", "AxisTheta", "AxisEta", "AxisMag"}; + +const std::vector s_axisDirections = { + AxisDirection::AxisX, AxisDirection::AxisY, AxisDirection::AxisZ, + AxisDirection::AxisR, AxisDirection::AxisPhi, AxisDirection::AxisRPhi, + AxisDirection::AxisTheta, AxisDirection::AxisEta, AxisDirection::AxisMag}; + +} // namespace + +const std::vector& allAxisDirections() { + return s_axisDirections; +} + +AxisDirection axisDirectionFromName(const std::string& name) { + auto it = std::ranges::find(s_axisDirectionNames, name); + if (it == s_axisDirectionNames.end()) { + // Legacy binning check - this should be removed once BinUtility is gone + it = std::ranges::find(s_legacyBinningValueNames, name); + if (it == s_legacyBinningValueNames.end()) { + throw std::invalid_argument("Unknown AxisDirection value name: " + name); + } + // both legacy and current failed + } + return static_cast( + std::distance(s_axisDirectionNames.begin(), it)); +} + +const std::string& axisDirectionName(AxisDirection aDir) { + return s_axisDirectionNames.at( + static_cast>(aDir)); +} + +std::ostream& operator<<(std::ostream& os, AxisDirection aDir) { + os << axisDirectionName(aDir); + return os; +} + +} // namespace Acts diff --git a/Core/src/Utilities/BinningType.cpp b/Core/src/Utilities/BinningType.cpp deleted file mode 100644 index 8faa7dcd856..00000000000 --- a/Core/src/Utilities/BinningType.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// This file is part of the ACTS project. -// -// Copyright (C) 2016 CERN for the benefit of the ACTS project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -#include "Acts/Utilities/BinningType.hpp" - -#include -#include -#include - -namespace Acts { - -namespace { - -static const std::vector s_binningValueNames = { - "binX", "binY", "binZ", "binR", "binPhi", - "binRPhi", "binH", "binEta", "binMag"}; - -static const std::vector s_binningValues = { - BinningValue::binX, BinningValue::binY, BinningValue::binZ, - BinningValue::binR, BinningValue::binPhi, BinningValue::binRPhi, - BinningValue::binH, BinningValue::binEta, BinningValue::binMag}; - -} // namespace - -const std::vector& allBinningValues() { - return s_binningValues; -} - -BinningValue binningValueFromName(const std::string& name) { - auto it = std::ranges::find(s_binningValueNames, name); - if (it == s_binningValueNames.end()) { - throw std::invalid_argument("Unknown binning value name: " + name); - } - return static_cast( - std::distance(s_binningValueNames.begin(), it)); -} - -const std::string& binningValueName(BinningValue bValue) { - return s_binningValueNames.at( - static_cast>(bValue)); -} - -std::ostream& operator<<(std::ostream& os, BinningValue bValue) { - os << binningValueName(bValue); - return os; -} - -} // namespace Acts diff --git a/Core/src/Utilities/CMakeLists.txt b/Core/src/Utilities/CMakeLists.txt index 1fb61813cd3..7abbe28c246 100644 --- a/Core/src/Utilities/CMakeLists.txt +++ b/Core/src/Utilities/CMakeLists.txt @@ -2,10 +2,10 @@ target_sources( ActsCore PRIVATE AnnealingUtility.cpp + AxisDefinitions.cpp Logger.cpp SpacePointUtility.cpp TrackHelpers.cpp - BinningType.cpp Intersection.cpp GraphViz.cpp ) diff --git a/Core/src/Visualization/GeometryView3D.cpp b/Core/src/Visualization/GeometryView3D.cpp index f16d9e809cc..d915a5ae633 100644 --- a/Core/src/Visualization/GeometryView3D.cpp +++ b/Core/src/Visualization/GeometryView3D.cpp @@ -79,9 +79,9 @@ void Acts::GeometryView3D::drawSurfaceArray( auto axes = surfaceArray.getAxes(); if (!binning.empty() && binning.size() == 2 && axes.size() == 2) { // Cylinder surface array - if (binning[0] == BinningValue::binPhi && - binning[1] == BinningValue::binZ) { - double R = arrayExtent.medium(BinningValue::binR) + gridConfig.offset; + if (binning[0] == AxisDirection::AxisPhi && + binning[1] == AxisDirection::AxisZ) { + double R = arrayExtent.medium(AxisDirection::AxisR) + gridConfig.offset; auto phiValues = axes[0]->getBinEdges(); auto zValues = axes[1]->getBinEdges(); ViewConfig gridRadConfig = gridConfig; @@ -103,9 +103,9 @@ void Acts::GeometryView3D::drawSurfaceArray( } } - } else if (binning[0] == BinningValue::binR && - binning[1] == BinningValue::binPhi) { - double z = arrayExtent.medium(BinningValue::binZ) + gridConfig.offset; + } else if (binning[0] == AxisDirection::AxisR && + binning[1] == AxisDirection::AxisPhi) { + double z = arrayExtent.medium(AxisDirection::AxisZ) + gridConfig.offset; auto rValues = axes[0]->getBinEdges(); auto phiValues = axes[1]->getBinEdges(); ViewConfig gridRadConfig = gridConfig; diff --git a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/Smearers.hpp b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/Smearers.hpp index 8d0130831ae..08c1ba06a74 100644 --- a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/Smearers.hpp +++ b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/Smearers.hpp @@ -8,7 +8,7 @@ #pragma once -#include "Acts/Utilities/BinningData.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Result.hpp" #include "ActsExamples/Framework/RandomNumbers.hpp" #include "ActsFatras/Digitization/DigitizationError.hpp" @@ -142,7 +142,7 @@ struct Uniform { /// Construct with a @param pitch standard deviation and @param range Uniform(double pitch, const std::pair& range_) : binningData( - Acts::open, Acts::BinningValue::binX, + Acts::open, Acts::AxisDirection::AxisX, static_cast((range_.second - range_.first) / pitch), range_.first, range_.second) {} @@ -180,7 +180,7 @@ struct Digital { /// Construct with a @param pitch standard deviation and @param range Digital(double pitch, const std::pair& range_) : binningData( - Acts::open, Acts::BinningValue::binX, + Acts::open, Acts::AxisDirection::AxisX, static_cast((range_.second - range_.first) / pitch), range_.first, range_.second) {} diff --git a/Examples/Algorithms/Digitization/scripts/smearing-config.py b/Examples/Algorithms/Digitization/scripts/smearing-config.py index 64dc1b1e3e9..61437a03aef 100644 --- a/Examples/Algorithms/Digitization/scripts/smearing-config.py +++ b/Examples/Algorithms/Digitization/scripts/smearing-config.py @@ -145,7 +145,7 @@ def block_to_json(args): data["bindata"] = [ 0, # Acts::Open, - 0, # Acts::BinningValue::binX, + 0, # Acts::AxisDirection::AxisX, (high - low) / pitch, low, high, diff --git a/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp b/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp index 8542b2fdd5b..fdac7783db2 100644 --- a/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp +++ b/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp @@ -81,17 +81,17 @@ void ActsExamples::DigitizationConfigurator::operator()( // The module is a rectangle module case Acts::SurfaceBounds::eRectangle: { if (inputSegmentation.binningData()[0].binvalue == - Acts::BinningValue::binX) { + Acts::AxisDirection::AxisX) { double minX = boundValues[Acts::RectangleBounds::eMinX]; double maxX = boundValues[Acts::RectangleBounds::eMaxX]; unsigned int nBins = static_cast(std::round( (maxX - minX) / inputSegmentation.binningData()[0].step)); outputSegmentation += Acts::BinUtility( nBins, static_cast(minX), static_cast(maxX), - Acts::open, Acts::BinningValue::binX); + Acts::open, Acts::AxisDirection::AxisX); } if (inputSegmentation.binningData()[0].binvalue == - Acts::BinningValue::binY || + Acts::AxisDirection::AxisY || inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; @@ -102,14 +102,14 @@ void ActsExamples::DigitizationConfigurator::operator()( inputSegmentation.binningData()[accessBin].step)); outputSegmentation += Acts::BinUtility( nBins, static_cast(minY), static_cast(maxY), - Acts::open, Acts::BinningValue::binY); + Acts::open, Acts::AxisDirection::AxisY); } } break; // The module is a trapezoid module case Acts::SurfaceBounds::eTrapezoid: { if (inputSegmentation.binningData()[0].binvalue == - Acts::BinningValue::binX) { + Acts::AxisDirection::AxisX) { double maxX = std::max( boundValues[Acts::TrapezoidBounds::eHalfLengthXnegY], boundValues[Acts::TrapezoidBounds::eHalfLengthXposY]); @@ -117,10 +117,10 @@ void ActsExamples::DigitizationConfigurator::operator()( 2 * maxX / inputSegmentation.binningData()[0].step)); outputSegmentation += Acts::BinUtility( nBins, -static_cast(maxX), static_cast(maxX), - Acts::open, Acts::BinningValue::binX); + Acts::open, Acts::AxisDirection::AxisX); } if (inputSegmentation.binningData()[0].binvalue == - Acts::BinningValue::binY || + Acts::AxisDirection::AxisY || inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; @@ -130,24 +130,24 @@ void ActsExamples::DigitizationConfigurator::operator()( inputSegmentation.binningData()[accessBin].step)); outputSegmentation += Acts::BinUtility( nBins, -static_cast(maxY), static_cast(maxY), - Acts::open, Acts::BinningValue::binY); + Acts::open, Acts::AxisDirection::AxisY); } } break; // The module is an annulus module case Acts::SurfaceBounds::eAnnulus: { if (inputSegmentation.binningData()[0].binvalue == - Acts::BinningValue::binR) { + Acts::AxisDirection::AxisR) { double minR = boundValues[Acts::AnnulusBounds::eMinR]; double maxR = boundValues[Acts::AnnulusBounds::eMaxR]; unsigned int nBins = static_cast(std::round( (maxR - minR) / inputSegmentation.binningData()[0].step)); outputSegmentation += Acts::BinUtility( nBins, static_cast(minR), static_cast(maxR), - Acts::open, Acts::BinningValue::binR); + Acts::open, Acts::AxisDirection::AxisR); } if (inputSegmentation.binningData()[0].binvalue == - Acts::BinningValue::binPhi || + Acts::AxisDirection::AxisPhi || inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; @@ -161,7 +161,7 @@ void ActsExamples::DigitizationConfigurator::operator()( inputSegmentation.binningData()[accessBin].step)); outputSegmentation += Acts::BinUtility( nBins, static_cast(minPhi), static_cast(maxPhi), - Acts::open, Acts::BinningValue::binPhi); + Acts::open, Acts::AxisDirection::AxisPhi); } } break; @@ -172,15 +172,15 @@ void ActsExamples::DigitizationConfigurator::operator()( double maxR = boundValues[Acts::DiscTrapezoidBounds::eMaxR]; if (inputSegmentation.binningData()[0].binvalue == - Acts::BinningValue::binR) { + Acts::AxisDirection::AxisR) { unsigned int nBins = static_cast(std::round( (maxR - minR) / inputSegmentation.binningData()[0].step)); outputSegmentation += Acts::BinUtility( nBins, static_cast(minR), static_cast(maxR), - Acts::open, Acts::BinningValue::binR); + Acts::open, Acts::AxisDirection::AxisR); } if (inputSegmentation.binningData()[0].binvalue == - Acts::BinningValue::binPhi || + Acts::AxisDirection::AxisPhi || inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; @@ -199,24 +199,24 @@ void ActsExamples::DigitizationConfigurator::operator()( outputSegmentation += Acts::BinUtility( nBins, static_cast(averagePhi - alpha), static_cast(averagePhi + alpha), Acts::open, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); } } break; case Acts::SurfaceBounds::eDisc: { if (inputSegmentation.binningData()[0].binvalue == - Acts::BinningValue::binR) { + Acts::AxisDirection::AxisR) { double minR = boundValues[Acts::RadialBounds::eMinR]; double maxR = boundValues[Acts::RadialBounds::eMaxR]; unsigned int nBins = static_cast(std::round( (maxR - minR) / inputSegmentation.binningData()[0].step)); outputSegmentation += Acts::BinUtility( nBins, static_cast(minR), static_cast(maxR), - Acts::open, Acts::BinningValue::binR); + Acts::open, Acts::AxisDirection::AxisR); } if (inputSegmentation.binningData()[0].binvalue == - Acts::BinningValue::binPhi || + Acts::AxisDirection::AxisPhi || inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; @@ -232,7 +232,7 @@ void ActsExamples::DigitizationConfigurator::operator()( inputSegmentation.binningData()[accessBin].step)); outputSegmentation += Acts::BinUtility( nBins, static_cast(minPhi), static_cast(maxPhi), - Acts::open, Acts::BinningValue::binPhi); + Acts::open, Acts::AxisDirection::AxisPhi); } } break; diff --git a/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MappingMaterialDecorator.hpp b/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MappingMaterialDecorator.hpp index e61d6e6ba5a..c343fbe58d6 100644 --- a/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MappingMaterialDecorator.hpp +++ b/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MappingMaterialDecorator.hpp @@ -202,11 +202,11 @@ class MappingMaterialDecorator : public IMaterialDecorator { std::numbers::pi) < Acts::s_epsilon ? Acts::closed : Acts::open, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); bUtility += Acts::BinUtility(binning.second, static_cast(radialBounds->rMin()), static_cast(radialBounds->rMax()), - Acts::open, Acts::BinningValue::binR); + Acts::open, Acts::AxisDirection::AxisR); } if (cylinderBounds != nullptr) { bUtility += Acts::BinUtility( @@ -219,32 +219,32 @@ class MappingMaterialDecorator : public IMaterialDecorator { std::numbers::pi) < Acts::s_epsilon ? Acts::closed : Acts::open, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); bUtility += Acts::BinUtility( binning.second, -1 * cylinderBounds->get(Acts::CylinderBounds::eHalfLengthZ), cylinderBounds->get(Acts::CylinderBounds::eHalfLengthZ), Acts::open, - Acts::BinningValue::binZ); + Acts::AxisDirection::AxisZ); } if (annulusBounds != nullptr) { bUtility += Acts::BinUtility( binning.first, annulusBounds->get(Acts::AnnulusBounds::eMinPhiRel), annulusBounds->get(Acts::AnnulusBounds::eMaxPhiRel), Acts::open, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); bUtility += Acts::BinUtility(binning.second, static_cast(annulusBounds->rMin()), static_cast(annulusBounds->rMax()), - Acts::open, Acts::BinningValue::binR); + Acts::open, Acts::AxisDirection::AxisR); } if (rectangleBounds != nullptr) { bUtility += Acts::BinUtility( binning.first, rectangleBounds->get(Acts::RectangleBounds::eMinX), rectangleBounds->get(Acts::RectangleBounds::eMaxX), Acts::open, - Acts::BinningValue::binX); + Acts::AxisDirection::AxisX); bUtility += Acts::BinUtility( binning.second, rectangleBounds->get(Acts::RectangleBounds::eMinY), rectangleBounds->get(Acts::RectangleBounds::eMaxY), Acts::open, - Acts::BinningValue::binY); + Acts::AxisDirection::AxisY); } if (trapezoidBounds != nullptr) { double halfLengthX = std::max( @@ -253,12 +253,12 @@ class MappingMaterialDecorator : public IMaterialDecorator { bUtility += Acts::BinUtility(binning.first, static_cast(-1 * halfLengthX), static_cast(halfLengthX), - Acts::open, Acts::BinningValue::binX); + Acts::open, Acts::AxisDirection::AxisX); bUtility += Acts::BinUtility( binning.second, -1 * trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthY), trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthY), - Acts::open, Acts::BinningValue::binY); + Acts::open, Acts::AxisDirection::AxisY); } } return std::make_shared(bUtility); diff --git a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp index aea978be935..f5f8f793f90 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp @@ -156,20 +156,21 @@ std::unique_ptr buildDetector( // Prepare the proto material - in case it's designed to do so // - cylindrical Acts::BinUtility pCylinderUtility(10, -1, 1, Acts::closed, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); pCylinderUtility += - Acts::BinUtility(10, -1, 1, Acts::open, Acts::BinningValue::binZ); + Acts::BinUtility(10, -1, 1, Acts::open, Acts::AxisDirection::AxisZ); auto pCylinderMaterial = std::make_shared(pCylinderUtility); // - disc - Acts::BinUtility pDiscUtility(10, 0, 1, Acts::open, Acts::BinningValue::binR); + Acts::BinUtility pDiscUtility(10, 0, 1, Acts::open, + Acts::AxisDirection::AxisR); pDiscUtility += - Acts::BinUtility(10, -1, 1, Acts::closed, Acts::BinningValue::binPhi); + Acts::BinUtility(10, -1, 1, Acts::closed, Acts::AxisDirection::AxisPhi); auto pDiscMaterial = std::make_shared(pDiscUtility); // - plane Acts::BinUtility pPlaneUtility(1, -1, 1, Acts::open, - Acts::BinningValue::binX); + Acts::AxisDirection::AxisX); auto pPlaneMaterial = std::make_shared(pPlaneUtility); diff --git a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp index d8e1ce24fb0..9eca8f20de5 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp @@ -280,14 +280,14 @@ ProtoLayerCreatorT::centralProtoLayers( auto moduleTransform = std::const_pointer_cast( mutableModuleTransform); // create the module - auto module = std::make_shared( + auto moduleElement = std::make_shared( moduleIdentifier, moduleTransform, moduleBounds, moduleThickness, moduleMaterialPtr); // put the module into the detector store - layerStore.push_back(module); + layerStore.push_back(moduleElement); // register the surface - sVector.push_back(module->surface().getSharedPtr()); + sVector.push_back(moduleElement->surface().getSharedPtr()); // IF double modules exist // and the backside one (if configured to do so) if (!m_cfg.centralModuleBacksideGap.empty()) { @@ -311,11 +311,11 @@ ProtoLayerCreatorT::centralProtoLayers( moduleTransform = std::const_pointer_cast( mutableModuleTransform); // create the backseide moulde - auto bsmodule = std::make_shared( + auto bsModuleElement = std::make_shared( moduleIdentifier, moduleTransform, moduleBounds, moduleThickness, moduleMaterialPtr); // everything is set for the next module - layerStore.push_back(std::move(bsmodule)); + layerStore.push_back(std::move(bsModuleElement)); } } @@ -326,10 +326,10 @@ ProtoLayerCreatorT::centralProtoLayers( // create the surface array - it will also fill the accessible binmember // cache if available Acts::ProtoLayer pl(gctx, sVector); - pl.envelope[Acts::BinningValue::binR] = {m_cfg.approachSurfaceEnvelope, - m_cfg.approachSurfaceEnvelope}; - pl.envelope[Acts::BinningValue::binZ] = {layerEnvelopeCoverZ, - layerEnvelopeCoverZ}; + pl.envelope[Acts::AxisDirection::AxisR] = {m_cfg.approachSurfaceEnvelope, + m_cfg.approachSurfaceEnvelope}; + pl.envelope[Acts::AxisDirection::AxisZ] = {layerEnvelopeCoverZ, + layerEnvelopeCoverZ}; // Record the proto layer and the surfaces for the later layer building ProtoLayerSurfaces pls{std::move(pl), sVector, phiBins, zBins}; @@ -456,10 +456,10 @@ ProtoLayerCreatorT::createProtoLayers( static_cast(imodule++); // create the module - auto module = std::make_shared( + auto moduleElement = std::make_shared( moduleIdentifier, moduleTransform, moduleBounds, moduleThickness, moduleMaterialPtr); - layerStore.push_back(module); + layerStore.push_back(moduleElement); // now deal with the potential backside if (!m_cfg.posnegModuleBacksideGap.empty()) { @@ -485,14 +485,14 @@ ProtoLayerCreatorT::createProtoLayers( moduleTransform = std::const_pointer_cast( mutableModuleTransform); // everything is set for the next module - auto bsmodule = std::make_shared( + auto bsModuleElement = std::make_shared( moduleIdentifier, moduleTransform, moduleBounds, moduleThickness, moduleMaterialPtr); // Put into the detector store - layerStore.push_back(std::move(bsmodule)); + layerStore.push_back(std::move(bsModuleElement)); } // create the surface - esVector.push_back(module->surface().getSharedPtr()); + esVector.push_back(moduleElement->surface().getSharedPtr()); } // counter of rings ++ipnR; @@ -512,9 +512,10 @@ ProtoLayerCreatorT::createProtoLayers( } // create the layers with the surface arrays Acts::ProtoLayer ple(gctx, esVector); - ple.envelope[Acts::BinningValue::binR] = {layerEnvelopeR, layerEnvelopeR}; - ple.envelope[Acts::BinningValue::binZ] = {m_cfg.approachSurfaceEnvelope, - m_cfg.approachSurfaceEnvelope}; + ple.envelope[Acts::AxisDirection::AxisR] = {layerEnvelopeR, + layerEnvelopeR}; + ple.envelope[Acts::AxisDirection::AxisZ] = { + m_cfg.approachSurfaceEnvelope, m_cfg.approachSurfaceEnvelope}; // push it into the layer vector ProtoLayerSurfaces ples{std::move(ple), esVector, layerBinsR, diff --git a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/MagneticField.hpp b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/MagneticField.hpp index e694f0fdd35..9e1997e97a2 100644 --- a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/MagneticField.hpp +++ b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/MagneticField.hpp @@ -14,7 +14,7 @@ #include "Acts/MagneticField/MagneticFieldProvider.hpp" #include "Acts/MagneticField/NullBField.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/Result.hpp" #include "Acts/Utilities/detail/grid_helper.hpp" diff --git a/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp b/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp index 884cfc8345d..4b6c2982fe3 100644 --- a/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp +++ b/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp @@ -63,14 +63,14 @@ std::vector makeLayerBuilderConfigs( // configure surface autobinning std::vector> binTolerances( - Acts::numBinningValues(), {0., 0.}); - binTolerances[toUnderlying(Acts::BinningValue::binR)] = { + Acts::numAxisDirections(), {0., 0.}); + binTolerances[toUnderlying(Acts::AxisDirection::AxisR)] = { volume.binToleranceR.lower.value_or(0.), volume.binToleranceR.upper.value_or(0.)}; - binTolerances[toUnderlying(Acts::BinningValue::binZ)] = { + binTolerances[toUnderlying(Acts::AxisDirection::AxisZ)] = { volume.binToleranceZ.lower.value_or(0.), volume.binToleranceZ.upper.value_or(0.)}; - binTolerances[toUnderlying(Acts::BinningValue::binPhi)] = { + binTolerances[toUnderlying(Acts::AxisDirection::AxisPhi)] = { volume.binTolerancePhi.lower.value_or(0.), volume.binTolerancePhi.upper.value_or(0.)}; @@ -101,18 +101,18 @@ std::vector makeLayerBuilderConfigs( auto zMin = zR.lower.value_or(-std::numeric_limits::max()); auto zMax = zR.upper.value_or(std::numeric_limits::max()); lConfig.parseRanges = { - {Acts::BinningValue::binR, {rMin, rMax}}, - {Acts::BinningValue::binZ, {zMin, zMax}}, + {Acts::AxisDirection::AxisR, {rMin, rMax}}, + {Acts::AxisDirection::AxisZ, {zMin, zMax}}, }; // Fill the layer splitting parameters in r/z auto str = volume.splitTolR.at(ncp); auto stz = volume.splitTolZ.at(ncp); if (0 < str) { - lConfig.splitConfigs.emplace_back(Acts::BinningValue::binR, str); + lConfig.splitConfigs.emplace_back(Acts::AxisDirection::AxisR, str); } if (0 < stz) { - lConfig.splitConfigs.emplace_back(Acts::BinningValue::binZ, stz); + lConfig.splitConfigs.emplace_back(Acts::AxisDirection::AxisZ, stz); } lConfig.binning0 = volume.binning0.at(ncp); lConfig.binning1 = volume.binning1.at(ncp); @@ -284,7 +284,7 @@ std::shared_ptr buildTGeoDetector( -> void { for (const auto& lcfg : lConfigs) { for (const auto& scfg : lcfg.splitConfigs) { - if (scfg.first == Acts::BinningValue::binR && scfg.second > 0.) { + if (scfg.first == Acts::AxisDirection::AxisR && scfg.second > 0.) { volumeConfig.ringTolerance = std::max(volumeConfig.ringTolerance, scfg.second); volumeConfig.checkRingLayout = true; diff --git a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp index 6e3b4e31cdf..f79621bea6f 100644 --- a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp +++ b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp @@ -9,7 +9,7 @@ #pragma once #include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -51,6 +51,6 @@ std::unique_ptr buildTelescopeDetector( const std::vector& stereoAngles, const std::array& offsets, const std::array& bounds, double thickness, TelescopeSurfaceType surfaceType, - Acts::BinningValue binValue = Acts::BinningValue::binZ); + Acts::AxisDirection binValue = Acts::AxisDirection::AxisZ); } // namespace ActsExamples diff --git a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp index 17145d4d301..679e3bb066f 100644 --- a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp +++ b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp @@ -9,6 +9,7 @@ #pragma once #include "Acts/Definitions/Units.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/DetectorCommons/Detector.hpp" diff --git a/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp b/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp index d436d577235..2232867e6d8 100644 --- a/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp +++ b/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp @@ -44,7 +44,7 @@ ActsExamples::buildTelescopeDetector( const std::vector& stereoAngles, const std::array& offsets, const std::array& bounds, double thickness, TelescopeSurfaceType surfaceType, - Acts::BinningValue binValue) { + Acts::AxisDirection binValue) { using namespace Acts::UnitLiterals; // The rectangle bounds for plane surface @@ -62,14 +62,14 @@ ActsExamples::buildTelescopeDetector( std::make_shared(matProp); // Construct the rotation - // This assumes the binValue is binX, binY or binZ. No reset is necessary in - // case of binZ + // This assumes the direction is AxisX, AxisY or AxisZ. No reset is necessary + // in case of AxisZ Acts::RotationMatrix3 rotation = Acts::RotationMatrix3::Identity(); - if (binValue == Acts::BinningValue::binX) { + if (binValue == Acts::AxisDirection::AxisX) { rotation.col(0) = Acts::Vector3(0, 0, -1); rotation.col(1) = Acts::Vector3(0, 1, 0); rotation.col(2) = Acts::Vector3(1, 0, 0); - } else if (binValue == Acts::BinningValue::binY) { + } else if (binValue == Acts::AxisDirection::AxisY) { rotation.col(0) = Acts::Vector3(1, 0, 0); rotation.col(1) = Acts::Vector3(0, 0, -1); rotation.col(2) = Acts::Vector3(0, 1, 0); diff --git a/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp b/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp index 414658204b8..a3ccfb34cfd 100644 --- a/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp +++ b/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp @@ -44,7 +44,7 @@ TelescopeDetector::TelescopeDetector(const Config& cfg) m_nominalGeometryContext, m_detectorStore, m_cfg.positions, m_cfg.stereos, m_cfg.offsets, m_cfg.bounds, m_cfg.thickness, static_cast(m_cfg.surfaceType), - static_cast(m_cfg.binValue)); + static_cast(m_cfg.binValue)); } } // namespace ActsExamples diff --git a/Examples/Detectors/TelescopeDetector/src/TelescopeG4DetectorConstruction.cpp b/Examples/Detectors/TelescopeDetector/src/TelescopeG4DetectorConstruction.cpp index 2566c069f61..157204be9df 100644 --- a/Examples/Detectors/TelescopeDetector/src/TelescopeG4DetectorConstruction.cpp +++ b/Examples/Detectors/TelescopeDetector/src/TelescopeG4DetectorConstruction.cpp @@ -65,14 +65,14 @@ G4VPhysicalVolume* TelescopeG4DetectorConstruction::Construct() { new G4Material("Silicon", 14, 28.0855 * g / mole, 2.329 * g / cm3); // Construct the rotation - // This assumes the binValue is BinningValue::binX, BinningValue::binY or - // BinningValue::binZ. No reset is necessary in case of BinningValue::binZ + // This assumes the binValue is AxisDirection::AxisX, AxisDirection::AxisY or + // AxisDirection::AxisZ. No reset is necessary in case of AxisDirection::AxisZ G4RotationMatrix* rotation = nullptr; - if (static_cast(m_cfg.binValue) == - Acts::BinningValue::binX) { + if (static_cast(m_cfg.binValue) == + Acts::AxisDirection::AxisX) { rotation = new G4RotationMatrix({0, 0, 1}, {0, 1, 0}, {-1, 0, 0}); - } else if (static_cast(m_cfg.binValue) == - Acts::BinningValue::binY) { + } else if (static_cast(m_cfg.binValue) == + Acts::AxisDirection::AxisY) { rotation = new G4RotationMatrix({1, 0, 0}, {0, 0, 1}, {0, -1, 0}); } diff --git a/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp b/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp index e88e8e9db38..3ffb0c0ac3b 100644 --- a/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp @@ -162,11 +162,11 @@ template inline auto selectModule(const GeometryIdMultiset& container, Acts::GeometryIdentifier::Value volume, Acts::GeometryIdentifier::Value layer, - Acts::GeometryIdentifier::Value module) { + Acts::GeometryIdentifier::Value sensitive) { return selectModule( container, Acts::GeometryIdentifier().setVolume(volume).setLayer(layer).setSensitive( - module)); + sensitive)); } /// Select all elements for the lowest non-zero identifier component. @@ -176,9 +176,9 @@ inline auto selectModule(const GeometryIdMultiset& container, /// applies to the lower components and not to intermediate zeros. /// /// Examples: -/// - volume=2,layer=0,module=3 -> select all elements in the module -/// - volume=1,layer=2,module=0 -> select all elements in the layer -/// - volume=3,layer=0,module=0 -> select all elements in the volume +/// - volume=2,layer=0,sensitive=3 -> select all elements in the sensitive +/// - volume=1,layer=2,sensitive=0 -> select all elements in the layer +/// - volume=3,layer=0,sensitive=0 -> select all elements in the volume /// /// @note An identifier with all components set to zero selects the whole input /// container. diff --git a/Examples/Framework/include/ActsExamples/Utilities/Range.hpp b/Examples/Framework/include/ActsExamples/Utilities/Range.hpp index 5acc97f082b..db1574ae72c 100644 --- a/Examples/Framework/include/ActsExamples/Utilities/Range.hpp +++ b/Examples/Framework/include/ActsExamples/Utilities/Range.hpp @@ -27,10 +27,10 @@ template class Range { public: Range(Iterator b, Iterator e) : m_begin(b), m_end(e) {} - Range(Range&&) = default; + Range(Range&&) noexcept = default; Range(const Range&) = default; ~Range() = default; - Range& operator=(Range&&) = default; + Range& operator=(Range&&) noexcept = default; Range& operator=(const Range&) = default; Iterator begin() const { return m_begin; } diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialDecorator.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialDecorator.hpp index 0cc10482c9e..7397a2ae255 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialDecorator.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialDecorator.hpp @@ -64,7 +64,7 @@ class RootMaterialDecorator : public Acts::IMaterialDecorator { std::string sentag = "_sen"; /// The bin number tag std::string ntag = "n"; - /// The value tag -> binning values: binZ, binR, binPhi, etc. + /// The value tag -> binning values: AxisZ, AxisR, AxisPhi, etc. std::string vtag = "v"; /// The option tag -> binning options: open, closed std::string otag = "o"; diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialWriter.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialWriter.hpp index ec6142e65f9..a4c4a4675ee 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialWriter.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialWriter.hpp @@ -85,7 +85,7 @@ class RootMaterialWriter : public IMaterialWriter { std::string sentag = "_sen"; /// The bin number tag std::string ntag = "n"; - /// The value tag -> binning values: binZ, binR, binPhi, etc. + /// The value tag -> binning values: AxisZ, AxisR, AxisPhi, etc. std::string vtag = "v"; /// The option tag -> binning options: open, closed std::string otag = "o"; diff --git a/Examples/Io/Root/src/RootMaterialDecorator.cpp b/Examples/Io/Root/src/RootMaterialDecorator.cpp index 37f396bb86c..79077fe72fd 100644 --- a/Examples/Io/Root/src/RootMaterialDecorator.cpp +++ b/Examples/Io/Root/src/RootMaterialDecorator.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -183,10 +184,8 @@ ActsExamples::RootMaterialDecorator::RootMaterialDecorator( Acts::BinUtility bUtility; for (int ib = 1; ib < n->GetNbinsX() + 1; ++ib) { std::size_t nbins = static_cast(n->GetBinContent(ib)); - Acts::BinningValue val = - static_cast(v->GetBinContent(ib)); - Acts::BinningOption opt = - static_cast(o->GetBinContent(ib)); + auto val = static_cast(v->GetBinContent(ib)); + auto opt = static_cast(o->GetBinContent(ib)); float rmin = min->GetBinContent(ib); float rmax = max->GetBinContent(ib); bUtility += Acts::BinUtility(nbins, rmin, rmax, opt, val); @@ -268,8 +267,8 @@ ActsExamples::RootMaterialDecorator::RootMaterialDecorator( Acts::BinUtility bUtility; for (int ib = 1; ib < dim + 1; ++ib) { std::size_t nbins = static_cast(n->GetBinContent(ib)); - Acts::BinningValue val = - static_cast(v->GetBinContent(ib)); + Acts::AxisDirection val = + static_cast(v->GetBinContent(ib)); Acts::BinningOption opt = static_cast(o->GetBinContent(ib)); float rmin = min->GetBinContent(ib); diff --git a/Examples/Io/Root/src/RootMeasurementWriter.cpp b/Examples/Io/Root/src/RootMeasurementWriter.cpp index df095557664..ffce34af0c3 100644 --- a/Examples/Io/Root/src/RootMeasurementWriter.cpp +++ b/Examples/Io/Root/src/RootMeasurementWriter.cpp @@ -37,6 +37,7 @@ struct RootMeasurementWriter::DigitizationTree { int volumeID = 0; int layerID = 0; int surfaceID = 0; + int extraID = 0; // Reconstruction information float recBound[Acts::eBoundSize] = {}; @@ -74,6 +75,7 @@ struct RootMeasurementWriter::DigitizationTree { tree->Branch("volume_id", &volumeID); tree->Branch("layer_id", &layerID); tree->Branch("surface_id", &surfaceID); + tree->Branch("extra_id", &extraID); for (auto ib : recoIndices) { tree->Branch(("rec_" + bNames[ib]).c_str(), &recBound[ib]); @@ -120,6 +122,7 @@ struct RootMeasurementWriter::DigitizationTree { volumeID = geoId.volume(); layerID = geoId.layer(); surfaceID = geoId.sensitive(); + extraID = geoId.extra(); } /// Convenience function to register the truth parameters diff --git a/Examples/Io/Root/src/RootPropagationStepsWriter.cpp b/Examples/Io/Root/src/RootPropagationStepsWriter.cpp index 643956a6ed1..9054bf33a2b 100644 --- a/Examples/Io/Root/src/RootPropagationStepsWriter.cpp +++ b/Examples/Io/Root/src/RootPropagationStepsWriter.cpp @@ -191,8 +191,8 @@ ActsExamples::ProcessCode ActsExamples::RootPropagationStepsWriter::writeT( m_dz.push_back(direction.z()); double accuracy = step.stepSize.accuracy(); - double actor = step.stepSize.value(Acts::ConstrainedStep::actor); - double aborter = step.stepSize.value(Acts::ConstrainedStep::aborter); + double actor = step.stepSize.value(Acts::ConstrainedStep::navigator); + double aborter = step.stepSize.value(Acts::ConstrainedStep::actor); double user = step.stepSize.value(Acts::ConstrainedStep::user); double actAbs = std::abs(actor); double accAbs = std::abs(accuracy); diff --git a/Examples/Python/python/acts/examples/reconstruction.py b/Examples/Python/python/acts/examples/reconstruction.py index 0e30961fe39..f81fc7e3404 100644 --- a/Examples/Python/python/acts/examples/reconstruction.py +++ b/Examples/Python/python/acts/examples/reconstruction.py @@ -1798,7 +1798,7 @@ def addExaTrkX( acts.examples.OnnxEdgeClassifier(**filterConfig), acts.examples.OnnxEdgeClassifier(**gnnConfig), ] - trackBuilder = acts.examples.CugraphTrackBuilding(customLogLevel()) + trackBuilder = acts.examples.BoostTrackBuilding(customLogLevel()) findingAlg = acts.examples.TrackFindingAlgorithmExaTrkX( level=customLogLevel(), diff --git a/Examples/Python/src/Base.cpp b/Examples/Python/src/Base.cpp index cc8a5f67dc1..1dde957c04b 100644 --- a/Examples/Python/src/Base.cpp +++ b/Examples/Python/src/Base.cpp @@ -13,7 +13,7 @@ #include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/Plugins/Python/Utilities.hpp" #include "Acts/Utilities/Any.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningData.hpp" #include "Acts/Utilities/CalibrationContext.hpp" #include "Acts/Utilities/Logger.hpp" @@ -359,16 +359,16 @@ void addAlgebra(Acts::Python::Context& ctx) { void addBinning(Context& ctx) { auto& m = ctx.get("main"); - auto binningValue = py::enum_(m, "BinningValue") - .value("binX", Acts::BinningValue::binX) - .value("binY", Acts::BinningValue::binY) - .value("binZ", Acts::BinningValue::binZ) - .value("binR", Acts::BinningValue::binR) - .value("binPhi", Acts::BinningValue::binPhi) - .value("binRPhi", Acts::BinningValue::binRPhi) - .value("binH", Acts::BinningValue::binH) - .value("binEta", Acts::BinningValue::binEta) - .value("binMag", Acts::BinningValue::binMag); + auto binningValue = py::enum_(m, "AxisDirection") + .value("AxisX", Acts::AxisDirection::AxisX) + .value("AxisY", Acts::AxisDirection::AxisY) + .value("AxisZ", Acts::AxisDirection::AxisZ) + .value("AxisR", Acts::AxisDirection::AxisR) + .value("AxisPhi", Acts::AxisDirection::AxisPhi) + .value("AxisRPhi", Acts::AxisDirection::AxisRPhi) + .value("AxisTheta", Acts::AxisDirection::AxisTheta) + .value("AxisEta", Acts::AxisDirection::AxisEta) + .value("AxisMag", Acts::AxisDirection::AxisMag); auto boundaryType = py::enum_(m, "AxisBoundaryType") .value("Bound", Acts::AxisBoundaryType::Bound) diff --git a/Examples/Python/src/Blueprint.cpp b/Examples/Python/src/Blueprint.cpp index f5ce4ddc3d0..c0ebdd4f5e8 100644 --- a/Examples/Python/src/Blueprint.cpp +++ b/Examples/Python/src/Blueprint.cpp @@ -17,7 +17,7 @@ #include "Acts/Geometry/StaticBlueprintNode.hpp" #include "Acts/Navigation/NavigationStream.hpp" #include "Acts/Plugins/Python/Utilities.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -338,7 +338,7 @@ void addBlueprint(Context& ctx) { py::class_>( m, "CylinderContainerBlueprintNode") - .def(py::init(), py::arg("name"), py::arg("direction"), @@ -362,7 +362,8 @@ void addBlueprint(Context& ctx) { addNodeMethods( "CylinderContainer", - [](BlueprintNode& self, const std::string& name, BinningValue direction) { + [](BlueprintNode& self, const std::string& name, + AxisDirection direction) { auto cylinder = std::make_shared(name, direction); self.addChild(cylinder); diff --git a/Examples/Python/src/ExaTrkXTrackFinding.cpp b/Examples/Python/src/ExaTrkXTrackFinding.cpp index 7fe63b76714..3c950365278 100644 --- a/Examples/Python/src/ExaTrkXTrackFinding.cpp +++ b/Examples/Python/src/ExaTrkXTrackFinding.cpp @@ -7,7 +7,6 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #include "Acts/Plugins/ExaTrkX/BoostTrackBuilding.hpp" -#include "Acts/Plugins/ExaTrkX/CugraphTrackBuilding.hpp" #include "Acts/Plugins/ExaTrkX/ExaTrkXPipeline.hpp" #include "Acts/Plugins/ExaTrkX/OnnxEdgeClassifier.hpp" #include "Acts/Plugins/ExaTrkX/OnnxMetricLearning.hpp" @@ -185,17 +184,6 @@ void addExaTrkXTrackFinding(Context &ctx) { ACTS_PYTHON_MEMBER(cut); ACTS_PYTHON_STRUCT_END(); } - { - using Alg = Acts::CugraphTrackBuilding; - - auto alg = py::class_>( - mex, "CugraphTrackBuilding") - .def(py::init([](Logging::Level lvl) { - return std::make_shared( - getDefaultLogger("EdgeClassifier", lvl)); - }), - py::arg("level")); - } #endif ACTS_PYTHON_DECLARE_ALGORITHM( diff --git a/Examples/Python/src/Geometry.cpp b/Examples/Python/src/Geometry.cpp index e9bbbfa350e..ec15814e940 100644 --- a/Examples/Python/src/Geometry.cpp +++ b/Examples/Python/src/Geometry.cpp @@ -38,7 +38,7 @@ #include "Acts/Plugins/Python/Utilities.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceArray.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/RangeXD.hpp" #include "Acts/Visualization/ViewConfig.hpp" @@ -242,33 +242,33 @@ void addGeometry(Context& ctx) { .def(py::init<>()) .def(py::init()) .def(py::init([](Envelope x, Envelope y, Envelope z, Envelope r, - Envelope phi, Envelope rPhi, Envelope h, Envelope eta, - Envelope mag) { + Envelope phi, Envelope rPhi, Envelope theta, + Envelope eta, Envelope mag) { return ExtentEnvelope({.x = x, .y = y, .z = z, .r = r, .phi = phi, .rPhi = rPhi, - .h = h, + .theta = theta, .eta = eta, .mag = mag}); }), py::arg("x") = zeroEnvelope, py::arg("y") = zeroEnvelope, py::arg("z") = zeroEnvelope, py::arg("r") = zeroEnvelope, py::arg("phi") = zeroEnvelope, py::arg("rPhi") = zeroEnvelope, - py::arg("h") = zeroEnvelope, py::arg("eta") = zeroEnvelope, + py::arg("theta") = zeroEnvelope, py::arg("eta") = zeroEnvelope, py::arg("mag") = zeroEnvelope) .def_static("Zero", &ExtentEnvelope::Zero) .def("__getitem__", [](ExtentEnvelope& self, - BinningValue bValue) { return self[bValue]; }) - .def("__setitem__", [](ExtentEnvelope& self, BinningValue bValue, + AxisDirection bValue) { return self[bValue]; }) + .def("__setitem__", [](ExtentEnvelope& self, AxisDirection bValue, const Envelope& value) { self[bValue] = value; }) .def("__str__", [](const ExtentEnvelope& self) { - std::array values; + std::array values; std::stringstream ss; - for (BinningValue val : allBinningValues()) { + for (AxisDirection val : allAxisDirections()) { ss << val << "=(" << self[val][0] << ", " << self[val][1] << ")"; values.at(toUnderlying(val)) = ss.str(); ss.str(""); @@ -286,7 +286,7 @@ void addGeometry(Context& ctx) { py::arg("envelope") = ExtentEnvelope::Zero()) .def("range", [](const Acts::Extent& self, - Acts::BinningValue bval) -> std::array { + Acts::AxisDirection bval) -> std::array { return {self.min(bval), self.max(bval)}; }) .def("__str__", &Extent::toString); @@ -346,8 +346,8 @@ void addExperimentalGeometry(Context& ctx) { extent.extend(volume->extent(gctx)); } auto bounds = std::make_shared( - 0., extent.max(Acts::BinningValue::binR), - extent.max(Acts::BinningValue::binZ)); + 0., extent.max(Acts::AxisDirection::AxisR), + extent.max(Acts::AxisDirection::AxisZ)); return std::make_shared(Transform3::Identity(), std::move(bounds)); @@ -387,13 +387,13 @@ void addExperimentalGeometry(Context& ctx) { { // Be able to construct a proto binning py::class_(m, "ProtoBinning") - .def(py::init&, std::size_t>(), "bValue"_a, "bType"_a, "e"_a, "exp"_a = 0u) - .def(py::init(), "bValue"_a, "bType"_a, "minE"_a, "maxE"_a, "nbins"_a, "exp"_a = 0u) - .def(py::init(), "bValue"_a, "bType"_a, "nbins"_a, "exp"_a = 0u); } @@ -457,7 +457,7 @@ void addExperimentalGeometry(Context& ctx) { m, "KdtSurfacesDim1Bin100") .def(py::init>&, - const std::array&>()) + const std::array&>()) .def("surfaces", py::overload_cast( &KdtSurfacesDim1Bin100::surfaces, py::const_)); @@ -487,7 +487,7 @@ void addExperimentalGeometry(Context& ctx) { m, "KdtSurfacesDim2Bin100") .def(py::init>&, - const std::array&>()) + const std::array&>()) .def("surfaces", py::overload_cast( &KdtSurfacesDim2Bin100::surfaces, py::const_)); @@ -619,7 +619,7 @@ void addExperimentalGeometry(Context& ctx) { std::shared_ptr< Acts::Experimental::IndexedRootVolumeFinderBuilder>>( m, "IndexedRootVolumeFinderBuilder") - .def(py::init>()); + .def(py::init>()); } { diff --git a/Examples/Python/src/TruthTracking.cpp b/Examples/Python/src/TruthTracking.cpp index 4d3569f4656..ed29333b0e7 100644 --- a/Examples/Python/src/TruthTracking.cpp +++ b/Examples/Python/src/TruthTracking.cpp @@ -67,6 +67,7 @@ void addTruthTracking(Context& ctx) { ACTS_PYTHON_STRUCT_BEGIN(c, Config); ACTS_PYTHON_MEMBER(inputParticles); + ACTS_PYTHON_MEMBER(inputParticleMeasurementsMap); ACTS_PYTHON_MEMBER(outputParticles); ACTS_PYTHON_MEMBER(rhoMin); ACTS_PYTHON_MEMBER(rhoMax); diff --git a/Examples/Python/tests/root_file_hashes.txt b/Examples/Python/tests/root_file_hashes.txt index 07d42c66ad1..4d874a7bc48 100644 --- a/Examples/Python/tests/root_file_hashes.txt +++ b/Examples/Python/tests/root_file_hashes.txt @@ -27,12 +27,12 @@ test_material_mapping__material-map_tracks.root: 938b1a855369e9304401cb10d2751df test_material_mapping__propagation-material.root: e2b4eade0d8124c03c89e01bf6ff5029dd12e3c9efc0a19c22a12c5cd2800e77 test_volume_material_mapping__material-map-volume_tracks.root: 98e212d32ca054fa3d01af4167c1f49755a139d43b82c57908197f5985e0a4ff test_volume_material_mapping__propagation-volume-material.root: 42bb2fd9c50d44210c914e487903bbdef65a0491f0a85a7159c0e078ac983a80 -test_digitization_example[smeared]__measurements.root: 2b583b886b76f94786c6c2832aa84d176059cbbc35882fb34b4fd1f22dd4c006 -test_digitization_example[geometric]__measurements.root: 85efa861d14207fd7d1798dab093edcd0a2685bc189b4fc9a96b07d1001013a0 +test_digitization_example[smeared]__measurements.root: a7980ac0186c772a2792045ca2aea6e2277f1a574ea0c6df7b0f84538f10f66f +test_digitization_example[geometric]__measurements.root: 9051599b058e3637672166c10df4881d905fdb1b1d7e096b359252845ac4bb27 test_digitization_example_input[smeared]__particles.root: 669d0304eb8bcf244aa627809a117944e5e3b994fdfcfb8710f2b9a8f9a62d3b -test_digitization_example_input[smeared]__measurements.root: 243c2f69b7b0db9dbeaa7494d4ea0f3dd1691dc90f16e10df6c0491ff4dc7d62 +test_digitization_example_input[smeared]__measurements.root: 8b1cfc670989b9acc50820744a64aa711ea8091f664282e6dc8b9a399fad3dad test_digitization_example_input[geometric]__particles.root: 669d0304eb8bcf244aa627809a117944e5e3b994fdfcfb8710f2b9a8f9a62d3b -test_digitization_example_input[geometric]__measurements.root: 63ec81635979058fb8976f94455bf490cf92b7b142c4a05cc39de6225f5de2fb +test_digitization_example_input[geometric]__measurements.root: ec545fc29d5a670bf4a47065058e8555ddb6c872c207b19a3e8ae1fabb2aa180 test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: f0b4c6018d0b2641024b88f6ac717f16a2ca486007c2e9bf166c85dc5e161739 test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: e5187591a0902d7214dd211adf459e2ec43b200b43c7ebdb90e5af50ee828f91 test_ckf_tracks_example[generic-full_seeding]__performance_seeding_trees.root: 0e0676ffafdb27112fbda50d1cf627859fa745760f98073261dcf6db3f2f991e @@ -62,7 +62,7 @@ test_root_prop_step_writer[kwargsConstructor]__prop_steps.root: 200ece7cde60eb0d test_root_particle_writer[configPosConstructor]__particles.root: e5d723e138b4e121c6e74a6dba072072f622995e117a40b8e63755ac784baad6 test_root_particle_writer[configKwConstructor]__particles.root: e5d723e138b4e121c6e74a6dba072072f622995e117a40b8e63755ac784baad6 test_root_particle_writer[kwargsConstructor]__particles.root: e5d723e138b4e121c6e74a6dba072072f622995e117a40b8e63755ac784baad6 -test_root_meas_writer__meas.root: 0f7e51c3c6e0133c6c1fc0da6d936e16f59ca2b579d15108e6c7b82bdf0a1e73 +test_root_meas_writer__meas.root: 8a60b56ff82e994c27506a5de5c61833e337fec6593442fb1520f83b12decbc0 test_root_simhits_writer[configPosConstructor]__meas.root: 66fee65a672bbf28098aac7af59ef181c2ac8331f87a379132873da86bdb1ba5 test_root_simhits_writer[configKwConstructor]__meas.root: 66fee65a672bbf28098aac7af59ef181c2ac8331f87a379132873da86bdb1ba5 test_root_simhits_writer[kwargsConstructor]__meas.root: 66fee65a672bbf28098aac7af59ef181c2ac8331f87a379132873da86bdb1ba5 diff --git a/Examples/Python/tests/test_blueprint.py b/Examples/Python/tests/test_blueprint.py index 8471bf52105..629753a8a49 100644 --- a/Examples/Python/tests/test_blueprint.py +++ b/Examples/Python/tests/test_blueprint.py @@ -6,7 +6,7 @@ m = acts.UnitConstants.m degree = acts.UnitConstants.degree -bv = acts.BinningValue +bv = acts.AxisDirection gctx = acts.GeometryContext() logLevel = acts.logging.VERBOSE @@ -25,7 +25,7 @@ def write(root: acts.BlueprintNode, stage: int): root = acts.Blueprint(envelope=acts.ExtentEnvelope(r=[10 * mm, 10 * mm])) assert root.depth == 0 - barrel = root.addCylinderContainer("Barrel", direction=bv.binR) + barrel = root.addCylinderContainer("Barrel", direction=bv.AxisR) assert barrel.depth == 1 @@ -42,11 +42,11 @@ def write(root: acts.BlueprintNode, stage: int): assert barrel.depth == 0 - det = root.addCylinderContainer("Detector", direction=bv.binZ) + det = root.addCylinderContainer("Detector", direction=bv.AxisZ) assert det.depth == 1 - with det.CylinderContainer("nEC", direction=bv.binZ) as ec: + with det.CylinderContainer("nEC", direction=bv.AxisZ) as ec: assert ec.depth == 2 z = -200 for i in range(1, 3): @@ -65,7 +65,7 @@ def write(root: acts.BlueprintNode, stage: int): write(det, 3) - with det.CylinderContainer("pEC", direction=bv.binZ) as ec: + with det.CylinderContainer("pEC", direction=bv.AxisZ) as ec: assert ec.depth == 2 z = 200 for i in range(1, 3): diff --git a/Examples/Scripts/Python/blueprint.py b/Examples/Scripts/Python/blueprint.py index 0dca3a6629f..386a44076b1 100755 --- a/Examples/Scripts/Python/blueprint.py +++ b/Examples/Scripts/Python/blueprint.py @@ -10,7 +10,7 @@ root = acts.Blueprint(envelope=acts.ExtentEnvelope(r=[10 * mm, 10 * mm])) -pixel = root.addCylinderContainer(direction=acts.BinningValue.binZ, name="Pixel") +pixel = root.addCylinderContainer(direction=acts.AxisDirection.AxisZ, name="Pixel") print(repr(pixel)) trf = acts.Transform3.Identity() * acts.Translation3(acts.Vector3(0, 0, 0 * mm)) @@ -19,7 +19,7 @@ if True: barrel = acts.CylinderContainerBlueprintNode( "PixelBarrel", - acts.BinningValue.binR, + acts.AxisDirection.AxisR, attachmentStrategy=acts.CylinderVolumeStack.AttachmentStrategy.Gap, resizeStrategy=acts.CylinderVolumeStack.ResizeStrategy.Gap, ) @@ -37,7 +37,7 @@ if True: - with pixel.CylinderContainer("PixelPosEndcap", acts.BinningValue.binZ) as ec: + with pixel.CylinderContainer("PixelPosEndcap", acts.AxisDirection.AxisZ) as ec: print("Positive Endcap") ec.attachmentStrategy = acts.CylinderVolumeStack.AttachmentStrategy.Gap @@ -60,7 +60,7 @@ if True: with pixel.Material() as mat: with mat.CylinderContainer( - direction=acts.BinningValue.binZ, name="PixelNegEndcap" + direction=acts.AxisDirection.AxisZ, name="PixelNegEndcap" ) as ec: ec.attachmentStrategy = acts.CylinderVolumeStack.AttachmentStrategy.Gap diff --git a/Examples/Scripts/Python/detector_creation.py b/Examples/Scripts/Python/detector_creation.py index 071520b85fc..8c90078d8d5 100644 --- a/Examples/Scripts/Python/detector_creation.py +++ b/Examples/Scripts/Python/detector_creation.py @@ -70,7 +70,7 @@ volumeOptions.surfaceOptions = surfaceOptions # Transverse view - xyRange = acts.Extent([[acts.BinningValue.binZ, [-50, 50]]]) + xyRange = acts.Extent([[acts.AxisDirection.AxisZ, [-50, 50]]]) xyView = acts.svg.drawDetector( geoContext, detector, @@ -83,7 +83,7 @@ xyFile.write("odd_xy.svg") # Longitudinal view - zrRange = acts.Extent([[acts.BinningValue.binPhi, [-0.1, 0.1]]]) + zrRange = acts.Extent([[acts.AxisDirection.AxisPhi, [-0.1, 0.1]]]) zrView = acts.svg.drawDetector( geoContext, detector, diff --git a/Examples/Scripts/Python/material_mapping_core.py b/Examples/Scripts/Python/material_mapping_core.py index e5a6e865246..f01ece5cb8f 100644 --- a/Examples/Scripts/Python/material_mapping_core.py +++ b/Examples/Scripts/Python/material_mapping_core.py @@ -231,8 +231,8 @@ def runMaterialMapping(surfaces, inputFile, outputFile, outputMap, loglevel): gmBlueprintConfig = gm.GeoModelBlueprintCreater.Config() gmBlueprintConfig.detectorSurfaces = gmSurfaces gmBlueprintConfig.kdtBinning = [ - acts.BinningValue.binZ, - acts.BinningValue.binR, + acts.AxisDirection.AxisZ, + acts.AxisDirection.AxisR, ] gmBlueprintOptions = gm.GeoModelBlueprintCreater.Options() diff --git a/Examples/Scripts/Python/material_validation_core.py b/Examples/Scripts/Python/material_validation_core.py index 1d81054c091..305c1bfd862 100644 --- a/Examples/Scripts/Python/material_validation_core.py +++ b/Examples/Scripts/Python/material_validation_core.py @@ -171,8 +171,8 @@ def runMaterialValidation(s, ntracks, surfaces, outputFile, seed, loglevel): gmBlueprintConfig = gm.GeoModelBlueprintCreater.Config() gmBlueprintConfig.detectorSurfaces = gmSurfaces gmBlueprintConfig.kdtBinning = [ - acts.BinningValue.binZ, - acts.BinningValue.binR, + acts.AxisDirection.AxisZ, + acts.AxisDirection.AxisR, ] gmBlueprintOptions = gm.GeoModelBlueprintCreater.Options() diff --git a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp index bee570485b0..58ece1e52c7 100644 --- a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp +++ b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp @@ -10,17 +10,15 @@ #include "Acts/Material/ISurfaceMaterial.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" -#include "Acts/Propagator/Propagator.hpp" +#include "Acts/Propagator/PropagatorState.hpp" #include "Acts/Propagator/StandardAborters.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "ActsFatras/EventData/Hit.hpp" #include "ActsFatras/EventData/Particle.hpp" #include "ActsFatras/Kernel/SimulationResult.hpp" #include #include #include -#include namespace ActsFatras::detail { diff --git a/Fatras/src/Digitization/Segmentizer.cpp b/Fatras/src/Digitization/Segmentizer.cpp index 27dfb903efc..72b452ca802 100644 --- a/Fatras/src/Digitization/Segmentizer.cpp +++ b/Fatras/src/Digitization/Segmentizer.cpp @@ -117,7 +117,7 @@ ActsFatras::Segmentizer::segments(const Acts::GeometryContext& geoCtx, // The phi boundaries if (bstart[1] != bend[1]) { double referenceR = - surface.binningPositionValue(geoCtx, Acts::BinningValue::binR); + surface.referencePositionValue(geoCtx, Acts::AxisDirection::AxisR); Acts::Vector2 origin = {0., 0.}; const auto& phiboundaries = segmentation.binningData()[1].boundaries(); std::vector phibbounds = { diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/GridSvgConverter.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/GridSvgConverter.hpp index c81698de5c2..1efb229797b 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/GridSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/GridSvgConverter.hpp @@ -31,7 +31,7 @@ using ProtoGrid = actsvg::proto::grid; namespace GridConverter { // An optional range and binning value -using AxisBound = std::tuple, BinningValue>; +using AxisBound = std::tuple, AxisDirection>; /// Nested Options struct struct Options { @@ -43,19 +43,19 @@ struct Options { /// Convert an ACTS grid into a actsvg protogrid, it currently works with /// -/// - 1D: [ binX ] , [ binY ], [ binR ] , [ binPhi ] -/// - 2D: [ binX, binY ], [ binZ, binPhi ], [ binR, binPhi ] +/// - 1D: [ AxisX ] , [ AxisY ], [ AxisR ] , [ AxisPhi ] +/// - 2D: [ AxisX, AxisY ], [ AxisZ, AxisPhi ], [ AxisR, AxisPhi ] /// /// @tparam grid_type is the type of the grid to be converted /// /// @param grid the grid to be converted -/// @param bValues the binning values identifying the axes +/// @param aDirs the axis directions of the grid /// @param cOptions the conversion options /// /// @return an ACTSVG proto grid for displaying template ProtoGrid convert(const grid_type& grid, - const std::array& bValues, + const std::array& aDirs, const GridConverter::Options& cOptions) { // The return object ProtoGrid pGrid; @@ -70,7 +70,7 @@ ProtoGrid convert(const grid_type& grid, // 1D case (more to be filled in later) if constexpr (grid_type::DIM == 1u) { - if (bValues[0u] == BinningValue::binPhi && + if (aDirs[0u] == AxisDirection::AxisPhi && axes[0]->getBoundaryType() == AxisBoundaryType::Closed) { // swap needed edges1 = axes[0]->getBinEdges(); @@ -78,7 +78,7 @@ ProtoGrid convert(const grid_type& grid, } if (cOptions.optionalBound.has_value()) { auto [boundRange, boundValue] = cOptions.optionalBound.value(); - if (boundValue == BinningValue::binR) { + if (boundValue == AxisDirection::AxisR) { // good - no swap needed edges0 = {boundRange[0u], boundRange[1u]}; } @@ -89,26 +89,26 @@ ProtoGrid convert(const grid_type& grid, // Assign edges0 = axes[0]->getBinEdges(); edges1 = axes[1]->getBinEdges(); - if (bValues[0] == BinningValue::binPhi && - bValues[1] == BinningValue::binZ) { + if (aDirs[0] == AxisDirection::AxisPhi && + aDirs[1] == AxisDirection::AxisZ) { // swap needed std::swap(edges0, edges1); pGrid._type = actsvg::proto::grid::e_z_phi; - } else if (bValues[0] == BinningValue::binPhi && - bValues[1] == BinningValue::binR) { + } else if (aDirs[0] == AxisDirection::AxisPhi && + aDirs[1] == AxisDirection::AxisR) { // swap needed std::swap(edges0, edges1); pGrid._type = actsvg::proto::grid::e_r_phi; - } else if (bValues[0] == BinningValue::binZ && - bValues[1] == BinningValue::binPhi) { + } else if (aDirs[0] == AxisDirection::AxisZ && + aDirs[1] == AxisDirection::AxisPhi) { // good - no swap needed pGrid._type = actsvg::proto::grid::e_z_phi; - } else if (bValues[0] == BinningValue::binR && - bValues[1] == BinningValue::binPhi) { + } else if (aDirs[0] == AxisDirection::AxisR && + aDirs[1] == AxisDirection::AxisPhi) { // good - no swap needed pGrid._type = actsvg::proto::grid::e_r_phi; - } else if (bValues[0] == BinningValue::binX && - bValues[1] == BinningValue::binY) { + } else if (aDirs[0] == AxisDirection::AxisX && + aDirs[1] == AxisDirection::AxisY) { // good - no swap needed pGrid._type = actsvg::proto::grid::e_x_y; } diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp index b90803b07a5..b22a97f49e3 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp @@ -72,10 +72,10 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, // - for 1D phi // - for 2D z-phi or phi-z bool estimateR = (index_grid::grid_type::DIM == 1 && - indexGrid.casts[0u] == BinningValue::binPhi) || + indexGrid.casts[0u] == AxisDirection::AxisPhi) || (index_grid::grid_type::DIM == 2 && - (indexGrid.casts[0u] == BinningValue::binPhi || - indexGrid.casts[1u] == BinningValue::binPhi)); + (indexGrid.casts[0u] == AxisDirection::AxisPhi || + indexGrid.casts[1u] == AxisDirection::AxisPhi)); for (auto [is, s] : enumerate(surfaces)) { // Create the surface converter options @@ -91,9 +91,9 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, auto sExtent = s->polyhedronRepresentation(gctx, 4u).extent(); if constexpr (index_grid::grid_type::DIM == 2u) { pSurface._radii[0u] = - static_cast(sExtent.medium(BinningValue::binR)); + static_cast(sExtent.medium(AxisDirection::AxisR)); } - constrain.extend(sExtent, {BinningValue::binR}); + constrain.extend(sExtent, {AxisDirection::AxisR}); } // Add center info std::string centerInfo = " - center = ("; @@ -113,10 +113,10 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, // Adjust the grid options if constexpr (index_grid::grid_type::DIM == 1u) { - if (indexGrid.casts[0u] == BinningValue::binPhi) { - auto estRangeR = constrain.range(BinningValue::binR); + if (indexGrid.casts[0u] == AxisDirection::AxisPhi) { + auto estRangeR = constrain.range(AxisDirection::AxisR); std::array rRange = {estRangeR.min(), estRangeR.max()}; - gridOptions.optionalBound = {rRange, BinningValue::binR}; + gridOptions.optionalBound = {rRange, AxisDirection::AxisR}; } } @@ -165,7 +165,7 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, pGrid._bin_ids.push_back(binInfo); if (estimateR) { pGrid._reference_r = - static_cast(constrain.medium(BinningValue::binR)); + static_cast(constrain.medium(AxisDirection::AxisR)); } } } diff --git a/Plugins/ActSVG/src/LayerSvgConverter.cpp b/Plugins/ActSVG/src/LayerSvgConverter.cpp index 1de781d509e..ca999ade6a4 100644 --- a/Plugins/ActSVG/src/LayerSvgConverter.cpp +++ b/Plugins/ActSVG/src/LayerSvgConverter.cpp @@ -86,7 +86,7 @@ std::vector Acts::Svg::LayerConverter::convert( for (const auto& sf : layer.surfaceArray()->surfaces()) { // Surface center const Acts::Vector3 rCenter = - sf->binningPosition(gctx, Acts::BinningValue::binR); + sf->referencePosition(gctx, Acts::AxisDirection::AxisR); const Acts::Vector3 sfCenter = sf->center(gctx); double radius = Acts::VectorHelpers::perp(rCenter); double phi = Acts::VectorHelpers::phi(rCenter); diff --git a/Plugins/ActSVG/src/PortalSvgConverter.cpp b/Plugins/ActSVG/src/PortalSvgConverter.cpp index 1c779d86dd2..56e0d600b92 100644 --- a/Plugins/ActSVG/src/PortalSvgConverter.cpp +++ b/Plugins/ActSVG/src/PortalSvgConverter.cpp @@ -68,22 +68,22 @@ std::vector convertMultiLink( Acts::Vector3 position = refPosition; if constexpr (decltype(multiLink.indexedUpdater)::grid_type::DIM == 1u) { // Get the binning value - Acts::BinningValue bValue = casts[0u]; + Acts::AxisDirection bValue = casts[0u]; // Get the boundaries - take care, they are in local coordinates const auto& boundaries = multiLink.indexedUpdater.grid.axes()[0u]->getBinEdges(); double refC = 0.5 * (boundaries[il + 1u] + boundaries[il]); - if (bValue == Acts::BinningValue::binR) { + if (bValue == Acts::AxisDirection::AxisR) { double phi = Acts::VectorHelpers::phi(refPosition); position = Acts::Vector3(refC * std::cos(phi), refC * std::sin(phi), refPosition.z()); - } else if (bValue == Acts::BinningValue::binZ) { + } else if (bValue == Acts::AxisDirection::AxisZ) { // correct to global refC += surface.transform(gctx).translation().z(); position[2] = refC; - } else if (bValue == Acts::BinningValue::binPhi) { + } else if (bValue == Acts::AxisDirection::AxisPhi) { double r = Acts::VectorHelpers::perp(refPosition); position = Acts::Vector3(r * std::cos(refC), r * std::sin(refC), refPosition.z()); diff --git a/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp b/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp index 4b327fe5e08..3166adbb724 100644 --- a/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp +++ b/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp @@ -51,29 +51,29 @@ Acts::Svg::SurfaceArrayConverter::convert( }; // Walk through the binning and translate - if (binning[0] == BinningValue::binPhi && - binning[1] == BinningValue::binZ) { + if (binning[0] == AxisDirection::AxisPhi && + binning[1] == AxisDirection::AxisZ) { vType = cylinder; // flip to fit with actsvg convention edges1 = axes[0]->getBinEdges(); edges0 = axes[1]->getBinEdges(); pGrid._type = actsvg::proto::grid::e_z_phi; - } else if (binning[0] == BinningValue::binPhi && - binning[1] == BinningValue::binR) { + } else if (binning[0] == AxisDirection::AxisPhi && + binning[1] == AxisDirection::AxisR) { vType = polar; // flip to fit with actsvg convention edges1 = axes[0]->getBinEdges(); edges0 = axes[1]->getBinEdges(); pGrid._type = actsvg::proto::grid::e_r_phi; - } else if (binning[0] == BinningValue::binZ && - binning[1] == BinningValue::binPhi) { + } else if (binning[0] == AxisDirection::AxisZ && + binning[1] == AxisDirection::AxisPhi) { // good vType = cylinder; edges0 = axes[0]->getBinEdges(); edges1 = axes[1]->getBinEdges(); pGrid._type = actsvg::proto::grid::e_z_phi; - } else if (binning[0] == BinningValue::binR && - binning[1] == BinningValue::binPhi) { + } else if (binning[0] == AxisDirection::AxisR && + binning[1] == AxisDirection::AxisPhi) { // good vType = polar; edges0 = axes[0]->getBinEdges(); diff --git a/Plugins/Covfie/src/FieldConversion.cpp b/Plugins/Covfie/src/FieldConversion.cpp index 7aee611b0fa..92b0168e542 100644 --- a/Plugins/Covfie/src/FieldConversion.cpp +++ b/Plugins/Covfie/src/FieldConversion.cpp @@ -8,10 +8,6 @@ #include "Acts/Plugins/Covfie/FieldConversion.hpp" -#include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" -#include "Acts/Utilities/Grid.hpp" - #include #include #include diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp index 6577905bbba..6ea2372780e 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp @@ -12,7 +12,7 @@ #include "Acts/Detector/ProtoBinning.hpp" #include "Acts/Geometry/Extent.hpp" #include "Acts/Plugins/DD4hep/DD4hepConversionHelpers.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningData.hpp" #include @@ -25,29 +25,30 @@ namespace Acts { -static std::vector> allowedBinnings = { - {"x", BinningValue::binX}, - {"y", BinningValue::binY}, - {"z", BinningValue::binZ}, - {"phi", BinningValue::binPhi}, - {"r", BinningValue::binR}}; +static std::vector> allowedBinnings = { + {"x", AxisDirection::AxisX}, + {"y", AxisDirection::AxisY}, + {"z", AxisDirection::AxisZ}, + {"phi", AxisDirection::AxisPhi}, + {"r", AxisDirection::AxisR}}; /// Helper method to convert the string to binning value /// /// @param binningString /// /// @return a binningValue -inline BinningValue stringToBinningValue(const std::string &binningString) { +inline AxisDirection stringToAxisDirection(const std::string &binningString) { + using enum AxisDirection; if (binningString == "x") { - return BinningValue::binX; + return AxisX; } else if (binningString == "y") { - return BinningValue::binY; + return AxisY; } else if (binningString == "z") { - return BinningValue::binZ; + return AxisZ; } else if (binningString == "phi") { - return BinningValue::binPhi; + return AxisPhi; } else if (binningString == "r") { - return BinningValue::binR; + return AxisR; } else { throw std::invalid_argument("DD4hepBinningHelpers: Binning value " + binningString + " not allowed."); @@ -55,22 +56,22 @@ inline BinningValue stringToBinningValue(const std::string &binningString) { } /// Helper method to cenvert a binning list string to a vector of binning values -/// e.g. "r,z" -> {binR, binZ} +/// e.g. "r,z" -> {AxisR, AxisZ} /// /// @param binningString /// @param del the delimiter for the splitting /// /// @return a vector of binninng values -inline std::vector stringToBinningValues( +inline std::vector stringToAxisDirections( const std::string &binningString, const char &del = ',') { if (binningString.empty()) { return {}; } - std::vector bBinning; + std::vector bBinning; std::stringstream s(binningString); std::string b = ""; while (getline(s, b, del)) { - bBinning.push_back(stringToBinningValue(b)); + bBinning.push_back(stringToAxisDirection(b)); } return bBinning; } diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBlueprintFactory.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBlueprintFactory.hpp index 634a776a29a..d7996d24b1a 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBlueprintFactory.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBlueprintFactory.hpp @@ -101,7 +101,7 @@ class DD4hepBlueprintFactory { /// /// @return a tuple of the bounds type, values and binning, auxiliary data std::tuple, - std::vector, std::string> + std::vector, std::string> extractExternals([[maybe_unused]] const GeometryContext& gctx, const dd4hep::DetElement& dd4hepElement, const std::string& baseName, diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp index 948608f4d5a..8cff5250363 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp @@ -70,7 +70,7 @@ class DD4hepDetectorSurfaceFactory { /// Optionally provide an Extent object to measure the passive std::optional pExtent = std::nullopt; /// Optionally provide an Extent constraints to measure the layers - std::vector extentConstraints = {}; + std::vector extentConstraints = {}; /// The approximination of a circle quarter for extent measuring std::size_t nExtentQSegments = 1u; }; diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerStructure.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerStructure.hpp index a44e4341feb..9cb5a61a005 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerStructure.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerStructure.hpp @@ -64,7 +64,7 @@ class DD4hepLayerStructure { // The extent structure - optionally std::optional extent = std::nullopt; /// The extent constraints - optionally - std::vector extentConstraints = {}; + std::vector extentConstraints = {}; /// Approximation for the polyhedron binning unsigned int quarterSegments = 1u; /// Patch the binning with the extent if possible diff --git a/Plugins/DD4hep/src/DD4hepBinningHelpers.cpp b/Plugins/DD4hep/src/DD4hepBinningHelpers.cpp index 5fee66d8231..ea1c33e6bd9 100644 --- a/Plugins/DD4hep/src/DD4hepBinningHelpers.cpp +++ b/Plugins/DD4hep/src/DD4hepBinningHelpers.cpp @@ -39,15 +39,15 @@ Acts::DD4hepBinningHelpers::convertBinning( } else { // Equidistant binning double minDefault = - bVal == BinningValue::binPhi ? -std::numbers::pi : 0.; + bVal == AxisDirection::AxisPhi ? -std::numbers::pi : 0.; double maxDefault = - bVal == BinningValue::binPhi ? std::numbers::pi : 0.; + bVal == AxisDirection::AxisPhi ? std::numbers::pi : 0.; auto min = getParamOr(bname + "_" + ab + "_min", dd4hepElement, minDefault); auto max = getParamOr(bname + "_" + ab + "_max", dd4hepElement, maxDefault); // Check for closed phi binning - if (bVal == BinningValue::binPhi && + if (bVal == AxisDirection::AxisPhi && (max - min) > 1.9 * std::numbers::pi) { bType = Acts::AxisBoundaryType::Closed; } @@ -62,7 +62,7 @@ Acts::DD4hepBinningHelpers::convertBinning( bname + "_" + ab + "_b" + std::to_string(ib), dd4hepElement, 0.)); } // Check for closed phi binning - if (bVal == BinningValue::binPhi && + if (bVal == AxisDirection::AxisPhi && (edges.back() - edges.front()) > 1.9 * std::numbers::pi) { bType = Acts::AxisBoundaryType::Closed; } diff --git a/Plugins/DD4hep/src/DD4hepBlueprintFactory.cpp b/Plugins/DD4hep/src/DD4hepBlueprintFactory.cpp index 06ff97153dd..28431f61043 100644 --- a/Plugins/DD4hep/src/DD4hepBlueprintFactory.cpp +++ b/Plugins/DD4hep/src/DD4hepBlueprintFactory.cpp @@ -32,7 +32,7 @@ Acts::Experimental::DD4hepBlueprintFactory::create( // Create the root node std::vector bValues = {0., 150., 1000.}; - std::vector binning = {Acts::BinningValue::binR}; + std::vector binning = {Acts::AxisDirection::AxisR}; auto root = std::make_unique( dd4hepElement.name(), Acts::Transform3::Identity(), Acts::VolumeBounds::eCylinder, bValues, binning); @@ -150,7 +150,7 @@ void Acts::Experimental::DD4hepBlueprintFactory::recursiveParse( } std::tuple, std::vector, std::string> + std::vector, std::vector, std::string> Acts::Experimental::DD4hepBlueprintFactory::extractExternals( [[maybe_unused]] const GeometryContext& gctx, const dd4hep::DetElement& dd4hepElement, const std::string& baseName, @@ -172,17 +172,17 @@ Acts::Experimental::DD4hepBlueprintFactory::extractExternals( // Set as defaults bValues = {0., 0., 0.}; auto parsedExtent = extOpt.value(); - if (parsedExtent.constrains(BinningValue::binR)) { - bValues[0u] = std::floor(parsedExtent.min(BinningValue::binR)); - bValues[1u] = std::ceil(parsedExtent.max(BinningValue::binR)); + if (parsedExtent.constrains(AxisDirection::AxisR)) { + bValues[0u] = std::floor(parsedExtent.min(AxisDirection::AxisR)); + bValues[1u] = std::ceil(parsedExtent.max(AxisDirection::AxisR)); } - if (parsedExtent.constrains(BinningValue::binZ)) { - double minZ = parsedExtent.min(BinningValue::binZ) > 0. - ? std::floor(parsedExtent.min(BinningValue::binZ)) - : std::ceil(parsedExtent.min(BinningValue::binZ)); - double maxZ = parsedExtent.max(BinningValue::binZ) > 0. - ? std::floor(parsedExtent.max(BinningValue::binZ)) - : std::ceil(parsedExtent.max(BinningValue::binZ)); + if (parsedExtent.constrains(AxisDirection::AxisZ)) { + double minZ = parsedExtent.min(AxisDirection::AxisZ) > 0. + ? std::floor(parsedExtent.min(AxisDirection::AxisZ)) + : std::ceil(parsedExtent.min(AxisDirection::AxisZ)); + double maxZ = parsedExtent.max(AxisDirection::AxisZ) > 0. + ? std::floor(parsedExtent.max(AxisDirection::AxisZ)) + : std::ceil(parsedExtent.max(AxisDirection::AxisZ)); bValues[2u] = 0.5 * (maxZ - minZ); transform.translation().z() = 0.5 * (maxZ + minZ); } @@ -201,8 +201,8 @@ Acts::Experimental::DD4hepBlueprintFactory::extractExternals( // Get the binning values auto binningString = getParamOr(baseName + "_binning", dd4hepElement, ""); - std::vector bBinning = - Acts::stringToBinningValues(binningString); + std::vector bBinning = + Acts::stringToAxisDirections(binningString); if (!binningString.empty()) { aux += "vol. binning : " + binningString; } @@ -253,19 +253,19 @@ Acts::Experimental::DD4hepBlueprintFactory::extractInternals( unitLength * Acts::getParamOr(baseName + "_internals_clearance", dd4hepElement, 0.); - auto internalBinningValues = stringToBinningValues(interenalsMeasure); - if (!internalBinningValues.empty()) { + auto internalAxisDirections = stringToAxisDirections(interenalsMeasure); + if (!internalAxisDirections.empty()) { ACTS_VERBOSE(" - internals extent measurement requested"); Extent internalsExtent; ExtentEnvelope clearance = ExtentEnvelope::Zero(); - for (const auto& bv : internalBinningValues) { - ACTS_VERBOSE(" -> measuring extent for " << binningValueName(bv)); + for (const auto& bv : internalAxisDirections) { + ACTS_VERBOSE(" -> measuring extent for " << axisDirectionName(bv)); ACTS_VERBOSE(" -> with clearance :" << internalsClearance); clearance[bv] = {internalsClearance, internalsClearance}; } internalsExtent.setEnvelope(clearance); lOptions.extent = internalsExtent; - lOptions.extentConstraints = internalBinningValues; + lOptions.extentConstraints = internalAxisDirections; } // Create the builder from the dd4hep element auto [ib, extOpt] = m_cfg.layerStructure->builder( @@ -284,8 +284,8 @@ Acts::Experimental::DD4hepBlueprintFactory::extractInternals( baseName + "_root_volume_finder", dd4hepElement, ""); if (rootFinder == "indexed") { aux[1u] = "root finder : indexed"; - std::vector binning = {BinningValue::binZ, - BinningValue::binR}; + std::vector binning = {AxisDirection::AxisZ, + AxisDirection::AxisR}; rootsFinderBuilder = std::make_shared( binning); diff --git a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp index 3ae1ecd9145..9e33e40363d 100644 --- a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp @@ -115,10 +115,10 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::endcapLayers( params.contains("envelope_z_max")) { // set the values of the proto layer in case enevelopes are handed // over - pl.envelope[Acts::BinningValue::binR] = { + pl.envelope[Acts::AxisDirection::AxisR] = { params.get("envelope_r_min"), params.get("envelope_r_max")}; - pl.envelope[Acts::BinningValue::binZ] = { + pl.envelope[Acts::AxisDirection::AxisZ] = { params.get("envelope_z_min"), params.get("envelope_z_max")}; } else if (geoShape != nullptr) { @@ -152,22 +152,22 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::endcapLayers( // manually create a proto layer double eiz = (z != 0.) ? z - m_cfg.defaultThickness : 0.; double eoz = (z != 0.) ? z + m_cfg.defaultThickness : 0.; - pl.extent.range(Acts::BinningValue::binZ).set(eiz, eoz); - pl.extent.range(Acts::BinningValue::binR).set(rMin, rMax); - pl.envelope[Acts::BinningValue::binR] = {0., 0.}; - pl.envelope[Acts::BinningValue::binZ] = {0., 0.}; + pl.extent.range(Acts::AxisDirection::AxisZ).set(eiz, eoz); + pl.extent.range(Acts::AxisDirection::AxisR).set(rMin, rMax); + pl.envelope[Acts::AxisDirection::AxisR] = {0., 0.}; + pl.envelope[Acts::AxisDirection::AxisZ] = {0., 0.}; } else { ACTS_VERBOSE(" Disc layer has " << layerSurfaces.size() << " sensitive surfaces."); // set the values of the proto layer in case dimensions are given by // geometry - pl.envelope[Acts::BinningValue::binZ] = { - std::abs(zMin - pl.min(Acts::BinningValue::binZ)), - std::abs(zMax - pl.max(Acts::BinningValue::binZ))}; - pl.envelope[Acts::BinningValue::binR] = { - std::abs(rMin - pl.min(Acts::BinningValue::binR)), - std::abs(rMax - pl.max(Acts::BinningValue::binR))}; - pl.extent.range(Acts::BinningValue::binR).set(rMin, rMax); + pl.envelope[Acts::AxisDirection::AxisZ] = { + std::abs(zMin - pl.min(Acts::AxisDirection::AxisZ)), + std::abs(zMax - pl.max(Acts::AxisDirection::AxisZ))}; + pl.envelope[Acts::AxisDirection::AxisR] = { + std::abs(rMin - pl.min(Acts::AxisDirection::AxisR)), + std::abs(rMax - pl.max(Acts::AxisDirection::AxisR))}; + pl.extent.range(Acts::AxisDirection::AxisR).set(rMin, rMax); } } else { throw std::logic_error( @@ -204,9 +204,10 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::endcapLayers( // create the share disc bounds auto dBounds = std::make_shared( - pl.min(Acts::BinningValue::binR), pl.max(Acts::BinningValue::binR)); - double thickness = std::abs(pl.max(Acts::BinningValue::binZ) - - pl.min(Acts::BinningValue::binZ)); + pl.min(Acts::AxisDirection::AxisR), + pl.max(Acts::AxisDirection::AxisR)); + double thickness = std::abs(pl.max(Acts::AxisDirection::AxisZ) - + pl.min(Acts::AxisDirection::AxisZ)); // Create the layer containing the sensitive surface endcapLayer = DiscLayer::create(transform, dBounds, std::move(sArray), thickness, nullptr, Acts::active); @@ -287,10 +288,10 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( params.contains("envelope_z_min") && params.contains("envelope_z_max")) { // set the values of the proto layer in case enevelopes are handed over - pl.envelope[Acts::BinningValue::binR] = { + pl.envelope[Acts::AxisDirection::AxisR] = { params.get("envelope_r_min"), params.get("envelope_r_max")}; - pl.envelope[Acts::BinningValue::binZ] = { + pl.envelope[Acts::AxisDirection::AxisZ] = { params.get("envelope_z_min"), params.get("envelope_z_max")}; } else if (geoShape != nullptr) { @@ -315,19 +316,19 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( // manually create a proto layer double eir = (r != 0.) ? r - m_cfg.defaultThickness : 0.; double eor = (r != 0.) ? r + m_cfg.defaultThickness : 0.; - pl.extent.range(Acts::BinningValue::binR).set(eir, eor); - pl.extent.range(Acts::BinningValue::binZ).set(-dz, dz); - pl.envelope[Acts::BinningValue::binR] = {0., 0.}; - pl.envelope[Acts::BinningValue::binZ] = {0., 0.}; + pl.extent.range(Acts::AxisDirection::AxisR).set(eir, eor); + pl.extent.range(Acts::AxisDirection::AxisZ).set(-dz, dz); + pl.envelope[Acts::AxisDirection::AxisR] = {0., 0.}; + pl.envelope[Acts::AxisDirection::AxisZ] = {0., 0.}; } else { // set the values of the proto layer in case dimensions are given by // geometry - pl.envelope[Acts::BinningValue::binZ] = { - std::abs(-dz - pl.min(Acts::BinningValue::binZ)), - std::abs(dz - pl.max(Acts::BinningValue::binZ))}; - pl.envelope[Acts::BinningValue::binR] = { - std::abs(rMin - pl.min(Acts::BinningValue::binR)), - std::abs(rMax - pl.max(Acts::BinningValue::binR))}; + pl.envelope[Acts::AxisDirection::AxisZ] = { + std::abs(-dz - pl.min(Acts::AxisDirection::AxisZ)), + std::abs(dz - pl.max(Acts::AxisDirection::AxisZ))}; + pl.envelope[Acts::AxisDirection::AxisR] = { + std::abs(rMin - pl.min(Acts::AxisDirection::AxisR)), + std::abs(rMax - pl.max(Acts::AxisDirection::AxisR))}; } } else { throw std::logic_error( @@ -337,8 +338,8 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( "constructor!")); } - double halfZ = (pl.min(Acts::BinningValue::binZ) - - pl.max(Acts::BinningValue::binZ)) * + double halfZ = (pl.min(Acts::AxisDirection::AxisZ) - + pl.max(Acts::AxisDirection::AxisZ)) * 0.5; std::shared_ptr centralLayer = nullptr; @@ -351,11 +352,11 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( std::make_unique(sensitiveSurf); // create the layer - double layerR = (pl.min(Acts::BinningValue::binR) + - pl.max(Acts::BinningValue::binR)) * + double layerR = (pl.min(Acts::AxisDirection::AxisR) + + pl.max(Acts::AxisDirection::AxisR)) * 0.5; - double thickness = std::abs(pl.max(Acts::BinningValue::binR) - - pl.min(Acts::BinningValue::binR)); + double thickness = std::abs(pl.max(Acts::AxisDirection::AxisR) - + pl.min(Acts::AxisDirection::AxisR)); auto cBounds = std::make_shared(layerR, halfZ); // Create the layer containing the sensitive surface centralLayer = diff --git a/Plugins/DD4hep/src/DD4hepLayerStructure.cpp b/Plugins/DD4hep/src/DD4hepLayerStructure.cpp index 10a4e6eb9f0..5546df6d8c0 100644 --- a/Plugins/DD4hep/src/DD4hepLayerStructure.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerStructure.cpp @@ -68,13 +68,13 @@ Acts::Experimental::DD4hepLayerStructure::builder( // Check if the binning ACTS_VERBOSE("Checking if surface binning ranges can be patched."); for (auto& b : fCache.binnings) { - if (extent.constrains(b.binValue)) { - ACTS_VERBOSE("Binning '" << binningValueName(b.binValue) + if (extent.constrains(b.axisDir)) { + ACTS_VERBOSE("Binning '" << axisDirectionName(b.axisDir) << "' is patched."); ACTS_VERBOSE(" <- from : [" << b.edges.front() << ", " << b.edges.back() << "]"); - b.edges.front() = extent.min(b.binValue); - b.edges.back() = extent.max(b.binValue); + b.edges.front() = extent.min(b.axisDir); + b.edges.back() = extent.max(b.axisDir); ACTS_VERBOSE(" -> to : [" << b.edges.front() << ", " << b.edges.back() << "]"); } diff --git a/Plugins/DD4hep/src/DD4hepMaterialHelpers.cpp b/Plugins/DD4hep/src/DD4hepMaterialHelpers.cpp index c3d6b346c72..845d1356b6a 100644 --- a/Plugins/DD4hep/src/DD4hepMaterialHelpers.cpp +++ b/Plugins/DD4hep/src/DD4hepMaterialHelpers.cpp @@ -36,7 +36,7 @@ std::shared_ptr Acts::createProtoMaterial( Acts::BinUtility bu; // Loop over the bins for (auto& bin : binning) { - BinningValue bval = binningValueFromName(bin.first); + AxisDirection bval = axisDirectionFromName(bin.first); Acts::BinningOption bopt = bin.second; double min = 0.; double max = 0.; diff --git a/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConversionUtils.hpp b/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConversionUtils.hpp index 2f827a08bea..7adc9bbe3f0 100644 --- a/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConversionUtils.hpp +++ b/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConversionUtils.hpp @@ -77,7 +77,7 @@ detray::axis::bounds convertBinningOption(BinningOption bOption); /// @param bValue the binning value /// /// @return a detray binning value -detray::axis::label convertBinningValue(BinningValue bValue); +detray::axis::label convertAxisDirection(AxisDirection bValue); /// Convert the binning type /// diff --git a/Plugins/Detray/src/DetrayConversionUtils.cpp b/Plugins/Detray/src/DetrayConversionUtils.cpp index b2a0f78138f..272b453511d 100644 --- a/Plugins/Detray/src/DetrayConversionUtils.cpp +++ b/Plugins/Detray/src/DetrayConversionUtils.cpp @@ -8,20 +8,20 @@ #include "Acts/Plugins/Detray/DetrayConversionUtils.hpp" -detray::axis::label Acts::DetrayConversionUtils::convertBinningValue( - BinningValue bValue) { +detray::axis::label Acts::DetrayConversionUtils::convertAxisDirection( + AxisDirection bValue) { switch (bValue) { - case BinningValue::binX: + case AxisDirection::AxisX: return detray::axis::label::e_x; - case BinningValue::binY: + case AxisDirection::AxisY: return detray::axis::label::e_y; - case BinningValue::binZ: + case AxisDirection::AxisZ: return detray::axis::label::e_z; - case BinningValue::binR: + case AxisDirection::AxisR: return detray::axis::label::e_r; - case BinningValue::binPhi: + case AxisDirection::AxisPhi: return detray::axis::label::e_phi; - case BinningValue::binRPhi: + case AxisDirection::AxisRPhi: return detray::axis::label::e_rphi; default: throw std::invalid_argument( @@ -69,7 +69,7 @@ detray::io::axis_payload Acts::DetrayConversionUtils::convertBinningData( // Set the binning option axis.bounds = convertBinningOption(bData.option); // Set the binning value - axis.label = convertBinningValue(bData.binvalue); + axis.label = convertAxisDirection(bData.binvalue); // Set the binning range axis.edges = {}; if (bData.type == BinningType::equidistant) { diff --git a/Plugins/Detray/src/DetrayGeometryConverter.cpp b/Plugins/Detray/src/DetrayGeometryConverter.cpp index 95fe27d3036..a4afbba0c72 100644 --- a/Plugins/Detray/src/DetrayGeometryConverter.cpp +++ b/Plugins/Detray/src/DetrayGeometryConverter.cpp @@ -149,13 +149,13 @@ Acts::DetrayGeometryConverter::convertPortal( std::array clipRange = {0., 0.}; std::vector boundValues = surfaceAdjusted->bounds().values(); if (surfaceType == Surface::SurfaceType::Cylinder && - cast == BinningValue::binZ) { + cast == AxisDirection::AxisZ) { double zPosition = surfaceAdjusted->center(gctx).z(); clipRange = { zPosition - boundValues[CylinderBounds::BoundValues::eHalfLengthZ], zPosition + boundValues[CylinderBounds::BoundValues::eHalfLengthZ]}; } else if (surfaceType == Surface::SurfaceType::Disc && - cast == BinningValue::binR) { + cast == AxisDirection::AxisR) { clipRange = {boundValues[RadialBounds::BoundValues::eMinR], boundValues[RadialBounds::BoundValues::eMaxR]}; } else { diff --git a/Plugins/Detray/src/DetrayMaterialConverter.cpp b/Plugins/Detray/src/DetrayMaterialConverter.cpp index f6b61236ec5..25242b85efa 100644 --- a/Plugins/Detray/src/DetrayMaterialConverter.cpp +++ b/Plugins/Detray/src/DetrayMaterialConverter.cpp @@ -143,27 +143,27 @@ Acts::DetrayMaterialConverter::convertGridSurfaceMaterial( BinUtility bUtility = binnedMaterial->binUtility(); // Turn the bin value into a 2D grid if (bUtility.dimensions() == 1u) { - if (bUtility.binningData()[0u].binvalue == BinningValue::binX) { + if (bUtility.binningData()[0u].binvalue == AxisDirection::AxisX) { // Turn to X-Y bUtility += BinUtility(1u, std::numeric_limits::lowest(), std::numeric_limits::max(), - BinningOption::closed, BinningValue::binY); - } else if (bUtility.binningData()[0u].binvalue == BinningValue::binY) { + BinningOption::closed, AxisDirection::AxisY); + } else if (bUtility.binningData()[0u].binvalue == AxisDirection::AxisY) { // Turn to X-Y BinUtility nbUtility(1u, std::numeric_limits::lowest(), std::numeric_limits::max(), - BinningOption::closed, BinningValue::binX); + BinningOption::closed, AxisDirection::AxisX); nbUtility += bUtility; bUtility = std::move(nbUtility); swapped = true; - } else if (bUtility.binningData()[0u].binvalue == BinningValue::binR) { + } else if (bUtility.binningData()[0u].binvalue == AxisDirection::AxisR) { // Turn to R-Phi bUtility += BinUtility(1u, -std::numbers::pi, std::numbers::pi, closed, - BinningValue::binPhi); - } else if (bUtility.binningData()[0u].binvalue == BinningValue::binZ) { + AxisDirection::AxisPhi); + } else if (bUtility.binningData()[0u].binvalue == AxisDirection::AxisZ) { // Turn to Phi-Z - swap needed BinUtility nbUtility(1u, -std::numbers::pi, std::numbers::pi, closed, - BinningValue::binPhi); + AxisDirection::AxisPhi); nbUtility += bUtility; bUtility = std::move(nbUtility); swapped = true; @@ -171,24 +171,25 @@ Acts::DetrayMaterialConverter::convertGridSurfaceMaterial( std::invalid_argument("Unsupported binning for Detray"); } } else if (bUtility.dimensions() == 2u && - bUtility.binningData()[0u].binvalue == BinningValue::binZ && - bUtility.binningData()[1u].binvalue == BinningValue::binPhi) { + bUtility.binningData()[0u].binvalue == AxisDirection::AxisZ && + bUtility.binningData()[1u].binvalue == AxisDirection::AxisPhi) { BinUtility nbUtility(bUtility.binningData()[1u]); - nbUtility += bUtility.binningData()[0u]; + nbUtility += BinUtility{bUtility.binningData()[0u]}; bUtility = std::move(nbUtility); swapped = true; } - BinningValue bVal0 = bUtility.binningData()[0u].binvalue; - BinningValue bVal1 = bUtility.binningData()[1u].binvalue; + AxisDirection bVal0 = bUtility.binningData()[0u].binvalue; + AxisDirection bVal1 = bUtility.binningData()[1u].binvalue; // Translate into grid index type detray::io::material_id gridIndexType = detray::io::material_id::unknown; - if (bVal0 == BinningValue::binR && bVal1 == BinningValue::binPhi) { + if (bVal0 == AxisDirection::AxisR && bVal1 == AxisDirection::AxisPhi) { gridIndexType = detray::io::material_id::ring2_map; - } else if (bVal0 == BinningValue::binPhi && bVal1 == BinningValue::binZ) { + } else if (bVal0 == AxisDirection::AxisPhi && + bVal1 == AxisDirection::AxisZ) { gridIndexType = detray::io::material_id::concentric_cylinder2_map; - } else if (bVal0 == BinningValue::binX && bVal1 == BinningValue::binY) { + } else if (bVal0 == AxisDirection::AxisX && bVal1 == AxisDirection::AxisY) { gridIndexType = detray::io::material_id::rectangle2_map; } else { std::runtime_error( diff --git a/Plugins/Detray/src/DetraySurfaceGridsConverter.cpp b/Plugins/Detray/src/DetraySurfaceGridsConverter.cpp index f1572b77c08..13e52cd23ac 100644 --- a/Plugins/Detray/src/DetraySurfaceGridsConverter.cpp +++ b/Plugins/Detray/src/DetraySurfaceGridsConverter.cpp @@ -111,8 +111,8 @@ Acts::DetraySurfaceGridsConverter::convertImpl(const index_grid& indexGrid) { if constexpr (index_grid::grid_type::DIM == 2u) { // Check for axis swap - swapAxes = (indexGrid.casts[0u] == Acts::BinningValue::binZ && - indexGrid.casts[1u] == Acts::BinningValue::binPhi); + swapAxes = (indexGrid.casts[0u] == Acts::AxisDirection::AxisZ && + indexGrid.casts[1u] == Acts::AxisDirection::AxisPhi); } detray::io::grid_payload grid_pd = diff --git a/Plugins/ExaTrkX/CMakeLists.txt b/Plugins/ExaTrkX/CMakeLists.txt index 417a6df73b5..bb6857a7c19 100644 --- a/Plugins/ExaTrkX/CMakeLists.txt +++ b/Plugins/ExaTrkX/CMakeLists.txt @@ -1,42 +1,26 @@ -set(SOURCES src/buildEdges.cpp src/ExaTrkXPipeline.cpp) +add_library(ActsPluginExaTrkX SHARED src/buildEdges.cpp src/ExaTrkXPipeline.cpp) -if(ACTS_EXATRKX_ENABLE_ONNX) - list( - APPEND - SOURCES - src/OnnxEdgeClassifier.cpp - src/OnnxMetricLearning.cpp - src/CugraphTrackBuilding.cpp - ) +if(ACTS_EXATRKX_ENABLE_CUDA) + target_compile_definitions(ActsPluginExaTrkX PUBLIC ACTS_EXATRKX_WITH_CUDA) endif() -if(ACTS_EXATRKX_ENABLE_TORCH) - list( - APPEND - SOURCES - src/TorchEdgeClassifier.cpp - src/TorchMetricLearning.cpp - src/BoostTrackBuilding.cpp - src/TorchTruthGraphMetricsHook.cpp - src/TorchGraphStoreHook.cpp +if(ACTS_EXATRKX_ENABLE_ONNX) + target_sources( + ActsPluginExaTrkX + PRIVATE src/OnnxEdgeClassifier.cpp src/OnnxMetricLearning.cpp ) endif() -if(ACTS_EXATRKX_ENABLE_TORCH_AOT) - target_sources(ActsPluginExaTrkX PRIVATE src/TorchEdgeClassifierAOT.cpp) - target_compile_definitions( +if(ACTS_EXATRKX_ENABLE_TORCH) + target_sources( ActsPluginExaTrkX - PUBLIC ACTS_EXATRKX_WITH_TORCH_AOT + PRIVATE + src/TorchEdgeClassifier.cpp + src/TorchMetricLearning.cpp + src/BoostTrackBuilding.cpp + src/TorchTruthGraphMetricsHook.cpp + src/TorchGraphStoreHook.cpp ) - - add_library(TorchGnnAot SHARED IMPORTED) - set_target_properties( - TorchGnnAot - PROPERTIES - IMPORTED_LOCATION - "/root/reproduce_gnn_results/rel24/data/gnn.test.so" - ) - target_link_libraries(ActsPluginExaTrkX PUBLIC TorchGnnAot) endif() if(ACTS_EXATRKX_ENABLE_TENSORRT) @@ -74,15 +58,21 @@ if(ACTS_EXATRKX_ENABLE_CUDA) set_target_properties( ActsPluginExaTrkX PROPERTIES - CUDA_STANDARD 17 + CUDA_STANDARD 20 CUDA_STANDARD_REQUIRED ON CUDA_SEPARABLE_COMPILATION ON ) + target_compile_options( + ActsPluginExaTrkX + PRIVATE + $<$:-g + --generate-line-info + --extended-lambda> + ) target_compile_definitions( ActsPluginExaTrkX PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM ) - target_compile_definitions(ActsPluginExaTrkX PUBLIC NO_CUGRAPH_OPS) else() target_compile_definitions(ActsPluginExaTrkX PUBLIC ACTS_EXATRKX_CPUONLY) endif() @@ -93,10 +83,7 @@ if(ACTS_EXATRKX_ENABLE_ONNX) PUBLIC ACTS_EXATRKX_ONNX_BACKEND ) - target_link_libraries( - ActsPluginExaTrkX - PRIVATE OnnxRuntime cugraph::cugraph - ) + target_link_libraries(ActsPluginExaTrkX PRIVATE OnnxRuntime) endif() if(ACTS_EXATRKX_ENABLE_TORCH) diff --git a/Plugins/ExaTrkX/README.md b/Plugins/ExaTrkX/README.md index 8a7944bd7f2..5878ce83a15 100644 --- a/Plugins/ExaTrkX/README.md +++ b/Plugins/ExaTrkX/README.md @@ -23,7 +23,6 @@ This plugin is known to build without errors with (as of September 2022) - [libtorch](https://pytorch.org/) v1.10.2 for CUDA version 10.2 and cxx-11-abi ([download](https://download.pytorch.org/libtorch/cu102/libtorch-cxx11-abi-shared-with-deps-1.10.2%2Bcu102.zip)) *For the ONNX backend:* -- [cugraph](https://github.com/rapidsai/cugraph) v22.02.00 - [ONNX](https://github.com/microsoft/onnxruntime) v1.10.0 with CUDA support enabled *For the Torch backend* diff --git a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/BoostTrackBuilding.hpp b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/BoostTrackBuilding.hpp index a6905d5b06c..95d7f10e3b8 100644 --- a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/BoostTrackBuilding.hpp +++ b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/BoostTrackBuilding.hpp @@ -25,7 +25,7 @@ class BoostTrackBuilding final : public Acts::TrackBuildingBase { std::vector> operator()( std::any nodes, std::any edges, std::any edge_weights, std::vector &spacepointIDs, - torch::Device device = torch::Device(torch::kCPU)) override; + const ExecutionContext &execContext = {}) override; torch::Device device() const override { return m_device; }; private: diff --git a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/CugraphTrackBuilding.hpp b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/CugraphTrackBuilding.hpp deleted file mode 100644 index 133ee79e187..00000000000 --- a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/CugraphTrackBuilding.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// This file is part of the ACTS project. -// -// Copyright (C) 2016 CERN for the benefit of the ACTS project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -#pragma once - -#include "Acts/Plugins/ExaTrkX/Stages.hpp" -#include "Acts/Utilities/Logger.hpp" - -#include - -#include - -namespace Acts { - -class CugraphTrackBuilding final : public Acts::TrackBuildingBase { - public: - CugraphTrackBuilding(std::unique_ptr logger) - : m_logger(std::move(logger)), m_device(torch::Device(torch::kCPU)) {} - - std::vector> operator()( - std::any nodes, std::any edges, std::any edge_weights, - std::vector &spacepointIDs, - torch::Device device = torch::Device(torch::kCPU)) override; - torch::Device device() const override { return m_device; }; - - private: - std::unique_ptr m_logger; - torch::Device m_device; - const auto &logger() const { return *m_logger; } -}; - -} // namespace Acts diff --git a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/OnnxEdgeClassifier.hpp b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/OnnxEdgeClassifier.hpp index 5682b7e84a9..529e31409d4 100644 --- a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/OnnxEdgeClassifier.hpp +++ b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/OnnxEdgeClassifier.hpp @@ -35,7 +35,7 @@ class OnnxEdgeClassifier final : public Acts::EdgeClassificationBase { std::tuple operator()( std::any nodeFeatures, std::any edgeIndex, std::any edgeFeatures = {}, - torch::Device device = torch::Device(torch::kCPU)) override; + const ExecutionContext &execContext = {}) override; Config config() const { return m_cfg; } torch::Device device() const override { return m_device; }; diff --git a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/OnnxMetricLearning.hpp b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/OnnxMetricLearning.hpp index d78139d0732..0a97ab697c3 100644 --- a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/OnnxMetricLearning.hpp +++ b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/OnnxMetricLearning.hpp @@ -39,7 +39,7 @@ class OnnxMetricLearning final : public Acts::GraphConstructionBase { std::tuple operator()( std::vector& inputValues, std::size_t numNodes, const std::vector& moduleIds, - torch::Device device = torch::Device(torch::kCPU)) override; + const ExecutionContext& execContext = {}) override; Config config() const { return m_cfg; } torch::Device device() const override { return m_device; }; diff --git a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/Stages.hpp b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/Stages.hpp index 1e35fb08a82..13753713917 100644 --- a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/Stages.hpp +++ b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/Stages.hpp @@ -13,6 +13,7 @@ #include #include +#include #include namespace Acts { @@ -20,6 +21,12 @@ namespace Acts { /// Error that is thrown if no edges are found struct NoEdgesError : std::exception {}; +/// Capture the context of the execution +struct ExecutionContext { + torch::Device device{torch::kCPU}; + std::optional stream; +}; + // TODO maybe replace std::any with some kind of variant, // unique_ptr>? // TODO maybe replace input for GraphConstructionBase with some kind of @@ -34,13 +41,12 @@ class GraphConstructionBase { /// then gives the number of features /// @param moduleIds Module IDs of the features (used for module-map-like /// graph construction) - /// @param device Which GPU device to pick. Not relevant for CPU-only builds - /// + /// @param execContext Device & stream information /// @return (node_features, edge_features, edge_index) virtual std::tuple operator()( std::vector &inputValues, std::size_t numNodes, const std::vector &moduleIds, - torch::Device device = torch::Device(torch::kCPU)) = 0; + const ExecutionContext &execContext = {}) = 0; virtual torch::Device device() const = 0; @@ -54,12 +60,12 @@ class EdgeClassificationBase { /// @param nodeFeatures Node tensor with shape (n_nodes, n_node_features) /// @param edgeIndex Edge-index tensor with shape (2, n_edges) /// @param edgeFeatures Edge-feature tensor with shape (n_edges, n_edge_features) - /// @param device Which GPU device to pick. Not relevant for CPU-only builds + /// @param execContext Device & stream information /// /// @return (node_features, edge_features, edge_index, edge_scores) virtual std::tuple operator()( std::any nodeFeatures, std::any edgeIndex, std::any edgeFeatures = {}, - torch::Device device = torch::Device(torch::kCPU)) = 0; + const ExecutionContext &execContext = {}) = 0; virtual torch::Device device() const = 0; @@ -74,13 +80,13 @@ class TrackBuildingBase { /// @param edgeIndex Edge-index tensor with shape (2, n_edges) /// @param edgeScores Scores of the previous edge classification phase /// @param spacepointIDs IDs of the nodes (must have size=n_nodes) - /// @param device Which GPU device to pick. Not relevant for CPU-only builds + /// @param execContext Device & stream information /// /// @return tracks (as vectors of node-IDs) virtual std::vector> operator()( std::any nodeFeatures, std::any edgeIndex, std::any edgeScores, std::vector &spacepointIDs, - torch::Device device = torch::Device(torch::kCPU)) = 0; + const ExecutionContext &execContext = {}) = 0; virtual torch::Device device() const = 0; diff --git a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/TorchEdgeClassifier.hpp b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/TorchEdgeClassifier.hpp index 4cf92a7115d..e7c1d04e9d6 100644 --- a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/TorchEdgeClassifier.hpp +++ b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/TorchEdgeClassifier.hpp @@ -42,7 +42,7 @@ class TorchEdgeClassifier final : public Acts::EdgeClassificationBase { std::tuple operator()( std::any nodeFeatures, std::any edgeIndex, std::any edgeFeatures = {}, - torch::Device device = torch::Device(torch::kCPU)) override; + const ExecutionContext &execContext = {}) override; Config config() const { return m_cfg; } torch::Device device() const override { return m_device; }; diff --git a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/TorchMetricLearning.hpp b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/TorchMetricLearning.hpp index 9d87e5c59d5..dba7d7f2220 100644 --- a/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/TorchMetricLearning.hpp +++ b/Plugins/ExaTrkX/include/Acts/Plugins/ExaTrkX/TorchMetricLearning.hpp @@ -44,7 +44,7 @@ class TorchMetricLearning final : public Acts::GraphConstructionBase { std::tuple operator()( std::vector &inputValues, std::size_t numNodes, const std::vector &moduleIds, - torch::Device device = torch::Device(torch::kCPU)) override; + const ExecutionContext &execContext = {}) override; Config config() const { return m_cfg; } torch::Device device() const override { return m_device; }; diff --git a/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp b/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp index 0d75b31cedd..d46bc2f58d5 100644 --- a/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp +++ b/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp @@ -48,7 +48,7 @@ namespace Acts { std::vector> BoostTrackBuilding::operator()( std::any /*nodes*/, std::any edges, std::any weights, - std::vector& spacepointIDs, torch::Device) { + std::vector& spacepointIDs, const ExecutionContext& execContext) { ACTS_DEBUG("Start track building"); const auto edgeTensor = std::any_cast(edges).to(torch::kCPU); const auto edgeWeightTensor = diff --git a/Plugins/ExaTrkX/src/CugraphTrackBuilding.cpp b/Plugins/ExaTrkX/src/CugraphTrackBuilding.cpp deleted file mode 100644 index 7750cd7b3ac..00000000000 --- a/Plugins/ExaTrkX/src/CugraphTrackBuilding.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// This file is part of the ACTS project. -// -// Copyright (C) 2016 CERN for the benefit of the ACTS project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -#include "Acts/Plugins/ExaTrkX/CugraphTrackBuilding.hpp" - -#include - -#include - -#include "weaklyConnectedComponentsCugraph.hpp" - -namespace Acts { - -std::vector> CugraphTrackBuilding::operator()( - std::any, std::any edges, std::any edge_weights, - std::vector &spacepointIDs, torch::Device) { - auto numSpacepoints = spacepointIDs.size(); - auto edgesAfterFiltering = std::any_cast>(edges); - auto numEdgesAfterF = edgesAfterFiltering.size() / 2; - auto gOutputCTen = std::any_cast(edge_weights); - - if (numEdgesAfterF == 0) { - return {}; - } - - // ************ - // Track Labeling with cugraph::connected_components - // ************ - std::vector rowIndices; - std::vector colIndices; - std::vector edgeWeights; - std::vector trackLabels(numSpacepoints); - std::copy(edgesAfterFiltering.begin(), - edgesAfterFiltering.begin() + numEdgesAfterF, - std::back_insert_iterator(rowIndices)); - std::copy(edgesAfterFiltering.begin() + numEdgesAfterF, - edgesAfterFiltering.end(), std::back_insert_iterator(colIndices)); - std::copy(gOutputCTen.data_ptr(), - gOutputCTen.data_ptr() + numEdgesAfterF, - std::back_insert_iterator(edgeWeights)); - - ACTS_VERBOSE("run weaklyConnectedComponents"); - weaklyConnectedComponents( - rowIndices, colIndices, edgeWeights, trackLabels, logger()); - - ACTS_DEBUG("size of components: " << trackLabels.size()); - if (trackLabels.size() == 0) { - return {}; - } - - std::vector> trackCandidates; - trackCandidates.clear(); - - int existTrkIdx = 0; - // map labeling from MCC to customized track id. - std::map trackLableToIds; - - for (auto idx = 0ul; idx < numSpacepoints; ++idx) { - int trackLabel = trackLabels[idx]; - int spacepointID = spacepointIDs[idx]; - - int trkId; - if (trackLableToIds.contains(trackLabel)) { - trkId = trackLableToIds[trackLabel]; - trackCandidates[trkId].push_back(spacepointID); - } else { - // a new track, assign the track id - // and create a vector - trkId = existTrkIdx; - trackCandidates.push_back(std::vector{trkId}); - trackLableToIds[trackLabel] = trkId; - existTrkIdx++; - } - } - - return trackCandidates; -} - -} // namespace Acts diff --git a/Plugins/ExaTrkX/src/ExaTrkXPipeline.cpp b/Plugins/ExaTrkX/src/ExaTrkXPipeline.cpp index 6a05ae96f8e..d81e94ab342 100644 --- a/Plugins/ExaTrkX/src/ExaTrkXPipeline.cpp +++ b/Plugins/ExaTrkX/src/ExaTrkXPipeline.cpp @@ -39,11 +39,18 @@ std::vector> ExaTrkXPipeline::run( std::vector &features, const std::vector &moduleIds, std::vector &spacepointIDs, const ExaTrkXHook &hook, ExaTrkXTiming *timing) const { + ExecutionContext ctx; + ctx.device = m_graphConstructor->device(); +#ifndef ACTS_EXATRKX_CPUONLY + if (ctx.device.type() == torch::kCUDA) { + ctx.stream = c10::cuda::getStreamFromPool(ctx.device.index()); + } +#endif + try { auto t0 = std::chrono::high_resolution_clock::now(); auto [nodeFeatures, edgeIndex, edgeFeatures] = - (*m_graphConstructor)(features, spacepointIDs.size(), moduleIds, - m_graphConstructor->device()); + (*m_graphConstructor)(features, spacepointIDs.size(), moduleIds, ctx); auto t1 = std::chrono::high_resolution_clock::now(); if (timing != nullptr) { @@ -59,7 +66,7 @@ std::vector> ExaTrkXPipeline::run( t0 = std::chrono::high_resolution_clock::now(); auto [newNodeFeatures, newEdgeIndex, newEdgeFeatures, newEdgeScores] = (*edgeClassifier)(std::move(nodeFeatures), std::move(edgeIndex), - std::move(edgeFeatures), edgeClassifier->device()); + std::move(edgeFeatures), ctx); t1 = std::chrono::high_resolution_clock::now(); if (timing != nullptr) { @@ -76,8 +83,7 @@ std::vector> ExaTrkXPipeline::run( t0 = std::chrono::high_resolution_clock::now(); auto res = (*m_trackBuilder)(std::move(nodeFeatures), std::move(edgeIndex), - std::move(edgeScores), spacepointIDs, - m_trackBuilder->device()); + std::move(edgeScores), spacepointIDs, ctx); t1 = std::chrono::high_resolution_clock::now(); if (timing != nullptr) { diff --git a/Plugins/ExaTrkX/src/OnnxEdgeClassifier.cpp b/Plugins/ExaTrkX/src/OnnxEdgeClassifier.cpp index 59452daec09..71cdd0097b5 100644 --- a/Plugins/ExaTrkX/src/OnnxEdgeClassifier.cpp +++ b/Plugins/ExaTrkX/src/OnnxEdgeClassifier.cpp @@ -90,7 +90,8 @@ std::ostream &operator<<(std::ostream &os, Ort::Value &v) { std::tuple OnnxEdgeClassifier::operator()(std::any inputNodes, std::any inputEdges, - std::any inEdgeFeatures, torch::Device) { + std::any inEdgeFeatures, + const ExecutionContext & /*unused*/) { auto torchDevice = torch::kCPU; Ort::MemoryInfo memoryInfo("Cpu", OrtArenaAllocator, /*device_id*/ 0, OrtMemTypeDefault); diff --git a/Plugins/ExaTrkX/src/TorchEdgeClassifier.cpp b/Plugins/ExaTrkX/src/TorchEdgeClassifier.cpp index b81335ad0a9..3aff05eb4e2 100644 --- a/Plugins/ExaTrkX/src/TorchEdgeClassifier.cpp +++ b/Plugins/ExaTrkX/src/TorchEdgeClassifier.cpp @@ -67,17 +67,23 @@ TorchEdgeClassifier::~TorchEdgeClassifier() {} std::tuple TorchEdgeClassifier::operator()(std::any inNodeFeatures, std::any inEdgeIndex, - std::any inEdgeFeatures, torch::Device device) { - decltype(std::chrono::high_resolution_clock::now()) t0, t1, t2, t3, t4, t5; + std::any inEdgeFeatures, + const ExecutionContext& execContext) { + const auto& device = execContext.device; + decltype(std::chrono::high_resolution_clock::now()) t0, t1, t2, t3, t4; t0 = std::chrono::high_resolution_clock::now(); ACTS_DEBUG("Start edge classification, use " << device); c10::InferenceMode guard(true); // add a protection to avoid calling for kCPU -#ifndef ACTS_EXATRKX_CPUONLY +#ifdef ACTS_EXATRKX_CPUONLY + assert(device == torch::Device(torch::kCPU)); +#else std::optional device_guard; + std::optional streamGuard; if (device.is_cuda()) { device_guard.emplace(device.index()); + streamGuard.emplace(execContext.stream.value()); } #endif diff --git a/Plugins/ExaTrkX/src/TorchMetricLearning.cpp b/Plugins/ExaTrkX/src/TorchMetricLearning.cpp index 08088a5d904..57cb271351a 100644 --- a/Plugins/ExaTrkX/src/TorchMetricLearning.cpp +++ b/Plugins/ExaTrkX/src/TorchMetricLearning.cpp @@ -69,15 +69,21 @@ TorchMetricLearning::~TorchMetricLearning() {} std::tuple TorchMetricLearning::operator()( std::vector &inputValues, std::size_t numNodes, - const std::vector & /*moduleIds*/, torch::Device device) { + const std::vector & /*moduleIds*/, + const ExecutionContext &execContext) { + const auto &device = execContext.device; ACTS_DEBUG("Start graph construction"); c10::InferenceMode guard(true); // add a protection to avoid calling for kCPU -#ifndef ACTS_EXATRKX_CPUONLY +#ifdef ACTS_EXATRKX_CPUONLY + assert(device == torch::Device(torch::kCPU)); +#else std::optional device_guard; + std::optional streamGuard; if (device.is_cuda()) { device_guard.emplace(device.index()); + streamGuard.emplace(execContext.stream.value()); } #endif diff --git a/Plugins/ExaTrkX/src/weaklyConnectedComponentsCugraph.hpp b/Plugins/ExaTrkX/src/weaklyConnectedComponentsCugraph.hpp deleted file mode 100644 index 4eb498a326d..00000000000 --- a/Plugins/ExaTrkX/src/weaklyConnectedComponentsCugraph.hpp +++ /dev/null @@ -1,108 +0,0 @@ -// This file is part of the ACTS project. -// -// Copyright (C) 2016 CERN for the benefit of the ACTS project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -#pragma once - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef CUDA_RT_CALL -#define CUDA_RT_CALL(call) \ - { \ - cudaError_t cudaStatus = call; \ - if (cudaSuccess != cudaStatus) { \ - fprintf(stderr, \ - "ERROR: CUDA RT call \"%s\" in line %d of file %s failed with " \ - "%s (%d).\n", \ - #call, __LINE__, __FILE__, cudaGetErrorString(cudaStatus), \ - cudaStatus); \ - } \ - } -#endif // CUDA_RT_CALL - -template -__global__ void weaklyConnectedComponents(std::vector& rowIndices, - std::vector& colIndices, - std::vector& edgeWeights, - std::vector& trackLabels, - const Acts::Logger& logger) { - cudaStream_t stream; - CUDA_RT_CALL(cudaStreamCreate(&stream)); - - ACTS_VERBOSE("Weakly components Start"); - ACTS_VERBOSE("edge size: " << rowIndices.size() << " " << colIndices.size()); - raft::handle_t handle{stream}; - - cugraph::graph_t graph(handle); - - // learn from matrix_market_file_utilities.cu - vertex_t maxVertexID_row = - *std::max_element(rowIndices.begin(), rowIndices.end()); - vertex_t maxVertexID_col = - *std::max_element(colIndices.begin(), colIndices.end()); - vertex_t maxVertex = std::max(maxVertexID_row, maxVertexID_col); - - vertex_t number_of_vertices = maxVertex; - rmm::device_uvector d_vertices(number_of_vertices, - handle.get_stream()); - std::vector vertex_idx(number_of_vertices); - for (vertex_t idx = 0; idx < number_of_vertices; idx++) { - vertex_idx[idx] = idx; - } - - rmm::device_uvector src_v(rowIndices.size(), handle.get_stream()); - rmm::device_uvector dst_v(colIndices.size(), handle.get_stream()); - rmm::device_uvector weights_v(edgeWeights.size(), - handle.get_stream()); - - raft::update_device(src_v.data(), rowIndices.data(), rowIndices.size(), - handle.get_stream()); - raft::update_device(dst_v.data(), colIndices.data(), colIndices.size(), - handle.get_stream()); - raft::update_device(weights_v.data(), edgeWeights.data(), edgeWeights.size(), - handle.get_stream()); - raft::update_device(d_vertices.data(), vertex_idx.data(), vertex_idx.size(), - handle.get_stream()); - - std::tie(graph, std::ignore) = - cugraph::create_graph_from_edgelist( - handle, std::move(d_vertices), std::move(src_v), std::move(dst_v), - std::move(weights_v), cugraph::graph_properties_t{true, false}, - false); - - auto graph_view = graph.view(); - CUDA_TRY(cudaDeviceSynchronize()); // for consistent performance measurement - - rmm::device_uvector d_components( - graph_view.get_number_of_vertices(), handle.get_stream()); - - ACTS_VERBOSE("2back from construct_graph"); - cugraph::weakly_connected_components(handle, graph_view, d_components.data()); - - ACTS_VERBOSE("number of components: " << d_components.size()); - raft::update_host(trackLabels.data(), d_components.data(), - d_components.size(), handle.get_stream()); -} diff --git a/Plugins/FpeMonitoring/include/Acts/Plugins/FpeMonitoring/FpeMonitor.hpp b/Plugins/FpeMonitoring/include/Acts/Plugins/FpeMonitoring/FpeMonitor.hpp index 022a07a3426..ee96ecdc29f 100644 --- a/Plugins/FpeMonitoring/include/Acts/Plugins/FpeMonitoring/FpeMonitor.hpp +++ b/Plugins/FpeMonitoring/include/Acts/Plugins/FpeMonitoring/FpeMonitor.hpp @@ -45,7 +45,7 @@ class FpeMonitor { m_size{bufferSize} {} Buffer(const Buffer &) = delete; - Buffer(Buffer &&other) { + Buffer(Buffer &&other) noexcept { m_data = std::move(other.m_data); m_size = other.m_size; m_offset = other.m_offset; diff --git a/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4SurfaceProvider.hpp b/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4SurfaceProvider.hpp index 64930b82ff6..de73cb6466d 100644 --- a/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4SurfaceProvider.hpp +++ b/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4SurfaceProvider.hpp @@ -69,7 +69,7 @@ class Geant4SurfaceProvider : public Acts::Experimental::ISurfacesProvider { Acts::RangeXD range; /// A set of binning values to perform the separation - std::array binningValues; + std::array binningValues; /// The maximum number of surfaces per leaf std::size_t leafSize = bSize; diff --git a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelBlueprintCreater.hpp b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelBlueprintCreater.hpp index e56b1ec573d..78dfca36996 100644 --- a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelBlueprintCreater.hpp +++ b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelBlueprintCreater.hpp @@ -39,7 +39,7 @@ class GeoModelBlueprintCreater { /// with a kdtree sorting structure std::vector> detectorSurfaces = {}; /// The binning values for the KDTree sorting - std::vector kdtBinning = {}; + std::vector kdtBinning = {}; /// Polyhedron approximation: number of segments per circlequarter unsigned int quarterSegments = 1u; }; @@ -140,7 +140,7 @@ class GeoModelBlueprintCreater { createInternalStructureBuilder( Cache& cache, const GeometryContext& gctx, const TableEntry& entry, const Extent& externalExtent = Extent(), - const std::vector& internalConstraints = {}) const; + const std::vector& internalConstraints = {}) const; /// @brief Parse bound value string from the database /// diff --git a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelBinningHelper.hpp b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelBinningHelper.hpp index 4cf2fde9b8d..5a50754673e 100644 --- a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelBinningHelper.hpp +++ b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelBinningHelper.hpp @@ -19,20 +19,21 @@ namespace Acts::detail::GeoModelBinningHelper { -/// @brief Helper to transform binning string to BinningValue enum +/// @brief Helper to transform binning string to AxisDirection enum /// /// @param binning the binning string -inline BinningValue toBinningValue(const std::string& binning) { +inline AxisDirection toAxisDirection(const std::string& binning) { + using enum AxisDirection; if (binning == "x") { - return BinningValue::binX; + return AxisX; } else if (binning == "y") { - return BinningValue::binY; + return AxisY; } else if (binning == "z") { - return BinningValue::binZ; + return AxisZ; } else if (binning == "r") { - return BinningValue::binR; + return AxisR; } else if (binning == "phi") { - return BinningValue::binPhi; + return AxisPhi; } throw std::invalid_argument("GeoModelBinningHelper: Unknown binning value '" + binning + "'"); diff --git a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelExtentHelper.hpp b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelExtentHelper.hpp index 5c27152b5f5..b0d792ca24d 100644 --- a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelExtentHelper.hpp +++ b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelExtentHelper.hpp @@ -25,15 +25,15 @@ namespace Acts::detail::GeoModelExentHelper { /// @param ctype the type of the constraint as string from the database /// /// @return a vector -std::vector readBoundsConstaints(const std::string& boundsEntry, - const std::string& ctype = "i"); +std::vector readBoundsConstaints(const std::string& boundsEntry, + const std::string& ctype = "i"); /// @brief Helper function to find out which ones are constraint needed for binning /// /// @param binningEntry the bounds entry from the database /// /// @return a vector -std::vector readBinningConstraints( +std::vector readBinningConstraints( const std::vector& binningEntry); /// @brief Helper function to create the extent from database volume entry diff --git a/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp b/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp index 081834d7069..293757b51be 100644 --- a/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp +++ b/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp @@ -54,8 +54,8 @@ Acts::GeoModelBlueprintCreater::create(const GeometryContext& gctx, // Prepare the KdtSurfaces if configured to do so // if (!m_cfg.detectorSurfaces.empty()) { - std::array kdtBinning = { - BinningValue::binX, BinningValue::binY, BinningValue::binZ}; + std::array kdtBinning = { + AxisDirection::AxisX, AxisDirection::AxisY, AxisDirection::AxisZ}; if (m_cfg.kdtBinning.empty()) { throw std::invalid_argument( "GeoModelBlueprintCreater: At least one binning value for KDTree " @@ -152,10 +152,10 @@ Acts::GeoModelBlueprintCreater::createNode( // Peak into the volume entry to understand which one should be constraint // by the internals building - std::vector internalConstraints = + std::vector internalConstraints = detail::GeoModelExentHelper::readBoundsConstaints(entry.bounds, "i"); // Check if the binnning will also use the internal constraints - std::vector binningConstraints = + std::vector binningConstraints = detail::GeoModelExentHelper::readBinningConstraints(entry.binnings); // Concatenate the binning constraints for (const auto& bc : binningConstraints) { @@ -168,7 +168,7 @@ Acts::GeoModelBlueprintCreater::createNode( ACTS_VERBOSE("Found " << internalConstraints.size() << " internal constraints to check for: "); for (const auto& ic : internalConstraints) { - ACTS_VERBOSE("- " << binningValueName(ic)); + ACTS_VERBOSE("- " << axisDirectionName(ic)); } } @@ -263,11 +263,11 @@ Acts::GeoModelBlueprintCreater::createNode( } // Create the binnings - std::vector binnings; + std::vector binnings; std::for_each( entry.binnings.begin(), entry.binnings.end(), [&binnings](const std::string& b) { - binnings.push_back(detail::GeoModelBinningHelper::toBinningValue(b)); + binnings.push_back(detail::GeoModelBinningHelper::toAxisDirection(b)); }); // Complete the children @@ -317,7 +317,7 @@ std::tuple, Acts::GeoModelBlueprintCreater::createInternalStructureBuilder( Cache& cache, const GeometryContext& gctx, const TableEntry& entry, const Extent& externalExtent, - const std::vector& internalConstraints) const { + const std::vector& internalConstraints) const { // Check if the internals entry is empty if (entry.internals.empty()) { return {nullptr, Extent()}; @@ -351,7 +351,7 @@ Acts::GeoModelBlueprintCreater::createInternalStructureBuilder( // Fill what we have - follow the convention to fill up with the last for (std::size_t ibv = 0; ibv < 3u; ++ibv) { if (ibv < m_cfg.kdtBinning.size()) { - BinningValue v = m_cfg.kdtBinning[ibv]; + AxisDirection v = m_cfg.kdtBinning[ibv]; mins[ibv] = rangeExtent.min(v); maxs[ibv] = rangeExtent.max(v); continue; @@ -424,10 +424,10 @@ Acts::GeoModelBlueprintCreater::parseBounds( // Switch on the bounds type if (boundsType == VolumeBounds::BoundsType::eCylinder) { // Create the translation & bound values - translation = Acts::Vector3(0., 0., extent.medium(BinningValue::binZ)); - boundValues = {extent.min(BinningValue::binR), - extent.max(BinningValue::binR), - 0.5 * extent.interval(BinningValue::binZ)}; + translation = Acts::Vector3(0., 0., extent.medium(AxisDirection::AxisZ)); + boundValues = {extent.min(AxisDirection::AxisR), + extent.max(AxisDirection::AxisR), + 0.5 * extent.interval(AxisDirection::AxisZ)}; } else { throw std::invalid_argument( "GeoModelBlueprintCreater: Unknown bounds type, only 'cyl' is " diff --git a/Plugins/GeoModel/src/detail/GeoModelBinningHelper.cpp b/Plugins/GeoModel/src/detail/GeoModelBinningHelper.cpp index cb138913fd1..d6c7551a174 100644 --- a/Plugins/GeoModel/src/detail/GeoModelBinningHelper.cpp +++ b/Plugins/GeoModel/src/detail/GeoModelBinningHelper.cpp @@ -17,7 +17,7 @@ Acts::detail::GeoModelBinningHelper::toProtoBinning( const std::string& binning, const std::optional& extent) { std::vector binningTokens; boost::split(binningTokens, binning, boost::is_any_of(",")); - BinningValue bValue = toBinningValue(binningTokens[0]); + AxisDirection bValue = toAxisDirection(binningTokens[0]); std::vector binningDetails = {binningTokens.begin() + 1, binningTokens.end()}; @@ -47,7 +47,7 @@ Acts::detail::GeoModelBinningHelper::toProtoBinning( // The Range double rangeMin = 0.; double rangeMax = 0.; - if (bValue == BinningValue::binPhi && + if (bValue == AxisDirection::AxisPhi && boundaryType == AxisBoundaryType::Closed) { rangeMin = -std::numbers::pi; rangeMax = std::numbers::pi; diff --git a/Plugins/GeoModel/src/detail/GeoModelExtentHelper.cpp b/Plugins/GeoModel/src/detail/GeoModelExtentHelper.cpp index 3734aefb8fe..3ef7da227aa 100644 --- a/Plugins/GeoModel/src/detail/GeoModelExtentHelper.cpp +++ b/Plugins/GeoModel/src/detail/GeoModelExtentHelper.cpp @@ -14,7 +14,7 @@ #include -std::vector +std::vector Acts::detail::GeoModelExentHelper::readBoundsConstaints( const std::string& boundsEntry, const std::string& ctype) { std::vector boundsEntrySplit; @@ -24,7 +24,7 @@ Acts::detail::GeoModelExentHelper::readBoundsConstaints( "GeoModelBlueprintCreater: Bounds entry has to have at least 2 " "entries (type, values)"); } - std::set constraints; + std::set constraints; // Switch on the bounds type if (boundsEntrySplit[0u] == "cyl") { // Capture the values @@ -36,9 +36,9 @@ Acts::detail::GeoModelExentHelper::readBoundsConstaints( "least 4 entries (rmin, rmax, zmin, zmax)"); } // Raw database values to extent entries - constexpr std::array bvCyl = { - BinningValue::binR, BinningValue::binR, BinningValue::binZ, - BinningValue::binZ, BinningValue::binPhi, BinningValue::binPhi}; + constexpr std::array bvCyl = { + AxisDirection::AxisR, AxisDirection::AxisR, AxisDirection::AxisZ, + AxisDirection::AxisZ, AxisDirection::AxisPhi, AxisDirection::AxisPhi}; for (auto [iv, value] : enumerate(valuesEntry)) { if (value == ctype || value[0u] == ctype[0u]) { @@ -49,10 +49,10 @@ Acts::detail::GeoModelExentHelper::readBoundsConstaints( return {constraints.begin(), constraints.end()}; } -std::vector +std::vector Acts::detail::GeoModelExentHelper::readBinningConstraints( const std::vector& binningEntry) { - std::set constraints; + std::set constraints; // Loop over the single binning Entries for (const auto& sbe : binningEntry) { if (sbe.empty()) { @@ -60,8 +60,8 @@ Acts::detail::GeoModelExentHelper::readBinningConstraints( } std::vector sbTokens; boost::split(sbTokens, sbe, boost::is_any_of(",")); - BinningValue bv = - Acts::detail::GeoModelBinningHelper::toBinningValue(sbTokens[0]); + AxisDirection bv = + Acts::detail::GeoModelBinningHelper::toAxisDirection(sbTokens[0]); if (sbTokens.size() > 1u) { std::vector valueTokens = {sbTokens.begin() + 1, sbTokens.end()}; @@ -103,12 +103,12 @@ Acts::detail::GeoModelExentHelper::extentFromTable( "least 4 entries (rmin, rmax, zmin, zmax)"); } // Raw database values to extent entries - constexpr std::array bvCyl = { - BinningValue::binR, BinningValue::binR, BinningValue::binZ, - BinningValue::binZ, BinningValue::binPhi, BinningValue::binPhi}; + constexpr std::array bvCyl = { + AxisDirection::AxisR, AxisDirection::AxisR, AxisDirection::AxisZ, + AxisDirection::AxisZ, AxisDirection::AxisPhi, AxisDirection::AxisPhi}; for (auto [iv, value] : enumerate(valuesEntry)) { // Get the binning value - BinningValue bValue = bvCyl.at(iv); + AxisDirection bValue = bvCyl.at(iv); double val = std::numeric_limits::max(); bool isMin = (iv % 2 == 0); // Case "e" : external extent @@ -149,7 +149,7 @@ Acts::detail::GeoModelExentHelper::extentFromTable( } // Round up / down if configured if (roundInternalExtent) { - for (const auto& bv : allBinningValues()) { + for (const auto& bv : allAxisDirections()) { if (internalExtent.constrains(bv)) { extent.setMin(bv, std::floor(extent.min(bv))); extent.setMax(bv, std::ceil(extent.max(bv))); diff --git a/Plugins/Json/include/Acts/Plugins/Json/DetectorVolumeFinderJsonConverter.hpp b/Plugins/Json/include/Acts/Plugins/Json/DetectorVolumeFinderJsonConverter.hpp index 7b391a53fb5..dbf348bdd8f 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/DetectorVolumeFinderJsonConverter.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/DetectorVolumeFinderJsonConverter.hpp @@ -13,7 +13,7 @@ #include "Acts/Navigation/PortalNavigation.hpp" #include "Acts/Plugins/Json/DetrayJsonHelper.hpp" #include "Acts/Plugins/Json/IndexedGridJsonHelper.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include diff --git a/Plugins/Json/include/Acts/Plugins/Json/DetrayJsonHelper.hpp b/Plugins/Json/include/Acts/Plugins/Json/DetrayJsonHelper.hpp index d80b5cbfdde..92db94bdb32 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/DetrayJsonHelper.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/DetrayJsonHelper.hpp @@ -9,7 +9,7 @@ #pragma once #include "Acts/Surfaces/SurfaceBounds.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -62,6 +62,6 @@ void addVolumeLink(nlohmann::json& jSurface, int vLink); /// @param casts are the grid axes cast types /// /// @return the acceleration link idnetifier -std::size_t accelerationLink(std::span casts); +std::size_t accelerationLink(std::span casts); } // namespace Acts::DetrayJsonHelper diff --git a/Plugins/Json/include/Acts/Plugins/Json/GridJsonConverter.hpp b/Plugins/Json/include/Acts/Plugins/Json/GridJsonConverter.hpp index 3215bd66eae..086ec7b0c03 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/GridJsonConverter.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/GridJsonConverter.hpp @@ -10,7 +10,7 @@ #include "Acts/Plugins/Json/ActsJson.hpp" #include "Acts/Plugins/Json/TrackParametersJsonConverter.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/GridAccessHelpers.hpp" #include "Acts/Utilities/IAxis.hpp" diff --git a/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp b/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp index 3a3ab6b829f..ae4dd431a1c 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp @@ -11,7 +11,7 @@ #include "Acts/Plugins/Json/AlgebraJsonConverter.hpp" #include "Acts/Plugins/Json/GridJsonConverter.hpp" #include "Acts/Plugins/Json/UtilitiesJsonConverter.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/GridAxisGenerators.hpp" @@ -46,8 +46,8 @@ nlohmann::json convertImpl(const index_grid& indexGrid, bool detray = false, jCasts.push_back(indexGrid.casts[0u]); jCasts.push_back(indexGrid.casts[1u]); // Check for axis swap (detray version) - swapAxes = checkSwap && (indexGrid.casts[0u] == BinningValue::binZ && - indexGrid.casts[1u] == BinningValue::binPhi); + swapAxes = checkSwap && (indexGrid.casts[0u] == AxisDirection::AxisZ && + indexGrid.casts[1u] == AxisDirection::AxisPhi); } jIndexedGrid["casts"] = jCasts; jIndexedGrid["transform"] = @@ -99,12 +99,12 @@ updator_type generateFromJson(const nlohmann::json& jUpdater, Transform3 transform = Transform3JsonConverter::fromJson(jUpdater["transform"]); auto jGrid = jUpdater["grid"]; - auto jCasts = jUpdater["casts"].get>(); + auto jCasts = jUpdater["casts"].get>(); auto jAxes = jGrid["axes"]; // 1D cases if (jAxes.size() == 1u) { - BinningValue bValue = jCasts[0u]; + AxisDirection bValue = jCasts[0u]; auto jAxis = jAxes[0u]; AxisType axisType = jAxis["type"]; @@ -146,8 +146,8 @@ updator_type generateFromJson(const nlohmann::json& jUpdater, // This currently writes out only the main options of 2D grids // nota bene: it assumes if one axis is closed, it is axis B - BinningValue bValueA = jCasts[0u]; - BinningValue bValueB = jCasts[1u]; + AxisDirection bValueA = jCasts[0u]; + AxisDirection bValueB = jCasts[1u]; auto jAxisA = jAxes[0u]; auto jAxisB = jAxes[1u]; diff --git a/Plugins/Json/include/Acts/Plugins/Json/IndexedSurfacesJsonConverter.hpp b/Plugins/Json/include/Acts/Plugins/Json/IndexedSurfacesJsonConverter.hpp index 4e0b8982a62..2511218af3f 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/IndexedSurfacesJsonConverter.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/IndexedSurfacesJsonConverter.hpp @@ -17,7 +17,7 @@ #include "Acts/Plugins/Json/DetrayJsonHelper.hpp" #include "Acts/Plugins/Json/GridJsonConverter.hpp" #include "Acts/Plugins/Json/IndexedGridJsonHelper.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Enumerate.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/GridAxisGenerators.hpp" diff --git a/Plugins/Json/include/Acts/Plugins/Json/UtilitiesJsonConverter.hpp b/Plugins/Json/include/Acts/Plugins/Json/UtilitiesJsonConverter.hpp index 4874f7b49ad..ef7207af333 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/UtilitiesJsonConverter.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/UtilitiesJsonConverter.hpp @@ -42,14 +42,15 @@ void from_json(const nlohmann::json& j, Range1D& r) { r.setMax(static_cast(j["max"])); } -NLOHMANN_JSON_SERIALIZE_ENUM(BinningValue, {{BinningValue::binX, "binX"}, - {BinningValue::binY, "binY"}, - {BinningValue::binZ, "binZ"}, - {BinningValue::binR, "binR"}, - {BinningValue::binPhi, "binPhi"}, - {BinningValue::binRPhi, "binRPhi"}, - {BinningValue::binH, "binH"}, - {BinningValue::binEta, "binEta"}, - {BinningValue::binMag, "binMag"}}) +NLOHMANN_JSON_SERIALIZE_ENUM(AxisDirection, + {{AxisDirection::AxisX, "AxisX"}, + {AxisDirection::AxisY, "AxisY"}, + {AxisDirection::AxisZ, "AxisZ"}, + {AxisDirection::AxisR, "AxisR"}, + {AxisDirection::AxisPhi, "AxisPhi"}, + {AxisDirection::AxisRPhi, "AxisRPhi"}, + {AxisDirection::AxisTheta, "AxisTheta"}, + {AxisDirection::AxisEta, "AxisEta"}, + {AxisDirection::AxisMag, "AxisMag"}}) } // namespace Acts diff --git a/Plugins/Json/src/DetectorVolumeFinderJsonConverter.cpp b/Plugins/Json/src/DetectorVolumeFinderJsonConverter.cpp index 8defd1ef5da..a71af293237 100644 --- a/Plugins/Json/src/DetectorVolumeFinderJsonConverter.cpp +++ b/Plugins/Json/src/DetectorVolumeFinderJsonConverter.cpp @@ -37,7 +37,7 @@ struct IndexedVolumesGenerator { template Acts::Experimental::ExternalNavigationDelegate createUpdater( grid_type&& grid, - const std::array& bv, + const std::array& bv, const Acts::Transform3& transform) { using IndexedDetectorVolumesImpl = Acts::Experimental::IndexedGridNavigation< diff --git a/Plugins/Json/src/DetrayJsonHelper.cpp b/Plugins/Json/src/DetrayJsonHelper.cpp index d17e6cee1d5..9accb3d9f2b 100644 --- a/Plugins/Json/src/DetrayJsonHelper.cpp +++ b/Plugins/Json/src/DetrayJsonHelper.cpp @@ -64,29 +64,25 @@ void addVolumeLink(nlohmann::json& jSurface, int vLink) { jSurface["volume_link"] = vLink; } -std::size_t accelerationLink(std::span casts) { +std::size_t accelerationLink(std::span casts) { // Default is `brute_force` + using enum AxisDirection; std::size_t accLink = 0u; if (casts.size() == 2u) { - if (casts[0u] == BinningValue::binX && casts[1u] == BinningValue::binY) { + if (casts[0u] == AxisX && casts[1u] == AxisY) { accLink = 1u; - } else if (casts[0u] == BinningValue::binR && - casts[1u] == BinningValue::binPhi) { + } else if (casts[0u] == AxisR && casts[1u] == AxisPhi) { accLink = 3u; - } else if (casts[0u] == BinningValue::binZ && - casts[1u] == BinningValue::binPhi) { + } else if (casts[0u] == AxisZ && casts[1u] == AxisPhi) { accLink = 4u; - } else if (casts[0u] == BinningValue::binZ && - casts[1u] == BinningValue::binR) { + } else if (casts[0u] == AxisZ && casts[1u] == AxisR) { accLink = 5u; } } else if (casts.size() == 3u) { - if (casts[0u] == BinningValue::binX && casts[1u] == BinningValue::binY && - casts[2u] == BinningValue::binZ) { + if (casts[0u] == AxisX && casts[1u] == AxisY && casts[2u] == AxisZ) { accLink = 2u; - } else if (casts[0u] == BinningValue::binZ && - casts[1u] == BinningValue::binPhi && - casts[2u] == BinningValue::binR) { + } else if (casts[0u] == AxisZ && casts[1u] == AxisPhi && + casts[2u] == AxisR) { accLink = 5u; } } diff --git a/Plugins/Json/src/ExtentJsonConverter.cpp b/Plugins/Json/src/ExtentJsonConverter.cpp index 67b501c79f4..3dfba75f2c1 100644 --- a/Plugins/Json/src/ExtentJsonConverter.cpp +++ b/Plugins/Json/src/ExtentJsonConverter.cpp @@ -22,9 +22,9 @@ void Acts::to_json(nlohmann::json& j, const Acts::Extent& e) { { nlohmann::json jrange; const auto& xrange = e.range(); - for (auto ibv : allBinningValues()) { + for (auto ibv : allAxisDirections()) { if (e.constrains(ibv)) { - jrange[binningValueName(ibv)] = xrange[toUnderlying(ibv)]; + jrange[axisDirectionName(ibv)] = xrange[toUnderlying(ibv)]; } } j["range"] = jrange; @@ -33,9 +33,9 @@ void Acts::to_json(nlohmann::json& j, const Acts::Extent& e) { { nlohmann::json jenvelope; const auto& envelope = e.envelope(); - for (auto ibv : allBinningValues()) { + for (auto ibv : allAxisDirections()) { if (envelope[ibv] != zeroEnvelope) { - jenvelope[binningValueName(ibv)] = + jenvelope[axisDirectionName(ibv)] = Range1D(envelope[ibv][0], envelope[ibv][1]); } } @@ -49,7 +49,7 @@ void Acts::from_json(const nlohmann::json& j, Acts::Extent& e) { const auto& jrange = j["range"]; for (const auto& [key, value] : jrange.items()) { - BinningValue bval = binningValueFromName(key); + AxisDirection bval = axisDirectionFromName(key); e.set(bval, value["min"], value["max"]); } @@ -58,7 +58,7 @@ void Acts::from_json(const nlohmann::json& j, Acts::Extent& e) { ExtentEnvelope envelope; for (const auto& [key, value] : jenvelope.items()) { - BinningValue bval = binningValueFromName(key); + AxisDirection bval = axisDirectionFromName(key); envelope[bval] = {value["min"], value["max"]}; } diff --git a/Plugins/Json/src/GridJsonConverter.cpp b/Plugins/Json/src/GridJsonConverter.cpp index 478224bc163..082b7002a0c 100644 --- a/Plugins/Json/src/GridJsonConverter.cpp +++ b/Plugins/Json/src/GridJsonConverter.cpp @@ -55,7 +55,7 @@ void encodeSubspace( const Subspace* subspace = dynamic_cast(&globalToGridLocal); if (subspace != nullptr) { jGlobalToGridLocal["type"] = "subspace"; - jGlobalToGridLocal["accessors"] = subspace->bValues; + jGlobalToGridLocal["accessors"] = subspace->axisDirs; } } @@ -96,13 +96,13 @@ void encodeSubspaces( } } -template +template std::unique_ptr> decodeSubspace( const nlohmann::json& /*j*/) { return std::make_unique>(); } -template +template std::unique_ptr>> decodeTransformedSubspace(const nlohmann::json& jGlobalToGridLocal) { @@ -114,7 +114,7 @@ decodeTransformedSubspace(const nlohmann::json& jGlobalToGridLocal) { transform); } -template +template std::unique_ptr decodeGeneralSubspace(const nlohmann::json& jGlobalToGridLocal) { if (jGlobalToGridLocal.find("transform") != jGlobalToGridLocal.end()) { @@ -123,7 +123,7 @@ decodeGeneralSubspace(const nlohmann::json& jGlobalToGridLocal) { return decodeSubspace(jGlobalToGridLocal); } -template +template void decorateGlobalDelegate(Delegate& delegate, const nlohmann::json& jGlobalToGridLocal) { // The delegate has already been connected @@ -136,8 +136,9 @@ void decorateGlobalDelegate(Delegate& delegate, jGlobalToGridLocal.find("transform") != jGlobalToGridLocal.end(); // Get the accessors - std::vector accessors = - jGlobalToGridLocal.at("accessors").get>(); + std::vector accessors = + jGlobalToGridLocal.at("accessors") + .get>(); // One dimensional setting if constexpr (sizeof...(Args) == 1u) { @@ -179,7 +180,7 @@ void decorateGlobalDelegate(Delegate& delegate, } } -template +template void decorateGlobal1DimDelegate( Acts::GridAccess::GlobalToGridLocal1DimDelegate& delegate, const nlohmann::json& jGlobalToGridLocal) { @@ -197,12 +198,12 @@ nlohmann::json Acts::GridAccessJsonConverter::toJson( std::array transformOptions = {false, true}; // One dimensional sub spaces - const std::tuple, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace> + const std::tuple, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace> oneDimSubspaces = {}; for (bool transform : transformOptions) { @@ -215,16 +216,16 @@ nlohmann::json Acts::GridAccessJsonConverter::toJson( // Useful two dimensional sub spaces const std::tuple< - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace, - GridAccess::GlobalSubspace> + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace> twoDimSubspaces = {}; for (bool transform : transformOptions) { @@ -243,35 +244,35 @@ Acts::GridAccessJsonConverter::globalToGridLocalFromJson( std::unique_ptr globalToGridLocal = nullptr; - std::vector accessors = - jGlobalToGridLocal.at("accessors").get>(); + std::vector accessors = + jGlobalToGridLocal.at("accessors").get>(); // Switch and fill for 1D if (accessors.size() == 1u) { switch (accessors[0]) { - case BinningValue::binX: + case AxisDirection::AxisX: globalToGridLocal = - decodeGeneralSubspace(jGlobalToGridLocal); + decodeGeneralSubspace(jGlobalToGridLocal); break; - case BinningValue::binY: + case AxisDirection::AxisY: globalToGridLocal = - decodeGeneralSubspace(jGlobalToGridLocal); + decodeGeneralSubspace(jGlobalToGridLocal); break; - case BinningValue::binZ: + case AxisDirection::AxisZ: globalToGridLocal = - decodeGeneralSubspace(jGlobalToGridLocal); + decodeGeneralSubspace(jGlobalToGridLocal); break; - case BinningValue::binR: + case AxisDirection::AxisR: globalToGridLocal = - decodeGeneralSubspace(jGlobalToGridLocal); + decodeGeneralSubspace(jGlobalToGridLocal); break; - case BinningValue::binPhi: + case AxisDirection::AxisPhi: globalToGridLocal = - decodeGeneralSubspace(jGlobalToGridLocal); + decodeGeneralSubspace(jGlobalToGridLocal); break; - case BinningValue::binEta: + case AxisDirection::AxisEta: globalToGridLocal = - decodeGeneralSubspace(jGlobalToGridLocal); + decodeGeneralSubspace(jGlobalToGridLocal); break; default: // globalToGridLocal = nullptr; @@ -281,55 +282,55 @@ Acts::GridAccessJsonConverter::globalToGridLocalFromJson( // Switch and fill for 2D if (accessors.size() == 2u) { - if (accessors == - std::vector{BinningValue::binX, BinningValue::binY}) { + if (accessors == std::vector{AxisDirection::AxisX, + AxisDirection::AxisY}) { globalToGridLocal = - decodeGeneralSubspace( + decodeGeneralSubspace( jGlobalToGridLocal); - } else if (accessors == std::vector{BinningValue::binY, - BinningValue::binX}) { + } else if (accessors == std::vector{AxisDirection::AxisY, + AxisDirection::AxisX}) { globalToGridLocal = - decodeGeneralSubspace( + decodeGeneralSubspace( jGlobalToGridLocal); - } else if (accessors == std::vector{BinningValue::binX, - BinningValue::binZ}) { + } else if (accessors == std::vector{AxisDirection::AxisX, + AxisDirection::AxisZ}) { globalToGridLocal = - decodeGeneralSubspace( + decodeGeneralSubspace( jGlobalToGridLocal); - } else if (accessors == std::vector{BinningValue::binZ, - BinningValue::binX}) { + } else if (accessors == std::vector{AxisDirection::AxisZ, + AxisDirection::AxisX}) { globalToGridLocal = - decodeGeneralSubspace( + decodeGeneralSubspace( jGlobalToGridLocal); - } else if (accessors == std::vector{BinningValue::binY, - BinningValue::binZ}) { + } else if (accessors == std::vector{AxisDirection::AxisY, + AxisDirection::AxisZ}) { globalToGridLocal = - decodeGeneralSubspace( + decodeGeneralSubspace( jGlobalToGridLocal); - } else if (accessors == std::vector{BinningValue::binZ, - BinningValue::binY}) { + } else if (accessors == std::vector{AxisDirection::AxisZ, + AxisDirection::AxisY}) { globalToGridLocal = - decodeGeneralSubspace( + decodeGeneralSubspace( jGlobalToGridLocal); - } else if (accessors == std::vector{BinningValue::binR, - BinningValue::binPhi}) { + } else if (accessors == std::vector{ + AxisDirection::AxisR, AxisDirection::AxisPhi}) { globalToGridLocal = - decodeGeneralSubspace( + decodeGeneralSubspace( jGlobalToGridLocal); - } else if (accessors == std::vector{BinningValue::binPhi, - BinningValue::binR}) { + } else if (accessors == std::vector{AxisDirection::AxisPhi, + AxisDirection::AxisR}) { globalToGridLocal = - decodeGeneralSubspace( + decodeGeneralSubspace( jGlobalToGridLocal); - } else if (accessors == std::vector{BinningValue::binZ, - BinningValue::binPhi}) { + } else if (accessors == std::vector{ + AxisDirection::AxisZ, AxisDirection::AxisPhi}) { globalToGridLocal = - decodeGeneralSubspace( + decodeGeneralSubspace( jGlobalToGridLocal); - } else if (accessors == std::vector{BinningValue::binPhi, - BinningValue::binZ}) { + } else if (accessors == std::vector{AxisDirection::AxisPhi, + AxisDirection::AxisZ}) { globalToGridLocal = - decodeGeneralSubspace( + decodeGeneralSubspace( jGlobalToGridLocal); } // else globalToGridLocal = nullptr; @@ -347,9 +348,9 @@ Acts::GridAccessJsonConverter::globalToGridLocal1DimDelegateFromJson( } // Unroll the decoration Acts::GridAccess::GlobalToGridLocal1DimDelegate delegate; - decorateGlobal1DimDelegate( + decorateGlobal1DimDelegate( delegate, jGlobalToGridLocal); return delegate; } @@ -367,34 +368,34 @@ Acts::GridAccessJsonConverter::globalToGridLocal2DimDelegateFromJson( // Only the matching one will be applied, matching condition is checked inside // the call - may unroll this es well decorateGlobalDelegate( + AxisDirection::AxisX, AxisDirection::AxisY>( delegate, jGlobalToGridLocal); decorateGlobalDelegate( + AxisDirection::AxisY, AxisDirection::AxisX>( delegate, jGlobalToGridLocal); decorateGlobalDelegate( + AxisDirection::AxisX, AxisDirection::AxisZ>( delegate, jGlobalToGridLocal); decorateGlobalDelegate( + AxisDirection::AxisZ, AxisDirection::AxisX>( delegate, jGlobalToGridLocal); decorateGlobalDelegate( + AxisDirection::AxisY, AxisDirection::AxisZ>( delegate, jGlobalToGridLocal); decorateGlobalDelegate( + AxisDirection::AxisZ, AxisDirection::AxisY>( delegate, jGlobalToGridLocal); decorateGlobalDelegate( + AxisDirection::AxisR, AxisDirection::AxisPhi>( delegate, jGlobalToGridLocal); decorateGlobalDelegate( + AxisDirection::AxisPhi, AxisDirection::AxisR>( delegate, jGlobalToGridLocal); decorateGlobalDelegate( + AxisDirection::AxisZ, AxisDirection::AxisPhi>( delegate, jGlobalToGridLocal); decorateGlobalDelegate( + AxisDirection::AxisPhi, AxisDirection::AxisZ>( delegate, jGlobalToGridLocal); return delegate; } diff --git a/Plugins/Json/src/IndexedSurfacesJsonConverter.cpp b/Plugins/Json/src/IndexedSurfacesJsonConverter.cpp index 40548ede336..9e2930eef1b 100644 --- a/Plugins/Json/src/IndexedSurfacesJsonConverter.cpp +++ b/Plugins/Json/src/IndexedSurfacesJsonConverter.cpp @@ -37,7 +37,7 @@ struct IndexedSurfacesGenerator { template Acts::Experimental::InternalNavigationDelegate createUpdater( grid_type&& grid, - const std::array& bv, + const std::array& bv, const Acts::Transform3& transform) { Acts::Experimental::IndexedSurfacesNavigation indexedSurfaces( std::forward(grid), bv, transform); diff --git a/Plugins/Json/src/MaterialJsonConverter.cpp b/Plugins/Json/src/MaterialJsonConverter.cpp index ce582850e3c..f6f722ef826 100644 --- a/Plugins/Json/src/MaterialJsonConverter.cpp +++ b/Plugins/Json/src/MaterialJsonConverter.cpp @@ -686,14 +686,14 @@ nlohmann::json Acts::MaterialJsonConverter::toJsonDetray( BinUtility bUtility = binnedMaterial->binUtility(); // Turn the bin value into a 2D grid if (bUtility.dimensions() == 1u) { - if (bUtility.binningData()[0u].binvalue == BinningValue::binR) { + if (bUtility.binningData()[0u].binvalue == AxisDirection::AxisR) { // Turn to R-Phi bUtility += BinUtility(1u, -std::numbers::pi, std::numbers::pi, closed, - BinningValue::binPhi); - } else if (bUtility.binningData()[0u].binvalue == BinningValue::binZ) { + AxisDirection::AxisPhi); + } else if (bUtility.binningData()[0u].binvalue == AxisDirection::AxisZ) { // Turn to Phi-Z - swap needed BinUtility nbUtility(1u, -std::numbers::pi, std::numbers::pi, closed, - BinningValue::binPhi); + AxisDirection::AxisPhi); nbUtility += bUtility; bUtility = std::move(nbUtility); swapped = true; @@ -701,24 +701,25 @@ nlohmann::json Acts::MaterialJsonConverter::toJsonDetray( std::runtime_error("Unsupported binning for Detray"); } } else if (bUtility.dimensions() == 2u && - bUtility.binningData()[0u].binvalue == BinningValue::binZ && - bUtility.binningData()[1u].binvalue == BinningValue::binPhi) { + bUtility.binningData()[0u].binvalue == AxisDirection::AxisZ && + bUtility.binningData()[1u].binvalue == AxisDirection::AxisPhi) { BinUtility nbUtility(bUtility.binningData()[1u]); - nbUtility += bUtility.binningData()[0u]; + nbUtility += BinUtility{bUtility.binningData()[0u]}; bUtility = std::move(nbUtility); swapped = true; } - BinningValue bVal0 = bUtility.binningData()[0u].binvalue; - BinningValue bVal1 = bUtility.binningData()[1u].binvalue; + AxisDirection bVal0 = bUtility.binningData()[0u].binvalue; + AxisDirection bVal1 = bUtility.binningData()[1u].binvalue; // Translate into grid index type int gridIndexType = 0; - if (bVal0 == BinningValue::binR && bVal1 == BinningValue::binPhi) { + if (bVal0 == AxisDirection::AxisR && bVal1 == AxisDirection::AxisPhi) { gridIndexType = 0; - } else if (bVal0 == BinningValue::binPhi && bVal1 == BinningValue::binZ) { + } else if (bVal0 == AxisDirection::AxisPhi && + bVal1 == AxisDirection::AxisZ) { gridIndexType = 3; - } else if (bVal0 == BinningValue::binX && bVal1 == BinningValue::binY) { + } else if (bVal0 == AxisDirection::AxisX && bVal1 == AxisDirection::AxisY) { gridIndexType = 2; } else { std::runtime_error("Unsupported binning for Detray"); @@ -801,7 +802,7 @@ nlohmann::json Acts::MaterialJsonConverter::toJsonDetray( jAxis["label"] = ib; jAxis["bins"] = bData.bins(); double offset = 0; - if (bData.binvalue == BinningValue::binZ) { + if (bData.binvalue == AxisDirection::AxisZ) { offset = surface.center(Acts::GeometryContext{}).z(); } jAxis["edges"] = diff --git a/Plugins/Json/src/MaterialMapJsonConverter.cpp b/Plugins/Json/src/MaterialMapJsonConverter.cpp index dc423ecc50b..51211ac2386 100644 --- a/Plugins/Json/src/MaterialMapJsonConverter.cpp +++ b/Plugins/Json/src/MaterialMapJsonConverter.cpp @@ -119,9 +119,9 @@ Acts::SurfaceAndMaterialWithContext defaultSurfaceMaterial( std::numbers::pi) < Acts::s_epsilon ? Acts::closed : Acts::open, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); bUtility += Acts::BinUtility(1, radialBounds->rMin(), radialBounds->rMax(), - Acts::open, Acts::BinningValue::binR); + Acts::open, Acts::AxisDirection::AxisR); } if (cylinderBounds != nullptr) { bUtility += Acts::BinUtility( @@ -134,41 +134,41 @@ Acts::SurfaceAndMaterialWithContext defaultSurfaceMaterial( std::numbers::pi) < Acts::s_epsilon ? Acts::closed : Acts::open, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); bUtility += Acts::BinUtility( 1, -1 * cylinderBounds->get(Acts::CylinderBounds::eHalfLengthZ), cylinderBounds->get(Acts::CylinderBounds::eHalfLengthZ), Acts::open, - Acts::BinningValue::binZ); + Acts::AxisDirection::AxisZ); } if (annulusBounds != nullptr) { bUtility += Acts::BinUtility(1, annulusBounds->get(Acts::AnnulusBounds::eMinPhiRel), annulusBounds->get(Acts::AnnulusBounds::eMaxPhiRel), - Acts::open, Acts::BinningValue::binPhi); + Acts::open, Acts::AxisDirection::AxisPhi); bUtility += Acts::BinUtility(1, static_cast(annulusBounds->rMin()), static_cast(annulusBounds->rMax()), - Acts::open, Acts::BinningValue::binR); + Acts::open, Acts::AxisDirection::AxisR); } if (rectangleBounds != nullptr) { bUtility += Acts::BinUtility(1, rectangleBounds->get(Acts::RectangleBounds::eMinX), rectangleBounds->get(Acts::RectangleBounds::eMaxX), - Acts::open, Acts::BinningValue::binX); + Acts::open, Acts::AxisDirection::AxisX); bUtility += Acts::BinUtility(1, rectangleBounds->get(Acts::RectangleBounds::eMinY), rectangleBounds->get(Acts::RectangleBounds::eMaxY), - Acts::open, Acts::BinningValue::binY); + Acts::open, Acts::AxisDirection::AxisY); } if (trapezoidBounds != nullptr) { double halfLengthX = std::max(trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthXnegY), trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthXposY)); bUtility += Acts::BinUtility(1, -1 * halfLengthX, halfLengthX, Acts::open, - Acts::BinningValue::binX); + Acts::AxisDirection::AxisX); bUtility += Acts::BinUtility( 1, -1 * trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthY), trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthY), Acts::open, - Acts::BinningValue::binY); + Acts::AxisDirection::AxisY); } return {surface, std::make_shared(bUtility), context}; @@ -192,7 +192,7 @@ Acts::TrackingVolumeAndMaterial defaultVolumeMaterial( bUtility += Acts::BinUtility(1, cyBounds->get(Acts::CylinderVolumeBounds::eMinR), cyBounds->get(Acts::CylinderVolumeBounds::eMaxR), - Acts::open, Acts::BinningValue::binR); + Acts::open, Acts::AxisDirection::AxisR); bUtility += Acts::BinUtility( 1, -cyBounds->get(Acts::CylinderVolumeBounds::eHalfPhiSector), cyBounds->get(Acts::CylinderVolumeBounds::eHalfPhiSector), @@ -200,37 +200,37 @@ Acts::TrackingVolumeAndMaterial defaultVolumeMaterial( std::numbers::pi) < Acts::s_epsilon ? Acts::closed : Acts::open, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); bUtility += Acts::BinUtility( 1, -cyBounds->get(Acts::CylinderVolumeBounds::eHalfLengthZ), cyBounds->get(Acts::CylinderVolumeBounds::eHalfLengthZ), Acts::open, - Acts::BinningValue::binZ); + Acts::AxisDirection::AxisZ); } if (cutcylBounds != nullptr) { bUtility += Acts::BinUtility( 1, cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eMinR), cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eMaxR), Acts::open, - Acts::BinningValue::binR); + Acts::AxisDirection::AxisR); bUtility += Acts::BinUtility(1, -std::numbers::pi_v, std::numbers::pi_v, Acts::closed, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); bUtility += Acts::BinUtility( 1, -cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eHalfLengthZ), cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eHalfLengthZ), - Acts::open, Acts::BinningValue::binZ); + Acts::open, Acts::AxisDirection::AxisZ); } else if (cuBounds != nullptr) { bUtility += Acts::BinUtility( 1, -cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthX), cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthX), Acts::open, - Acts::BinningValue::binX); + Acts::AxisDirection::AxisX); bUtility += Acts::BinUtility( 1, -cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthY), cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthY), Acts::open, - Acts::BinningValue::binY); + Acts::AxisDirection::AxisY); bUtility += Acts::BinUtility( 1, -cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthZ), cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthZ), Acts::open, - Acts::BinningValue::binZ); + Acts::AxisDirection::AxisZ); } return {volume, std::make_shared(bUtility)}; } diff --git a/Plugins/Json/src/PortalJsonConverter.cpp b/Plugins/Json/src/PortalJsonConverter.cpp index 3fb7e4865a3..fd1bd742068 100644 --- a/Plugins/Json/src/PortalJsonConverter.cpp +++ b/Plugins/Json/src/PortalJsonConverter.cpp @@ -157,13 +157,13 @@ Acts::PortalJsonConverter::toJsonDetray( std::array clipRange = {0., 0.}; std::vector boundValues = surfaceAdjusted->bounds().values(); if (surfaceType == Surface::SurfaceType::Cylinder && - cast == BinningValue::binZ) { + cast == AxisDirection::AxisZ) { double zPosition = surfaceAdjusted->center(gctx).z(); clipRange = { zPosition - boundValues[CylinderBounds::BoundValues::eHalfLengthZ], zPosition + boundValues[CylinderBounds::BoundValues::eHalfLengthZ]}; } else if (surfaceType == Surface::SurfaceType::Disc && - cast == BinningValue::binR) { + cast == AxisDirection::AxisR) { clipRange = {boundValues[RadialBounds::BoundValues::eMinR], boundValues[RadialBounds::BoundValues::eMaxR]}; } else { @@ -332,7 +332,7 @@ std::shared_ptr Acts::PortalJsonConverter::fromJson( // Resolve the multi link 1D auto jMultiLink = vl["multi_1D"]; auto boundaries = jMultiLink["boundaries"].get>(); - auto binning = jMultiLink["binning"].get(); + auto binning = jMultiLink["binning"].get(); auto targets = jMultiLink["targets"].get>(); std::vector> targetVolumes; for (const auto t : targets) { diff --git a/Plugins/Json/src/UtilitiesJsonConverter.cpp b/Plugins/Json/src/UtilitiesJsonConverter.cpp index 558bb8aa048..6bb186b120b 100644 --- a/Plugins/Json/src/UtilitiesJsonConverter.cpp +++ b/Plugins/Json/src/UtilitiesJsonConverter.cpp @@ -54,7 +54,37 @@ void Acts::from_json(const nlohmann::json& j, BinningData& bd) { float min = j["min"]; float max = j["max"]; int bins = j["bins"]; - auto bValue = j["value"].get(); + + // Support legacy format with BinningValue instead of AxisDirection, + // this will anyway disappear with the removal of BinUtility + AxisDirection bValue = AxisDirection::AxisX; + if (j["value"].get().substr(0, 3) == "bin") { + std::string bValueStr = j["value"]; + if (bValueStr == "binX") { + bValue = AxisDirection::AxisX; + } else if (bValueStr == "binY") { + bValue = AxisDirection::AxisY; + } else if (bValueStr == "binZ") { + bValue = AxisDirection::AxisZ; + } else if (bValueStr == "binR") { + bValue = AxisDirection::AxisR; + } else if (bValueStr == "binPhi") { + bValue = AxisDirection::AxisPhi; + } else if (bValueStr == "binRPhi") { + bValue = AxisDirection::AxisRPhi; + } else if (bValueStr == "binH") { + bValue = AxisDirection::AxisTheta; + } else if (bValueStr == "binEta") { + bValue = AxisDirection::AxisEta; + } else if (bValueStr == "binMag") { + bValue = AxisDirection::AxisMag; + } else { + throw std::invalid_argument("Unknown binning value name: " + bValueStr); + } + } else { + bValue = j["value"].get(); + } + if (bins == 1 && !(j["type"] == "arbitrary")) { bd = BinningData(bValue, min, max); return; diff --git a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp index 8bd87122332..bf2eb7e9916 100644 --- a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp +++ b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp @@ -58,9 +58,9 @@ class TGeoLayerBuilder : public ILayerBuilder { /// Helper config structs for volume parsing struct LayerConfig { public: - using RangeConfig = std::pair>; + using RangeConfig = std::pair>; - using SplitConfig = std::pair; + using SplitConfig = std::pair; /// Identify the search volume by name std::string volumeName = ""; diff --git a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoParser.hpp b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoParser.hpp index 3a99a008819..a59743a5b46 100644 --- a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoParser.hpp +++ b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoParser.hpp @@ -10,7 +10,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Units.hpp" -#include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -69,7 +69,7 @@ struct TGeoParser { /// Scaling from TGeo to ROOT double unit = 1 * UnitConstants::cm; /// Parse restrictions, several can apply - std::vector > parseRanges = {}; + std::vector > parseRanges = {}; }; /// The parsing module, it takes the top Volume and recursively steps down diff --git a/Plugins/TGeo/src/TGeoLayerBuilder.cpp b/Plugins/TGeo/src/TGeoLayerBuilder.cpp index 73cd8bb25ec..3cbce625c7c 100644 --- a/Plugins/TGeo/src/TGeoLayerBuilder.cpp +++ b/Plugins/TGeo/src/TGeoLayerBuilder.cpp @@ -150,12 +150,12 @@ void Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, ProtoLayer pl(gctx, lSurfaces); ACTS_DEBUG("- creating CylinderLayer with " << lSurfaces.size() - << " surfaces at r = " << pl.medium(BinningValue::binR)); + << " surfaces at r = " << pl.medium(AxisDirection::AxisR)); - pl.envelope[Acts::BinningValue::binR] = {lCfg.envelope.first, - lCfg.envelope.second}; - pl.envelope[Acts::BinningValue::binZ] = {lCfg.envelope.second, - lCfg.envelope.second}; + pl.envelope[Acts::AxisDirection::AxisR] = {lCfg.envelope.first, + lCfg.envelope.second}; + pl.envelope[Acts::AxisDirection::AxisZ] = {lCfg.envelope.second, + lCfg.envelope.second}; if (nb0 >= 0 && nb1 >= 0) { layers.push_back( m_cfg.layerCreator->cylinderLayer(gctx, lSurfaces, nb0, nb1, pl)); @@ -167,12 +167,12 @@ void Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, ProtoLayer pl(gctx, lSurfaces); ACTS_DEBUG("- creating DiscLayer with " << lSurfaces.size() - << " surfaces at z = " << pl.medium(BinningValue::binZ)); + << " surfaces at z = " << pl.medium(AxisDirection::AxisZ)); - pl.envelope[Acts::BinningValue::binR] = {lCfg.envelope.first, - lCfg.envelope.second}; - pl.envelope[Acts::BinningValue::binZ] = {lCfg.envelope.second, - lCfg.envelope.second}; + pl.envelope[Acts::AxisDirection::AxisR] = {lCfg.envelope.first, + lCfg.envelope.second}; + pl.envelope[Acts::AxisDirection::AxisZ] = {lCfg.envelope.second, + lCfg.envelope.second}; if (nb0 >= 0 && nb1 >= 0) { layers.push_back( m_cfg.layerCreator->discLayer(gctx, lSurfaces, nb0, nb1, pl)); @@ -192,7 +192,7 @@ void Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, if (!layerCfg.parseRanges.empty()) { for (const auto& pRange : layerCfg.parseRanges) { ACTS_DEBUG("- layer parsing restricted in " - << binningValueName(pRange.first) << " to [" + << axisDirectionName(pRange.first) << " to [" << pRange.second.first << "/" << pRange.second.second << "]."); } @@ -200,7 +200,7 @@ void Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, if (!layerCfg.splitConfigs.empty()) { for (const auto& sConfig : layerCfg.splitConfigs) { ACTS_DEBUG("- layer splitting attempt in " - << binningValueName(sConfig.first) << " with tolerance " + << axisDirectionName(sConfig.first) << " with tolerance " << sConfig.second << "."); } } @@ -240,7 +240,7 @@ void Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, ACTS_DEBUG("- applying " << layerCfg.parseRanges.size() << " search restrictions."); for (const auto& prange : layerCfg.parseRanges) { - ACTS_VERBOSE(" - range " << binningValueName(prange.first) + ACTS_VERBOSE(" - range " << axisDirectionName(prange.first) << " within [ " << prange.second.first << ", " << prange.second.second << "]"); } diff --git a/Tests/Benchmarks/BinUtilityBenchmark.cpp b/Tests/Benchmarks/BinUtilityBenchmark.cpp index 251503e2f73..0fcf652ecdf 100644 --- a/Tests/Benchmarks/BinUtilityBenchmark.cpp +++ b/Tests/Benchmarks/BinUtilityBenchmark.cpp @@ -50,14 +50,14 @@ int main(int argc, char* argv[]) { for (unsigned int ib = 0; ib < 6; ++ib) { fewBins.push_back(ib * 6. / 5.); } - Acts::BinUtility small(fewBins, Acts::open, Acts::BinningValue::binX); + Acts::BinUtility small(fewBins, Acts::open, Acts::AxisDirection::AxisX); std::vector mediumBins; mediumBins.reserve(21); for (unsigned int ib = 0; ib < 21; ++ib) { mediumBins.push_back(ib * 6. / 20.); } - Acts::BinUtility medium(mediumBins, Acts::open, Acts::BinningValue::binX); + Acts::BinUtility medium(mediumBins, Acts::open, Acts::AxisDirection::AxisX); std::vector manyBins; manyBins.reserve(101); @@ -65,7 +65,7 @@ int main(int argc, char* argv[]) { manyBins.push_back(ib * 6. / 100.); } - Acts::BinUtility many(manyBins, Acts::open, Acts::BinningValue::binX); + Acts::BinUtility many(manyBins, Acts::open, Acts::AxisDirection::AxisX); Acts::Vector3 low = Acts::Vector3(1.5, 0., 0.); Acts::Vector3 high = Acts::Vector3(4.5, 0., 0.); @@ -125,7 +125,7 @@ int main(int argc, char* argv[]) { ACTS_INFO("Fraction is: " << st << " vs. " << gt); Acts::BinUtility equidistant(100, 0., 6., Acts::open, - Acts::BinningValue::binX); + Acts::AxisDirection::AxisX); st = 0; gt = 0; num_iters = 0; diff --git a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp index 55793113d99..9967d1b9750 100644 --- a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp +++ b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp @@ -134,7 +134,7 @@ struct CubicTrackingGeometry { layVec.push_back(layers[1]); std::unique_ptr layArr1(layArrCreator.layerArray( geoContext, layVec, -2_m - 1._mm, -1._m + 1._mm, BinningType::arbitrary, - BinningValue::binX)); + AxisDirection::AxisX)); auto trackVolume1 = std::make_shared( trafoVol1, boundsVol, nullptr, std::move(layArr1), nullptr, @@ -150,7 +150,7 @@ struct CubicTrackingGeometry { } std::unique_ptr layArr2( layArrCreator.layerArray(geoContext, layVec, 1._m - 2._mm, 2._m + 2._mm, - BinningType::arbitrary, BinningValue::binX)); + BinningType::arbitrary, AxisDirection::AxisX)); auto trackVolume2 = std::make_shared( trafoVol2, boundsVol, nullptr, std::move(layArr2), nullptr, @@ -178,7 +178,8 @@ struct CubicTrackingGeometry { std::vector binBoundaries = {-3._m, 0., 3._m}; - BinningData binData(BinningOption::open, BinningValue::binX, binBoundaries); + BinningData binData(BinningOption::open, AxisDirection::AxisX, + binBoundaries); std::unique_ptr bu(new BinUtility(binData)); std::shared_ptr trVolArr( diff --git a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalDetector.cpp b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalDetector.cpp index 7ab854d4e65..5ec9a806005 100644 --- a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalDetector.cpp +++ b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalDetector.cpp @@ -73,7 +73,7 @@ std::shared_ptr Acts::Test::buildCylindricalDetector( // Create the barrel container builder CylindricalContainerBuilder::Config barrelRCfg; barrelRCfg.builders = {barrel0, barrel1, barrel2}; - barrelRCfg.binning = {BinningValue::binR}; + barrelRCfg.binning = {AxisDirection::AxisR}; auto barrel = std::make_shared( barrelRCfg, getDefaultLogger("BarrelBuilderR", Logging::INFO)); @@ -88,7 +88,7 @@ std::shared_ptr Acts::Test::buildCylindricalDetector( // Create the barrel container builder CylindricalContainerBuilder::Config barrelEndcapCfg; barrelEndcapCfg.builders = {endcapN, barrel, endcapP}; - barrelEndcapCfg.binning = {BinningValue::binZ}; + barrelEndcapCfg.binning = {AxisDirection::AxisZ}; auto barrelEndcap = std::make_shared( barrelEndcapCfg, getDefaultLogger("BarrelEndcapBuilder", Logging::INFO)); @@ -96,7 +96,7 @@ std::shared_ptr Acts::Test::buildCylindricalDetector( // Create the barrel container builder CylindricalContainerBuilder::Config detectorCfg; detectorCfg.builders = {beampipe, barrelEndcap}; - detectorCfg.binning = {BinningValue::binR}; + detectorCfg.binning = {AxisDirection::AxisR}; auto containerBuilder = std::make_shared( detectorCfg, getDefaultLogger("DetectorBuilder", Logging::INFO)); diff --git a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp index a37bbcb1e8f..84e51027a6e 100644 --- a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp +++ b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp @@ -304,7 +304,7 @@ struct CylindricalTrackingGeometry { // create the layer and store it ProtoLayer protoLayer(geoContext, layerSurfaces); - protoLayer.envelope[BinningValue::binR] = {0.5, 0.5}; + protoLayer.envelope[AxisDirection::AxisR] = {0.5, 0.5}; auto pLayer = layerCreator->cylinderLayer( geoContext, std::move(layerSurfacePtrs), pLayerBinning[ilp].first, pLayerBinning[ilp].second, protoLayer); @@ -319,7 +319,7 @@ struct CylindricalTrackingGeometry { // layer array auto pLayerArray = layerArrayCreator->layerArray( - geoContext, pLayers, 25., 300., arbitrary, BinningValue::binR); + geoContext, pLayers, 25., 300., arbitrary, AxisDirection::AxisR); auto pVolumeBounds = std::make_shared(25., 300., 1100.); // create the Tracking volume diff --git a/Tests/Data/material-map.json b/Tests/Data/material-map.json index a59a29a7d17..447fad8f872 100644 --- a/Tests/Data/material-map.json +++ b/Tests/Data/material-map.json @@ -17,7 +17,7 @@ "min": 0.0, "option": "open", "type": "equidistant", - "value": "binR" + "value": "AxisR" }, { "bins": 2, @@ -25,7 +25,7 @@ "min": -3.1415927410125732, "option": "closed", "type": "equidistant", - "value": "binPhi" + "value": "AxisPhi" }, { "bins": 2, @@ -33,7 +33,7 @@ "min": -4002.0, "option": "open", "type": "equidistant", - "value": "binZ" + "value": "AxisZ" } ] }, @@ -154,7 +154,7 @@ "min": -3.1415927410125732, "option": "open", "type": "equidistant", - "value": "binPhi" + "value": "AxisPhi" }, { "bins": 2, @@ -162,7 +162,7 @@ "min": -524.0, "option": "open", "type": "equidistant", - "value": "binZ" + "value": "AxisZ" } ] }, @@ -212,7 +212,7 @@ "min": -3.1415927410125732, "option": "open", "type": "equidistant", - "value": "binPhi" + "value": "AxisPhi" }, { "bins": 2, @@ -220,7 +220,7 @@ "min": -524.0, "option": "open", "type": "equidistant", - "value": "binZ" + "value": "AxisZ" } ] }, @@ -269,7 +269,7 @@ "min": -3.1415927410125732, "option": "open", "type": "equidistant", - "value": "binPhi" + "value": "AxisPhi" }, { "bins": 3, @@ -277,7 +277,7 @@ "min": 27.0, "option": "open", "type": "equidistant", - "value": "binR" + "value": "AxisR" } ] }, @@ -338,7 +338,7 @@ "min": -3.1415927410125732, "option": "closed", "type": "equidistant", - "value": "binPhi" + "value": "AxisPhi" }, { "bins": 3, @@ -346,7 +346,7 @@ "min": -1154.0, "option": "open", "type": "equidistant", - "value": "binZ" + "value": "AxisZ" } ] }, diff --git a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp index f459feb0f24..941423f6a74 100644 --- a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp +++ b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp @@ -10,10 +10,10 @@ #include #include "Acts/Definitions/ParticleData.hpp" -#include "Acts/EventData/TrackParameters.hpp" #include "Acts/MagneticField/ConstantBField.hpp" #include "Acts/Propagator/EigenStepper.hpp" #include "Acts/Propagator/Navigator.hpp" +#include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/StraightLineStepper.hpp" #include "Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp" #include "Acts/Utilities/Logger.hpp" diff --git a/Tests/UnitTests/Alignment/Kernel/AlignmentTests.cpp b/Tests/UnitTests/Alignment/Kernel/AlignmentTests.cpp index e6bbad83f4b..86d668b5beb 100644 --- a/Tests/UnitTests/Alignment/Kernel/AlignmentTests.cpp +++ b/Tests/UnitTests/Alignment/Kernel/AlignmentTests.cpp @@ -158,7 +158,7 @@ struct TelescopeDetector { // Create the layer array std::unique_ptr layArr(layArrCreator.layerArray( geoContext, layVec, positions.front() - 2._mm, positions.back() + 2._mm, - BinningType::arbitrary, BinningValue::binX)); + BinningType::arbitrary, AxisDirection::AxisX)); // Build the tracking volume auto trackVolume = std::make_shared( diff --git a/Tests/UnitTests/Core/Detector/BlueprintHelperTests.cpp b/Tests/UnitTests/Core/Detector/BlueprintHelperTests.cpp index a8876bbd8f3..b10042791cf 100644 --- a/Tests/UnitTests/Core/Detector/BlueprintHelperTests.cpp +++ b/Tests/UnitTests/Core/Detector/BlueprintHelperTests.cpp @@ -23,7 +23,8 @@ BOOST_AUTO_TEST_SUITE(Experimental) BOOST_AUTO_TEST_CASE(BlueprintHelperSorting) { // Create root node - std::vector detectorBinning = {Acts::BinningValue::binR}; + std::vector detectorBinning = { + Acts::AxisDirection::AxisR}; std::vector detectorBoundaries = {0., 50., 100.}; auto detector = std::make_unique( "detector", Acts::Transform3::Identity(), Acts::VolumeBounds::eCylinder, @@ -33,7 +34,7 @@ BOOST_AUTO_TEST_CASE(BlueprintHelperSorting) { BOOST_CHECK(detector->children.empty()); BOOST_CHECK_EQUAL(detector->name, "detector"); - std::vector pixelsBinning = {Acts::BinningValue::binZ}; + std::vector pixelsBinning = {Acts::AxisDirection::AxisZ}; std::vector pixelsBoundaries = {20., 50., 100.}; auto pixels = std::make_unique( @@ -105,7 +106,8 @@ BOOST_AUTO_TEST_CASE(BlueprintCylindricalGapFilling) { std::make_shared(); // Create root node - std::vector detectorBinning = {Acts::BinningValue::binR}; + std::vector detectorBinning = { + Acts::AxisDirection::AxisR}; std::vector detectorBoundaries = {detectorIr, detectorOr, detectorHz}; // The root node - detector @@ -122,14 +124,15 @@ BOOST_AUTO_TEST_CASE(BlueprintCylindricalGapFilling) { // A pixel system std::vector pixelBoundaries = {pixelIr, pixelOr, detectorHz}; - std::vector pixelBinning = {Acts::BinningValue::binZ}; + std::vector pixelBinning = {Acts::AxisDirection::AxisZ}; auto pixel = std::make_unique( "pixel", Acts::Transform3::Identity(), Acts::VolumeBounds::eCylinder, pixelBoundaries, pixelBinning); // Nec: Small differences to check if the adjustments are made std::vector pixelEcBoundaries = {pixelIr, pixelOr - 5., pixelEcHz}; - std::vector pixelEcBinning = {Acts::BinningValue::binZ}; + std::vector pixelEcBinning = { + Acts::AxisDirection::AxisZ}; auto pixelNec = std::make_unique( "pixelNec", @@ -150,8 +153,8 @@ BOOST_AUTO_TEST_CASE(BlueprintCylindricalGapFilling) { // Barrel std::vector pixelBarrelBoundaries = {pixelIr + 1, pixelOr - 1., detectorHz - 2 * pixelEcHz}; - std::vector pixelBarrelBinning = { - Acts::BinningValue::binR}; + std::vector pixelBarrelBinning = { + Acts::AxisDirection::AxisR}; auto pixelBarrel = std::make_unique( "pixelBarrel", Acts::Transform3::Identity(), @@ -260,7 +263,8 @@ BOOST_AUTO_TEST_CASE(BlueprintCylindricalGapException) { // The root node - detector std::vector detectorBoundaries = {0., 50., 100.}; - std::vector detectorBinning = {Acts::BinningValue::binX}; + std::vector detectorBinning = { + Acts::AxisDirection::AxisX}; auto detector = std::make_unique( "detector", Acts::Transform3::Identity(), Acts::VolumeBounds::eCylinder, detectorBoundaries, detectorBinning); diff --git a/Tests/UnitTests/Core/Detector/BlueprintTests.cpp b/Tests/UnitTests/Core/Detector/BlueprintTests.cpp index 72be3a15c77..2c4a090d24f 100644 --- a/Tests/UnitTests/Core/Detector/BlueprintTests.cpp +++ b/Tests/UnitTests/Core/Detector/BlueprintTests.cpp @@ -23,7 +23,7 @@ BOOST_AUTO_TEST_CASE(BlueprintTest) { std::vector bValues = {0., 10., 100.}; // Create root node - std::vector binning = {Acts::BinningValue::binR}; + std::vector binning = {Acts::AxisDirection::AxisR}; auto root = std::make_unique( "detector", Acts::Transform3::Identity(), Acts::VolumeBounds::eOther, bValues, binning); diff --git a/Tests/UnitTests/Core/Detector/CuboidalContainerBuilderTests.cpp b/Tests/UnitTests/Core/Detector/CuboidalContainerBuilderTests.cpp index 8578b282a76..bc803685b2c 100644 --- a/Tests/UnitTests/Core/Detector/CuboidalContainerBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/CuboidalContainerBuilderTests.cpp @@ -125,15 +125,15 @@ BOOST_AUTO_TEST_CASE(CuboidalContainerBuilder_Misconfiguration) { std::invalid_argument); // misconfiguration - 1D binning not in x, y, z misCfg.builders = {nullptr}; - misCfg.binning = Acts::BinningValue::binR; + misCfg.binning = Acts::AxisDirection::AxisR; BOOST_CHECK_THROW(auto b = CuboidalContainerBuilder(misCfg), std::invalid_argument); } BOOST_AUTO_TEST_CASE(CuboidalContainerBuildingXYZVolumes) { - std::array binningValues = {Acts::BinningValue::binX, - Acts::BinningValue::binY, - Acts::BinningValue::binZ}; + std::array binningValues = { + Acts::AxisDirection::AxisX, Acts::AxisDirection::AxisY, + Acts::AxisDirection::AxisZ}; for (auto bVal : binningValues) { // A perfect box shape auto box = Acts::CuboidVolumeBounds(10, 10, 10); diff --git a/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp b/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp index 8711a2847ab..e5259d79587 100644 --- a/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp +++ b/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp @@ -95,7 +95,7 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { double pixelZ = 10; // Create root node - std::vector detectorBins = {Acts::BinningValue::binX}; + std::vector detectorBins = {Acts::AxisDirection::AxisX}; std::vector detectorBounds = {detectorX, detectorY, detectorZ}; // The root node - detector @@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { // Left arm std::vector leftArmBounds = {detectorX * 0.5, detectorY, detectorZ}; - std::vector leftArmBins = {Acts::BinningValue::binZ}; + std::vector leftArmBins = {Acts::AxisDirection::AxisZ}; Acts::Transform3 leftArmTransform = Acts::Transform3::Identity() * @@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { // Right arm std::vector rightArmBounds = {detectorX * 0.5, detectorY, detectorZ}; - std::vector rightArmBins = {Acts::BinningValue::binZ}; + std::vector rightArmBins = {Acts::AxisDirection::AxisZ}; Acts::Transform3 rightArmTransform = Acts::Transform3::Identity() * Acts::Translation3(detectorX * 0.5, 0., 0); @@ -258,76 +258,76 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { double internalStretchLeftZ = detector->volumes()[0] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binZ)] + + .values()[toUnderlying(Acts::AxisDirection::AxisZ)] + detector->volumes()[1] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binZ)] + + .values()[toUnderlying(Acts::AxisDirection::AxisZ)] + detector->volumes()[2] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binZ)] + + .values()[toUnderlying(Acts::AxisDirection::AxisZ)] + detector->volumes()[3] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binZ)] + + .values()[toUnderlying(Acts::AxisDirection::AxisZ)] + detector->volumes()[4] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binZ)]; + .values()[toUnderlying(Acts::AxisDirection::AxisZ)]; double internalStretchRightZ = detector->volumes()[5] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binZ)] + + .values()[toUnderlying(Acts::AxisDirection::AxisZ)] + detector->volumes()[6] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binZ)] + + .values()[toUnderlying(Acts::AxisDirection::AxisZ)] + detector->volumes()[7] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binZ)] + + .values()[toUnderlying(Acts::AxisDirection::AxisZ)] + detector->volumes()[8] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binZ)] + + .values()[toUnderlying(Acts::AxisDirection::AxisZ)] + detector->volumes()[9] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binZ)]; + .values()[toUnderlying(Acts::AxisDirection::AxisZ)]; double internalStretchX1 = detector->volumes()[0] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binX)] + + .values()[toUnderlying(Acts::AxisDirection::AxisX)] + detector->volumes()[5] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binX)]; + .values()[toUnderlying(Acts::AxisDirection::AxisX)]; double internalStretchX2 = detector->volumes()[1] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binX)] + + .values()[toUnderlying(Acts::AxisDirection::AxisX)] + detector->volumes()[6] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binX)]; + .values()[toUnderlying(Acts::AxisDirection::AxisX)]; double internalStretchX3 = detector->volumes()[2] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binX)] + + .values()[toUnderlying(Acts::AxisDirection::AxisX)] + detector->volumes()[7] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binX)]; + .values()[toUnderlying(Acts::AxisDirection::AxisX)]; double internalStretchX4 = detector->volumes()[3] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binX)] + + .values()[toUnderlying(Acts::AxisDirection::AxisX)] + detector->volumes()[8] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binX)]; + .values()[toUnderlying(Acts::AxisDirection::AxisX)]; double internalStretchX5 = detector->volumes()[4] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binX)] + + .values()[toUnderlying(Acts::AxisDirection::AxisX)] + detector->volumes()[9] ->volumeBounds() - .values()[toUnderlying(Acts::BinningValue::binX)]; + .values()[toUnderlying(Acts::AxisDirection::AxisX)]; BOOST_CHECK_EQUAL(internalStretchLeftZ, detectorZ); BOOST_CHECK_EQUAL(internalStretchRightZ, detectorZ); @@ -338,9 +338,9 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { BOOST_CHECK_EQUAL(internalStretchX5, detectorX); for (auto& volume : detector->volumes()) { - BOOST_CHECK_EQUAL( - volume->volumeBounds().values()[toUnderlying(Acts::BinningValue::binY)], - detectorY); + BOOST_CHECK_EQUAL(volume->volumeBounds() + .values()[toUnderlying(Acts::AxisDirection::AxisY)], + detectorY); } // There should be surfaces inside the pixel diff --git a/Tests/UnitTests/Core/Detector/CuboidalDetectorHelperTests.cpp b/Tests/UnitTests/Core/Detector/CuboidalDetectorHelperTests.cpp index 0f7e453ef35..388b9410d69 100644 --- a/Tests/UnitTests/Core/Detector/CuboidalDetectorHelperTests.cpp +++ b/Tests/UnitTests/Core/Detector/CuboidalDetectorHelperTests.cpp @@ -50,15 +50,15 @@ BOOST_AUTO_TEST_CASE(CubicVolumeExceptions) { volumeA, volumeB}; BOOST_CHECK_THROW(Acts::Experimental::detail::CuboidalDetectorHelper::connect( - tContext, volumes, Acts::BinningValue::binX, {}, + tContext, volumes, Acts::AxisDirection::AxisX, {}, Acts::Logging::VERBOSE), std::invalid_argument); } BOOST_AUTO_TEST_CASE(SimpleBoxConnection) { - std::array binningValues = {Acts::BinningValue::binX, - Acts::BinningValue::binY, - Acts::BinningValue::binZ}; + std::array binningValues = { + Acts::AxisDirection::AxisX, Acts::AxisDirection::AxisY, + Acts::AxisDirection::AxisZ}; for (auto bVal : binningValues) { // A perfect box shape auto box = std::make_shared(10, 10, 10); @@ -91,15 +91,15 @@ BOOST_AUTO_TEST_CASE(SimpleBoxConnection) { Acts::ObjVisualization3D obj; Acts::GeometryView3D::drawDetectorVolume(obj, *volumeA, tContext); Acts::GeometryView3D::drawDetectorVolume(obj, *volumeB, tContext); - obj.write("ConnectectBoxesRegular_" + Acts::binningValueName(bVal) + + obj.write("ConnectectBoxesRegular_" + Acts::axisDirectionName(bVal) + ".obj"); } } BOOST_AUTO_TEST_CASE(IrregularBoxConnectionInZ) { - std::vector binningValues = {Acts::BinningValue::binX, - Acts::BinningValue::binY, - Acts::BinningValue::binZ}; + std::vector binningValues = {Acts::AxisDirection::AxisX, + Acts::AxisDirection::AxisY, + Acts::AxisDirection::AxisZ}; using HlPos = std::array; using VolHlPos = std::array; @@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(IrregularBoxConnectionInZ) { Acts::GeometryView3D::drawDetectorVolume(obj, *volumeA, tContext); Acts::GeometryView3D::drawDetectorVolume(obj, *volumeB, tContext); Acts::GeometryView3D::drawDetectorVolume(obj, *volumeC, tContext); - obj.write("ConnectectBoxesIrregular_" + Acts::binningValueName(bVal) + + obj.write("ConnectectBoxesIrregular_" + Acts::axisDirectionName(bVal) + trstr + ".obj"); } } @@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(ContainerConnection) { // Move it into the bval direction auto transformB = Acts::Transform3::Identity(); Acts::Vector3 translationB = Acts::Vector3::Zero(); - translationB[toUnderlying(Acts::BinningValue::binX)] = 20; + translationB[toUnderlying(Acts::AxisDirection::AxisX)] = 20; transformB.pretranslate(translationB); // Create volume B auto volumeB = Acts::Experimental::DetectorVolumeFactory::construct( @@ -201,14 +201,14 @@ BOOST_AUTO_TEST_CASE(ContainerConnection) { volumeA, volumeB}; auto containerAB = Acts::Experimental::detail::CuboidalDetectorHelper::connect( - tContext, volumes, Acts::BinningValue::binX, {}, + tContext, volumes, Acts::AxisDirection::AxisX, {}, Acts::Logging::VERBOSE); // Create a CD container auto transformC = Acts::Transform3::Identity(); Acts::Vector3 translationC = Acts::Vector3::Zero(); - translationC[toUnderlying(Acts::BinningValue::binY)] = 20; + translationC[toUnderlying(Acts::AxisDirection::AxisY)] = 20; transformC.pretranslate(translationC); auto volumeC = Acts::Experimental::DetectorVolumeFactory::construct( @@ -217,8 +217,8 @@ BOOST_AUTO_TEST_CASE(ContainerConnection) { auto transformD = Acts::Transform3::Identity(); Acts::Vector3 translationD = Acts::Vector3::Zero(); - translationD[toUnderlying(Acts::BinningValue::binX)] = 20; - translationD[toUnderlying(Acts::BinningValue::binY)] = 20; + translationD[toUnderlying(Acts::AxisDirection::AxisX)] = 20; + translationD[toUnderlying(Acts::AxisDirection::AxisY)] = 20; transformD.pretranslate(translationD); auto volumeD = Acts::Experimental::DetectorVolumeFactory::construct( @@ -228,12 +228,12 @@ BOOST_AUTO_TEST_CASE(ContainerConnection) { volumes = {volumeC, volumeD}; auto containerCD = Acts::Experimental::detail::CuboidalDetectorHelper::connect( - tContext, volumes, Acts::BinningValue::binX, {}, + tContext, volumes, Acts::AxisDirection::AxisX, {}, Acts::Logging::VERBOSE); auto containerABCD = Acts::Experimental::detail::CuboidalDetectorHelper::connect( - tContext, {containerAB, containerCD}, Acts::BinningValue::binY, {}, + tContext, {containerAB, containerCD}, Acts::AxisDirection::AxisY, {}, Acts::Logging::VERBOSE); // Check the container is constructed diff --git a/Tests/UnitTests/Core/Detector/CylindricalContainerBuilderTests.cpp b/Tests/UnitTests/Core/Detector/CylindricalContainerBuilderTests.cpp index 3ee5c24cda3..52a93cfc0ea 100644 --- a/Tests/UnitTests/Core/Detector/CylindricalContainerBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/CylindricalContainerBuilderTests.cpp @@ -84,19 +84,19 @@ BOOST_AUTO_TEST_CASE(CylindricaContainerBuilder_Misconfiguration) { std::invalid_argument); // misconfiguration - 1D binning not in z, r, phi misCfg.builders = {nullptr}; - misCfg.binning = {Acts::BinningValue::binX}; + misCfg.binning = {Acts::AxisDirection::AxisX}; BOOST_CHECK_THROW(auto b = CylindricalContainerBuilder(misCfg), std::invalid_argument); // misconfiguration - 2D binning not in z, r, misCfg.builders = {nullptr, nullptr}; - misCfg.binning = {Acts::BinningValue::binZ, Acts::BinningValue::binPhi}; + misCfg.binning = {Acts::AxisDirection::AxisZ, Acts::AxisDirection::AxisPhi}; BOOST_CHECK_THROW(auto c = CylindricalContainerBuilder(misCfg), std::invalid_argument); // misconfiguration - 2D binning in z, r, but not exactly 2 builders misCfg.builders = {nullptr, nullptr, nullptr}; - misCfg.binning = {Acts::BinningValue::binZ, Acts::BinningValue::binR}; + misCfg.binning = {Acts::AxisDirection::AxisZ, Acts::AxisDirection::AxisR}; BOOST_CHECK_THROW(auto d = CylindricalContainerBuilder(misCfg), std::invalid_argument); } @@ -127,12 +127,12 @@ BOOST_AUTO_TEST_CASE(CylindricaContainerBuildingZ) { CylindricalContainerBuilder::Config tripleZCfg; tripleZCfg.auxiliary = "*** Test 0 - Build triple in Z ***"; tripleZCfg.builders = {negDisc, barrel, posDisc}; - tripleZCfg.binning = {BinningValue::binZ}; + tripleZCfg.binning = {AxisDirection::AxisZ}; tripleZCfg.geoIdGenerator = std::make_shared(); // Create a materialBinning tripleZCfg.portalMaterialBinning[2u] = BinningDescription{ - {ProtoBinning(BinningValue::binZ, Acts::AxisBoundaryType::Bound, 50), - ProtoBinning(BinningValue::binPhi, Acts::AxisBoundaryType::Closed, + {ProtoBinning(AxisDirection::AxisZ, Acts::AxisBoundaryType::Bound, 50), + ProtoBinning(AxisDirection::AxisPhi, Acts::AxisBoundaryType::Closed, -std::numbers::pi, std::numbers::pi, 12)}}; // Let's test the reverse generation @@ -180,7 +180,7 @@ BOOST_AUTO_TEST_CASE(CylindricaContainerBuildingR) { CylindricalContainerBuilder::Config barrelRCfg; barrelRCfg.auxiliary = "*** Test 1 - Build multilayer barrel ***"; barrelRCfg.builders = {barrel0, barrel1, barrel2}; - barrelRCfg.binning = {BinningValue::binR}; + barrelRCfg.binning = {AxisDirection::AxisR}; barrelRCfg.geoIdGenerator = std::make_shared(); auto barrelR = std::make_shared( @@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE(CylindricaContainerBuildingPhi) { // Create the container builder CylindricalContainerBuilder::Config barrelPhiCfg; barrelPhiCfg.auxiliary = "*** Test 2 - Build segmented phi barrel ***"; - barrelPhiCfg.binning = {BinningValue::binPhi}; + barrelPhiCfg.binning = {AxisDirection::AxisPhi}; unsigned int phiSectors = 5; double phiHalfSector = std::numbers::pi / phiSectors; @@ -267,7 +267,7 @@ BOOST_AUTO_TEST_CASE(CylindricalContainerBuilderDetector) { // Create the barrel container builder CylindricalContainerBuilder::Config barrelRCfg; barrelRCfg.builders = {barrel0, barrel1, barrel2}; - barrelRCfg.binning = {BinningValue::binR}; + barrelRCfg.binning = {AxisDirection::AxisR}; auto barrel = std::make_shared( barrelRCfg, getDefaultLogger("BarrelBuilderR", Logging::VERBOSE)); @@ -282,7 +282,7 @@ BOOST_AUTO_TEST_CASE(CylindricalContainerBuilderDetector) { // Create the barrel container builder CylindricalContainerBuilder::Config barrelEndcapCfg; barrelEndcapCfg.builders = {endcapN, barrel, endcapP}; - barrelEndcapCfg.binning = {BinningValue::binZ}; + barrelEndcapCfg.binning = {AxisDirection::AxisZ}; auto barrelEndcap = std::make_shared( barrelEndcapCfg, @@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE(CylindricalContainerBuilderDetector) { // Create the barrel container builder CylindricalContainerBuilder::Config detectorCfg; detectorCfg.builders = {beampipe, barrelEndcap}; - detectorCfg.binning = {BinningValue::binR}; + detectorCfg.binning = {AxisDirection::AxisR}; auto detector = std::make_shared( detectorCfg, getDefaultLogger("DetectorBuilder", Logging::VERBOSE)); diff --git a/Tests/UnitTests/Core/Detector/CylindricalDetectorFromBlueprintTests.cpp b/Tests/UnitTests/Core/Detector/CylindricalDetectorFromBlueprintTests.cpp index 2a3a45518ee..0323b844921 100644 --- a/Tests/UnitTests/Core/Detector/CylindricalDetectorFromBlueprintTests.cpp +++ b/Tests/UnitTests/Core/Detector/CylindricalDetectorFromBlueprintTests.cpp @@ -91,7 +91,8 @@ BOOST_AUTO_TEST_CASE(CylindricalDetectorFromBlueprintTest) { double pixelEcLayerHz = 10; // Create root node - std::vector detectorBinning = {Acts::BinningValue::binR}; + std::vector detectorBinning = { + Acts::AxisDirection::AxisR}; std::vector detectorBoundaries = {detectorIr, detectorOr, detectorHz}; // The root node - detector @@ -112,14 +113,15 @@ BOOST_AUTO_TEST_CASE(CylindricalDetectorFromBlueprintTest) { // A pixel system std::vector pixelBoundaries = {pixelIr, pixelOr, detectorHz}; - std::vector pixelBinning = {Acts::BinningValue::binZ}; + std::vector pixelBinning = {Acts::AxisDirection::AxisZ}; auto pixel = std::make_unique( "pixel", Acts::Transform3::Identity(), Acts::VolumeBounds::eCylinder, pixelBoundaries, pixelBinning); // Nec: Small differences to check if the adjustments are made std::vector pixelEcBoundaries = {pixelIr, pixelOr - 5., pixelEcHz}; - std::vector pixelEcBinning = {Acts::BinningValue::binZ}; + std::vector pixelEcBinning = { + Acts::AxisDirection::AxisZ}; Acts::Transform3 pixelNecTransform = Acts::Transform3::Identity() * @@ -146,8 +148,8 @@ BOOST_AUTO_TEST_CASE(CylindricalDetectorFromBlueprintTest) { // Barrel std::vector pixelBarrelBoundaries = {pixelIr + 1, pixelOr - 1., detectorHz - 2 * pixelEcHz}; - std::vector pixelBarrelBinning = { - Acts::BinningValue::binR}; + std::vector pixelBarrelBinning = { + Acts::AxisDirection::AxisR}; auto pixelBarrel = std::make_unique( "pixel_barrel", Acts::Transform3::Identity(), @@ -205,8 +207,8 @@ BOOST_AUTO_TEST_CASE(CylindricalDetectorFromBlueprintTest) { detectorBpr->add(std::move(pixel)); // An Indexed volume finder will be attached - std::vector rootVolumeBinning = { - Acts::BinningValue::binZ, Acts::BinningValue::binR}; + std::vector rootVolumeBinning = { + Acts::AxisDirection::AxisZ, Acts::AxisDirection::AxisR}; detectorBpr->rootVolumeFinderBuilder = std::make_shared( rootVolumeBinning); diff --git a/Tests/UnitTests/Core/Detector/DetectorVolumeBuilderTests.cpp b/Tests/UnitTests/Core/Detector/DetectorVolumeBuilderTests.cpp index 7b0a551f36e..c23abf8339e 100644 --- a/Tests/UnitTests/Core/Detector/DetectorVolumeBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/DetectorVolumeBuilderTests.cpp @@ -161,8 +161,8 @@ BOOST_AUTO_TEST_CASE(DetectorVolumeBuilder_EmptyVolume) { // Assign proto material to dvCfg.portalMaterialBinning[2u] = BinningDescription{ - {ProtoBinning(BinningValue::binZ, Acts::AxisBoundaryType::Bound, 50), - ProtoBinning(BinningValue::binPhi, Acts::AxisBoundaryType::Closed, + {ProtoBinning(AxisDirection::AxisZ, Acts::AxisBoundaryType::Bound, 50), + ProtoBinning(AxisDirection::AxisPhi, Acts::AxisBoundaryType::Closed, -std::numbers::pi, std::numbers::pi, 12)}}; auto dvBuilder = std::make_shared( diff --git a/Tests/UnitTests/Core/Detector/DetectorVolumeConsistencyTests.cpp b/Tests/UnitTests/Core/Detector/DetectorVolumeConsistencyTests.cpp index d46133b4760..f96ce7ab4a0 100644 --- a/Tests/UnitTests/Core/Detector/DetectorVolumeConsistencyTests.cpp +++ b/Tests/UnitTests/Core/Detector/DetectorVolumeConsistencyTests.cpp @@ -33,8 +33,8 @@ BOOST_AUTO_TEST_CASE(DetectorVolumeConsistencyFail) { // Move it into the bval direction auto transformB = Acts::Transform3::Identity(); Acts::Vector3 translationB = Acts::Vector3::Zero(); - translationB[toUnderlying(Acts::BinningValue::binX)] = 20; - translationB[toUnderlying(Acts::BinningValue::binY)] = 5; + translationB[toUnderlying(Acts::AxisDirection::AxisX)] = 20; + translationB[toUnderlying(Acts::AxisDirection::AxisY)] = 5; transformB.pretranslate(translationB); // Create volume B auto volumeB = Acts::Experimental::DetectorVolumeFactory::construct( @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(DetectorVolumeConsistencyFail) { BOOST_CHECK_THROW(Acts::Experimental::detail::DetectorVolumeConsistency:: checkCenterAlignment(tContext, {volumeA, volumeB}, - Acts::BinningValue::binX), + Acts::AxisDirection::AxisX), std::invalid_argument); } @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(DetectorVolumeConsistencyPass) { // Move it into the bval direction auto transformB = Acts::Transform3::Identity(); Acts::Vector3 translationB = Acts::Vector3::Zero(); - translationB[toUnderlying(Acts::BinningValue::binX)] = 20; + translationB[toUnderlying(Acts::AxisDirection::AxisX)] = 20; transformB.pretranslate(translationB); // Create volume B auto volumeB = Acts::Experimental::DetectorVolumeFactory::construct( @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(DetectorVolumeConsistencyPass) { BOOST_CHECK_NO_THROW(Acts::Experimental::detail::DetectorVolumeConsistency:: checkCenterAlignment(tContext, {volumeA, volumeB}, - Acts::BinningValue::binX)); + Acts::AxisDirection::AxisX)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Core/Detector/DetectorVolumeTests.cpp b/Tests/UnitTests/Core/Detector/DetectorVolumeTests.cpp index 7c050c564bc..35f398b184b 100644 --- a/Tests/UnitTests/Core/Detector/DetectorVolumeTests.cpp +++ b/Tests/UnitTests/Core/Detector/DetectorVolumeTests.cpp @@ -185,10 +185,10 @@ BOOST_AUTO_TEST_CASE(CylindricalDetectorVolumePortals) { // Check the extent auto volumeExtent = tubeCylinderVolume->extent(tContext, 1); - CHECK_CLOSE_ABS(volumeExtent.min(Acts::BinningValue::binR), 10., 10e-5); - CHECK_CLOSE_ABS(volumeExtent.max(Acts::BinningValue::binR), 100., 10e-5); - CHECK_CLOSE_ABS(volumeExtent.min(Acts::BinningValue::binZ), -200., 10e-5); - CHECK_CLOSE_ABS(volumeExtent.max(Acts::BinningValue::binZ), 200., 10e-5); + CHECK_CLOSE_ABS(volumeExtent.min(Acts::AxisDirection::AxisR), 10., 10e-5); + CHECK_CLOSE_ABS(volumeExtent.max(Acts::AxisDirection::AxisR), 100., 10e-5); + CHECK_CLOSE_ABS(volumeExtent.min(Acts::AxisDirection::AxisZ), -200., 10e-5); + CHECK_CLOSE_ABS(volumeExtent.max(Acts::AxisDirection::AxisZ), 200., 10e-5); } BOOST_AUTO_TEST_CASE(UpdatePortal) { diff --git a/Tests/UnitTests/Core/Detector/IndexedRootVolumeFinderBuilderTests.cpp b/Tests/UnitTests/Core/Detector/IndexedRootVolumeFinderBuilderTests.cpp index f505e901236..30c9a1f9ce5 100644 --- a/Tests/UnitTests/Core/Detector/IndexedRootVolumeFinderBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/IndexedRootVolumeFinderBuilderTests.cpp @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(IndexedRootVolumeFinderBuilderCylindrical) { innerV, middleLV, middleDV, middleUV, middleRV, outerV}; IndexedRootVolumeFinderBuilder builder( - {Acts::BinningValue::binZ, Acts::BinningValue::binR}); + {Acts::AxisDirection::AxisZ, Acts::AxisDirection::AxisR}); // Let's construct a detector auto rootVolumeFinder = builder.construct(tContext, rootVolumes); diff --git a/Tests/UnitTests/Core/Detector/IndexedSurfaceGridFillerTests.cpp b/Tests/UnitTests/Core/Detector/IndexedSurfaceGridFillerTests.cpp index ffe66a708c6..62a25480ef2 100644 --- a/Tests/UnitTests/Core/Detector/IndexedSurfaceGridFillerTests.cpp +++ b/Tests/UnitTests/Core/Detector/IndexedSurfaceGridFillerTests.cpp @@ -20,7 +20,7 @@ #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Enumerate.hpp" #include "Acts/Utilities/Grid.hpp" @@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE(IndexGridXYOneSurfaceCenter) { // Indexed Surface grid IndexedSurfacesNavigation indexedGridXY( - std::move(gridXY), {BinningValue::binX, BinningValue::binY}); + std::move(gridXY), {AxisDirection::AxisX, AxisDirection::AxisY}); // Create a single surface in the center auto rBounds = std::make_shared(4., 4.); @@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(IndexGridXYOneSurfaceBinValue) { // Indexed Surface grid IndexedSurfacesNavigation indexedGridXY( - std::move(gridXY), {BinningValue::binX, BinningValue::binY}); + std::move(gridXY), {AxisDirection::AxisX, AxisDirection::AxisY}); // Create a single surface in the center auto rBounds = std::make_shared(4., 4.); @@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE(IndexGridXYOneSurfaceBinValue) { IndexedGridFiller filler{{}}; filler.oLogger = getDefaultLogger("IndexGridFiller", Logging::VERBOSE); - BinningValueReferenceGenerator generator; + AxisDirectionReferenceGenerator generator; std::vector> surfaces = {pSurface}; // Fill the surface @@ -200,7 +200,7 @@ BOOST_AUTO_TEST_CASE(IndexGridXYOneSurfacePolyhedron) { // Indexed Surface grid IndexedSurfacesNavigation indexedGridXY( - std::move(gridXY), {BinningValue::binX, BinningValue::binY}); + std::move(gridXY), {AxisDirection::AxisX, AxisDirection::AxisY}); // Create a single surface in the center auto rBounds = std::make_shared(4., 4.); @@ -237,7 +237,7 @@ BOOST_AUTO_TEST_CASE(IndexGridXYOneSurfacePolyhedronBinExpansion) { // Indexed Surface grid IndexedSurfacesNavigation indexedGridXY( - std::move(gridXY), {BinningValue::binX, BinningValue::binY}); + std::move(gridXY), {AxisDirection::AxisX, AxisDirection::AxisY}); // Create a single surface in the center auto rBounds = std::make_shared(4., 4.); @@ -274,7 +274,7 @@ BOOST_AUTO_TEST_CASE(IndexGridZPhiYOneSurfacePolyhedronBinExpansion) { // Indexed Surface grid IndexedSurfacesNavigation indexedGridZPhi( - std::move(gridZPhi), {BinningValue::binZ, BinningValue::binPhi}); + std::move(gridZPhi), {AxisDirection::AxisZ, AxisDirection::AxisPhi}); auto cBounds = std::make_shared(10, 2., std::numbers::pi / 30, 0.); @@ -312,7 +312,7 @@ BOOST_AUTO_TEST_CASE(IndexGridZPhiYOneSurfaceMPIPolyhedronBinExpansion) { // Indexed Surface grid IndexedSurfacesNavigation indexedGridZPhi( - std::move(gridZPhi), {BinningValue::binZ, BinningValue::binPhi}); + std::move(gridZPhi), {AxisDirection::AxisZ, AxisDirection::AxisPhi}); auto cBounds = std::make_shared(10, 2., std::numbers::pi / 10, 0.); diff --git a/Tests/UnitTests/Core/Detector/IndexedSurfacesGeneratorTests.cpp b/Tests/UnitTests/Core/Detector/IndexedSurfacesGeneratorTests.cpp index f95adbdcb3b..4d0bbe9634e 100644 --- a/Tests/UnitTests/Core/Detector/IndexedSurfacesGeneratorTests.cpp +++ b/Tests/UnitTests/Core/Detector/IndexedSurfacesGeneratorTests.cpp @@ -20,7 +20,7 @@ #include "Acts/Surfaces/RadialBounds.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Delegate.hpp" #include "Acts/Utilities/Enumerate.hpp" @@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(RingDisc1D) { 55., 0., 2., 22u); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {BinningValue::binPhi}}; + irSurfaces{rSurfaces, {}, {AxisDirection::AxisPhi}}; GridAxisGenerators::EqClosed aGenerator{{-std::numbers::pi, std::numbers::pi}, 44u}; @@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE(RingDisc1DWithSupport) { rSurfaces.push_back(dSurface.get()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {rSurfaces.size() - 1u}, {BinningValue::binPhi}}; + irSurfaces{rSurfaces, {rSurfaces.size() - 1u}, {AxisDirection::AxisPhi}}; GridAxisGenerators::EqClosed aGenerator{{-std::numbers::pi, std::numbers::pi}, 44u}; @@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(RingDisc2D) { rSurfaces.insert(rSurfaces.end(), rSurfacesR1.begin(), rSurfacesR1.end()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}}; + irSurfaces{rSurfaces, {}, {AxisDirection::AxisR, AxisDirection::AxisPhi}}; GridAxisGenerators::VarBoundEqClosed aGenerator{ {24., 74., 110.}, {-std::numbers::pi, std::numbers::pi}, 44u}; @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(RingDisc2DFine) { rSurfaces.insert(rSurfaces.end(), rSurfacesR2.begin(), rSurfacesR2.end()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}}; + irSurfaces{rSurfaces, {}, {AxisDirection::AxisR, AxisDirection::AxisPhi}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {24., 152}, 8u, {-std::numbers::pi, std::numbers::pi}, 88u}; @@ -241,8 +241,10 @@ BOOST_AUTO_TEST_CASE(RingDisc2DFineExpanded) { rSurfaces.insert(rSurfaces.end(), rSurfacesR2.begin(), rSurfacesR2.end()); IndexedSurfacesGenerator - irSurfaces{ - rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}, {2u, 4u}}; + irSurfaces{rSurfaces, + {}, + {AxisDirection::AxisR, AxisDirection::AxisPhi}, + {2u, 4u}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {24., 152}, 8u, {-std::numbers::pi, std::numbers::pi}, 88u}; @@ -276,8 +278,10 @@ BOOST_AUTO_TEST_CASE(Cylinder2D) { 116., 3., 2., {52, 14}); IndexedSurfacesGenerator - icSurfaces{ - surfaces, {}, {BinningValue::binZ, BinningValue::binPhi}, {1u, 1u}}; + icSurfaces{surfaces, + {}, + {AxisDirection::AxisZ, AxisDirection::AxisPhi}, + {1u, 1u}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {-500., 500}, 28, {-std::numbers::pi, std::numbers::pi}, 52u}; diff --git a/Tests/UnitTests/Core/Detector/KdtSurfacesProviderTests.cpp b/Tests/UnitTests/Core/Detector/KdtSurfacesProviderTests.cpp index 254ded41d52..d12f0874a6c 100644 --- a/Tests/UnitTests/Core/Detector/KdtSurfacesProviderTests.cpp +++ b/Tests/UnitTests/Core/Detector/KdtSurfacesProviderTests.cpp @@ -99,12 +99,12 @@ BOOST_AUTO_TEST_CASE(KdtSurfacesProvider) { using KDTS = Acts::Experimental::KdtSurfaces<>; auto skdt = std::make_shared( - KDTS(tContext, pSurfaces, {BinningValue::binZ, BinningValue::binR})); + KDTS(tContext, pSurfaces, {AxisDirection::AxisZ, AxisDirection::AxisR})); // query: Negative disc 3, it should yield 22 surfaces Acts::Extent regionND3; - regionND3.set(BinningValue::binZ, -820, -780); - regionND3.set(BinningValue::binR, 0., 200.); + regionND3.set(AxisDirection::AxisZ, -820, -780); + regionND3.set(AxisDirection::AxisR, 0., 200.); Acts::Experimental::KdtSurfacesProvider<> end3(skdt, regionND3); auto nd3 = end3.surfaces(tContext); @@ -112,8 +112,8 @@ BOOST_AUTO_TEST_CASE(KdtSurfacesProvider) { // query: 2nd Pixel barrel Acts::Extent regionB1; - regionB1.set(BinningValue::binZ, -580, 580); - regionB1.set(BinningValue::binR, 60., 80.); + regionB1.set(AxisDirection::AxisZ, -580, 580); + regionB1.set(AxisDirection::AxisR, 60., 80.); Acts::Experimental::KdtSurfacesProvider<> ba1(skdt, regionB1); diff --git a/Tests/UnitTests/Core/Detector/LayerStructureBuilderTests.cpp b/Tests/UnitTests/Core/Detector/LayerStructureBuilderTests.cpp index bf4009335c6..cb36e6cf99f 100644 --- a/Tests/UnitTests/Core/Detector/LayerStructureBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/LayerStructureBuilderTests.cpp @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationRing) { lsConfig.auxiliary = "*** Endcap with 22 surfaces ***"; lsConfig.surfacesProvider = endcapSurfaces; lsConfig.binnings = { - ProtoBinning(Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, + ProtoBinning(Acts::AxisDirection::AxisPhi, Acts::AxisBoundaryType::Closed, -std::numbers::pi, std::numbers::pi, 22u, 1u)}; auto endcapBuilder = Acts::Experimental::LayerStructureBuilder( @@ -89,8 +89,8 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationRing) { LayerSupport supportDisc; supportDisc.type = Acts::Surface::SurfaceType::Disc; supportDisc.offset = 15.; - supportDisc.internalConstraints = {Acts::BinningValue::binZ, - Acts::BinningValue::binR}; + supportDisc.internalConstraints = {Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR}; lsConfig.auxiliary = "*** Endcap with 22 surfaces + 1 support disc, " @@ -118,9 +118,9 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationRing) { // clearance: z is still from internals, but r is from the volume/external // // Second test with one support disc, but external constraint - supportDisc.internalConstraints = {Acts::BinningValue::binZ}; - supportDisc.volumeExtent.set(Acts::BinningValue::binR, 10., 120.); - supportDisc.volumeClearance[Acts::BinningValue::binR] = {2., 1.}; + supportDisc.internalConstraints = {Acts::AxisDirection::AxisZ}; + supportDisc.volumeExtent.set(Acts::AxisDirection::AxisR, 10., 120.); + supportDisc.volumeClearance[Acts::AxisDirection::AxisR] = {2., 1.}; lsConfig.supports = {supportDisc}; @@ -187,11 +187,11 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationCylinder) { lsConfig.auxiliary = "*** Barrel with 448 surfaces ***"; lsConfig.surfacesProvider = barrelSurfaces; lsConfig.binnings = { - Acts::Experimental::ProtoBinning{Acts::BinningValue::binZ, + Acts::Experimental::ProtoBinning{Acts::AxisDirection::AxisZ, Acts::AxisBoundaryType::Bound, -480., 480., 14u, 1u}, Acts::Experimental::ProtoBinning( - Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, + Acts::AxisDirection::AxisPhi, Acts::AxisBoundaryType::Closed, -std::numbers::pi, std::numbers::pi, 32u, 1u)}; auto barrelBuilder = Acts::Experimental::LayerStructureBuilder( @@ -211,8 +211,8 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationCylinder) { LayerSupport supportCylinder; supportCylinder.type = Acts::Surface::SurfaceType::Cylinder; supportCylinder.offset = 15.; - supportCylinder.internalConstraints = {Acts::BinningValue::binZ, - Acts::BinningValue::binR}; + supportCylinder.internalConstraints = {Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR}; lsConfig.supports = {supportCylinder}; lsConfig.auxiliary = "*** Barrel with 448 surfaces + 1 support cylinder, r/z evaluated ***"; @@ -229,9 +229,9 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationCylinder) { BOOST_CHECK(volumeUpdater1.connected()); // Second test: z-range externally given - supportCylinder.internalConstraints = {Acts::BinningValue::binR}; - supportCylinder.volumeExtent.set(Acts::BinningValue::binZ, -600., 600.); - supportCylinder.volumeClearance[Acts::BinningValue::binZ] = {2., 2.}; + supportCylinder.internalConstraints = {Acts::AxisDirection::AxisR}; + supportCylinder.volumeExtent.set(Acts::AxisDirection::AxisZ, -600., 600.); + supportCylinder.volumeClearance[Acts::AxisDirection::AxisZ] = {2., 2.}; lsConfig.supports = {supportCylinder}; lsConfig.auxiliary = "*** Barrel with 448 surfaces + 1 support cylinder, r evaluated, z given " diff --git a/Tests/UnitTests/Core/Detector/MultiWireStructureBuilderTests.cpp b/Tests/UnitTests/Core/Detector/MultiWireStructureBuilderTests.cpp index e9daba0e0a0..3939908064b 100644 --- a/Tests/UnitTests/Core/Detector/MultiWireStructureBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/MultiWireStructureBuilderTests.cpp @@ -72,9 +72,9 @@ BOOST_AUTO_TEST_CASE(Multi_Wire_Structure_Builder_StrawSurfacesCreation) { mlCfg.mlSurfaces = strawSurfaces; mlCfg.mlBounds = vBounds; mlCfg.mlBinning = { - ProtoBinning(Acts::BinningValue::binX, Acts::AxisBoundaryType::Bound, + ProtoBinning(Acts::AxisDirection::AxisX, Acts::AxisBoundaryType::Bound, -vBounds[0], vBounds[0], nSurfacesX, 1u), - ProtoBinning(Acts::BinningValue::binY, Acts::AxisBoundaryType::Bound, + ProtoBinning(Acts::AxisDirection::AxisY, Acts::AxisBoundaryType::Bound, -vBounds[1], vBounds[1], nSurfacesY, 0u)}; MultiWireStructureBuilder mlBuilder(mlCfg); diff --git a/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp b/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp index 46492d9f27c..269292acd2d 100644 --- a/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp +++ b/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp @@ -20,29 +20,29 @@ BOOST_AUTO_TEST_SUITE(Detector) BOOST_AUTO_TEST_CASE(ProtoBinningPlaceHolderEquidistant) { // A valid placeholder binning - auto peq = - ProtoBinning(Acts::BinningValue::binX, Acts::AxisBoundaryType::Bound, 5u); + auto peq = ProtoBinning(Acts::AxisDirection::AxisX, + Acts::AxisBoundaryType::Bound, 5u); BOOST_CHECK_EQUAL(peq.bins(), 5u); } BOOST_AUTO_TEST_CASE(ProtoBinningEquidistant) { // An invalid binning, 0 bins given - BOOST_CHECK_THROW(ProtoBinning(Acts::BinningValue::binX, + BOOST_CHECK_THROW(ProtoBinning(Acts::AxisDirection::AxisX, Acts::AxisBoundaryType::Bound, 15., 20., 0), std::invalid_argument); // Another invalid binning, min/max swapped - BOOST_CHECK_THROW(ProtoBinning(Acts::BinningValue::binX, + BOOST_CHECK_THROW(ProtoBinning(Acts::AxisDirection::AxisX, Acts::AxisBoundaryType::Bound, 150., 20., 10), std::invalid_argument); // A valid binning - auto eq = ProtoBinning(Acts::BinningValue::binX, + auto eq = ProtoBinning(Acts::AxisDirection::AxisX, Acts::AxisBoundaryType::Bound, 0., 10., 5u); std::vector reference = {0., 2., 4., 6., 8., 10.}; BOOST_CHECK_EQUAL(eq.bins(), 5u); - BOOST_CHECK_EQUAL(eq.binValue, Acts::BinningValue::binX); + BOOST_CHECK_EQUAL(eq.axisDir, Acts::AxisDirection::AxisX); BOOST_CHECK(eq.axisType == Acts::AxisType::Equidistant); BOOST_CHECK(eq.boundaryType == Acts::AxisBoundaryType::Bound); BOOST_CHECK_EQUAL_COLLECTIONS(eq.edges.begin(), eq.edges.end(), @@ -52,17 +52,17 @@ BOOST_AUTO_TEST_CASE(ProtoBinningEquidistant) { BOOST_AUTO_TEST_CASE(ProtoBinningVariable) { // An invalid binning, edge size < 2u std::vector iedges = {12.}; - BOOST_CHECK_THROW(ProtoBinning(Acts::BinningValue::binX, + BOOST_CHECK_THROW(ProtoBinning(Acts::AxisDirection::AxisX, Acts::AxisBoundaryType::Bound, iedges), std::invalid_argument); // A valid binning std::vector varEdges = {0., 12., 13., 15., 20.}; - auto var = ProtoBinning(Acts::BinningValue::binX, + auto var = ProtoBinning(Acts::AxisDirection::AxisX, Acts::AxisBoundaryType::Bound, varEdges); BOOST_CHECK_EQUAL(var.bins(), 4u); - BOOST_CHECK_EQUAL(var.binValue, Acts::BinningValue::binX); + BOOST_CHECK_EQUAL(var.axisDir, Acts::AxisDirection::AxisX); BOOST_CHECK(var.axisType == Acts::AxisType::Variable); BOOST_CHECK(var.boundaryType == Acts::AxisBoundaryType::Bound); BOOST_CHECK_EQUAL_COLLECTIONS(var.edges.begin(), var.edges.end(), @@ -71,9 +71,11 @@ BOOST_AUTO_TEST_CASE(ProtoBinningVariable) { BOOST_AUTO_TEST_CASE(BinningDescriptionFromAndToBinUtility) { // A valid binning - Acts::BinUtility bUtility(5u, 0., 10., Acts::open, Acts::BinningValue::binR); + Acts::BinUtility bUtility(5u, 0., 10., Acts::open, + Acts::AxisDirection::AxisR); std::vector edges = {-std::numbers::pi, 0.1, std::numbers::pi}; - bUtility += Acts::BinUtility(edges, Acts::closed, Acts::BinningValue::binPhi); + bUtility += + Acts::BinUtility(edges, Acts::closed, Acts::AxisDirection::AxisPhi); auto bDescription = BinningDescription::fromBinUtility(bUtility); @@ -81,7 +83,8 @@ BOOST_AUTO_TEST_CASE(BinningDescriptionFromAndToBinUtility) { // Test the first entry BOOST_CHECK_EQUAL(bDescription.binning[0].bins(), 5u); - BOOST_CHECK_EQUAL(bDescription.binning[0].binValue, Acts::BinningValue::binR); + BOOST_CHECK_EQUAL(bDescription.binning[0].axisDir, + Acts::AxisDirection::AxisR); BOOST_CHECK(bDescription.binning[0].axisType == Acts::AxisType::Equidistant); BOOST_CHECK(bDescription.binning[0].boundaryType == Acts::AxisBoundaryType::Bound); @@ -89,8 +92,8 @@ BOOST_AUTO_TEST_CASE(BinningDescriptionFromAndToBinUtility) { // Check the second entry BOOST_CHECK_EQUAL(bDescription.binning[1].bins(), 2u); - BOOST_CHECK_EQUAL(bDescription.binning[1].binValue, - Acts::BinningValue::binPhi); + BOOST_CHECK_EQUAL(bDescription.binning[1].axisDir, + Acts::AxisDirection::AxisPhi); BOOST_CHECK(bDescription.binning[1].axisType == Acts::AxisType::Variable); BOOST_CHECK(bDescription.binning[1].boundaryType == Acts::AxisBoundaryType::Closed); diff --git a/Tests/UnitTests/Core/Detector/ProtoDetectorTests.cpp b/Tests/UnitTests/Core/Detector/ProtoDetectorTests.cpp index 71d571eda37..a8d7ee5cd55 100644 --- a/Tests/UnitTests/Core/Detector/ProtoDetectorTests.cpp +++ b/Tests/UnitTests/Core/Detector/ProtoDetectorTests.cpp @@ -35,56 +35,56 @@ Acts::ProtoDetector createProtoDetector() { // Container Acts::ProtoVolume detectorVolume; detectorVolume.name = "detector-container"; - detectorVolume.extent.set(Acts::BinningValue::binZ, -2000., 2000); + detectorVolume.extent.set(Acts::AxisDirection::AxisZ, -2000., 2000); // Beam Pipe volume Acts::ProtoVolume beamPipe; beamPipe.name = "beam-pipe"; - beamPipe.extent.set(Acts::BinningValue::binR, 0., 30.); + beamPipe.extent.set(Acts::AxisDirection::AxisR, 0., 30.); // Pixel section Acts::ProtoVolume pixelContainer; pixelContainer.name = "pixel-container"; - pixelContainer.extent.set(Acts::BinningValue::binR, 40., 200); + pixelContainer.extent.set(Acts::AxisDirection::AxisR, 40., 200); // Pixel volume sub structure Acts::ProtoVolume pixelNec; pixelNec.name = "pixel-nec"; - pixelNec.extent.set(Acts::BinningValue::binZ, -1900., -600); + pixelNec.extent.set(Acts::AxisDirection::AxisZ, -1900., -600); Acts::ProtoVolume pixelBarrel; pixelBarrel.name = "pixel-barrel"; - pixelBarrel.extent.set(Acts::BinningValue::binR, 41., 199.); - pixelBarrel.extent.set(Acts::BinningValue::binZ, -550., 550.); + pixelBarrel.extent.set(Acts::AxisDirection::AxisR, 41., 199.); + pixelBarrel.extent.set(Acts::AxisDirection::AxisZ, -550., 550.); Acts::ProtoVolume pixelBarrelL0; pixelBarrelL0.name = "pixel-barrel-l0"; - pixelBarrelL0.extent.set(Acts::BinningValue::binR, 45., 50.); + pixelBarrelL0.extent.set(Acts::AxisDirection::AxisR, 45., 50.); pixelBarrelL0.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; Acts::ProtoVolume pixelBarrelL1; pixelBarrelL1.name = "pixel-barrel-l1"; - pixelBarrelL1.extent.set(Acts::BinningValue::binR, 70., 80.); + pixelBarrelL1.extent.set(Acts::AxisDirection::AxisR, 70., 80.); pixelBarrelL1.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; pixelBarrel.container = Acts::ProtoVolume::ContainerStructure{ {pixelBarrelL0, pixelBarrelL1}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1.})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 1.})}, true}; Acts::ProtoVolume pixelPec; pixelPec.name = "pixel-pec"; - pixelPec.extent.set(Acts::BinningValue::binZ, 600., 1900.); + pixelPec.extent.set(Acts::AxisDirection::AxisZ, 600., 1900.); pixelContainer.container = Acts::ProtoVolume::ContainerStructure{ {pixelNec, pixelBarrel, pixelPec}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}}; + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {0., 1})}}; detectorVolume.container = Acts::ProtoVolume::ContainerStructure{ {beamPipe, pixelContainer}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1})}}; + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 1})}}; Acts::ProtoDetector detector; detector.name = "detector"; @@ -108,10 +108,10 @@ BOOST_AUTO_TEST_CASE(ProtoTrackingGeometryTests) { auto& detectorVolume = detector.worldVolume; // The detector volume should have received maximum dimensions - CHECK_CLOSE_ABS(detectorVolume.extent.min(Acts::BinningValue::binR), 0, + CHECK_CLOSE_ABS(detectorVolume.extent.min(Acts::AxisDirection::AxisR), 0, std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(detectorVolume.extent.max(Acts::BinningValue::binR), 200., + CHECK_CLOSE_ABS(detectorVolume.extent.max(Acts::AxisDirection::AxisR), 200., std::numeric_limits::epsilon()); // The detector container should have binning in R @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(ProtoTrackingGeometryTests) { BOOST_CHECK_EQUAL(cts.constituentBinning.size(), 1u); BOOST_CHECK_EQUAL(cts.constituentBinning[0].type, Acts::arbitrary); BOOST_CHECK_EQUAL(cts.constituentBinning[0].binvalue, - Acts::BinningValue::binR); + Acts::AxisDirection::AxisR); const auto& binBoundaries = cts.constituentBinning[0].boundaries(); BOOST_CHECK_EQUAL(binBoundaries.size(), 3u); @@ -139,14 +139,14 @@ BOOST_AUTO_TEST_CASE(ProtoTrackingGeometryTests) { auto& beamPipe = cts.constituentVolumes[0u]; BOOST_CHECK_EQUAL(beamPipe.name, "beam-pipe"); - CHECK_CLOSE_ABS(beamPipe.extent.min(Acts::BinningValue::binZ), -2000., + CHECK_CLOSE_ABS(beamPipe.extent.min(Acts::AxisDirection::AxisZ), -2000., std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(beamPipe.extent.max(Acts::BinningValue::binZ), 2000., + CHECK_CLOSE_ABS(beamPipe.extent.max(Acts::AxisDirection::AxisZ), 2000., std::numeric_limits::epsilon()); // The new beam pipe radius should have been applied - CHECK_CLOSE_ABS(beamPipe.extent.max(Acts::BinningValue::binR), 35., + CHECK_CLOSE_ABS(beamPipe.extent.max(Acts::AxisDirection::AxisR), 35., std::numeric_limits::epsilon()); // The second volume is the pixel detector @@ -154,13 +154,13 @@ BOOST_AUTO_TEST_CASE(ProtoTrackingGeometryTests) { BOOST_CHECK_EQUAL(pixelContainer.name, "pixel-container"); // Pixel container should have fitting boundaries - CHECK_CLOSE_ABS(pixelContainer.extent.min(Acts::BinningValue::binR), 35., + CHECK_CLOSE_ABS(pixelContainer.extent.min(Acts::AxisDirection::AxisR), 35., std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(pixelContainer.extent.max(Acts::BinningValue::binR), 200., + CHECK_CLOSE_ABS(pixelContainer.extent.max(Acts::AxisDirection::AxisR), 200., std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(pixelContainer.extent.min(Acts::BinningValue::binZ), -2000., + CHECK_CLOSE_ABS(pixelContainer.extent.min(Acts::AxisDirection::AxisZ), -2000., std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(pixelContainer.extent.max(Acts::BinningValue::binZ), 2000., + CHECK_CLOSE_ABS(pixelContainer.extent.max(Acts::AxisDirection::AxisZ), 2000., std::numeric_limits::epsilon()); // The Pixel container has constituents @@ -170,10 +170,10 @@ BOOST_AUTO_TEST_CASE(ProtoTrackingGeometryTests) { // All of the internal containers should now have synchronized // inner & outer boundaries for (auto& pv : cts1.constituentVolumes) { - CHECK_CLOSE_ABS(pv.extent.min(Acts::BinningValue::binR), 35., + CHECK_CLOSE_ABS(pv.extent.min(Acts::AxisDirection::AxisR), 35., std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(pv.extent.max(Acts::BinningValue::binR), 200., + CHECK_CLOSE_ABS(pv.extent.max(Acts::AxisDirection::AxisR), 200., std::numeric_limits::epsilon()); } @@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(ProtoTrackingGeometryTests) { BOOST_CHECK_EQUAL(cts1.constituentBinning.size(), 1u); BOOST_CHECK_EQUAL(cts1.constituentBinning[0].type, Acts::arbitrary); BOOST_CHECK_EQUAL(cts1.constituentBinning[0].binvalue, - Acts::BinningValue::binZ); + Acts::AxisDirection::AxisZ); const auto& binBoundariesZ = cts1.constituentBinning[0].boundaries(); BOOST_CHECK_EQUAL(binBoundariesZ.size(), 4u); diff --git a/Tests/UnitTests/Core/Detector/ReferenceGeneratorsTests.cpp b/Tests/UnitTests/Core/Detector/ReferenceGeneratorsTests.cpp index 662119ab3a1..c623bc23fa0 100644 --- a/Tests/UnitTests/Core/Detector/ReferenceGeneratorsTests.cpp +++ b/Tests/UnitTests/Core/Detector/ReferenceGeneratorsTests.cpp @@ -41,10 +41,10 @@ BOOST_AUTO_TEST_CASE(CenterReference) { BOOST_AUTO_TEST_CASE(BinningPositionReference) { // Simply return binning position, we test only the behavior of the generator // not the output - auto binningPosition = - BinningValueReferenceGenerator{}.references( + auto referencePosition = + AxisDirectionReferenceGenerator{}.references( tContext, *pSurface); - BOOST_CHECK_EQUAL(binningPosition.size(), 1u); + BOOST_CHECK_EQUAL(referencePosition.size(), 1u); } BOOST_AUTO_TEST_CASE(PolyhedronReference) { diff --git a/Tests/UnitTests/Core/Detector/SupportSurfacesHelperTests.cpp b/Tests/UnitTests/Core/Detector/SupportSurfacesHelperTests.cpp index c93f529db78..d76b90be92b 100644 --- a/Tests/UnitTests/Core/Detector/SupportSurfacesHelperTests.cpp +++ b/Tests/UnitTests/Core/Detector/SupportSurfacesHelperTests.cpp @@ -43,8 +43,8 @@ BOOST_AUTO_TEST_CASE(CylindricalSupportCase) { // phi max = 2pi Acts::Extent lExtent; - lExtent.set(Acts::BinningValue::binR, 100., 110.); - lExtent.set(Acts::BinningValue::binZ, -400., 400.); + lExtent.set(Acts::AxisDirection::AxisR, 100., 110.); + lExtent.set(Acts::AxisDirection::AxisZ, -400., 400.); // Test creation of surface components CylindricalSupport csCreator{10., {1., 1.}}; @@ -101,8 +101,8 @@ BOOST_AUTO_TEST_CASE(DiscSupportCase) { // phi min = 0 // phi max = 2pi Acts::Extent lExtent; - lExtent.set(Acts::BinningValue::binR, 100., 400.); - lExtent.set(Acts::BinningValue::binZ, -405., -395.); + lExtent.set(Acts::AxisDirection::AxisR, 100., 400.); + lExtent.set(Acts::AxisDirection::AxisZ, -405., -395.); // Test creation of surface components DiscSupport dsCreator{0., {1., 1.}}; @@ -162,14 +162,14 @@ BOOST_AUTO_TEST_CASE(RectangularSupportCase) { // dy = [-200,200] // dz = [-50, -60] Acts::Extent lExtent; - lExtent.set(Acts::BinningValue::binX, -100., 100.); - lExtent.set(Acts::BinningValue::binY, -200., 200.); - lExtent.set(Acts::BinningValue::binZ, -60., -50.); + lExtent.set(Acts::AxisDirection::AxisX, -100., 100.); + lExtent.set(Acts::AxisDirection::AxisY, -200., 200.); + lExtent.set(Acts::AxisDirection::AxisZ, -60., -50.); // place in Z with offset 2_mm // Asymmetric clearances in x an y for testing RectangularSupport rsCreator{ - Acts::BinningValue::binZ, 2., {1., 2.}, {3., 4.}}; + Acts::AxisDirection::AxisZ, 2., {1., 2.}, {3., 4.}}; auto rsComponents = rsCreator(lExtent); auto& [rsType, rsValues, rsTransform] = rsComponents; @@ -192,8 +192,8 @@ BOOST_AUTO_TEST_CASE(RectangularSupportCase) { // Invalid / runtime checks Acts::Extent invalid; - invalid.set(Acts::BinningValue::binX, -100., 100.); - invalid.set(Acts::BinningValue::binY, -200., 200.); + invalid.set(Acts::AxisDirection::AxisX, -100., 100.); + invalid.set(Acts::AxisDirection::AxisY, -200., 200.); BOOST_CHECK_THROW(rsCreator(invalid), std::invalid_argument); } @@ -209,8 +209,8 @@ BOOST_AUTO_TEST_CASE(addCylinderSupportCase) { // -> did yield and extend of 100 < r 110 // The volume would give an extend of -400 < z < 400 Acts::Extent lExtent; - lExtent.set(Acts::BinningValue::binR, 100., 110.); - lExtent.set(Acts::BinningValue::binZ, -400., 400.); + lExtent.set(Acts::AxisDirection::AxisR, 100., 110.); + lExtent.set(Acts::AxisDirection::AxisZ, -400., 400.); // Cylinder support CylindricalSupport csCreator{10., {1., 1.}}; @@ -249,8 +249,8 @@ BOOST_AUTO_TEST_CASE(addDiscSupportCase) { // The Extent Acts::Extent lExtent; - lExtent.set(Acts::BinningValue::binR, 100., 400.); - lExtent.set(Acts::BinningValue::binZ, -110., -100.); + lExtent.set(Acts::AxisDirection::AxisR, 100., 400.); + lExtent.set(Acts::AxisDirection::AxisZ, -110., -100.); // Disc support: this would set the disc at the center DiscSupport dsCreator{0., {1., 1.}}; @@ -291,14 +291,14 @@ BOOST_AUTO_TEST_CASE(addRectangularSupportCase) { // dy = [-200,200] // dz = [-50, -60] Acts::Extent lExtent; - lExtent.set(Acts::BinningValue::binX, -100., 100.); - lExtent.set(Acts::BinningValue::binY, -200., 200.); - lExtent.set(Acts::BinningValue::binZ, -60., -50.); + lExtent.set(Acts::AxisDirection::AxisX, -100., 100.); + lExtent.set(Acts::AxisDirection::AxisY, -200., 200.); + lExtent.set(Acts::AxisDirection::AxisZ, -60., -50.); // place in Z with offset 2_mm // Asymmetric clearances in x an y for testing RectangularSupport rsCreator{ - Acts::BinningValue::binZ, 2., {1., 2.}, {3., 4.}}; + Acts::AxisDirection::AxisZ, 2., {1., 2.}, {3., 4.}}; // Add a single disc as a support surface Acts::Experimental::detail::SupportSurfacesHelper::addSupport( @@ -337,8 +337,8 @@ BOOST_AUTO_TEST_CASE(addMisconfiguredSupportCase) { std::invalid_argument); // The Extent - lExtent.set(Acts::BinningValue::binR, 100., 400.); - lExtent.set(Acts::BinningValue::binZ, -110., -100.); + lExtent.set(Acts::AxisDirection::AxisR, 100., 400.); + lExtent.set(Acts::AxisDirection::AxisZ, -110., -100.); // Wrong surface type struct InvalidCreator { diff --git a/Tests/UnitTests/Core/Detector/VolumeStructureBuilderTests.cpp b/Tests/UnitTests/Core/Detector/VolumeStructureBuilderTests.cpp index 9d7064a52a4..fb50110efd6 100644 --- a/Tests/UnitTests/Core/Detector/VolumeStructureBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/VolumeStructureBuilderTests.cpp @@ -107,9 +107,9 @@ BOOST_AUTO_TEST_CASE(VolumeStructureBuilderCuboid) { // Cuboid volume from extent Extent cuboidExtent; - cuboidExtent.set(BinningValue::binX, -100, 100); - cuboidExtent.set(BinningValue::binY, -200, 200); - cuboidExtent.set(BinningValue::binZ, -300, 300); + cuboidExtent.set(AxisDirection::AxisX, -100, 100); + cuboidExtent.set(AxisDirection::AxisY, -200, 200); + cuboidExtent.set(AxisDirection::AxisZ, -300, 300); VolumeStructureBuilder::Config cuboidExtentConfig; cuboidExtentConfig.boundsType = VolumeBounds::BoundsType::eCuboid; @@ -224,8 +224,8 @@ BOOST_AUTO_TEST_CASE(VolumeStructureBuilderCylinder) { // Cylinder volume from extent Extent cylinderExtent; - cylinderExtent.set(BinningValue::binR, 100., 200.); - cylinderExtent.set(BinningValue::binZ, -800., 0.); + cylinderExtent.set(AxisDirection::AxisR, 100., 200.); + cylinderExtent.set(AxisDirection::AxisZ, -800., 0.); VolumeStructureBuilder::Config cylExtentConfig; cylExtentConfig.extent = cylinderExtent; diff --git a/Tests/UnitTests/Core/Geometry/BlueprintApiTests.cpp b/Tests/UnitTests/Core/Geometry/BlueprintApiTests.cpp index 737f410e24b..dd42e620a17 100644 --- a/Tests/UnitTests/Core/Geometry/BlueprintApiTests.cpp +++ b/Tests/UnitTests/Core/Geometry/BlueprintApiTests.cpp @@ -254,28 +254,28 @@ BOOST_AUTO_TEST_CASE(NodeApiTestContainers) { }; Blueprint::Config cfg; - cfg.envelope[BinningValue::binZ] = {20_mm, 20_mm}; - cfg.envelope[BinningValue::binR] = {0_mm, 20_mm}; + cfg.envelope[AxisDirection::AxisZ] = {20_mm, 20_mm}; + cfg.envelope[AxisDirection::AxisR] = {0_mm, 20_mm}; auto root = std::make_unique(cfg); root->addMaterial("GlobalMaterial", [&](MaterialDesignatorBlueprintNode& mat) { - Experimental::ProtoBinning zBinning{BinningValue::binZ, + Experimental::ProtoBinning zBinning{AxisDirection::AxisZ, AxisBoundaryType::Bound, 20}; - Experimental::ProtoBinning rPhiBinning{BinningValue::binRPhi, + Experimental::ProtoBinning rPhiBinning{AxisDirection::AxisRPhi, AxisBoundaryType::Bound, 20}; mat.setBinning(std::vector{std::tuple{ CylinderVolumeBounds::Face::OuterCylinder, rPhiBinning, zBinning}}); - mat.addCylinderContainer("Detector", BinningValue::binR, [&](auto& det) { - det.addCylinderContainer("Pixel", BinningValue::binZ, [&](auto& cyl) { + mat.addCylinderContainer("Detector", AxisDirection::AxisR, [&](auto& det) { + det.addCylinderContainer("Pixel", AxisDirection::AxisZ, [&](auto& cyl) { cyl.setAttachmentStrategy(CylinderVolumeStack::AttachmentStrategy::Gap) .setResizeStrategy(CylinderVolumeStack::ResizeStrategy::Gap); cyl.addCylinderContainer( - "PixelNegativeEndcap", BinningValue::binZ, [&](auto& ec) { + "PixelNegativeEndcap", AxisDirection::AxisZ, [&](auto& ec) { ec.setAttachmentStrategy( CylinderVolumeStack::AttachmentStrategy::Gap); @@ -307,7 +307,7 @@ BOOST_AUTO_TEST_CASE(NodeApiTestContainers) { }); cyl.addCylinderContainer( - "PixelBarrel", BinningValue::binR, [&](auto& brl) { + "PixelBarrel", AxisDirection::AxisR, [&](auto& brl) { brl.setAttachmentStrategy( CylinderVolumeStack::AttachmentStrategy::Gap) .setResizeStrategy(CylinderVolumeStack::ResizeStrategy::Gap); @@ -342,7 +342,7 @@ BOOST_AUTO_TEST_CASE(NodeApiTestContainers) { }); auto& ec = - cyl.addCylinderContainer("PixelPosWrapper", BinningValue::binR); + cyl.addCylinderContainer("PixelPosWrapper", AxisDirection::AxisR); ec.setResizeStrategy(CylinderVolumeStack::ResizeStrategy::Gap); ec.addStaticVolume(std::make_unique( base * Translation3{Vector3{0, 0, 600_mm}}, diff --git a/Tests/UnitTests/Core/Geometry/BlueprintTests.cpp b/Tests/UnitTests/Core/Geometry/BlueprintTests.cpp index c3a0ecc028f..6d7a1a30fb9 100644 --- a/Tests/UnitTests/Core/Geometry/BlueprintTests.cpp +++ b/Tests/UnitTests/Core/Geometry/BlueprintTests.cpp @@ -168,8 +168,8 @@ BOOST_AUTO_TEST_CASE(Depth) { BOOST_AUTO_TEST_CASE(Static) { Blueprint::Config cfg; - cfg.envelope[BinningValue::binZ] = {20_mm, 20_mm}; - cfg.envelope[BinningValue::binR] = {1_mm, 2_mm}; + cfg.envelope[AxisDirection::AxisZ] = {20_mm, 20_mm}; + cfg.envelope[AxisDirection::AxisR] = {1_mm, 2_mm}; Blueprint root{cfg}; double hlZ = 30_mm; @@ -209,11 +209,11 @@ BOOST_AUTO_TEST_CASE(Static) { BOOST_AUTO_TEST_CASE(CylinderContainer) { Blueprint::Config cfg; - cfg.envelope[BinningValue::binZ] = {20_mm, 20_mm}; - cfg.envelope[BinningValue::binR] = {2_mm, 20_mm}; + cfg.envelope[AxisDirection::AxisZ] = {20_mm, 20_mm}; + cfg.envelope[AxisDirection::AxisR] = {2_mm, 20_mm}; auto root = std::make_unique(cfg); - auto& cyl = root->addCylinderContainer("Container", BinningValue::binZ); + auto& cyl = root->addCylinderContainer("Container", AxisDirection::AxisZ); cyl.setAttachmentStrategy(CylinderVolumeStack::AttachmentStrategy::Gap); double z0 = -200_mm; @@ -262,8 +262,8 @@ BOOST_AUTO_TEST_CASE(Confined) { Transform3 base{Transform3::Identity()}; Blueprint::Config cfg; - cfg.envelope[BinningValue::binZ] = {20_mm, 20_mm}; - cfg.envelope[BinningValue::binR] = {2_mm, 20_mm}; + cfg.envelope[AxisDirection::AxisZ] = {20_mm, 20_mm}; + cfg.envelope[AxisDirection::AxisR] = {2_mm, 20_mm}; auto root = std::make_unique(cfg); root->addStaticVolume( @@ -472,8 +472,8 @@ BOOST_AUTO_TEST_CASE(CylinderLayer) { BOOST_AUTO_TEST_CASE(Material) { Blueprint::Config cfg; - cfg.envelope[BinningValue::binZ] = {20_mm, 20_mm}; - cfg.envelope[BinningValue::binR] = {1_mm, 2_mm}; + cfg.envelope[AxisDirection::AxisZ] = {20_mm, 20_mm}; + cfg.envelope[AxisDirection::AxisR] = {1_mm, 2_mm}; Blueprint root{cfg}; double hlZ = 30_mm; @@ -481,17 +481,17 @@ BOOST_AUTO_TEST_CASE(Material) { auto cyl = std::make_unique(Transform3::Identity(), cylBounds, "child"); - using enum BinningValue; + using enum AxisDirection; using enum CylinderVolumeBounds::Face; using enum AxisBoundaryType; root.addMaterial("Material", [&](auto& mat) { // @TODO: This API is not great mat.setBinning(std::vector{ - std::tuple{NegativeDisc, Experimental::ProtoBinning{binR, Bound, 5}, - Experimental::ProtoBinning{binPhi, Bound, 10}}, - std::tuple{PositiveDisc, Experimental::ProtoBinning{binR, Bound, 15}, - Experimental::ProtoBinning{binPhi, Bound, 20}}, + std::tuple{NegativeDisc, Experimental::ProtoBinning{AxisR, Bound, 5}, + Experimental::ProtoBinning{AxisPhi, Bound, 10}}, + std::tuple{PositiveDisc, Experimental::ProtoBinning{AxisR, Bound, 15}, + Experimental::ProtoBinning{AxisPhi, Bound, 20}}, }); mat.addStaticVolume(std::move(cyl)); diff --git a/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp index a4c18aa3609..79688dad718 100644 --- a/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp @@ -104,10 +104,13 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeProperties) { } // Check the binning value positions - CHECK_CLOSE_ABS(box.binningBorder(Acts::BinningValue::binX), hx, s_epsilon); - CHECK_CLOSE_ABS(box.binningBorder(Acts::BinningValue::binY), hy, s_epsilon); - CHECK_CLOSE_ABS(box.binningBorder(Acts::BinningValue::binZ), hz, s_epsilon); - CHECK_CLOSE_ABS(box.binningBorder(Acts::BinningValue::binR), + CHECK_CLOSE_ABS(box.referenceBorder(Acts::AxisDirection::AxisX), hx, + s_epsilon); + CHECK_CLOSE_ABS(box.referenceBorder(Acts::AxisDirection::AxisY), hy, + s_epsilon); + CHECK_CLOSE_ABS(box.referenceBorder(Acts::AxisDirection::AxisZ), hz, + s_epsilon); + CHECK_CLOSE_ABS(box.referenceBorder(Acts::AxisDirection::AxisR), std::sqrt(hx * hx + hy * hy), s_epsilon); } diff --git a/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp index 7518ad5489a..90a455ebc81 100644 --- a/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp @@ -194,7 +194,8 @@ BOOST_AUTO_TEST_CASE(CutoutCylinderVolumeOrientedBoundaries) { Vector3 zaxis(0., 0., 1.); for (auto& os : ccvbOrientedSurfaces) { - auto onSurface = os.surface->binningPosition(geoCtx, BinningValue::binR); + auto onSurface = + os.surface->referencePosition(geoCtx, AxisDirection::AxisR); auto locPos = os.surface->globalToLocal(geoCtx, onSurface, Vector3::Zero()).value(); auto osNormal = os.surface->normal(geoCtx, locPos); diff --git a/Tests/UnitTests/Core/Geometry/CylinderVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/CylinderVolumeBoundsTests.cpp index 9de254dfb68..9c7ce9ac061 100644 --- a/Tests/UnitTests/Core/Geometry/CylinderVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CylinderVolumeBoundsTests.cpp @@ -311,7 +311,8 @@ BOOST_AUTO_TEST_CASE(CylinderVolumeOrientedBoundaries) { Vector3 zaxis(0., 0., 1.); for (auto& os : cvbOrientedSurfaces) { - auto onSurface = os.surface->binningPosition(geoCtx, BinningValue::binR); + auto onSurface = + os.surface->referencePosition(geoCtx, AxisDirection::AxisR); auto locPos = os.surface->globalToLocal(geoCtx, onSurface, Vector3::Zero()).value(); auto osNormal = os.surface->normal(geoCtx, locPos); diff --git a/Tests/UnitTests/Core/Geometry/CylinderVolumeStackTests.cpp b/Tests/UnitTests/Core/Geometry/CylinderVolumeStackTests.cpp index 4ed2d419c49..59987bfb42e 100644 --- a/Tests/UnitTests/Core/Geometry/CylinderVolumeStackTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CylinderVolumeStackTests.cpp @@ -108,12 +108,12 @@ BOOST_DATA_TEST_CASE(Baseline, if (shift < 1.0) { BOOST_CHECK_THROW( - CylinderVolumeStack(volumes, BinningValue::binZ, strategy, + CylinderVolumeStack(volumes, AxisDirection::AxisZ, strategy, CylinderVolumeStack::ResizeStrategy::Gap, *logger), std::invalid_argument); return; } - CylinderVolumeStack cylStack(volumes, BinningValue::binZ, strategy, + CylinderVolumeStack cylStack(volumes, AxisDirection::AxisZ, strategy, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -341,9 +341,10 @@ BOOST_AUTO_TEST_CASE(Asymmetric) { std::vector volumes = {vol2.get(), vol1.get(), vol3.get()}; - CylinderVolumeStack cylStack( - volumes, BinningValue::binZ, CylinderVolumeStack::AttachmentStrategy::Gap, - CylinderVolumeStack::ResizeStrategy::Gap, *logger); + CylinderVolumeStack cylStack(volumes, AxisDirection::AxisZ, + CylinderVolumeStack::AttachmentStrategy::Gap, + CylinderVolumeStack::ResizeStrategy::Gap, + *logger); BOOST_CHECK_EQUAL(volumes.size(), 5); auto stackBounds = @@ -383,7 +384,7 @@ BOOST_DATA_TEST_CASE(RotationInZ, boost::unit_test::data::make(strategies), std::vector volumes = {vol1.get(), vol2.get()}; - CylinderVolumeStack cylStack(volumes, BinningValue::binZ, strategy, + CylinderVolumeStack cylStack(volumes, AxisDirection::AxisZ, strategy, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -479,7 +480,7 @@ BOOST_DATA_TEST_CASE(UpdateStack, transform3}; CylinderVolumeStack cylStack( - volumes, BinningValue::binZ, + volumes, AxisDirection::AxisZ, CylinderVolumeStack::AttachmentStrategy::Gap, // should not make a // difference strategy, *logger); @@ -710,7 +711,7 @@ BOOST_DATA_TEST_CASE( std::vector volumes = {vol1.get(), vol2.get()}; - CylinderVolumeStack cylStack{volumes, BinningValue::binZ, + CylinderVolumeStack cylStack{volumes, AxisDirection::AxisZ, CylinderVolumeStack::AttachmentStrategy::Gap, strategy, *logger}; const auto* originalBounds = @@ -822,7 +823,7 @@ BOOST_AUTO_TEST_CASE(ResizeReproduction1) { Volume vol1{trf1, bounds1}; std::vector volumes = {&vol1}; - CylinderVolumeStack stack(volumes, BinningValue::binZ, + CylinderVolumeStack stack(volumes, AxisDirection::AxisZ, CylinderVolumeStack::AttachmentStrategy::Gap, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -848,7 +849,7 @@ BOOST_AUTO_TEST_CASE(ResizeReproduction2) { Volume vol1{trf1, bounds1}; std::vector volumes = {&vol1}; - CylinderVolumeStack stack(volumes, BinningValue::binZ, + CylinderVolumeStack stack(volumes, AxisDirection::AxisZ, CylinderVolumeStack::AttachmentStrategy::Gap, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -901,7 +902,7 @@ BOOST_AUTO_TEST_CASE(ResizeGapMultiple) { BOOST_TEST_CONTEXT("Positive") { std::vector volumes = {&vol}; - CylinderVolumeStack stack(volumes, BinningValue::binZ, + CylinderVolumeStack stack(volumes, AxisDirection::AxisZ, CylinderVolumeStack::AttachmentStrategy::Gap, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -938,7 +939,7 @@ BOOST_AUTO_TEST_CASE(ResizeGapMultiple) { BOOST_TEST_CONTEXT("Negative") { std::vector volumes = {&vol}; - CylinderVolumeStack stack(volumes, BinningValue::binZ, + CylinderVolumeStack stack(volumes, AxisDirection::AxisZ, CylinderVolumeStack::AttachmentStrategy::Gap, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -1034,13 +1035,13 @@ BOOST_DATA_TEST_CASE(Baseline, if (f < 0.0) { BOOST_CHECK_THROW( - CylinderVolumeStack(volumes, BinningValue::binR, strategy, + CylinderVolumeStack(volumes, AxisDirection::AxisR, strategy, CylinderVolumeStack::ResizeStrategy::Gap, *logger), std::invalid_argument); return; } - CylinderVolumeStack cylStack(volumes, BinningValue::binR, strategy, + CylinderVolumeStack cylStack(volumes, AxisDirection::AxisR, strategy, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -1276,7 +1277,7 @@ BOOST_DATA_TEST_CASE(UpdateStack, } cylStack = std::make_unique( - volumes, BinningValue::binR, + volumes, AxisDirection::AxisR, CylinderVolumeStack::AttachmentStrategy::Gap, // should not make a // difference strategy, *logger); @@ -1595,7 +1596,7 @@ BOOST_DATA_TEST_CASE( std::vector volumes = {vol1.get(), vol2.get()}; - CylinderVolumeStack cylStack{volumes, BinningValue::binR, + CylinderVolumeStack cylStack{volumes, AxisDirection::AxisR, CylinderVolumeStack::AttachmentStrategy::Gap, strategy, *logger}; const auto* originalBounds = @@ -1671,7 +1672,7 @@ BOOST_AUTO_TEST_CASE(ResizeGapMultiple) { BOOST_TEST_CONTEXT("Outer") { std::vector volumes = {&vol}; - CylinderVolumeStack stack(volumes, BinningValue::binR, + CylinderVolumeStack stack(volumes, AxisDirection::AxisR, CylinderVolumeStack::AttachmentStrategy::Gap, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -1706,7 +1707,7 @@ BOOST_AUTO_TEST_CASE(ResizeGapMultiple) { BOOST_TEST_CONTEXT("Inner") { std::vector volumes = {&vol}; - CylinderVolumeStack stack(volumes, BinningValue::binR, + CylinderVolumeStack stack(volumes, AxisDirection::AxisR, CylinderVolumeStack::AttachmentStrategy::Gap, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -1753,22 +1754,24 @@ BOOST_DATA_TEST_CASE(JoinCylinderVolumesInvalidDirection, volumes.push_back(vol1.get()); // Single volume invalid direction still gives an error - BOOST_CHECK_THROW(CylinderVolumeStack(volumes, BinningValue::binY, strategy), - std::invalid_argument); + BOOST_CHECK_THROW( + CylinderVolumeStack(volumes, AxisDirection::AxisY, strategy), + std::invalid_argument); auto vol2 = std::make_shared( Transform3::Identity(), std::make_shared(100_mm, 400_mm, 400_mm)); volumes.push_back(vol2.get()); - BOOST_CHECK_THROW(CylinderVolumeStack(volumes, BinningValue::binY, strategy), - std::invalid_argument); + BOOST_CHECK_THROW( + CylinderVolumeStack(volumes, AxisDirection::AxisY, strategy), + std::invalid_argument); } BOOST_DATA_TEST_CASE(JoinCylinderVolumesInvalidInput, (boost::unit_test::data::make(strategies) * - boost::unit_test::data::make(Acts::BinningValue::binZ, - Acts::BinningValue::binR)), + boost::unit_test::data::make(Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR)), strategy, direction) { BOOST_TEST_CONTEXT("Empty Volume") { std::vector volumes; @@ -1857,7 +1860,7 @@ BOOST_DATA_TEST_CASE(JoinCylinderVolumesInvalidInput, { std::shared_ptr vol; - if (direction == BinningValue::binZ) { + if (direction == AxisDirection::AxisZ) { vol = std::make_shared( Transform3{Translation3{Vector3{0_mm, 0_mm, 500_mm}}}, invalid); } else { @@ -1881,8 +1884,8 @@ BOOST_DATA_TEST_CASE(JoinCylinderVolumesInvalidInput, } BOOST_DATA_TEST_CASE(JoinCylinderVolumeSingle, - (boost::unit_test::data::make(Acts::BinningValue::binZ, - Acts::BinningValue::binR) * + (boost::unit_test::data::make(Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR) * boost::unit_test::data::make(strategies)), direction, strategy) { auto vol = std::make_shared( diff --git a/Tests/UnitTests/Core/Geometry/ExtentTests.cpp b/Tests/UnitTests/Core/Geometry/ExtentTests.cpp index 3d0595f807d..2b0f4d5ad95 100644 --- a/Tests/UnitTests/Core/Geometry/ExtentTests.cpp +++ b/Tests/UnitTests/Core/Geometry/ExtentTests.cpp @@ -42,24 +42,24 @@ BOOST_AUTO_TEST_CASE(ExtentTest) { double phiMax = std::atan2(3_mm, 15_mm); double rMin = std::hypot(15_mm, 3_mm); - CHECK_CLOSE_ABS(gExt.min(BinningValue::binX), 15_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binX), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(BinningValue::binY), -3_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binY), 3_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(BinningValue::binZ), -10_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binZ), 10_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(BinningValue::binR), rMin, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binR), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(BinningValue::binPhi), phiMin, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binPhi), phiMax, 1e-6); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisX), 15_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisX), 18_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisY), -3_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisY), 3_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisZ), -10_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisZ), 10_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisR), rMin, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisR), 18_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisPhi), phiMin, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisPhi), phiMax, 1e-6); // Call with histogram filling Extent gExtHist; for (const auto& v : vertices) { - gExtHist.extend(v, {BinningValue::binX}, false, true); + gExtHist.extend(v, {AxisDirection::AxisX}, false, true); } const auto& vHist = gExtHist.valueHistograms(); - auto xVals = vHist[toUnderlying(BinningValue::binX)]; + auto xVals = vHist[toUnderlying(AxisDirection::AxisX)]; BOOST_CHECK_EQUAL(xVals.size(), 6u); std::vector reference = {15_mm, 18_mm, 15_mm, 15_mm, 18_mm, 15_mm}; @@ -68,31 +68,31 @@ BOOST_AUTO_TEST_CASE(ExtentTest) { // Call with ieterator range Extent gExtItr; gExtItr.extend(vertices.begin(), vertices.end()); - CHECK_CLOSE_ABS(gExtItr.min(BinningValue::binX), 15_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.max(BinningValue::binX), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.min(BinningValue::binY), -3_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.max(BinningValue::binY), 3_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.min(BinningValue::binZ), -10_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.max(BinningValue::binZ), 10_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.min(BinningValue::binR), rMin, 1e-6); - CHECK_CLOSE_ABS(gExtItr.max(BinningValue::binR), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.min(BinningValue::binPhi), phiMin, 1e-6); - CHECK_CLOSE_ABS(gExtItr.max(BinningValue::binPhi), phiMax, 1e-6); + CHECK_CLOSE_ABS(gExtItr.min(AxisDirection::AxisX), 15_mm, 1e-6); + CHECK_CLOSE_ABS(gExtItr.max(AxisDirection::AxisX), 18_mm, 1e-6); + CHECK_CLOSE_ABS(gExtItr.min(AxisDirection::AxisY), -3_mm, 1e-6); + CHECK_CLOSE_ABS(gExtItr.max(AxisDirection::AxisY), 3_mm, 1e-6); + CHECK_CLOSE_ABS(gExtItr.min(AxisDirection::AxisZ), -10_mm, 1e-6); + CHECK_CLOSE_ABS(gExtItr.max(AxisDirection::AxisZ), 10_mm, 1e-6); + CHECK_CLOSE_ABS(gExtItr.min(AxisDirection::AxisR), rMin, 1e-6); + CHECK_CLOSE_ABS(gExtItr.max(AxisDirection::AxisR), 18_mm, 1e-6); + CHECK_CLOSE_ABS(gExtItr.min(AxisDirection::AxisPhi), phiMin, 1e-6); + CHECK_CLOSE_ABS(gExtItr.max(AxisDirection::AxisPhi), phiMax, 1e-6); // Create a second Extent Extent gExtCopy; gExtCopy.extend(gExt); - CHECK_CLOSE_ABS(gExtCopy.min(BinningValue::binX), 15_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.max(BinningValue::binX), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.min(BinningValue::binY), -3_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.max(BinningValue::binY), 3_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.min(BinningValue::binZ), -10_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.max(BinningValue::binZ), 10_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.min(BinningValue::binR), rMin, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.max(BinningValue::binR), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.min(BinningValue::binPhi), phiMin, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.max(BinningValue::binPhi), phiMax, 1e-6); + CHECK_CLOSE_ABS(gExtCopy.min(AxisDirection::AxisX), 15_mm, 1e-6); + CHECK_CLOSE_ABS(gExtCopy.max(AxisDirection::AxisX), 18_mm, 1e-6); + CHECK_CLOSE_ABS(gExtCopy.min(AxisDirection::AxisY), -3_mm, 1e-6); + CHECK_CLOSE_ABS(gExtCopy.max(AxisDirection::AxisY), 3_mm, 1e-6); + CHECK_CLOSE_ABS(gExtCopy.min(AxisDirection::AxisZ), -10_mm, 1e-6); + CHECK_CLOSE_ABS(gExtCopy.max(AxisDirection::AxisZ), 10_mm, 1e-6); + CHECK_CLOSE_ABS(gExtCopy.min(AxisDirection::AxisR), rMin, 1e-6); + CHECK_CLOSE_ABS(gExtCopy.max(AxisDirection::AxisR), 18_mm, 1e-6); + CHECK_CLOSE_ABS(gExtCopy.min(AxisDirection::AxisPhi), phiMin, 1e-6); + CHECK_CLOSE_ABS(gExtCopy.max(AxisDirection::AxisPhi), phiMax, 1e-6); // Check containment Extent unbound; @@ -101,55 +101,55 @@ BOOST_AUTO_TEST_CASE(ExtentTest) { // Check application of an envelope on it ExtentEnvelope xEnvelopes = ExtentEnvelope::Zero(); - xEnvelopes[BinningValue::binX] = {1., 2.}; + xEnvelopes[AxisDirection::AxisX] = {1., 2.}; // Take the extent and extend by an envelope Extent envelope(xEnvelopes); gExt.extend(envelope); // Changed ones - CHECK_CLOSE_ABS(gExt.min(BinningValue::binX), 14_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binX), 20_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisX), 14_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisX), 20_mm, 1e-6); // Unchanged ones - CHECK_CLOSE_ABS(gExt.min(BinningValue::binY), -3_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binY), 3_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(BinningValue::binZ), -10_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binZ), 10_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(BinningValue::binR), rMin, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binR), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(BinningValue::binPhi), phiMin, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binPhi), phiMax, 1e-6); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisY), -3_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisY), 3_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisZ), -10_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisZ), 10_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisR), rMin, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisR), 18_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisPhi), phiMin, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisPhi), phiMax, 1e-6); // Fill it with envelope Extent gExtEnv(envelope); gExtEnv.extend(vertices.begin(), vertices.end()); // Changed ones - CHECK_CLOSE_ABS(gExtEnv.min(BinningValue::binX), 14_mm, 1e-6); - CHECK_CLOSE_ABS(gExtEnv.max(BinningValue::binX), 20_mm, 1e-6); + CHECK_CLOSE_ABS(gExtEnv.min(AxisDirection::AxisX), 14_mm, 1e-6); + CHECK_CLOSE_ABS(gExtEnv.max(AxisDirection::AxisX), 20_mm, 1e-6); // Check the set method - gExt.set(BinningValue::binX, 2_mm, 8_mm); - CHECK_CLOSE_ABS(gExt.min(BinningValue::binX), 2_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binX), 8_mm, 1e-6); + gExt.set(AxisDirection::AxisX, 2_mm, 8_mm); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisX), 2_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisX), 8_mm, 1e-6); // Radius can not go below 0 - gExt.set(BinningValue::binR, -2_mm, 18_mm); - CHECK_CLOSE_ABS(gExt.min(BinningValue::binR), 0_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(BinningValue::binR), 18_mm, 1e-6); + gExt.set(AxisDirection::AxisR, -2_mm, 18_mm); + CHECK_CLOSE_ABS(gExt.min(AxisDirection::AxisR), 0_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.max(AxisDirection::AxisR), 18_mm, 1e-6); // Take an Extent and add a constraint Extent gExtConst; - gExtConst.set(BinningValue::binR, 0., 5.); + gExtConst.set(AxisDirection::AxisR, 0., 5.); Extent gExtNonConst; - BOOST_CHECK(!gExtNonConst.constrains(BinningValue::binR)); + BOOST_CHECK(!gExtNonConst.constrains(AxisDirection::AxisR)); gExtNonConst.addConstrain(gExtConst); - BOOST_CHECK(gExtNonConst.constrains(BinningValue::binR)); + BOOST_CHECK(gExtNonConst.constrains(AxisDirection::AxisR)); std::string tString = gExtConst.toString(); BOOST_CHECK(!tString.empty()); // Check single vertex containment Extent gExtVertexCheck; - gExtVertexCheck.set(BinningValue::binR, 0., 5.); + gExtVertexCheck.set(AxisDirection::AxisR, 0., 5.); BOOST_CHECK(gExtVertexCheck.contains(Vector3(1., 0., 0.))); BOOST_CHECK(!gExtVertexCheck.contains(Vector3(6., 0., 0.))); } @@ -163,23 +163,23 @@ BOOST_AUTO_TEST_CASE(ProtoSupportCaseTests) { Vector3(18_mm, 0_mm, 10_mm), Vector3(15_mm, 3_mm, 10_mm)}; Extent volumeExtent; - volumeExtent.set(BinningValue::binZ, -300_mm, 300_mm); + volumeExtent.set(AxisDirection::AxisZ, -300_mm, 300_mm); - BOOST_CHECK(volumeExtent.constrains(BinningValue::binZ)); - BOOST_CHECK(!volumeExtent.constrains(BinningValue::binR)); + BOOST_CHECK(volumeExtent.constrains(AxisDirection::AxisZ)); + BOOST_CHECK(!volumeExtent.constrains(AxisDirection::AxisR)); for (const auto& v : vertices) { - volumeExtent.extend(v, {BinningValue::binR}); + volumeExtent.extend(v, {AxisDirection::AxisR}); } - BOOST_CHECK(volumeExtent.constrains(BinningValue::binR)); + BOOST_CHECK(volumeExtent.constrains(AxisDirection::AxisR)); } BOOST_AUTO_TEST_CASE(DesignatedInitializers) { - using enum BinningValue; + using enum AxisDirection; ExtentEnvelope exp; - exp[binX] = {1., 2.}; - exp[binEta] = {-1., 1.}; + exp[AxisX] = {1., 2.}; + exp[AxisEta] = {-1., 1.}; ExtentEnvelope act{{.x = {1., 2.}, .eta = {-1., 1.}}}; diff --git a/Tests/UnitTests/Core/Geometry/KDTreeTrackingGeometryBuilderTests.cpp b/Tests/UnitTests/Core/Geometry/KDTreeTrackingGeometryBuilderTests.cpp index f30bd15c6cb..87fd7a9b4cd 100644 --- a/Tests/UnitTests/Core/Geometry/KDTreeTrackingGeometryBuilderTests.cpp +++ b/Tests/UnitTests/Core/Geometry/KDTreeTrackingGeometryBuilderTests.cpp @@ -100,35 +100,35 @@ BOOST_AUTO_TEST_CASE(KDTreeTrackingGeometryBuilder_simple) { // Make a proto detectpr description Acts::ProtoVolume beamPipeContainer; beamPipeContainer.name = "odd-beam-pipe"; - beamPipeContainer.extent.set(Acts::BinningValue::binR, 0., 17); + beamPipeContainer.extent.set(Acts::AxisDirection::AxisR, 0., 17); Acts::ProtoVolume beamPipe; beamPipe.name = "odd-beam-pipe-l"; - beamPipe.extent.set(Acts::BinningValue::binR, 2., 16.); + beamPipe.extent.set(Acts::AxisDirection::AxisR, 2., 16.); beamPipe.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; beamPipeContainer.container = Acts::ProtoVolume::ContainerStructure{ {beamPipe}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1.})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 1.})}, true}; // Pixel section Acts::ProtoVolume pixelContainer; pixelContainer.name = "odd-pixel"; - pixelContainer.extent.set(Acts::BinningValue::binR, 18., 200); + pixelContainer.extent.set(Acts::AxisDirection::AxisR, 18., 200); Acts::ProtoVolume pixelNec; pixelNec.name = "odd-pixel-nec"; - pixelNec.extent.set(Acts::BinningValue::binZ, -1000., -580); + pixelNec.extent.set(Acts::AxisDirection::AxisZ, -1000., -580); Acts::ProtoVolume pixNecD1; pixNecD1.name = "odd-pixel-nec-d1"; - pixNecD1.extent.set(Acts::BinningValue::binZ, -720., -680); + pixNecD1.extent.set(Acts::AxisDirection::AxisZ, -720., -680); Acts::ProtoVolume pixNecD0; pixNecD0.name = "odd-pixel-nec-d0"; - pixNecD0.extent.set(Acts::BinningValue::binZ, -620., -580); + pixNecD0.extent.set(Acts::AxisDirection::AxisZ, -620., -580); pixelNec.container = Acts::ProtoVolume::ContainerStructure{ {pixNecD1, pixNecD0}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1.})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {0., 1.})}, true}; for (auto& cv : pixelNec.container.value().constituentVolumes) { cv.internal = @@ -137,52 +137,52 @@ BOOST_AUTO_TEST_CASE(KDTreeTrackingGeometryBuilder_simple) { Acts::ProtoVolume pixelBarrel; pixelBarrel.name = "odd-pixel-barrel"; - pixelBarrel.extent.set(Acts::BinningValue::binZ, -580., 580); + pixelBarrel.extent.set(Acts::AxisDirection::AxisZ, -580., 580); Acts::ProtoVolume pixBarrelL0; pixBarrelL0.name = "odd-pixel-barrel-l0"; - pixBarrelL0.extent.set(Acts::BinningValue::binR, 28., 48.); - pixBarrelL0.extent.set(Acts::BinningValue::binZ, -580., 580); + pixBarrelL0.extent.set(Acts::AxisDirection::AxisR, 28., 48.); + pixBarrelL0.extent.set(Acts::AxisDirection::AxisZ, -580., 580); pixBarrelL0.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; Acts::ProtoVolume pixBarrelL1; pixBarrelL1.name = "odd-pixel-barrel-l1"; - pixBarrelL1.extent.set(Acts::BinningValue::binR, 62., 76); - pixBarrelL1.extent.set(Acts::BinningValue::binZ, -580., 580); + pixBarrelL1.extent.set(Acts::AxisDirection::AxisR, 62., 76); + pixBarrelL1.extent.set(Acts::AxisDirection::AxisZ, -580., 580); pixBarrelL1.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; Acts::ProtoVolume pixBarrelL2; pixBarrelL2.name = "odd-pixel-barrel-l2"; - pixBarrelL2.extent.set(Acts::BinningValue::binR, 100., 120.); - pixBarrelL2.extent.set(Acts::BinningValue::binZ, -580., 580); + pixBarrelL2.extent.set(Acts::AxisDirection::AxisR, 100., 120.); + pixBarrelL2.extent.set(Acts::AxisDirection::AxisZ, -580., 580); pixBarrelL2.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; Acts::ProtoVolume pixBarrelL3; pixBarrelL3.name = "odd-pixel-barrel-l3"; - pixBarrelL3.extent.set(Acts::BinningValue::binR, 160., 180.); - pixBarrelL3.extent.set(Acts::BinningValue::binZ, -580., 580); + pixBarrelL3.extent.set(Acts::AxisDirection::AxisR, 160., 180.); + pixBarrelL3.extent.set(Acts::AxisDirection::AxisZ, -580., 580); pixBarrelL3.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; pixelBarrel.container = Acts::ProtoVolume::ContainerStructure{ {pixBarrelL0, pixBarrelL1, pixBarrelL2, pixBarrelL3}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 1})}, true}; Acts::ProtoVolume pixelPec; pixelPec.name = "odd-pixel-pec"; - pixelPec.extent.set(Acts::BinningValue::binZ, 580., 1000.); + pixelPec.extent.set(Acts::AxisDirection::AxisZ, 580., 1000.); Acts::ProtoVolume pixPecD0; pixPecD0.name = "odd-pixel-pec-d0"; - pixPecD0.extent.set(Acts::BinningValue::binZ, 580., 620); + pixPecD0.extent.set(Acts::AxisDirection::AxisZ, 580., 620); Acts::ProtoVolume pixPecD1; pixPecD1.name = "odd-pixel-pec-d1"; - pixPecD1.extent.set(Acts::BinningValue::binZ, 680., 720); + pixPecD1.extent.set(Acts::AxisDirection::AxisZ, 680., 720); pixelPec.container = Acts::ProtoVolume::ContainerStructure{ {pixPecD0, pixPecD1}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {0., 1})}, true}; for (auto& cv : pixelPec.container.value().constituentVolumes) { cv.internal = @@ -191,15 +191,15 @@ BOOST_AUTO_TEST_CASE(KDTreeTrackingGeometryBuilder_simple) { pixelContainer.container = Acts::ProtoVolume::ContainerStructure{ {pixelNec, pixelBarrel, pixelPec}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {-1000., -580., 580., 1000.})}}; Acts::ProtoVolume detectorContainer; detectorContainer.name = "odd-detector"; - detectorContainer.extent.set(Acts::BinningValue::binR, 0., 200); + detectorContainer.extent.set(Acts::AxisDirection::AxisR, 0., 200); detectorContainer.container = Acts::ProtoVolume::ContainerStructure{ {beamPipeContainer, pixelContainer}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 17.5, 200.})}}; Acts::ProtoDetector detector; diff --git a/Tests/UnitTests/Core/Geometry/LayerCreatorTests.cpp b/Tests/UnitTests/Core/Geometry/LayerCreatorTests.cpp index 20f43a3b68e..adf80a20880 100644 --- a/Tests/UnitTests/Core/Geometry/LayerCreatorTests.cpp +++ b/Tests/UnitTests/Core/Geometry/LayerCreatorTests.cpp @@ -245,8 +245,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_createCylinderLayer, LayerCreatorFixture) { // CASE I double envR = 0.1, envZ = 0.5; ProtoLayer pl(tgContext, srf); - pl.envelope[Acts::BinningValue::binR] = {envR, envR}; - pl.envelope[Acts::BinningValue::binZ] = {envZ, envZ}; + pl.envelope[Acts::AxisDirection::AxisR] = {envR, envR}; + pl.envelope[Acts::AxisDirection::AxisZ] = {envZ, envZ}; std::shared_ptr layer = std::dynamic_pointer_cast( p_LC->cylinderLayer(tgContext, srf, equidistant, equidistant, pl)); @@ -270,8 +270,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_createCylinderLayer, LayerCreatorFixture) { // CASE II ProtoLayer pl2(tgContext, srf); - pl2.envelope[Acts::BinningValue::binR] = {envR, envR}; - pl2.envelope[Acts::BinningValue::binZ] = {envZ, envZ}; + pl2.envelope[Acts::AxisDirection::AxisR] = {envR, envR}; + pl2.envelope[Acts::AxisDirection::AxisZ] = {envZ, envZ}; layer = std::dynamic_pointer_cast( p_LC->cylinderLayer(tgContext, srf, 30, 7, pl2)); CHECK_CLOSE_REL(layer->thickness(), (rMax - rMin) + 2 * envR, 1e-3); @@ -306,8 +306,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_createCylinderLayer, LayerCreatorFixture) { // CASE III ProtoLayer pl3; - pl3.extent.range(Acts::BinningValue::binR).set(1, 20); - pl3.extent.range(Acts::BinningValue::binZ).set(-25, 25); + pl3.extent.range(Acts::AxisDirection::AxisR).set(1, 20); + pl3.extent.range(Acts::AxisDirection::AxisZ).set(-25, 25); layer = std::dynamic_pointer_cast( p_LC->cylinderLayer(tgContext, srf, equidistant, equidistant, pl3)); CHECK_CLOSE_REL(layer->thickness(), 19, 1e-3); @@ -340,8 +340,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_createDiscLayer, LayerCreatorFixture) { draw_surfaces(surfaces, "LayerCreator_createDiscLayer_EC_1.obj"); ProtoLayer pl(tgContext, surfaces); - pl.extent.range(BinningValue::binZ).set(-10, 10); - pl.extent.range(BinningValue::binR).set(5., 25.); + pl.extent.range(AxisDirection::AxisZ).set(-10, 10); + pl.extent.range(AxisDirection::AxisR).set(5., 25.); std::shared_ptr layer = std::dynamic_pointer_cast( p_LC->discLayer(tgContext, surfaces, equidistant, equidistant, pl)); CHECK_CLOSE_REL(layer->thickness(), 20, 1e-3); @@ -368,8 +368,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_createDiscLayer, LayerCreatorFixture) { double envMinR = 1, envMaxR = 1, envZ = 5; std::size_t nBinsR = 3, nBinsPhi = 30; ProtoLayer pl2(tgContext, surfaces); - pl2.envelope[BinningValue::binR] = {envMinR, envMaxR}; - pl2.envelope[BinningValue::binZ] = {envZ, envZ}; + pl2.envelope[AxisDirection::AxisR] = {envMinR, envMaxR}; + pl2.envelope[AxisDirection::AxisZ] = {envZ, envZ}; layer = std::dynamic_pointer_cast( p_LC->discLayer(tgContext, surfaces, nBinsR, nBinsPhi, pl2)); @@ -424,8 +424,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_barrelStagger, LayerCreatorFixture) { double envR = 0, envZ = 0; ProtoLayer pl(tgContext, brl); - pl.envelope[BinningValue::binR] = {envR, envR}; - pl.envelope[BinningValue::binZ] = {envZ, envZ}; + pl.envelope[AxisDirection::AxisR] = {envR, envR}; + pl.envelope[AxisDirection::AxisZ] = {envZ, envZ}; std::shared_ptr layer = std::dynamic_pointer_cast( p_LC->cylinderLayer(tgContext, brl, equidistant, equidistant, pl)); @@ -444,7 +444,7 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_barrelStagger, LayerCreatorFixture) { // std::cout << "dPHi = " << A->center().phi() - B->center().phi() << // std::endl; - Vector3 ctr = A->binningPosition(tgContext, BinningValue::binR); + Vector3 ctr = A->referencePosition(tgContext, AxisDirection::AxisR); auto binContent = layer->surfaceArray()->at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 2u); std::set act; diff --git a/Tests/UnitTests/Core/Geometry/NavigationLayerTests.cpp b/Tests/UnitTests/Core/Geometry/NavigationLayerTests.cpp index 32406c3a288..6e606e3e03c 100644 --- a/Tests/UnitTests/Core/Geometry/NavigationLayerTests.cpp +++ b/Tests/UnitTests/Core/Geometry/NavigationLayerTests.cpp @@ -51,10 +51,10 @@ BOOST_AUTO_TEST_CASE(NavigationLayerProperties) { auto rawSurfacePtr = pSurface.get(); auto pNavigationLayer = NavigationLayer::create(std::move(pSurface), thickness); - BinningValue b{BinningValue::binZ}; + AxisDirection b{AxisDirection::AxisZ}; Vector3 origin{0., 0., 0.}; - // binningPosition(), needs a better test - BOOST_CHECK_EQUAL(pNavigationLayer->binningPosition(tgContext, b), origin); + // referencePosition(), needs a better test + BOOST_CHECK_EQUAL(pNavigationLayer->referencePosition(tgContext, b), origin); // surfaceRepresentation() [looks dangerous] BOOST_CHECK_EQUAL(rawSurfacePtr, &(pNavigationLayer->surfaceRepresentation())); diff --git a/Tests/UnitTests/Core/Geometry/PlaneLayerTests.cpp b/Tests/UnitTests/Core/Geometry/PlaneLayerTests.cpp index b3d96a56943..229ce3fbe8e 100644 --- a/Tests/UnitTests/Core/Geometry/PlaneLayerTests.cpp +++ b/Tests/UnitTests/Core/Geometry/PlaneLayerTests.cpp @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(PlaneLayerConstruction) { SurfaceArrayCreator sac; std::size_t binsX(2), binsY(4); auto pSurfaceArray = sac.surfaceArrayOnPlane(tgContext, aSurfaces, binsX, - binsY, BinningValue::binZ); + binsY, AxisDirection::AxisZ); auto pPlaneLayerFromSurfaces = PlaneLayer::create(pTransform, pRectangle, std::move(pSurfaceArray)); BOOST_CHECK_EQUAL(pPlaneLayerFromSurfaces->layerType(), LayerType::active); diff --git a/Tests/UnitTests/Core/Geometry/PolyhedronTests.cpp b/Tests/UnitTests/Core/Geometry/PolyhedronTests.cpp index d087c6485cf..6b6e8548d0c 100644 --- a/Tests/UnitTests/Core/Geometry/PolyhedronTests.cpp +++ b/Tests/UnitTests/Core/Geometry/PolyhedronTests.cpp @@ -83,18 +83,18 @@ BOOST_AUTO_TEST_CASE(PolyhedronExtent) { Polyhedron rectangle(rvertices, rfaces, rmesh); auto rExtent = rectangle.extent(); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binX), -1., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binX), 1., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binY), -2., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binY), -1., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binZ), 0., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binZ), 0., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binR), 1., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binR), + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisX), -1., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisX), 1., 1e-6); + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisY), -2., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisY), -1., 1e-6); + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisZ), 0., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisZ), 0., 1e-6); + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisR), 1., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisR), VectorHelpers::perp(rvertices[0]), 1e-6); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binPhi), + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisPhi), VectorHelpers::phi(rvertices[3]), 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binPhi), + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisPhi), VectorHelpers::phi(rvertices[2]), 1e-6); // Now shift the Extent @@ -102,12 +102,12 @@ BOOST_AUTO_TEST_CASE(PolyhedronExtent) { Transform3 shiftedTransform = Transform3::Identity(); shiftedTransform.pretranslate(shift); rExtent = rectangle.extent(shiftedTransform); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binX), -2., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binX), 0., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binY), -2., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binY), -1., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binZ), 1., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binZ), 1., 1e-6); + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisX), -2., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisX), 0., 1e-6); + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisY), -2., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisY), -1., 1e-6); + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisZ), 1., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisZ), 1., 1e-6); // Test a rectangle in yz - pane (at x == 3) rvertices = {Vector3(3_mm, -5_mm, -10_mm), Vector3(3_mm, 5_mm, -10_mm), @@ -115,14 +115,14 @@ BOOST_AUTO_TEST_CASE(PolyhedronExtent) { rectangle = Polyhedron(rvertices, rfaces, rmesh); rExtent = rectangle.extent(); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binX), 3., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binX), 3., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binY), -5., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binY), 5., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binZ), -10., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binZ), 10., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(BinningValue::binR), 3., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(BinningValue::binR), std::sqrt(9. + 25.), 1e-6); + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisX), 3., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisX), 3., 1e-6); + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisY), -5., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisY), 5., 1e-6); + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisZ), -10., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisZ), 10., 1e-6); + CHECK_CLOSE_ABS(rExtent.min(AxisDirection::AxisR), 3., 1e-6); + CHECK_CLOSE_ABS(rExtent.max(AxisDirection::AxisR), std::sqrt(9. + 25.), 1e-6); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Core/Geometry/PortalLinkTests.cpp b/Tests/UnitTests/Core/Geometry/PortalLinkTests.cpp index fd87545d4f0..90b39c63d4d 100644 --- a/Tests/UnitTests/Core/Geometry/PortalLinkTests.cpp +++ b/Tests/UnitTests/Core/Geometry/PortalLinkTests.cpp @@ -23,7 +23,7 @@ #include "Acts/Surfaces/RadialBounds.hpp" #include "Acts/Surfaces/SurfaceMergingException.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/ThrowAssert.hpp" #include @@ -94,23 +94,23 @@ BOOST_AUTO_TEST_CASE(Cylinder) { std::make_shared(30_mm, 40_mm, 100_mm)); // Incompatible binning - BOOST_CHECK_THROW( - GridPortalLink::make(cyl, BinningValue::binZ, Axis{AxisBound, 0, 5, 5}), - std::invalid_argument); + BOOST_CHECK_THROW(GridPortalLink::make(cyl, AxisDirection::AxisZ, + Axis{AxisBound, 0, 5, 5}), + std::invalid_argument); - auto grid1dCyl = GridPortalLink::make(cyl, BinningValue::binZ, + auto grid1dCyl = GridPortalLink::make(cyl, AxisDirection::AxisZ, Axis{AxisBound, -100_mm, 100_mm, 10}); BOOST_REQUIRE(grid1dCyl); grid1dCyl->setVolume(vol.get()); // Throws because non-closed axis - BOOST_CHECK_THROW(GridPortalLink::make(cyl, BinningValue::binRPhi, + BOOST_CHECK_THROW(GridPortalLink::make(cyl, AxisDirection::AxisRPhi, Axis{AxisBound, -180_degree * 30_mm, 180_degree * 30_mm, 10}), std::invalid_argument); auto grid1dCylRPhi = GridPortalLink::make( - cyl, BinningValue::binRPhi, + cyl, AxisDirection::AxisRPhi, Axis{AxisClosed, -180_degree * 30_mm, 180_degree * 30_mm, 10}); BOOST_REQUIRE_NE(grid1dCylRPhi, nullptr); grid1dCylRPhi->setVolume(vol.get()); @@ -124,14 +124,14 @@ BOOST_AUTO_TEST_CASE(Cylinder) { auto cyl2 = Surface::makeShared( Transform3{Translation3{Vector3::UnitZ() * 150_mm}}, 30_mm, 50_mm); - auto grid1dCyl2 = GridPortalLink::make(cyl2, BinningValue::binZ, + auto grid1dCyl2 = GridPortalLink::make(cyl2, AxisDirection::AxisZ, Axis{AxisBound, -50_mm, 50_mm, 5}); // Test exception on cylinder with non-zero average phi auto cylNonZeroAverage = Surface::makeShared( Transform3::Identity(), 30_mm, 100_mm, 20_degree, 45_degree); BOOST_CHECK_THROW( - GridPortalLink::make(cylNonZeroAverage, BinningValue::binZ, + GridPortalLink::make(cylNonZeroAverage, AxisDirection::AxisZ, Axis{AxisBound, -100_mm, 100_mm, 10}), std::invalid_argument); @@ -185,12 +185,12 @@ BOOST_AUTO_TEST_CASE(Cylinder) { auto cylPhi = Surface::makeShared( Transform3::Identity(), 30_mm, 100_mm, 45_degree); std::unique_ptr grid1dCylPhi = GridPortalLink::make( - cylPhi, BinningValue::binZ, Axis{AxisBound, -100_mm, 100_mm, 10}); + cylPhi, AxisDirection::AxisZ, Axis{AxisBound, -100_mm, 100_mm, 10}); grid1dCylPhi->setVolume(vol.get()); // Check that phi sector portal does not accept closed axis - BOOST_CHECK_THROW(GridPortalLink::make(cylPhi, BinningValue::binRPhi, + BOOST_CHECK_THROW(GridPortalLink::make(cylPhi, AxisDirection::AxisRPhi, Axis{AxisClosed, -45_degree * 30_mm, 45_degree * 30_mm, 10}), std::invalid_argument); @@ -290,17 +290,17 @@ BOOST_AUTO_TEST_CASE(Disc) { Transform3::Identity(), std::make_shared(30_mm, 40_mm, 100_mm)); - BOOST_CHECK_THROW(GridPortalLink::make(disc1, BinningValue::binZ, + BOOST_CHECK_THROW(GridPortalLink::make(disc1, AxisDirection::AxisZ, Axis{AxisBound, 30_mm, 100_mm, 3}), std::invalid_argument); // Check exception for full disc and non-closed phi axis BOOST_CHECK_THROW( - GridPortalLink::make(disc1, BinningValue::binPhi, + GridPortalLink::make(disc1, AxisDirection::AxisPhi, Axis{AxisBound, -180_degree, 180_degree, 3}), std::invalid_argument); - auto grid1 = GridPortalLink::make(disc1, BinningValue::binR, + auto grid1 = GridPortalLink::make(disc1, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 3}); BOOST_REQUIRE_NE(grid1, nullptr); BOOST_CHECK_EQUAL(grid1->grid().axes().size(), 1); @@ -315,12 +315,12 @@ BOOST_AUTO_TEST_CASE(Disc) { // Check thet disc with phi sector does not accept closed axis BOOST_CHECK_THROW( - GridPortalLink::make(discPhi, BinningValue::binPhi, + GridPortalLink::make(discPhi, AxisDirection::AxisPhi, Axis{AxisClosed, -45_degree, 45_degree, 3}), std::invalid_argument); auto gridPhi = - GridPortalLink::make(discPhi, BinningValue::binPhi, + GridPortalLink::make(discPhi, AxisDirection::AxisPhi, Axis{AxisBound, -45_degree, 45_degree, 3}); BOOST_REQUIRE_NE(gridPhi, nullptr); gridPhi->setVolume(vol.get()); @@ -330,7 +330,7 @@ BOOST_AUTO_TEST_CASE(Disc) { Transform3::Identity(), std::make_shared(30_mm, 100_mm, 45_degree, 75_degree)); BOOST_CHECK_THROW( - GridPortalLink::make(discNonZeroAverage, BinningValue::binR, + GridPortalLink::make(discNonZeroAverage, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 3}), std::invalid_argument); @@ -379,7 +379,7 @@ BOOST_AUTO_TEST_CASE(Disc) { *grid2dExplicit)); auto gridPhiBinnedInR = GridPortalLink::make( - discPhi, BinningValue::binR, Axis{AxisBound, 30_mm, 100_mm, 3}); + discPhi, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 3}); gridPhiBinnedInR->setVolume(vol.get()); auto grid2dPhiNonClosed = gridPhiBinnedInR->extendTo2d(nullptr); BOOST_REQUIRE(grid2dPhiNonClosed); @@ -483,7 +483,7 @@ BOOST_AUTO_TEST_CASE(FromTrivial) { BOOST_CHECK_EQUAL(trivial->resolveVolume(gctx, Vector2{1, 2}).value(), vol.get()); - auto gridZ = trivial->makeGrid(BinningValue::binZ); + auto gridZ = trivial->makeGrid(AxisDirection::AxisZ); BOOST_REQUIRE(gridZ); BOOST_CHECK_EQUAL(gridZ->grid().axes().size(), 1); @@ -495,7 +495,7 @@ BOOST_AUTO_TEST_CASE(FromTrivial) { gridZ->resolveVolume(gctx, Vector2{20_degree * 30_mm, 90_mm}).value(), vol.get()); - auto gridRPhi = trivial->makeGrid(BinningValue::binRPhi); + auto gridRPhi = trivial->makeGrid(AxisDirection::AxisRPhi); BOOST_REQUIRE(gridRPhi); BOOST_CHECK_EQUAL(gridRPhi->grid().axes().size(), 1); @@ -513,7 +513,7 @@ BOOST_AUTO_TEST_CASE(FromTrivial) { BOOST_CHECK_EQUAL(trivialPhi->resolveVolume(gctx, Vector2{1, 2}).value(), vol.get()); - auto gridRPhiSector = trivialPhi->makeGrid(BinningValue::binRPhi); + auto gridRPhiSector = trivialPhi->makeGrid(AxisDirection::AxisRPhi); BOOST_REQUIRE(gridRPhiSector); BOOST_CHECK_EQUAL( @@ -543,7 +543,7 @@ BOOST_AUTO_TEST_CASE(FromTrivial) { BOOST_CHECK_EQUAL(trivial->resolveVolume(gctx, Vector2{1, 2}).value(), vol.get()); - auto gridR = trivial->makeGrid(BinningValue::binR); + auto gridR = trivial->makeGrid(AxisDirection::AxisR); BOOST_REQUIRE(gridR); BOOST_CHECK_EQUAL(gridR->grid().axes().size(), 1); @@ -555,7 +555,7 @@ BOOST_AUTO_TEST_CASE(FromTrivial) { gridR->resolveVolume(gctx, Vector2{90_mm, 10_degree}).value(), vol.get()); - auto gridPhi = trivial->makeGrid(BinningValue::binPhi); + auto gridPhi = trivial->makeGrid(AxisDirection::AxisPhi); BOOST_REQUIRE(gridPhi); BOOST_CHECK_EQUAL(gridPhi->grid().axes().size(), 1); @@ -584,7 +584,7 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { auto cyl = Surface::makeShared(Transform3::Identity(), 30_mm, 100_mm); - auto grid1dCyl = GridPortalLink::make(cyl, BinningValue::binZ, + auto grid1dCyl = GridPortalLink::make(cyl, AxisDirection::AxisZ, Axis{AxisBound, -100_mm, 100_mm, 10}); grid1dCyl->setVolume(vol1.get()); @@ -592,24 +592,24 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { auto cyl2 = Surface::makeShared( Transform3{Translation3{Vector3::UnitZ() * 150_mm}}, 30_mm, 50_mm); - auto grid1dCyl2 = GridPortalLink::make(cyl2, BinningValue::binZ, + auto grid1dCyl2 = GridPortalLink::make(cyl2, AxisDirection::AxisZ, Axis{AxisBound, -50_mm, 50_mm, 5}); grid1dCyl2->setVolume(vol2.get()); // Completely invalid BOOST_CHECK_THROW(GridPortalLink::merge(*grid1dCyl, *grid1dCyl2, - BinningValue::binPhi, *logger), + AxisDirection::AxisPhi, *logger), AssertionFailureException); // Invalid direction, as the cylinders are shifted in z, and can't be merged // in r x phi BOOST_CHECK_THROW(GridPortalLink::merge(*grid1dCyl, *grid1dCyl2, - BinningValue::binRPhi, *logger), + AxisDirection::AxisRPhi, *logger), SurfaceMergingException); BOOST_TEST_CONTEXT("Consistent equidistant") { auto mergedPtr = GridPortalLink::merge(*grid1dCyl, *grid1dCyl2, - BinningValue::binZ, *logger); + AxisDirection::AxisZ, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -624,10 +624,10 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Inconsistent equidistant") { auto grid1dCyl2BinWidthChanged = GridPortalLink::make( - cyl2, BinningValue::binZ, Axis{AxisBound, -50_mm, 50_mm, 6}); + cyl2, AxisDirection::AxisZ, Axis{AxisBound, -50_mm, 50_mm, 6}); auto mergedPtr = GridPortalLink::merge( - *grid1dCyl, *grid1dCyl2BinWidthChanged, BinningValue::binZ, *logger); + *grid1dCyl, *grid1dCyl2BinWidthChanged, AxisDirection::AxisZ, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -641,15 +641,15 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { } BOOST_TEST_CONTEXT("Right Variable") { - auto gridLeft = GridPortalLink::make(cyl, BinningValue::binZ, + auto gridLeft = GridPortalLink::make(cyl, AxisDirection::AxisZ, Axis{AxisBound, -100_mm, 100_mm, 10}); auto gridRight = - GridPortalLink::make(cyl2, BinningValue::binZ, + GridPortalLink::make(cyl2, AxisDirection::AxisZ, Axis{AxisBound, {-50_mm, -10_mm, 10_mm, 50_mm}}); auto mergedPtr = GridPortalLink::merge(*gridLeft, *gridRight, - BinningValue::binZ, *logger); + AxisDirection::AxisZ, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -664,14 +664,14 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Left Variable") { auto gridLeft = - GridPortalLink::make(cyl, BinningValue::binZ, + GridPortalLink::make(cyl, AxisDirection::AxisZ, Axis{AxisBound, {-100_mm, -80_mm, 10_mm, 100_mm}}); - auto gridRight = GridPortalLink::make(cyl2, BinningValue::binZ, + auto gridRight = GridPortalLink::make(cyl2, AxisDirection::AxisZ, Axis{AxisBound, -50_mm, 50_mm, 8}); auto mergedPtr = GridPortalLink::merge(*gridLeft, *gridRight, - BinningValue::binZ, *logger); + AxisDirection::AxisZ, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -686,15 +686,15 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Both Variable") { auto gridLeft = - GridPortalLink::make(cyl, BinningValue::binZ, + GridPortalLink::make(cyl, AxisDirection::AxisZ, Axis{AxisBound, {-100_mm, -80_mm, 10_mm, 100_mm}}); auto gridRight = - GridPortalLink::make(cyl2, BinningValue::binZ, + GridPortalLink::make(cyl2, AxisDirection::AxisZ, Axis{AxisBound, {-50_mm, -10_mm, 10_mm, 50_mm}}); auto mergedPtr = GridPortalLink::merge(*gridLeft, *gridRight, - BinningValue::binZ, *logger); + AxisDirection::AxisZ, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -709,21 +709,21 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Non bound axis") { std::unique_ptr gridLeft = - GridPortalLink::make(cyl, BinningValue::binZ, + GridPortalLink::make(cyl, AxisDirection::AxisZ, Axis{AxisBound, {-100_mm, -80_mm, 10_mm, 100_mm}}); std::unique_ptr gridRightClosed = - GridPortalLink::make(cyl2, BinningValue::binZ, + GridPortalLink::make(cyl2, AxisDirection::AxisZ, Axis{AxisClosed, {-50_mm, -10_mm, 10_mm, 50_mm}}); std::unique_ptr gridRightOpen = - GridPortalLink::make(cyl2, BinningValue::binZ, + GridPortalLink::make(cyl2, AxisDirection::AxisZ, Axis{AxisOpen, {-50_mm, -10_mm, 10_mm, 50_mm}}); auto compositeLR = PortalLinkBase::merge( - copy(gridLeft), copy(gridRightClosed), BinningValue::binZ, *logger); + copy(gridLeft), copy(gridRightClosed), AxisDirection::AxisZ, *logger); BOOST_CHECK_NE(dynamic_cast(compositeLR.get()), nullptr); auto compositeRL = PortalLinkBase::merge( - copy(gridLeft), copy(gridRightOpen), BinningValue::binZ, *logger); + copy(gridLeft), copy(gridRightOpen), AxisDirection::AxisZ, *logger); BOOST_CHECK_NE(dynamic_cast(compositeRL.get()), nullptr); } @@ -735,7 +735,7 @@ BOOST_AUTO_TEST_CASE(ParallelMerge) { 30_mm, 100_mm, 35_degree); auto grid1 = GridPortalLink::make( - cyl1, BinningValue::binRPhi, + cyl1, AxisDirection::AxisRPhi, Axis{AxisBound, -35_degree * 30_mm, 35_degree * 30_mm, 3}); auto cyl2 = Surface::makeShared( @@ -743,11 +743,11 @@ BOOST_AUTO_TEST_CASE(ParallelMerge) { 35_degree); auto grid2 = GridPortalLink::make( - cyl2, BinningValue::binRPhi, + cyl2, AxisDirection::AxisRPhi, Axis{AxisBound, -35_degree * 30_mm, 35_degree * 30_mm, 3}); auto merged12Ptr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binZ, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisZ, *logger); BOOST_REQUIRE_NE(merged12Ptr, nullptr); auto merged12 = dynamic_cast(merged12Ptr.get()); BOOST_REQUIRE_NE(merged12, nullptr); @@ -769,7 +769,7 @@ BOOST_AUTO_TEST_SUITE(RPhiDirection) BOOST_AUTO_TEST_CASE(ColinearMerge) { auto cyl = Surface::makeShared(Transform3::Identity(), 30_mm, 100_mm); - BOOST_CHECK_THROW(GridPortalLink::make(cyl, BinningValue::binRPhi, + BOOST_CHECK_THROW(GridPortalLink::make(cyl, AxisDirection::AxisRPhi, Axis{AxisBound, 0, 5, 5}), std::invalid_argument); @@ -778,7 +778,7 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_CHECK_THROW( GridPortalLink::make( - cylNonZeroAverage, BinningValue::binRPhi, + cylNonZeroAverage, AxisDirection::AxisRPhi, Axis{AxisBound, -20_degree * 30_mm, 20_degree * 30_mm, 5}), std::invalid_argument); @@ -792,11 +792,11 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { 30_mm, 100_mm, 40_degree, 0_degree); auto portalPhi1 = GridPortalLink::make( - cylPhi1, BinningValue::binRPhi, + cylPhi1, AxisDirection::AxisRPhi, Axis{AxisBound, -20_degree * 30_mm, 20_degree * 30_mm, 5}); auto portalPhi2 = GridPortalLink::make( - cylPhi2, BinningValue::binRPhi, + cylPhi2, AxisDirection::AxisRPhi, Axis{AxisBound, -40_degree * 30_mm, 40_degree * 30_mm, 10}); auto cylPhi3 = Surface::makeShared( @@ -808,16 +808,16 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { 30_mm, 100_mm, 90_degree, 0_degree); auto portalPhi3 = GridPortalLink::make( - cylPhi3, BinningValue::binRPhi, + cylPhi3, AxisDirection::AxisRPhi, Axis{AxisBound, -90_degree * 30_mm, 90_degree * 30_mm, 2}); auto portalPhi4 = GridPortalLink::make( - cylPhi4, BinningValue::binRPhi, + cylPhi4, AxisDirection::AxisRPhi, Axis{AxisBound, -90_degree * 30_mm, 90_degree * 30_mm, 2}); BOOST_TEST_CONTEXT("Consistent equidistant") { - auto portalMerged = GridPortalLink::merge(*portalPhi1, *portalPhi2, - BinningValue::binRPhi, *logger); + auto portalMerged = GridPortalLink::merge( + *portalPhi1, *portalPhi2, AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(portalMerged, nullptr); const auto* merged = @@ -833,7 +833,7 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { // Test that if you merge half-circles, we get a closed axis auto portalMerged34 = GridPortalLink::merge( - *portalPhi3, *portalPhi4, BinningValue::binRPhi, *logger); + *portalPhi3, *portalPhi4, AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(portalMerged34, nullptr); const auto* merged34 = @@ -850,11 +850,11 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Inconsistent equidistant") { auto portalPhi2Mod = GridPortalLink::make( - cylPhi2, BinningValue::binRPhi, + cylPhi2, AxisDirection::AxisRPhi, Axis{AxisBound, -40_degree * 30_mm, 40_degree * 30_mm, 3}); auto portalMergedMod = GridPortalLink::merge( - *portalPhi1, *portalPhi2Mod, BinningValue::binRPhi, *logger); + *portalPhi1, *portalPhi2Mod, AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(portalMergedMod, nullptr); const auto* merged12 = @@ -874,11 +874,11 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { CHECK_CLOSE_OR_SMALL(axis12.getBinEdges(), expected12, 1e-4, 10e-10); auto portalPhi4Mod = GridPortalLink::make( - cylPhi4, BinningValue::binRPhi, + cylPhi4, AxisDirection::AxisRPhi, Axis{AxisBound, -90_degree * 30_mm, 90_degree * 30_mm, 1}); auto portalMerged34 = GridPortalLink::merge( - *portalPhi3, *portalPhi4Mod, BinningValue::binRPhi, *logger); + *portalPhi3, *portalPhi4Mod, AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(portalMerged34, nullptr); const auto* merged34 = @@ -901,16 +901,16 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Left variable") { BOOST_TEST_CONTEXT("Non-closed") { auto gridLeft = - GridPortalLink::make(cylPhi1, BinningValue::binRPhi, + GridPortalLink::make(cylPhi1, AxisDirection::AxisRPhi, Axis{AxisBound, {-20_degree * 30_mm, -10_degree * 30_mm, 10_degree * 30_mm, 20_degree * 30_mm}}); auto gridRight = GridPortalLink::make( - cylPhi2, BinningValue::binRPhi, + cylPhi2, AxisDirection::AxisRPhi, Axis{AxisBound, -40_degree * 30_mm, 40_degree * 30_mm, 3}); - auto mergedPtr = GridPortalLink::merge(*gridLeft, *gridRight, - BinningValue::binRPhi, *logger); + auto mergedPtr = GridPortalLink::merge( + *gridLeft, *gridRight, AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = @@ -931,16 +931,16 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Closed") { auto gridLeft = GridPortalLink::make( - cylPhi4, BinningValue::binRPhi, + cylPhi4, AxisDirection::AxisRPhi, Axis{AxisBound, {-90_degree * 30_mm, 25_degree * 30_mm, 90_degree * 30_mm}}); auto gridRight = GridPortalLink::make( - cylPhi3, BinningValue::binRPhi, + cylPhi3, AxisDirection::AxisRPhi, Axis{AxisBound, -90_degree * 30_mm, 90_degree * 30_mm, 3}); - auto mergedPtr = GridPortalLink::merge(*gridLeft, *gridRight, - BinningValue::binRPhi, *logger); + auto mergedPtr = GridPortalLink::merge( + *gridLeft, *gridRight, AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = @@ -965,16 +965,16 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Right variable") { BOOST_TEST_CONTEXT("Non-closed") { auto gridLeft = GridPortalLink::make( - cylPhi1, BinningValue::binRPhi, + cylPhi1, AxisDirection::AxisRPhi, Axis{AxisBound, -20_degree * 30_mm, 20_degree * 30_mm, 3}); auto gridRight = - GridPortalLink::make(cylPhi2, BinningValue::binRPhi, + GridPortalLink::make(cylPhi2, AxisDirection::AxisRPhi, Axis{AxisBound, {-40_degree * 30_mm, -10_degree * 30_mm, 10_degree * 30_mm, 40_degree * 30_mm}}); - auto mergedPtr = GridPortalLink::merge(*gridLeft, *gridRight, - BinningValue::binRPhi, *logger); + auto mergedPtr = GridPortalLink::merge( + *gridLeft, *gridRight, AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = @@ -995,16 +995,16 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Closed") { auto gridLeft = GridPortalLink::make( - cylPhi4, BinningValue::binRPhi, + cylPhi4, AxisDirection::AxisRPhi, Axis{AxisBound, -90_degree * 30_mm, 90_degree * 30_mm, 3}); auto gridRight = GridPortalLink::make( - cylPhi3, BinningValue::binRPhi, + cylPhi3, AxisDirection::AxisRPhi, Axis{AxisBound, {-90_degree * 30_mm, 25_degree * 30_mm, 90_degree * 30_mm}}); - auto mergedPtr = GridPortalLink::merge(*gridLeft, *gridRight, - BinningValue::binRPhi, *logger); + auto mergedPtr = GridPortalLink::merge( + *gridLeft, *gridRight, AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = @@ -1029,17 +1029,17 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Both variable") { BOOST_TEST_CONTEXT("Non-closed") { auto gridLeft = - GridPortalLink::make(cylPhi1, BinningValue::binRPhi, + GridPortalLink::make(cylPhi1, AxisDirection::AxisRPhi, Axis{AxisBound, {-20_degree * 30_mm, -10_degree * 30_mm, 10_degree * 30_mm, 20_degree * 30_mm}}); auto gridRight = GridPortalLink::make( - cylPhi2, BinningValue::binRPhi, + cylPhi2, AxisDirection::AxisRPhi, Axis{AxisBound, {-40_degree * 30_mm, -5_degree * 30_mm, 40_degree * 30_mm}}); - auto mergedPtr = GridPortalLink::merge(*gridLeft, *gridRight, - BinningValue::binRPhi, *logger); + auto mergedPtr = GridPortalLink::merge( + *gridLeft, *gridRight, AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = @@ -1060,18 +1060,18 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { BOOST_TEST_CONTEXT("Closed") { auto gridLeft = GridPortalLink::make( - cylPhi4, BinningValue::binRPhi, + cylPhi4, AxisDirection::AxisRPhi, Axis{AxisBound, {-90_degree * 30_mm, 25_degree * 30_mm, 90_degree * 30_mm}}); auto gridRight = - GridPortalLink::make(cylPhi3, BinningValue::binRPhi, + GridPortalLink::make(cylPhi3, AxisDirection::AxisRPhi, Axis{AxisBound, {-90_degree * 30_mm, -10_degree * 30_mm, 10_degree * 30_mm, 90_degree * 30_mm}}); - auto mergedPtr = GridPortalLink::merge(*gridLeft, *gridRight, - BinningValue::binRPhi, *logger); + auto mergedPtr = GridPortalLink::merge( + *gridLeft, *gridRight, AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(mergedPtr, nullptr); const auto* merged = @@ -1105,14 +1105,14 @@ BOOST_AUTO_TEST_CASE(ParallelMerge) { Transform3::Identity() * AngleAxis3(85_degree, Vector3::UnitZ()), 30_mm, 100_mm, 20_degree, 0_degree); - auto portalPhi1 = GridPortalLink::make(cylPhi1, BinningValue::binZ, + auto portalPhi1 = GridPortalLink::make(cylPhi1, AxisDirection::AxisZ, Axis{AxisBound, -100_mm, 100_mm, 5}); - auto portalPhi2 = GridPortalLink::make(cylPhi2, BinningValue::binZ, + auto portalPhi2 = GridPortalLink::make(cylPhi2, AxisDirection::AxisZ, Axis{AxisBound, -100_mm, 100_mm, 5}); auto merged12Ptr = GridPortalLink::merge(*portalPhi1, *portalPhi2, - BinningValue::binRPhi, *logger); + AxisDirection::AxisRPhi, *logger); BOOST_REQUIRE_NE(merged12Ptr, nullptr); auto merged12 = dynamic_cast(merged12Ptr.get()); BOOST_REQUIRE_NE(merged12, nullptr); @@ -1154,7 +1154,7 @@ BOOST_AUTO_TEST_CASE(ZDirection) { // We're merging in z direction, so the phi binnings need to be the same auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binZ, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisZ, *logger); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(mergedPtr, nullptr); @@ -1178,7 +1178,7 @@ BOOST_AUTO_TEST_CASE(ZDirection) { Axis{AxisBound, -50_mm, 50_mm, 5}); auto composite = PortalLinkBase::merge(copy(grid1), copy(grid3), - BinningValue::binZ, *logger); + AxisDirection::AxisZ, *logger); BOOST_CHECK_NE(dynamic_cast(composite.get()), nullptr); } @@ -1202,7 +1202,7 @@ BOOST_AUTO_TEST_CASE(ZDirection) { Axis{AxisBound, -50_mm, 50_mm, 5}); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binZ, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisZ, *logger); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(mergedPtr, nullptr); @@ -1240,7 +1240,7 @@ BOOST_AUTO_TEST_CASE(RPhiDirection) { // We're merging in z direction, so the phi binnings need to be the same auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binRPhi, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisRPhi, *logger); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(mergedPtr, nullptr); @@ -1266,17 +1266,17 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { auto disc1 = Surface::makeShared(Transform3::Identity(), 30_mm, 100_mm); - auto grid1 = GridPortalLink::make(disc1, BinningValue::binR, + auto grid1 = GridPortalLink::make(disc1, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 7}); auto disc2 = Surface::makeShared(Transform3::Identity(), 100_mm, 150_mm); - auto grid2 = GridPortalLink::make(disc2, BinningValue::binR, + auto grid2 = GridPortalLink::make(disc2, AxisDirection::AxisR, Axis{AxisBound, 100_mm, 150_mm, 5}); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binR, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisR, *logger); BOOST_REQUIRE(mergedPtr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -1289,17 +1289,17 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { auto discPhi1 = Surface::makeShared(Transform3::Identity(), 30_mm, 100_mm, 30_degree); - auto discPhiGrid1 = GridPortalLink::make(discPhi1, BinningValue::binR, + auto discPhiGrid1 = GridPortalLink::make(discPhi1, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 7}); auto discPhi2 = Surface::makeShared(Transform3::Identity(), 100_mm, 150_mm, 30_degree); - auto discPhiGrid2 = GridPortalLink::make(discPhi2, BinningValue::binR, + auto discPhiGrid2 = GridPortalLink::make(discPhi2, AxisDirection::AxisR, Axis{AxisBound, 100_mm, 150_mm, 5}); auto mergedPhiPtr = GridPortalLink::merge(*discPhiGrid1, *discPhiGrid2, - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); BOOST_REQUIRE(mergedPhiPtr); const auto* mergedPhi = dynamic_cast(mergedPhiPtr.get()); @@ -1314,18 +1314,18 @@ BOOST_AUTO_TEST_CASE(ParallelMerge) { Surface::makeShared(Transform3::Identity(), 30_mm, 100_mm); auto grid1 = - GridPortalLink::make(disc1, BinningValue::binPhi, + GridPortalLink::make(disc1, AxisDirection::AxisPhi, Axis{AxisClosed, -180_degree, 180_degree, 5}); auto disc2 = Surface::makeShared(Transform3::Identity(), 100_mm, 150_mm); auto grid2 = - GridPortalLink::make(disc2, BinningValue::binPhi, + GridPortalLink::make(disc2, AxisDirection::AxisPhi, Axis{AxisClosed, -180_degree, 180_degree, 5}); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binR, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisR, *logger); BOOST_REQUIRE(mergedPtr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -1347,18 +1347,18 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { auto disc1 = Surface::makeShared(Transform3::Identity(), 30_mm, 100_mm, 30_degree); - auto grid1 = GridPortalLink::make(disc1, BinningValue::binPhi, + auto grid1 = GridPortalLink::make(disc1, AxisDirection::AxisPhi, Axis{AxisBound, -30_degree, 30_degree, 3}); auto disc2 = Surface::makeShared( Transform3{AngleAxis3{90_degree, Vector3::UnitZ()}}, 30_mm, 100_mm, 60_degree); - auto grid2 = GridPortalLink::make(disc2, BinningValue::binPhi, + auto grid2 = GridPortalLink::make(disc2, AxisDirection::AxisPhi, Axis{AxisBound, -60_degree, 60_degree, 6}); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binPhi, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisPhi, *logger); BOOST_REQUIRE(mergedPtr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -1376,7 +1376,7 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { 90_degree); auto grid1Half = - GridPortalLink::make(disc1Half, BinningValue::binPhi, + GridPortalLink::make(disc1Half, AxisDirection::AxisPhi, Axis{AxisBound, -90_degree, 90_degree, 3}); auto disc2Half = Surface::makeShared( @@ -1384,11 +1384,11 @@ BOOST_AUTO_TEST_CASE(ColinearMerge) { 90_degree); auto grid2Half = - GridPortalLink::make(disc2Half, BinningValue::binPhi, + GridPortalLink::make(disc2Half, AxisDirection::AxisPhi, Axis{AxisBound, -90_degree, 90_degree, 3}); auto mergedHalfPtr = GridPortalLink::merge(*grid1Half, *grid2Half, - BinningValue::binPhi, *logger); + AxisDirection::AxisPhi, *logger); BOOST_REQUIRE(mergedHalfPtr); const auto* mergedHalf = dynamic_cast(mergedHalfPtr.get()); @@ -1403,18 +1403,18 @@ BOOST_AUTO_TEST_CASE(ParallelMerge) { auto disc1 = Surface::makeShared(Transform3::Identity(), 30_mm, 100_mm, 30_degree); - auto grid1 = GridPortalLink::make(disc1, BinningValue::binR, + auto grid1 = GridPortalLink::make(disc1, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 3}); auto disc2 = Surface::makeShared( Transform3{AngleAxis3{90_degree, Vector3::UnitZ()}}, 30_mm, 100_mm, 60_degree); - auto grid2 = GridPortalLink::make(disc2, BinningValue::binR, + auto grid2 = GridPortalLink::make(disc2, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 3}); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binPhi, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisPhi, *logger); BOOST_REQUIRE(mergedPtr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -1446,7 +1446,7 @@ BOOST_AUTO_TEST_CASE(BinFilling) { auto disc1 = Surface::makeShared(Transform3::Identity(), 30_mm, 60_mm, 30_degree); - auto grid1 = GridPortalLink::make(disc1, BinningValue::binR, + auto grid1 = GridPortalLink::make(disc1, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 60_mm, 2}); grid1->setVolume(vol1.get()); @@ -1454,13 +1454,13 @@ BOOST_AUTO_TEST_CASE(BinFilling) { auto disc2 = Surface::makeShared(Transform3::Identity(), 60_mm, 90_mm, 30_degree); - auto grid2 = GridPortalLink::make(disc2, BinningValue::binR, + auto grid2 = GridPortalLink::make(disc2, AxisDirection::AxisR, Axis{AxisBound, 60_mm, 90_mm, 2}); grid2->setVolume(vol2.get()); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binR, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisR, *logger); using merged_type = GridPortalLinkT>; @@ -1482,8 +1482,9 @@ BOOST_AUTO_TEST_CASE(BinFilling) { auto disc1 = Surface::makeShared(Transform3::Identity(), 30_mm, 100_mm, 30_degree); - auto grid1 = GridPortalLink::make( - disc1, BinningValue::binPhi, Axis{AxisBound, -30_degree, 30_degree, 2}); + auto grid1 = + GridPortalLink::make(disc1, AxisDirection::AxisPhi, + Axis{AxisBound, -30_degree, 30_degree, 2}); grid1->setVolume(vol1.get()); @@ -1491,13 +1492,14 @@ BOOST_AUTO_TEST_CASE(BinFilling) { Transform3{AngleAxis3{60_degree, Vector3::UnitZ()}}, 30_mm, 100_mm, 30_degree); - auto grid2 = GridPortalLink::make( - disc2, BinningValue::binPhi, Axis{AxisBound, -30_degree, 30_degree, 2}); + auto grid2 = + GridPortalLink::make(disc2, AxisDirection::AxisPhi, + Axis{AxisBound, -30_degree, 30_degree, 2}); grid2->setVolume(vol2.get()); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binPhi, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisPhi, *logger); BOOST_REQUIRE(mergedPtr); using merged_type = @@ -1538,7 +1540,7 @@ BOOST_AUTO_TEST_CASE(RDirection) { Axis{AxisBound, -30_degree, 30_degree, 3}); auto mergedPtr = GridPortalLink::merge(*discPhiGrid1, *discPhiGrid2, - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); BOOST_REQUIRE(mergedPtr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -1573,7 +1575,7 @@ BOOST_AUTO_TEST_CASE(PhiDirection) { Axis{AxisBound, -60_degree, 60_degree, 6}); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binPhi, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisPhi, *logger); BOOST_REQUIRE(mergedPtr); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -1649,7 +1651,7 @@ BOOST_AUTO_TEST_CASE(BinFilling) { checkCheckerBoard(discPhiGrid2->grid()); auto mergedPtr = GridPortalLink::merge(*discPhiGrid1, *discPhiGrid2, - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); using merged_type = GridPortalLinkT, @@ -1664,7 +1666,7 @@ BOOST_AUTO_TEST_CASE(BinFilling) { discPhiGrid2->setVolume(vol2.get()); mergedPtr = GridPortalLink::merge(*discPhiGrid1, *discPhiGrid2, - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE(merged); @@ -1720,7 +1722,7 @@ BOOST_AUTO_TEST_CASE(BinFilling) { checkCheckerBoard(grid2->grid()); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binPhi, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisPhi, *logger); BOOST_REQUIRE(mergedPtr); @@ -1738,7 +1740,7 @@ BOOST_AUTO_TEST_CASE(BinFilling) { grid2->setVolume(vol2.get()); mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binPhi, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisPhi, *logger); merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE(merged); @@ -1787,18 +1789,18 @@ BOOST_AUTO_TEST_CASE(RDirection) { 100_mm, 150_mm, 30_degree); auto discPhiGrid21dPhi = - GridPortalLink::make(discPhi2, BinningValue::binPhi, + GridPortalLink::make(discPhi2, AxisDirection::AxisPhi, Axis{AxisBound, -30_degree, 30_degree, 3}); auto merged12PhiPtr = GridPortalLink::merge(*discPhiGrid1, *discPhiGrid21dPhi, - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); BOOST_REQUIRE(merged12PhiPtr); const auto* merged12Phi = dynamic_cast(merged12PhiPtr.get()); BOOST_REQUIRE_NE(merged12Phi, nullptr); auto merged21PhiPtr = GridPortalLink::merge(*discPhiGrid21dPhi, *discPhiGrid1, - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); BOOST_REQUIRE(merged21PhiPtr); const auto* merged21Phi = dynamic_cast(merged21PhiPtr.get()); @@ -1822,17 +1824,17 @@ BOOST_AUTO_TEST_CASE(RDirection) { BOOST_CHECK_EQUAL(axis2.getBoundaryType(), AxisBoundaryType::Bound); auto discPhiGrid21dR = GridPortalLink::make( - discPhi2, BinningValue::binR, Axis{AxisBound, 100_mm, 150_mm, 5}); + discPhi2, AxisDirection::AxisR, Axis{AxisBound, 100_mm, 150_mm, 5}); auto merged12RPtr = GridPortalLink::merge(*discPhiGrid1, *discPhiGrid21dR, - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); BOOST_REQUIRE(merged12RPtr); const auto* merged12R = dynamic_cast(merged12RPtr.get()); BOOST_REQUIRE_NE(merged12R, nullptr); auto merged21RPtr = GridPortalLink::merge(*discPhiGrid21dR, *discPhiGrid1, - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); BOOST_REQUIRE(merged21RPtr); const auto* merged21R = dynamic_cast(merged21RPtr.get()); @@ -1867,12 +1869,12 @@ BOOST_AUTO_TEST_CASE(PhiDirection) { 60_degree); auto grid21dPhi = - GridPortalLink::make(disc2, BinningValue::binPhi, + GridPortalLink::make(disc2, AxisDirection::AxisPhi, Axis{AxisBound, -60_degree, 60_degree, 6}); - auto merged12PhiPtr = - GridPortalLink::merge(*grid1, *grid21dPhi, BinningValue::binPhi, *logger); + auto merged12PhiPtr = GridPortalLink::merge(*grid1, *grid21dPhi, + AxisDirection::AxisPhi, *logger); BOOST_REQUIRE(merged12PhiPtr); const auto* merged12Phi = dynamic_cast(merged12PhiPtr.get()); @@ -1893,11 +1895,11 @@ BOOST_AUTO_TEST_CASE(PhiDirection) { BOOST_CHECK_EQUAL(axis2.getType(), AxisType::Equidistant); BOOST_CHECK_EQUAL(axis2.getBoundaryType(), AxisBoundaryType::Bound); - auto grid21dR = GridPortalLink::make(disc2, BinningValue::binR, + auto grid21dR = GridPortalLink::make(disc2, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 3}); auto merged12RPtr = - GridPortalLink::merge(*grid1, *grid21dR, BinningValue::binPhi, *logger); + GridPortalLink::merge(*grid1, *grid21dR, AxisDirection::AxisPhi, *logger); BOOST_REQUIRE(merged12RPtr); const auto* merged12R = dynamic_cast(merged12RPtr.get()); @@ -1933,7 +1935,7 @@ BOOST_AUTO_TEST_CASE(RDirection) { auto disc1 = Surface::makeShared(Transform3::Identity(), 30_mm, 100_mm, 30_degree); - auto grid1 = GridPortalLink::make(disc1, BinningValue::binR, + auto grid1 = GridPortalLink::make(disc1, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 2}); grid1->grid().atLocalBins({1}) = vol1.get(); grid1->grid().atLocalBins({2}) = vol2.get(); @@ -1941,14 +1943,14 @@ BOOST_AUTO_TEST_CASE(RDirection) { auto disc2 = Surface::makeShared(Transform3::Identity(), 100_mm, 150_mm, 30_degree); - auto grid2 = GridPortalLink::make(disc2, BinningValue::binPhi, + auto grid2 = GridPortalLink::make(disc2, AxisDirection::AxisPhi, Axis{AxisBound, -30_degree, 30_degree, 2}); grid2->grid().atLocalBins({1}) = vol3.get(); grid2->grid().atLocalBins({2}) = vol4.get(); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binR, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisR, *logger); const auto* merged = dynamic_cast(mergedPtr.get()); BOOST_REQUIRE_NE(merged, nullptr); @@ -1990,7 +1992,7 @@ BOOST_AUTO_TEST_CASE(PhiDirection) { auto disc1 = Surface::makeShared(Transform3::Identity(), 30_mm, 100_mm, 30_degree); - auto grid1 = GridPortalLink::make(disc1, BinningValue::binR, + auto grid1 = GridPortalLink::make(disc1, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 2}); grid1->grid().atLocalBins({1}) = vol1.get(); @@ -2000,14 +2002,14 @@ BOOST_AUTO_TEST_CASE(PhiDirection) { Transform3{AngleAxis3{90_degree, Vector3::UnitZ()}}, 30_mm, 100_mm, 60_degree); - auto grid2 = GridPortalLink::make(disc2, BinningValue::binPhi, + auto grid2 = GridPortalLink::make(disc2, AxisDirection::AxisPhi, Axis{AxisBound, -60_degree, 60_degree, 2}); grid2->grid().atLocalBins({1}) = vol3.get(); grid2->grid().atLocalBins({2}) = vol4.get(); auto mergedPtr = - GridPortalLink::merge(*grid1, *grid2, BinningValue::binPhi, *logger); + GridPortalLink::merge(*grid1, *grid2, AxisDirection::AxisPhi, *logger); using merged_type = GridPortalLinkT, @@ -2072,10 +2074,10 @@ BOOST_AUTO_TEST_CASE(CompositeConstruction) { auto trivial2 = std::make_unique(disc2, *vol2); auto composite = std::make_unique( - copy(trivial1), copy(trivial2), BinningValue::binR); + copy(trivial1), copy(trivial2), AxisDirection::AxisR); auto compositeCopy = std::make_unique( - copy(trivial1), copy(trivial2), BinningValue::binR); + copy(trivial1), copy(trivial2), AxisDirection::AxisR); BOOST_CHECK_EQUAL( composite->resolveVolume(gctx, Vector2{40_mm, 0_degree}).value(), @@ -2090,9 +2092,9 @@ BOOST_AUTO_TEST_CASE(CompositeConstruction) { auto cyl = Surface::makeShared(Transform3::Identity(), 30_mm, 40_mm); auto trivialCyl = std::make_unique(cyl, *vol3); - BOOST_CHECK_THROW( - CompositePortalLink(copy(trivial1), copy(trivialCyl), BinningValue::binR), - std::invalid_argument); + BOOST_CHECK_THROW(CompositePortalLink(copy(trivial1), copy(trivialCyl), + AxisDirection::AxisR), + std::invalid_argument); auto disc3 = Surface::makeShared(Transform3::Identity(), 90_mm, 120_mm); @@ -2100,13 +2102,13 @@ BOOST_AUTO_TEST_CASE(CompositeConstruction) { // Test exception on un-mergable surfaces BOOST_CHECK_THROW( - CompositePortalLink(copy(trivial1), copy(trivial3), BinningValue::binR), + CompositePortalLink(copy(trivial1), copy(trivial3), AxisDirection::AxisR), SurfaceMergingException); // Composite with a composite (this should work regardless of flattening) CompositePortalLink composite2(std::move(composite), copy(trivial3), - BinningValue::binR, false); + AxisDirection::AxisR, false); BOOST_CHECK_EQUAL( composite2.resolveVolume(gctx, Vector2{40_mm, 0_degree}).value(), @@ -2122,7 +2124,7 @@ BOOST_AUTO_TEST_CASE(CompositeConstruction) { BOOST_CHECK_EQUAL(composite2.depth(), 2); CompositePortalLink composite2Flat(std::move(compositeCopy), copy(trivial3), - BinningValue::binR, true); + AxisDirection::AxisR, true); // One because of flattening BOOST_CHECK_EQUAL(composite2Flat.depth(), 1); @@ -2177,17 +2179,18 @@ BOOST_DATA_TEST_CASE(TrivialTrivial, auto trivial3 = std::make_unique(disc3, *vol3); BOOST_REQUIRE(trivial3); - auto grid1 = trivial1->makeGrid(BinningValue::binR); + auto grid1 = trivial1->makeGrid(AxisDirection::AxisR); auto compGridTrivial = PortalLinkBase::merge( std::move(grid1), std::make_unique(*trivial2), - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); BOOST_REQUIRE(compGridTrivial); BOOST_CHECK_EQUAL(dynamic_cast(*compGridTrivial) .makeGrid(gctx, *logger), nullptr); - auto composite = PortalLinkBase::merge( - std::move(trivial1), std::move(trivial2), BinningValue::binR, *logger); + auto composite = + PortalLinkBase::merge(std::move(trivial1), std::move(trivial2), + AxisDirection::AxisR, *logger); BOOST_REQUIRE(composite); auto grid12 = @@ -2203,7 +2206,7 @@ BOOST_DATA_TEST_CASE(TrivialTrivial, vol2.get()); composite = PortalLinkBase::merge(std::move(composite), std::move(trivial3), - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); BOOST_REQUIRE(composite); auto grid123 = @@ -2250,17 +2253,18 @@ BOOST_DATA_TEST_CASE(TrivialTrivial, auto trivial3 = std::make_unique(cyl3, *vol3); BOOST_REQUIRE(trivial3); - auto grid1 = trivial1->makeGrid(BinningValue::binZ); + auto grid1 = trivial1->makeGrid(AxisDirection::AxisZ); auto compGridTrivial = PortalLinkBase::merge( std::move(grid1), std::make_unique(*trivial2), - BinningValue::binZ, *logger); + AxisDirection::AxisZ, *logger); BOOST_REQUIRE(compGridTrivial); BOOST_CHECK_EQUAL(dynamic_cast(*compGridTrivial) .makeGrid(gctx, *logger), nullptr); - auto composite = PortalLinkBase::merge( - std::move(trivial1), std::move(trivial2), BinningValue::binZ, *logger); + auto composite = + PortalLinkBase::merge(std::move(trivial1), std::move(trivial2), + AxisDirection::AxisZ, *logger); BOOST_REQUIRE(composite); auto grid12 = @@ -2275,7 +2279,7 @@ BOOST_DATA_TEST_CASE(TrivialTrivial, grid12->resolveVolume(gctx, Vector2{40_mm, 40_mm}).value(), vol2.get()); composite = PortalLinkBase::merge(std::move(composite), std::move(trivial3), - BinningValue::binZ, *logger); + AxisDirection::AxisZ, *logger); BOOST_REQUIRE(composite); auto grid123 = @@ -2315,24 +2319,24 @@ BOOST_AUTO_TEST_CASE(TrivialGridR) { BOOST_REQUIRE(trivial); auto gridPhi = GridPortalLink::make( - disc1, BinningValue::binPhi, + disc1, AxisDirection::AxisPhi, Axis{AxisClosed, -std::numbers::pi, std::numbers::pi, 2}); gridPhi->setVolume(vol1.get()); - auto gridR = GridPortalLink::make(disc1, BinningValue::binR, + auto gridR = GridPortalLink::make(disc1, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 60_mm, 2}); gridR->setVolume(vol1.get()); BOOST_TEST_CONTEXT("Colinear") { auto merged = PortalLinkBase::merge(copy(trivial), copy(gridR), - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); BOOST_REQUIRE(merged); BOOST_CHECK_NE(dynamic_cast(merged.get()), nullptr); } BOOST_TEST_CONTEXT("Orthogonal") { auto merged = PortalLinkBase::merge(copy(gridPhi), copy(trivial), - BinningValue::binR, *logger); + AxisDirection::AxisR, *logger); BOOST_REQUIRE(merged); BOOST_CHECK_NE(dynamic_cast(merged.get()), nullptr); } @@ -2358,23 +2362,23 @@ BOOST_AUTO_TEST_CASE(TrivialGridPhi) { BOOST_REQUIRE(trivial); auto gridPhi = GridPortalLink::make( - disc1, BinningValue::binPhi, Axis{AxisBound, -30_degree, 30_degree, 2}); + disc1, AxisDirection::AxisPhi, Axis{AxisBound, -30_degree, 30_degree, 2}); gridPhi->setVolume(vol1.get()); - auto gridR = GridPortalLink::make(disc1, BinningValue::binR, + auto gridR = GridPortalLink::make(disc1, AxisDirection::AxisR, Axis{AxisBound, 30_mm, 100_mm, 2}); gridR->setVolume(vol1.get()); BOOST_TEST_CONTEXT("Colinear") { auto merged = PortalLinkBase::merge(copy(trivial), copy(gridPhi), - BinningValue::binPhi, *logger); + AxisDirection::AxisPhi, *logger); BOOST_REQUIRE(merged); BOOST_CHECK_NE(dynamic_cast(merged.get()), nullptr); } BOOST_TEST_CONTEXT("Orthogonal") { auto merged = PortalLinkBase::merge(copy(gridR), copy(trivial), - BinningValue::binPhi, *logger); + AxisDirection::AxisPhi, *logger); BOOST_REQUIRE(merged); BOOST_CHECK_NE(dynamic_cast(merged.get()), nullptr); } @@ -2400,19 +2404,20 @@ BOOST_AUTO_TEST_CASE(CompositeOther) { auto disc3 = Surface::makeShared(Transform3::Identity(), 90_mm, 120_mm); - auto grid1 = GridPortalLink::make(disc1, *vol1, BinningValue::binR); + auto grid1 = GridPortalLink::make(disc1, *vol1, AxisDirection::AxisR); auto trivial2 = std::make_unique(disc2, *vol2); auto composite12 = std::make_unique( - std::move(grid1), std::move(trivial2), BinningValue::binR); + std::move(grid1), std::move(trivial2), AxisDirection::AxisR); BOOST_CHECK_EQUAL(composite12->depth(), 1); BOOST_CHECK_EQUAL(composite12->size(), 2); auto trivial3 = std::make_unique(disc3, *vol3); - auto composite123Ptr = PortalLinkBase::merge( - std::move(composite12), std::move(trivial3), BinningValue::binR, *logger); + auto composite123Ptr = + PortalLinkBase::merge(std::move(composite12), std::move(trivial3), + AxisDirection::AxisR, *logger); const auto* composite123 = dynamic_cast(composite123Ptr.get()); diff --git a/Tests/UnitTests/Core/Geometry/PortalShellTests.cpp b/Tests/UnitTests/Core/Geometry/PortalShellTests.cpp index 090dc851611..e12a3ca3dbc 100644 --- a/Tests/UnitTests/Core/Geometry/PortalShellTests.cpp +++ b/Tests/UnitTests/Core/Geometry/PortalShellTests.cpp @@ -317,7 +317,7 @@ BOOST_AUTO_TEST_CASE(PortalAssignment) { oCyl->getLink(Direction::OppositeNormal)); BOOST_REQUIRE_NE(oCylLink, nullptr); - auto grid = oCylLink->makeGrid(BinningValue::binZ); + auto grid = oCylLink->makeGrid(AxisDirection::AxisZ); auto portal2 = std::make_shared(Direction::OppositeNormal, std::move(grid)); @@ -335,7 +335,7 @@ BOOST_AUTO_TEST_CASE(PortalAssignment) { nDisc->getLink(Direction::AlongNormal)); BOOST_REQUIRE_NE(nDiscLink, nullptr); - grid = nDiscLink->makeGrid(BinningValue::binR); + grid = nDiscLink->makeGrid(AxisDirection::AxisR); auto portal3 = std::make_shared(Direction::AlongNormal, std::move(grid)); @@ -366,7 +366,7 @@ BOOST_AUTO_TEST_CASE(ZDirection) { BOOST_CHECK_NE(shell1.portal(PositiveDisc), shell2.portal(NegativeDisc)); CylinderStackPortalShell stack{ - gctx, {&shell1, &shell2}, BinningValue::binZ}; + gctx, {&shell1, &shell2}, AxisDirection::AxisZ}; BOOST_CHECK_EQUAL(stack.size(), 4); const auto* iCyl = stack.portal(InnerCylinder); @@ -392,9 +392,9 @@ BOOST_AUTO_TEST_CASE(ZDirection) { shell1 = SingleCylinderPortalShell{vol1}; shell2 = SingleCylinderPortalShell{vol2}; - BOOST_CHECK_THROW( - CylinderStackPortalShell(gctx, {&shell1, &shell2}, BinningValue::binR), - SurfaceMergingException); + BOOST_CHECK_THROW(CylinderStackPortalShell(gctx, {&shell1, &shell2}, + AxisDirection::AxisR), + SurfaceMergingException); } BOOST_TEST_CONTEXT("rMin==0") { @@ -415,7 +415,7 @@ BOOST_AUTO_TEST_CASE(ZDirection) { BOOST_CHECK_NE(shell1.portal(PositiveDisc), shell2.portal(NegativeDisc)); CylinderStackPortalShell stack{ - gctx, {&shell1, &shell2}, BinningValue::binZ}; + gctx, {&shell1, &shell2}, AxisDirection::AxisZ}; BOOST_CHECK_EQUAL(stack.size(), 3); // Disc portals have been fused @@ -440,9 +440,9 @@ BOOST_AUTO_TEST_CASE(ZDirection) { shell1 = SingleCylinderPortalShell{vol1}; shell2 = SingleCylinderPortalShell{vol2}; - BOOST_CHECK_THROW( - CylinderStackPortalShell(gctx, {&shell1, &shell2}, BinningValue::binR), - SurfaceMergingException); + BOOST_CHECK_THROW(CylinderStackPortalShell(gctx, {&shell1, &shell2}, + AxisDirection::AxisR), + SurfaceMergingException); } } @@ -463,7 +463,7 @@ BOOST_AUTO_TEST_CASE(RDirection) { BOOST_CHECK_NE(shell1.portal(OuterCylinder), shell2.portal(InnerCylinder)); CylinderStackPortalShell stack{ - gctx, {&shell1, &shell2}, BinningValue::binR}; + gctx, {&shell1, &shell2}, AxisDirection::AxisR}; BOOST_CHECK_EQUAL(stack.size(), 4); // Internal cylinder portals have been fused @@ -492,9 +492,9 @@ BOOST_AUTO_TEST_CASE(RDirection) { shell1 = SingleCylinderPortalShell{vol1}; shell2 = SingleCylinderPortalShell{vol2}; - BOOST_CHECK_THROW( - CylinderStackPortalShell(gctx, {&shell1, &shell2}, BinningValue::binZ), - SurfaceMergingException); + BOOST_CHECK_THROW(CylinderStackPortalShell(gctx, {&shell1, &shell2}, + AxisDirection::AxisZ), + SurfaceMergingException); } BOOST_TEST_CONTEXT("rMin==0") { @@ -513,7 +513,7 @@ BOOST_AUTO_TEST_CASE(RDirection) { BOOST_CHECK_NE(shell1.portal(OuterCylinder), shell2.portal(InnerCylinder)); CylinderStackPortalShell stack{ - gctx, {&shell1, &shell2}, BinningValue::binR}; + gctx, {&shell1, &shell2}, AxisDirection::AxisR}; BOOST_CHECK_EQUAL(stack.size(), 4); // Internal cylinder portals have been fused @@ -541,9 +541,9 @@ BOOST_AUTO_TEST_CASE(RDirection) { shell1 = SingleCylinderPortalShell{vol1}; shell2 = SingleCylinderPortalShell{vol2}; - BOOST_CHECK_THROW( - CylinderStackPortalShell(gctx, {&shell1, &shell2}, BinningValue::binZ), - std::invalid_argument); + BOOST_CHECK_THROW(CylinderStackPortalShell(gctx, {&shell1, &shell2}, + AxisDirection::AxisZ), + std::invalid_argument); } } @@ -599,7 +599,7 @@ BOOST_AUTO_TEST_CASE(NestedStacks) { BOOST_CHECK(shell2.isValid()); CylinderStackPortalShell stack{ - gctx, {&shell1, &gapShell, &shell2}, BinningValue::binR}; + gctx, {&shell1, &gapShell, &shell2}, AxisDirection::AxisR}; BOOST_CHECK(stack.isValid()); @@ -607,7 +607,7 @@ BOOST_AUTO_TEST_CASE(NestedStacks) { BOOST_CHECK(shell3.isValid()); CylinderStackPortalShell stack2{ - gctx, {&stack, &shell3}, BinningValue::binZ, *logger}; + gctx, {&stack, &shell3}, AxisDirection::AxisZ, *logger}; BOOST_CHECK(stack2.isValid()); using enum CylinderVolumeBounds::Face; diff --git a/Tests/UnitTests/Core/Geometry/PortalTests.cpp b/Tests/UnitTests/Core/Geometry/PortalTests.cpp index 8997ccedda7..0eb38677154 100644 --- a/Tests/UnitTests/Core/Geometry/PortalTests.cpp +++ b/Tests/UnitTests/Core/Geometry/PortalTests.cpp @@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE(Cylinder) { // | // v BOOST_CHECK_THROW( - Portal::merge(gctx, portal1, portal4, BinningValue::binZ, *logger), + Portal::merge(gctx, portal1, portal4, AxisDirection::AxisZ, *logger), PortalMergingException); // This call leaves both valid because the exception is thrown before the @@ -146,9 +146,9 @@ BOOST_AUTO_TEST_CASE(Cylinder) { .value(), nullptr); - // Cannot merge in binRPhi + // Cannot merge in AxisRPhi BOOST_CHECK_THROW( - Portal::merge(gctx, portal1, portal2, BinningValue::binRPhi, *logger), + Portal::merge(gctx, portal1, portal2, AxisDirection::AxisRPhi, *logger), SurfaceMergingException); // The call above leaves both portals invalid because the exception is thrown @@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE(Cylinder) { portal2 = Portal{gctx, {.alongNormal = {cyl2, *vol2}}}; Portal merged12 = - Portal::merge(gctx, portal1, portal2, BinningValue::binZ, *logger); + Portal::merge(gctx, portal1, portal2, AxisDirection::AxisZ, *logger); BOOST_CHECK_NE(merged12.getLink(Direction::AlongNormal), nullptr); BOOST_CHECK_EQUAL(merged12.getLink(Direction::OppositeNormal), nullptr); @@ -204,14 +204,14 @@ BOOST_AUTO_TEST_CASE(Cylinder) { // Can't merge with self BOOST_CHECK_THROW( - Portal::merge(gctx, portal1, portal1, BinningValue::binZ, *logger), + Portal::merge(gctx, portal1, portal1, AxisDirection::AxisZ, *logger), PortalMergingException); // Can't merge because the surfaces are the same portal1 = Portal{gctx, {.alongNormal = {cyl1, *vol1}}}; portal2 = Portal{gctx, {.alongNormal = {cyl1, *vol2}}}; BOOST_CHECK_THROW( - Portal::merge(gctx, portal1, portal2, BinningValue::binZ, *logger), + Portal::merge(gctx, portal1, portal2, AxisDirection::AxisZ, *logger), AssertionFailureException); // Can't merge because surface has material @@ -221,7 +221,7 @@ BOOST_AUTO_TEST_CASE(Cylinder) { portal1 = Portal{gctx, {.alongNormal = {cyl1, *vol1}}}; portal2 = Portal{gctx, {.alongNormal = {cyl2, *vol2}}}; BOOST_CHECK_THROW( - Portal::merge(gctx, portal1, portal2, BinningValue::binZ, *logger), + Portal::merge(gctx, portal1, portal2, AxisDirection::AxisZ, *logger), PortalMergingException); } @@ -270,14 +270,14 @@ BOOST_AUTO_TEST_CASE(Disc) { vol4.get()); BOOST_CHECK_THROW( - Portal::merge(gctx, portal1, portal2, BinningValue::binZ, *logger), + Portal::merge(gctx, portal1, portal2, AxisDirection::AxisZ, *logger), AssertionFailureException); BOOST_CHECK(portal1.isValid()); BOOST_CHECK(portal2.isValid()); BOOST_CHECK_THROW( - Portal::merge(gctx, portal1, portal2, BinningValue::binPhi, *logger), + Portal::merge(gctx, portal1, portal2, AxisDirection::AxisPhi, *logger), SurfaceMergingException); // Portals not valid anymore because they were moved before the exception was @@ -302,7 +302,7 @@ BOOST_AUTO_TEST_CASE(Disc) { // | | // v v Portal merged12 = - Portal::merge(gctx, portal1, portal2, BinningValue::binR, *logger); + Portal::merge(gctx, portal1, portal2, AxisDirection::AxisR, *logger); BOOST_CHECK_EQUAL( merged12.resolveVolume(gctx, Vector3{55_mm, 0_mm, 0_mm}, Vector3::UnitZ()) @@ -334,7 +334,7 @@ BOOST_AUTO_TEST_CASE(Disc) { portal2 = Portal{ gctx, {.alongNormal = {disc2, *vol3}, .oppositeNormal = {disc2, *vol4}}}; BOOST_CHECK_THROW( - Portal::merge(gctx, portal1, portal2, BinningValue::binR, *logger), + Portal::merge(gctx, portal1, portal2, AxisDirection::AxisR, *logger), PortalMergingException); } @@ -565,7 +565,7 @@ BOOST_AUTO_TEST_CASE(GridCreationOnFuse) { links.push_back(std::move(trivial3)); auto composite = std::make_unique(std::move(links), - BinningValue::binR); + AxisDirection::AxisR); auto discOpposite = Surface::makeShared(Transform3::Identity(), 30_mm, 120_mm); diff --git a/Tests/UnitTests/Core/Geometry/ProtoLayerHelperTests.cpp b/Tests/UnitTests/Core/Geometry/ProtoLayerHelperTests.cpp index c6ccd763095..10d446cff53 100644 --- a/Tests/UnitTests/Core/Geometry/ProtoLayerHelperTests.cpp +++ b/Tests/UnitTests/Core/Geometry/ProtoLayerHelperTests.cpp @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(ProtoLayerHelperTests) { // Sort into ProtoLayers auto radialLayers = plHelper.protoLayers( tgContext, cylinderSurfaces, - ProtoLayerHelper::SortingConfig(BinningValue::binR, 5.)); + ProtoLayerHelper::SortingConfig(AxisDirection::AxisR, 5.)); BOOST_CHECK_EQUAL(radialLayers.size(), 4); @@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(ProtoLayerHelperTests) { // Sort into ProtoLayers auto discLayersZ = - plHelper.protoLayers(tgContext, discSurfaces, {BinningValue::binZ, 5.}); + plHelper.protoLayers(tgContext, discSurfaces, {AxisDirection::AxisZ, 5.}); BOOST_CHECK_EQUAL(discLayersZ.size(), 4); @@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(ProtoLayerHelperTests) { // First: Sort into ProtoLayers radially auto rSorted = plHelper.protoLayers( tgContext, ringSurfaces, - ProtoLayerHelper::SortingConfig(BinningValue::binR, 1.)); + ProtoLayerHelper::SortingConfig(AxisDirection::AxisR, 1.)); BOOST_CHECK_EQUAL(rSorted.size(), 3); Color dColor = {0, 0, 0}; @@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(ProtoLayerHelperTests) { for (auto& rBatch : rSorted) { auto lSorted = plHelper.protoLayers( tgContext, rBatch.surfaces(), - ProtoLayerHelper::SortingConfig(BinningValue::binZ, 5.)); + ProtoLayerHelper::SortingConfig(AxisDirection::AxisZ, 5.)); il = 0; dColor[ir] = 256; for (auto& layer : lSorted) { @@ -206,9 +206,9 @@ BOOST_AUTO_TEST_CASE(ProtoLayerHelperTests) { objVis.write("ProtoLayerHelper_RingLayers_sorted"); // Perform the split at once - auto rzSorted = - plHelper.protoLayers(tgContext, ringSurfaces, - {{BinningValue::binR, 1.}, {BinningValue::binZ, 5}}); + auto rzSorted = plHelper.protoLayers( + tgContext, ringSurfaces, + {{AxisDirection::AxisR, 1.}, {AxisDirection::AxisZ, 5}}); std::size_t irz = 0; for (auto& layer : rzSorted) { diff --git a/Tests/UnitTests/Core/Geometry/ProtoLayerTests.cpp b/Tests/UnitTests/Core/Geometry/ProtoLayerTests.cpp index 3fdf8ec1c16..a0cc315b4b1 100644 --- a/Tests/UnitTests/Core/Geometry/ProtoLayerTests.cpp +++ b/Tests/UnitTests/Core/Geometry/ProtoLayerTests.cpp @@ -36,7 +36,7 @@ GeometryContext tgContext = GeometryContext(); BOOST_AUTO_TEST_SUITE(Geometry) BOOST_AUTO_TEST_CASE(ProtoLayerTests) { - using enum BinningValue; + using enum AxisDirection; // Create a proto layer with 4 surfaces on the x/y grid auto recBounds = std::make_shared(3., 6.); @@ -111,20 +111,20 @@ BOOST_AUTO_TEST_CASE(ProtoLayerTests) { // Test 1 - identity transform auto protoLayer = createProtoLayer(Transform3::Identity()); - CHECK_CLOSE_ABS(protoLayer.range(binX), 12., 1e-8); - CHECK_CLOSE_ABS(protoLayer.medium(binX), 0., 1e-8); - CHECK_CLOSE_ABS(protoLayer.min(binX), -6., 1e-8); - CHECK_CLOSE_ABS(protoLayer.max(binX), 6., 1e-8); - CHECK_CLOSE_ABS(protoLayer.range(binY), 6., 1e-8); - CHECK_CLOSE_ABS(protoLayer.medium(binY), 0., 1e-8); - CHECK_CLOSE_ABS(protoLayer.min(binY), -3., 1e-8); - CHECK_CLOSE_ABS(protoLayer.max(binY), 3., 1e-8); - CHECK_CLOSE_ABS(protoLayer.range(binZ), 12., 1e-8); - CHECK_CLOSE_ABS(protoLayer.medium(binZ), 0., 1e-8); - CHECK_CLOSE_ABS(protoLayer.min(binZ), -6., 1e-8); - CHECK_CLOSE_ABS(protoLayer.max(binZ), 6., 1e-8); - CHECK_CLOSE_ABS(protoLayer.max(binR), std::hypot(3, 6), 1e-8); - CHECK_CLOSE_ABS(protoLayer.min(binR), 3., 1e-8); + CHECK_CLOSE_ABS(protoLayer.range(AxisX), 12., 1e-8); + CHECK_CLOSE_ABS(protoLayer.medium(AxisX), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayer.min(AxisX), -6., 1e-8); + CHECK_CLOSE_ABS(protoLayer.max(AxisX), 6., 1e-8); + CHECK_CLOSE_ABS(protoLayer.range(AxisY), 6., 1e-8); + CHECK_CLOSE_ABS(protoLayer.medium(AxisY), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayer.min(AxisY), -3., 1e-8); + CHECK_CLOSE_ABS(protoLayer.max(AxisY), 3., 1e-8); + CHECK_CLOSE_ABS(protoLayer.range(AxisZ), 12., 1e-8); + CHECK_CLOSE_ABS(protoLayer.medium(AxisZ), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayer.min(AxisZ), -6., 1e-8); + CHECK_CLOSE_ABS(protoLayer.max(AxisZ), 6., 1e-8); + CHECK_CLOSE_ABS(protoLayer.max(AxisR), std::hypot(3, 6), 1e-8); + CHECK_CLOSE_ABS(protoLayer.min(AxisR), 3., 1e-8); // Test 1a @@ -133,35 +133,35 @@ BOOST_AUTO_TEST_CASE(ProtoLayerTests) { auto protoLayerRot = createProtoLayer(AngleAxis3(-0.345, Vector3::UnitZ()) * Transform3::Identity()); - BOOST_CHECK_NE(protoLayer.min(binX), -6.); - CHECK_CLOSE_ABS(protoLayerRot.medium(binX), 0., 1e-8); - CHECK_CLOSE_ABS(protoLayerRot.medium(binY), 0., 1e-8); - CHECK_CLOSE_ABS(protoLayerRot.range(binZ), 12., 1e-8); - CHECK_CLOSE_ABS(protoLayerRot.medium(binZ), 0., 1e-8); - CHECK_CLOSE_ABS(protoLayerRot.min(binZ), -6., 1e-8); - CHECK_CLOSE_ABS(protoLayerRot.max(binZ), 6., 1e-8); - CHECK_CLOSE_ABS(protoLayerRot.min(binR), 3., 1e-8); - CHECK_CLOSE_ABS(protoLayerRot.max(binR), std::hypot(3, 6), 1e-8); + BOOST_CHECK_NE(protoLayer.min(AxisX), -6.); + CHECK_CLOSE_ABS(protoLayerRot.medium(AxisX), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.medium(AxisY), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.range(AxisZ), 12., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.medium(AxisZ), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.min(AxisZ), -6., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.max(AxisZ), 6., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.min(AxisR), 3., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.max(AxisR), std::hypot(3, 6), 1e-8); std::stringstream sstream; protoLayerRot.toStream(sstream); std::string oString = R"(ProtoLayer with dimensions (min/max) Extent in space : - - value : binX | range = [-6.66104, 6.66104] - - value : binY | range = [-4.85241, 4.85241] - - value : binZ | range = [-6, 6] - - value : binR | range = [3, 6.7082] - - value : binPhi | range = [-3.02295, 2.33295] - - value : binRPhi | range = [-20.2785, 15.6499] - - value : binH | range = [0.61548, 2.52611] - - value : binEta | range = [-1.14622, 1.14622] - - value : binMag | range = [7.34847, 7.34847] + - value : AxisX | range = [-6.66104, 6.66104] + - value : AxisY | range = [-4.85241, 4.85241] + - value : AxisZ | range = [-6, 6] + - value : AxisR | range = [3, 6.7082] + - value : AxisPhi | range = [-3.02295, 2.33295] + - value : AxisRPhi | range = [-20.2785, 15.6499] + - value : AxisTheta | range = [0.61548, 2.52611] + - value : AxisEta | range = [-1.14622, 1.14622] + - value : AxisMag | range = [7.34847, 7.34847] )"; BOOST_CHECK_EQUAL(sstream.str(), oString); } BOOST_AUTO_TEST_CASE(OrientedLayer) { - using enum BinningValue; + using enum AxisDirection; using namespace Acts::UnitLiterals; Transform3 base = Transform3::Identity(); @@ -197,14 +197,14 @@ BOOST_AUTO_TEST_CASE(OrientedLayer) { ProtoLayer protoLayer(tgContext, surfaces); BOOST_CHECK_EQUAL(protoLayer.surfaces().size(), 8); - BOOST_CHECK_CLOSE(protoLayer.min(binX), -23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binX), 23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binY), -23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binY), 23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binZ), 0_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binZ), 0_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binR), 17_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binR), 23.769728648_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisX), -23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisX), 23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisY), -23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisY), 23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisZ), 0_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisZ), 0_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisR), 17_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisR), 23.769728648_mm, 1e-8); surfaces = makeFan(45_degree); @@ -212,41 +212,41 @@ BOOST_AUTO_TEST_CASE(OrientedLayer) { protoLayer = {tgContext, surfaces}; BOOST_CHECK_EQUAL(protoLayer.surfaces().size(), 8); - BOOST_CHECK_CLOSE(protoLayer.min(binX), -16.26345596_mm, 1e-4); - BOOST_CHECK_CLOSE(protoLayer.max(binX), 16.26345596_mm, 1e-4); - BOOST_CHECK_CLOSE(protoLayer.min(binY), -23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binY), 23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binZ), -16.26345596_mm, 1e-4); - BOOST_CHECK_CLOSE(protoLayer.max(binZ), 16.26345596_mm, 1e-4); + BOOST_CHECK_CLOSE(protoLayer.min(AxisX), -16.26345596_mm, 1e-4); + BOOST_CHECK_CLOSE(protoLayer.max(AxisX), 16.26345596_mm, 1e-4); + BOOST_CHECK_CLOSE(protoLayer.min(AxisY), -23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisY), 23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisZ), -16.26345596_mm, 1e-4); + BOOST_CHECK_CLOSE(protoLayer.max(AxisZ), 16.26345596_mm, 1e-4); protoLayer = {tgContext, surfaces, Transform3{AngleAxis3{45_degree, Vector3::UnitY()}}.inverse()}; BOOST_CHECK_EQUAL(protoLayer.surfaces().size(), 8); - BOOST_CHECK_CLOSE(protoLayer.range(binX), 46_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binX), -23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binX), 23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.range(binY), 46_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binY), -23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binY), 23_mm, 1e-8); - CHECK_SMALL(protoLayer.range(binZ), 1e-14); - CHECK_SMALL(protoLayer.min(binZ), 1e-14); - CHECK_SMALL(protoLayer.max(binZ), 1e-14); + BOOST_CHECK_CLOSE(protoLayer.range(AxisX), 46_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisX), -23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisX), 23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.range(AxisY), 46_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisY), -23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisY), 23_mm, 1e-8); + CHECK_SMALL(protoLayer.range(AxisZ), 1e-14); + CHECK_SMALL(protoLayer.min(AxisZ), 1e-14); + CHECK_SMALL(protoLayer.max(AxisZ), 1e-14); surfaces = makeFan(0_degree, 10_mm); protoLayer = {tgContext, surfaces}; BOOST_CHECK_EQUAL(protoLayer.surfaces().size(), 8); - BOOST_CHECK_CLOSE(protoLayer.range(binX), 46_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binX), -23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binX), 23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.range(binY), 46_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binY), -23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binY), 23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.range(binZ), 10_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binZ), -5_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binZ), 5_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.range(AxisX), 46_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisX), -23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisX), 23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.range(AxisY), 46_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisY), -23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisY), 23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.range(AxisZ), 10_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisZ), -5_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisZ), 5_mm, 1e-8); surfaces = makeFan(45_degree, 10_mm); @@ -254,15 +254,15 @@ BOOST_AUTO_TEST_CASE(OrientedLayer) { Transform3{AngleAxis3{45_degree, Vector3::UnitY()}}.inverse()}; BOOST_CHECK_EQUAL(protoLayer.surfaces().size(), 8); - BOOST_CHECK_CLOSE(protoLayer.range(binX), 46_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binX), -23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binX), 23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.range(binY), 46_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binY), -23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binY), 23_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.range(binZ), 10_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.min(binZ), -5_mm, 1e-8); - BOOST_CHECK_CLOSE(protoLayer.max(binZ), 5_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.range(AxisX), 46_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisX), -23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisX), 23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.range(AxisY), 46_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisY), -23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisY), 23_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.range(AxisZ), 10_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.min(AxisZ), -5_mm, 1e-8); + BOOST_CHECK_CLOSE(protoLayer.max(AxisZ), 5_mm, 1e-8); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Core/Geometry/SurfaceArrayCreatorTests.cpp b/Tests/UnitTests/Core/Geometry/SurfaceArrayCreatorTests.cpp index 6d69c1667da..9681f1b221d 100644 --- a/Tests/UnitTests/Core/Geometry/SurfaceArrayCreatorTests.cpp +++ b/Tests/UnitTests/Core/Geometry/SurfaceArrayCreatorTests.cpp @@ -20,7 +20,7 @@ #include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/Helpers.hpp" @@ -272,9 +272,9 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, std::vector emptyRaw; ProtoLayer pl(tgContext, emptyRaw); auto tr = Transform3::Identity(); - BOOST_CHECK_THROW( - createEquidistantAxis(tgContext, emptyRaw, BinningValue::binPhi, pl, tr), - std::logic_error); + BOOST_CHECK_THROW(createEquidistantAxis(tgContext, emptyRaw, + AxisDirection::AxisPhi, pl, tr), + std::logic_error); std::vector bdExp = { -3.14159, -2.93215, -2.72271, -2.51327, -2.30383, -2.0944, -1.88496, @@ -296,7 +296,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3::Identity(); auto axis = createEquidistantAxis(tgContext, surfacesRaw, - BinningValue::binPhi, pl, tr); + AxisDirection::AxisPhi, pl, tr); BOOST_CHECK_EQUAL(axis.nBins, 30u); CHECK_CLOSE_REL(axis.max, std::numbers::pi, 1e-6); @@ -310,7 +310,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, + axis = createEquidistantAxis(tgContext, surfacesRaw, AxisDirection::AxisPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_2.obj"); @@ -326,7 +326,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, + axis = createEquidistantAxis(tgContext, surfacesRaw, AxisDirection::AxisPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_3.obj"); @@ -343,7 +343,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, pl = ProtoLayer(tgContext, surfaces); surfacesRaw = unpack_shared_vector(surfaces); tr = Transform3::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, + axis = createEquidistantAxis(tgContext, surfacesRaw, AxisDirection::AxisPhi, pl, tr); surfacesRaw = unpack_shared_vector(surfaces); draw_surfaces(surfaces, @@ -364,7 +364,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3::Identity(); auto axis = createEquidistantAxis(tgContext, surfacesRaw, - BinningValue::binPhi, pl, tr); + AxisDirection::AxisPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_1.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30u); @@ -379,7 +379,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, + axis = createEquidistantAxis(tgContext, surfacesRaw, AxisDirection::AxisPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_2.obj"); @@ -396,7 +396,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, + axis = createEquidistantAxis(tgContext, surfacesRaw, AxisDirection::AxisPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_3.obj"); @@ -413,7 +413,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, + axis = createEquidistantAxis(tgContext, surfacesRaw, AxisDirection::AxisPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_4.obj"); @@ -436,7 +436,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3::Identity(); auto axis = createEquidistantAxis(tgContext, surfacesRaw, - BinningValue::binPhi, pl, tr); + AxisDirection::AxisPhi, pl, tr); BOOST_CHECK_EQUAL(axis.nBins, 1u); CHECK_CLOSE_ABS(axis.max, phi(Vector3(8, 1, 0)), 1e-3); @@ -451,8 +451,8 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Z, auto surfacesRaw = unpack_shared_vector(surfaces); ProtoLayer pl = ProtoLayer(tgContext, surfacesRaw); auto trf = Transform3::Identity(); - auto axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binZ, - pl, trf); + auto axis = createEquidistantAxis(tgContext, surfacesRaw, + AxisDirection::AxisZ, pl, trf); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_Z_1.obj"); BOOST_CHECK_EQUAL(axis.nBins, 1u); CHECK_CLOSE_ABS(axis.max, 3, 1e-6); @@ -466,8 +466,8 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Z, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binZ, pl, - trf); + axis = createEquidistantAxis(tgContext, surfacesRaw, AxisDirection::AxisZ, + pl, trf); draw_surfaces( surfaces, (boost::format( @@ -487,7 +487,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Z, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binZ, pl, + axis = createEquidistantAxis(tgContext, surfacesRaw, AxisDirection::AxisZ, pl, trf); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_Z_3.obj"); BOOST_CHECK_EQUAL(axis.nBins, 10u); @@ -504,8 +504,8 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_R, draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_R_1.obj"); auto trf = Transform3::Identity(); ProtoLayer pl = ProtoLayer(tgContext, surfacesRaw); - auto axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binR, - pl, trf); + auto axis = createEquidistantAxis(tgContext, surfacesRaw, + AxisDirection::AxisR, pl, trf); BOOST_CHECK_EQUAL(axis.nBins, 1u); CHECK_CLOSE_ABS(axis.max, perp(Vector3(17, 1, 0)), 1e-3); CHECK_CLOSE_ABS(axis.min, 13, 1e-3); @@ -524,7 +524,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_R, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binR, pl, + axis = createEquidistantAxis(tgContext, surfacesRaw, AxisDirection::AxisR, pl, trf); BOOST_CHECK_EQUAL(axis.nBins, 3u); @@ -595,7 +595,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_completeBinning, // actually filled SA for (const auto& srf : brl) { - Vector3 ctr = srf->binningPosition(tgContext, BinningValue::binR); + Vector3 ctr = srf->referencePosition(tgContext, AxisDirection::AxisR); auto binContent = sa.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 1u); @@ -616,9 +616,9 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_barrelStagger, Transform3 tr = Transform3::Identity(); auto pAxisPhi = - createEquidistantAxis(tgContext, brlRaw, BinningValue::binPhi, pl, tr); + createEquidistantAxis(tgContext, brlRaw, AxisDirection::AxisPhi, pl, tr); auto pAxisZ = - createEquidistantAxis(tgContext, brlRaw, BinningValue::binZ, pl, tr); + createEquidistantAxis(tgContext, brlRaw, AxisDirection::AxisZ, pl, tr); double R = 10.; Transform3 itr = tr.inverse(); @@ -645,7 +645,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_barrelStagger, auto A = pr.first; auto B = pr.second; - Vector3 ctr = A->binningPosition(tgContext, BinningValue::binR); + Vector3 ctr = A->referencePosition(tgContext, AxisDirection::AxisR); auto binContent = sa.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 2u); std::set act; @@ -664,9 +664,9 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_barrelStagger, tr = Transform3::Identity(); auto pAxisPhiVar = - createVariableAxis(tgContext, brlRaw, BinningValue::binPhi, pl, tr); + createVariableAxis(tgContext, brlRaw, AxisDirection::AxisPhi, pl, tr); auto pAxisZVar = - createVariableAxis(tgContext, brlRaw, BinningValue::binZ, pl, tr); + createVariableAxis(tgContext, brlRaw, AxisDirection::AxisZ, pl, tr); itr = tr.inverse(); @@ -715,7 +715,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_barrelStagger, auto A = pr.first; auto B = pr.second; - Vector3 ctr = A->binningPosition(tgContext, BinningValue::binR); + Vector3 ctr = A->referencePosition(tgContext, AxisDirection::AxisR); auto binContent = sa2.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 2u); std::set act; diff --git a/Tests/UnitTests/Core/Geometry/SurfaceBinningMatcherTests.cpp b/Tests/UnitTests/Core/Geometry/SurfaceBinningMatcherTests.cpp index 6a3c92aa8a3..726620a15c1 100644 --- a/Tests/UnitTests/Core/Geometry/SurfaceBinningMatcherTests.cpp +++ b/Tests/UnitTests/Core/Geometry/SurfaceBinningMatcherTests.cpp @@ -58,25 +58,25 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceMatcher) { Surface::makeShared(identity, similarPhiBounds); SurfaceBinningMatcher sbm; - sbm.tolerances[toUnderlying(BinningValue::binR)] = {rMinTol, rMaxTol}; - sbm.tolerances[toUnderlying(BinningValue::binPhi)] = {phiTol, phiTol}; + sbm.tolerances[toUnderlying(AxisDirection::AxisR)] = {rMinTol, rMaxTol}; + sbm.tolerances[toUnderlying(AxisDirection::AxisPhi)] = {phiTol, phiTol}; // Always true - for (BinningValue ib : allBinningValues()) { + for (AxisDirection ib : allAxisDirections()) { BOOST_CHECK(sbm(tgContext, ib, oneSurface.get(), oneSurface.get())); } // Not matching in R - BOOST_CHECK(!sbm(tgContext, BinningValue::binR, oneSurface.get(), + BOOST_CHECK(!sbm(tgContext, AxisDirection::AxisR, oneSurface.get(), otherSurface.get())); // Not matching in phi - BOOST_CHECK(!sbm(tgContext, BinningValue::binPhi, oneSurface.get(), + BOOST_CHECK(!sbm(tgContext, AxisDirection::AxisPhi, oneSurface.get(), otherSurface.get())); // Good enough matching in R - BOOST_CHECK(sbm(tgContext, BinningValue::binR, oneSurface.get(), + BOOST_CHECK(sbm(tgContext, AxisDirection::AxisR, oneSurface.get(), similarRSurface.get())); // Good enough matching in phi - BOOST_CHECK(sbm(tgContext, BinningValue::binPhi, oneSurface.get(), + BOOST_CHECK(sbm(tgContext, AxisDirection::AxisPhi, oneSurface.get(), similarPhiSurface.get())); } diff --git a/Tests/UnitTests/Core/Geometry/TrackingVolumeCreation.hpp b/Tests/UnitTests/Core/Geometry/TrackingVolumeCreation.hpp index d895f74ccab..899bcaa8a41 100644 --- a/Tests/UnitTests/Core/Geometry/TrackingVolumeCreation.hpp +++ b/Tests/UnitTests/Core/Geometry/TrackingVolumeCreation.hpp @@ -96,14 +96,14 @@ MutableTrackingVolumePtr constructContainerVolume(const GeometryContext& gctx, /// create the volume array using VAP = std::pair; std::vector volumes = { - {iVolume, iVolume->binningPosition(gctx, BinningValue::binR)}, - {oVolume, oVolume->binningPosition(gctx, BinningValue::binR)}}; + {iVolume, iVolume->referencePosition(gctx, AxisDirection::AxisR)}, + {oVolume, oVolume->referencePosition(gctx, AxisDirection::AxisR)}}; /// the bounds for the container auto hVolumeBounds = std::make_shared(0., hVolumeR, hVolumeHalflength); /// create the BinUtility & the BinnedArray auto vUtility = std::make_unique( - volumes.size(), 0., hVolumeR, open, BinningValue::binR); + volumes.size(), 0., hVolumeR, open, AxisDirection::AxisR); std::shared_ptr vArray = std::make_shared>( volumes, std::move(vUtility)); diff --git a/Tests/UnitTests/Core/Geometry/VolumeTests.cpp b/Tests/UnitTests/Core/Geometry/VolumeTests.cpp index 8c10abc18c2..8e9c8296ef3 100644 --- a/Tests/UnitTests/Core/Geometry/VolumeTests.cpp +++ b/Tests/UnitTests/Core/Geometry/VolumeTests.cpp @@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(VolumeTest) { // Binning test GeometryContext gctx; - BOOST_CHECK_EQUAL(volume.binningPosition(gctx, BinningValue::binX), + BOOST_CHECK_EQUAL(volume.referencePosition(gctx, AxisDirection::AxisX), volume.center()); } diff --git a/Tests/UnitTests/Core/MagneticField/InterpolatedBFieldMapTests.cpp b/Tests/UnitTests/Core/MagneticField/InterpolatedBFieldMapTests.cpp index 925d6617018..e7620de6d06 100644 --- a/Tests/UnitTests/Core/MagneticField/InterpolatedBFieldMapTests.cpp +++ b/Tests/UnitTests/Core/MagneticField/InterpolatedBFieldMapTests.cpp @@ -13,7 +13,7 @@ #include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/Result.hpp" #include "Acts/Utilities/VectorHelpers.hpp" diff --git a/Tests/UnitTests/Core/Material/AccumulatedSurfaceMaterialTests.cpp b/Tests/UnitTests/Core/Material/AccumulatedSurfaceMaterialTests.cpp index 9eb412a344d..3326c258c77 100644 --- a/Tests/UnitTests/Core/Material/AccumulatedSurfaceMaterialTests.cpp +++ b/Tests/UnitTests/Core/Material/AccumulatedSurfaceMaterialTests.cpp @@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(AccumulatedSurfaceMaterial_construction_test) { // Test: // BinsSurfaceMaterial accumulation - 1D - BinUtility binUtility1D(10, -5., 5., open, BinningValue::binX); + BinUtility binUtility1D(10, -5., 5., open, AxisDirection::AxisX); AccumulatedSurfaceMaterial material1D{binUtility1D}; auto accMat1D = material1D.accumulatedMaterial(); BOOST_CHECK_EQUAL(accMat1D.size(), 1u); @@ -43,8 +43,8 @@ BOOST_AUTO_TEST_CASE(AccumulatedSurfaceMaterial_construction_test) { // Test: // BinsSurfaceMaterial accumulation - 2D - BinUtility binUtility2D(10, -5., 5., open, BinningValue::binX); - binUtility2D += BinUtility(20, -10., 10., open, BinningValue::binY); + BinUtility binUtility2D(10, -5., 5., open, AxisDirection::AxisX); + binUtility2D += BinUtility(20, -10., 10., open, AxisDirection::AxisY); AccumulatedSurfaceMaterial material2D{binUtility2D}; auto accMat2D = material2D.accumulatedMaterial(); BOOST_CHECK_EQUAL(accMat2D.size(), 20u); @@ -91,8 +91,8 @@ BOOST_AUTO_TEST_CASE(AccumulatedSurfaceMaterial_fill_convert_1D) { MaterialSlab four(mat, 4.); // BinsSurfaceMaterial accumulation - 2D - BinUtility binUtility2D(2, -1., 1., open, BinningValue::binX); - binUtility2D += BinUtility(2, -1., 1., open, BinningValue::binY); + BinUtility binUtility2D(2, -1., 1., open, AxisDirection::AxisX); + binUtility2D += BinUtility(2, -1., 1., open, AxisDirection::AxisY); AccumulatedSurfaceMaterial material2D{binUtility2D}; const std::vector> bin; diff --git a/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialAccumulaterTests.cpp b/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialAccumulaterTests.cpp index a249d22ba4b..d3759c16400 100644 --- a/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialAccumulaterTests.cpp +++ b/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialAccumulaterTests.cpp @@ -87,14 +87,14 @@ BOOST_AUTO_TEST_CASE(AccumulationTest) { // Second surface is binned Phi / Z BinUtility sb1(4, -std::numbers::pi, std::numbers::pi, closed, - BinningValue::binPhi); - sb1 += BinUtility(2, -100., 100., open, BinningValue::binZ); + AxisDirection::AxisPhi); + sb1 += BinUtility(2, -100., 100., open, AxisDirection::AxisZ); surfaces[1u]->assignSurfaceMaterial( std::make_shared(sb1)); // Third is binned std::vector mps = {mp, mp, mp}; - BinUtility sb2(3, -100., 100., open, BinningValue::binZ); + BinUtility sb2(3, -100., 100., open, AxisDirection::AxisZ); surfaces[2u]->assignSurfaceMaterial( std::make_shared(sb2, mps)); diff --git a/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialTests.cpp b/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialTests.cpp index f9c2d26df40..9551c131adc 100644 --- a/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialTests.cpp +++ b/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialTests.cpp @@ -21,8 +21,8 @@ namespace Acts::Test { /// Test the constructors BOOST_AUTO_TEST_CASE(BinnedSurfaceMaterial_construction_test) { - BinUtility xyBinning(2, -1., 1., open, BinningValue::binX); - xyBinning += BinUtility(3, -3., 3., open, BinningValue::binY); + BinUtility xyBinning(2, -1., 1., open, AxisDirection::AxisX); + xyBinning += BinUtility(3, -3., 3., open, AxisDirection::AxisY); // Constructor a few material properties MaterialSlab a00(Material::fromMolarDensity(1., 2., 3., 4., 5.), 6.); diff --git a/Tests/UnitTests/Core/Material/InterpolatedMaterialMapTests.cpp b/Tests/UnitTests/Core/Material/InterpolatedMaterialMapTests.cpp index 10933ccfa0c..4977918c05d 100644 --- a/Tests/UnitTests/Core/Material/InterpolatedMaterialMapTests.cpp +++ b/Tests/UnitTests/Core/Material/InterpolatedMaterialMapTests.cpp @@ -13,7 +13,7 @@ #include "Acts/Material/Material.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include diff --git a/Tests/UnitTests/Core/Material/MaterialGridHelperTests.cpp b/Tests/UnitTests/Core/Material/MaterialGridHelperTests.cpp index 1c76cf866f7..51d330a2bc9 100644 --- a/Tests/UnitTests/Core/Material/MaterialGridHelperTests.cpp +++ b/Tests/UnitTests/Core/Material/MaterialGridHelperTests.cpp @@ -15,7 +15,7 @@ #include "Acts/Material/MaterialSlab.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinUtility.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Grid.hpp" @@ -40,8 +40,8 @@ using MaterialGrid3D = /// @brief Various test for the Material in the case of a Cuboid volume and 2D /// Grid BOOST_AUTO_TEST_CASE(Square_Grid_test) { - BinUtility bu(7, -3., 3., open, BinningValue::binX); - bu += BinUtility(3, -2., 2., open, BinningValue::binY); + BinUtility bu(7, -3., 3., open, AxisDirection::AxisX); + bu += BinUtility(3, -2., 2., open, AxisDirection::AxisY); auto bd = bu.binningData(); std::function transfoGlobalToLocal; @@ -129,9 +129,9 @@ BOOST_AUTO_TEST_CASE(Square_Grid_test) { /// @brief Various test for the Material in the case of a Cylindrical volume /// with a 2D grid BOOST_AUTO_TEST_CASE(PhiZ_Grid_test) { - BinUtility bu(2, -2., 2., open, BinningValue::binZ); + BinUtility bu(2, -2., 2., open, AxisDirection::AxisZ); bu += BinUtility(3, -std::numbers::pi, std::numbers::pi, closed, - BinningValue::binPhi); + AxisDirection::AxisPhi); auto bd = bu.binningData(); std::function transfoGlobalToLocal; @@ -219,9 +219,9 @@ BOOST_AUTO_TEST_CASE(PhiZ_Grid_test) { /// @brief Various test for the Material in the case of a Cuboid volume BOOST_AUTO_TEST_CASE(Cubic_Grid_test) { - BinUtility bu(7, -3., 3., open, BinningValue::binX); - bu += BinUtility(3, -2., 2., open, BinningValue::binY); - bu += BinUtility(2, -1., 1., open, BinningValue::binZ); + BinUtility bu(7, -3., 3., open, AxisDirection::AxisX); + bu += BinUtility(3, -2., 2., open, AxisDirection::AxisY); + bu += BinUtility(2, -1., 1., open, AxisDirection::AxisZ); auto bd = bu.binningData(); std::function transfoGlobalToLocal; @@ -310,10 +310,10 @@ BOOST_AUTO_TEST_CASE(Cubic_Grid_test) { /// @brief Various test for the Material in the case of a Cylindrical volume BOOST_AUTO_TEST_CASE(Cylindrical_Grid_test) { - BinUtility bu(4, 1., 4., open, BinningValue::binR); + BinUtility bu(4, 1., 4., open, AxisDirection::AxisR); bu += BinUtility(3, -std::numbers::pi, std::numbers::pi, closed, - BinningValue::binPhi); - bu += BinUtility(2, -2., 2., open, BinningValue::binZ); + AxisDirection::AxisPhi); + bu += BinUtility(2, -2., 2., open, AxisDirection::AxisZ); auto bd = bu.binningData(); std::function transfoGlobalToLocal; diff --git a/Tests/UnitTests/Core/Material/PropagatorMaterialAssignerTests.cpp b/Tests/UnitTests/Core/Material/PropagatorMaterialAssignerTests.cpp index 03ab7415d1b..18f5880c98e 100644 --- a/Tests/UnitTests/Core/Material/PropagatorMaterialAssignerTests.cpp +++ b/Tests/UnitTests/Core/Material/PropagatorMaterialAssignerTests.cpp @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(FindSurfaceIntersectionsTrackingGeometry) { LayerArrayCreator::Config lacConfig; LayerArrayCreator lac = LayerArrayCreator(lacConfig); auto layers = lac.layerArray(tContext, {pCylinderLayer}, rMin, rMid, - arbitrary, BinningValue::binR); + arbitrary, AxisDirection::AxisR); auto innerVolume = std::make_shared( Transform3::Identity(), vCylinderInner, nullptr, std::move(layers), @@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(FindSurfaceIntersectionsTrackingGeometry) { TrackingVolumeArrayCreator tvac = TrackingVolumeArrayCreator(tvacConfig); auto volumes = tvac.trackingVolumeArray(tContext, {innerVolume, outerVolume}, - BinningValue::binR); + AxisDirection::AxisR); auto vCylinderTop = std::make_shared(rMin, rMax, 110.); diff --git a/Tests/UnitTests/Core/Material/ProtoSurfaceMaterialTests.cpp b/Tests/UnitTests/Core/Material/ProtoSurfaceMaterialTests.cpp index 195ef30b81d..b2b3b153626 100644 --- a/Tests/UnitTests/Core/Material/ProtoSurfaceMaterialTests.cpp +++ b/Tests/UnitTests/Core/Material/ProtoSurfaceMaterialTests.cpp @@ -18,8 +18,8 @@ namespace Acts::Test { /// Test the constructors BOOST_AUTO_TEST_CASE(ProtoSurfaceMaterial_construction_test) { - BinUtility smpBU(10, -10., 10., open, BinningValue::binX); - smpBU += BinUtility(10, -10., 10., open, BinningValue::binY); + BinUtility smpBU(10, -10., 10., open, AxisDirection::AxisX); + smpBU += BinUtility(10, -10., 10., open, AxisDirection::AxisY); // Constructor from arguments ProtoSurfaceMaterial smp(smpBU); diff --git a/Tests/UnitTests/Core/Material/ProtoVolumeMaterialTests.cpp b/Tests/UnitTests/Core/Material/ProtoVolumeMaterialTests.cpp index f5cc2c90953..fac92072e41 100644 --- a/Tests/UnitTests/Core/Material/ProtoVolumeMaterialTests.cpp +++ b/Tests/UnitTests/Core/Material/ProtoVolumeMaterialTests.cpp @@ -18,9 +18,9 @@ namespace Acts::Test { /// Test the constructors BOOST_AUTO_TEST_CASE(ProtoVolumeMaterial_construction_test) { - BinUtility vmpBU(10, -10., 10., open, BinningValue::binX); - vmpBU += BinUtility(10, -10., 10., open, BinningValue::binY); - vmpBU += BinUtility(10, -10., 10., open, BinningValue::binZ); + BinUtility vmpBU(10, -10., 10., open, AxisDirection::AxisX); + vmpBU += BinUtility(10, -10., 10., open, AxisDirection::AxisY); + vmpBU += BinUtility(10, -10., 10., open, AxisDirection::AxisZ); // Constructor from arguments ProtoVolumeMaterial vmp(vmpBU); diff --git a/Tests/UnitTests/Core/Material/SurfaceMaterialMapperTests.cpp b/Tests/UnitTests/Core/Material/SurfaceMaterialMapperTests.cpp index 6d7b94fecde..d31e8bac9cf 100644 --- a/Tests/UnitTests/Core/Material/SurfaceMaterialMapperTests.cpp +++ b/Tests/UnitTests/Core/Material/SurfaceMaterialMapperTests.cpp @@ -40,7 +40,7 @@ namespace Acts { std::shared_ptr trackingGeometry() { using namespace Acts::UnitLiterals; - BinUtility zbinned(8, -40, 40, open, BinningValue::binZ); + BinUtility zbinned(8, -40, 40, open, AxisDirection::AxisZ); auto matProxy = std::make_shared(zbinned); Logging::Level surfaceLLevel = Logging::INFO; diff --git a/Tests/UnitTests/Core/Material/VolumeMaterialMapperTests.cpp b/Tests/UnitTests/Core/Material/VolumeMaterialMapperTests.cpp index ffe731cb6ca..ec3d0d733c9 100644 --- a/Tests/UnitTests/Core/Material/VolumeMaterialMapperTests.cpp +++ b/Tests/UnitTests/Core/Material/VolumeMaterialMapperTests.cpp @@ -85,17 +85,17 @@ namespace Acts::Test { BOOST_AUTO_TEST_CASE(SurfaceMaterialMapper_tests) { using namespace Acts::UnitLiterals; - BinUtility bu1(4, 0_m, 1_m, open, BinningValue::binX); - bu1 += BinUtility(2, -0.5_m, 0.5_m, open, BinningValue::binY); - bu1 += BinUtility(2, -0.5_m, 0.5_m, open, BinningValue::binZ); + BinUtility bu1(4, 0_m, 1_m, open, AxisDirection::AxisX); + bu1 += BinUtility(2, -0.5_m, 0.5_m, open, AxisDirection::AxisY); + bu1 += BinUtility(2, -0.5_m, 0.5_m, open, AxisDirection::AxisZ); - BinUtility bu2(4, 1_m, 2_m, open, BinningValue::binX); - bu2 += BinUtility(2, -0.5_m, 0.5_m, open, BinningValue::binY); - bu2 += BinUtility(2, -0.5_m, 0.5_m, open, BinningValue::binZ); + BinUtility bu2(4, 1_m, 2_m, open, AxisDirection::AxisX); + bu2 += BinUtility(2, -0.5_m, 0.5_m, open, AxisDirection::AxisY); + bu2 += BinUtility(2, -0.5_m, 0.5_m, open, AxisDirection::AxisZ); - BinUtility bu3(4, 2_m, 3_m, open, BinningValue::binX); - bu3 += BinUtility(2, -0.5_m, 0.5_m, open, BinningValue::binY); - bu3 += BinUtility(2, -0.5_m, 0.5_m, open, BinningValue::binZ); + BinUtility bu3(4, 2_m, 3_m, open, AxisDirection::AxisX); + bu3 += BinUtility(2, -0.5_m, 0.5_m, open, AxisDirection::AxisY); + bu3 += BinUtility(2, -0.5_m, 0.5_m, open, AxisDirection::AxisZ); // Build a vacuum volume CuboidVolumeBuilder::VolumeConfig vCfg1; diff --git a/Tests/UnitTests/Core/Navigation/DetectorNavigatorTests.cpp b/Tests/UnitTests/Core/Navigation/DetectorNavigatorTests.cpp index 2dc5bbacdbd..7596c4881ad 100644 --- a/Tests/UnitTests/Core/Navigation/DetectorNavigatorTests.cpp +++ b/Tests/UnitTests/Core/Navigation/DetectorNavigatorTests.cpp @@ -232,7 +232,7 @@ BOOST_AUTO_TEST_CASE(DetectorNavigatorTestsForwardBackward) { auto portalContainer = Acts::Experimental::detail::CuboidalDetectorHelper::connect( - geoContext, detectorVolumes, Acts::BinningValue::binX, {}, + geoContext, detectorVolumes, Acts::AxisDirection::AxisX, {}, Acts::Logging::VERBOSE); // Make sure that the geometry ids are diff --git a/Tests/UnitTests/Core/Navigation/DetectorVolumeFindersTests.cpp b/Tests/UnitTests/Core/Navigation/DetectorVolumeFindersTests.cpp index 1b6d423ed75..83ed81e5d56 100644 --- a/Tests/UnitTests/Core/Navigation/DetectorVolumeFindersTests.cpp +++ b/Tests/UnitTests/Core/Navigation/DetectorVolumeFindersTests.cpp @@ -19,7 +19,7 @@ #include "Acts/Navigation/InternalNavigation.hpp" #include "Acts/Navigation/NavigationState.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Grid.hpp" @@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(IndexedDetectorVolumeFinder) { g.atPosition(std::array{150.}) = 2u; Acts::Experimental::IndexedDetectorVolumesImpl idv( - std::move(g), {Acts::BinningValue::binR}); + std::move(g), {Acts::AxisDirection::AxisR}); // Cylinder 0 nState.position = Acts::Vector3(5., 0., 0.); diff --git a/Tests/UnitTests/Core/Navigation/MultiWireNavigationTests.cpp b/Tests/UnitTests/Core/Navigation/MultiWireNavigationTests.cpp index dbf40914e27..ccce81a5b62 100644 --- a/Tests/UnitTests/Core/Navigation/MultiWireNavigationTests.cpp +++ b/Tests/UnitTests/Core/Navigation/MultiWireNavigationTests.cpp @@ -76,9 +76,9 @@ BOOST_AUTO_TEST_CASE(Navigation_in_Indexed_Surfaces) { mlCfg.mlSurfaces = strawSurfaces; mlCfg.mlBinning = { - ProtoBinning(Acts::BinningValue::binX, Acts::AxisBoundaryType::Bound, + ProtoBinning(Acts::AxisDirection::AxisX, Acts::AxisBoundaryType::Bound, -vBounds[0], vBounds[0], nSurfacesX, 1u), - ProtoBinning(Acts::BinningValue::binY, Acts::AxisBoundaryType::Bound, + ProtoBinning(Acts::AxisDirection::AxisY, Acts::AxisBoundaryType::Bound, -vBounds[1], vBounds[1], nSurfacesY, 0u)}; mlCfg.mlBounds = vBounds; diff --git a/Tests/UnitTests/Core/Navigation/NavigationStateUpdatersTests.cpp b/Tests/UnitTests/Core/Navigation/NavigationStateUpdatersTests.cpp index 93996bcae07..8f0eaefca4a 100644 --- a/Tests/UnitTests/Core/Navigation/NavigationStateUpdatersTests.cpp +++ b/Tests/UnitTests/Core/Navigation/NavigationStateUpdatersTests.cpp @@ -13,7 +13,7 @@ #include "Acts/Navigation/NavigationState.hpp" #include "Acts/Navigation/NavigationStateFillers.hpp" #include "Acts/Navigation/NavigationStateUpdaters.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/IAxis.hpp" @@ -268,7 +268,7 @@ BOOST_AUTO_TEST_CASE(AllPortalsGrid1DSurfaces) { Acts::Experimental::IndexedSurfacesExtractor, Acts::Experimental::SurfacesFiller>; auto grid1DSurfaces = - Grid1DSurfacesProvider(std::move(grid), {Acts::BinningValue::binR}); + Grid1DSurfacesProvider(std::move(grid), {Acts::AxisDirection::AxisR}); auto allPortalsGrid1DSurfaces = Acts::Experimental::ChainedNavigation< Acts::Experimental::IInternalNavigation, AllPortalsProvider, @@ -295,7 +295,8 @@ BOOST_AUTO_TEST_CASE(AllPortalsGrid2DSurfaces) { Acts::Experimental::IndexedSurfacesExtractor, Acts::Experimental::SurfacesFiller>; auto grid2DSurfaces = Grid2DSurfacesProvider( - std::move(grid), {Acts::BinningValue::binR, Acts::BinningValue::binZ}); + std::move(grid), + {Acts::AxisDirection::AxisR, Acts::AxisDirection::AxisZ}); auto allPortalsGrid2DSurfaces = Acts::Experimental::ChainedNavigation< Acts::Experimental::IInternalNavigation, AllPortalsProvider, diff --git a/Tests/UnitTests/Core/Navigation/PortalNavigationTests.cpp b/Tests/UnitTests/Core/Navigation/PortalNavigationTests.cpp index 30836c9396e..822a5d949dc 100644 --- a/Tests/UnitTests/Core/Navigation/PortalNavigationTests.cpp +++ b/Tests/UnitTests/Core/Navigation/PortalNavigationTests.cpp @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(VolumeArrayUpdate) { std::vector volumes = { volumeA.get(), volumeB.get(), volumeC.get(), volumeD.get()}; Acts::Experimental::BoundVolumesGrid1Navigation bvg( - zArray, Acts::BinningValue::binZ, volumes); + zArray, Acts::AxisDirection::AxisZ, volumes); // Reset the navigation state nState.currentVolume = nullptr; @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(VolumeArrayUpdate) { shift300.pretranslate(Acts::Vector3(0, 0, 300)); Acts::Experimental::BoundVolumesGrid1Navigation bvgs( - zArray, Acts::BinningValue::binZ, volumes, shift300.inverse()); + zArray, Acts::AxisDirection::AxisZ, volumes, shift300.inverse()); // 150 (-300) -> transforms to -150, hence it yields A nState.position = Acts::Vector3(0., 0., 150.); diff --git a/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp b/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp index f7bdbe1e6b0..9974fd3dfad 100644 --- a/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp @@ -585,11 +585,11 @@ BOOST_AUTO_TEST_CASE(StepSize) { Stepper::State state = stepper.makeState(options, cp); - stepper.updateStepSize(state, -5_cm, ConstrainedStep::actor, true); + stepper.updateStepSize(state, -5_cm, ConstrainedStep::navigator); BOOST_CHECK_EQUAL(state.previousStepSize, stepSize); BOOST_CHECK_EQUAL(state.stepSize.value(), -5_cm); - stepper.releaseStepSize(state, ConstrainedStep::actor); + stepper.releaseStepSize(state, ConstrainedStep::navigator); BOOST_CHECK_EQUAL(state.stepSize.value(), stepSize); } @@ -611,8 +611,8 @@ BOOST_AUTO_TEST_CASE(StepSizeSurface) { stepper.updateSurfaceStatus(state, *target, 0, navDir, BoundaryTolerance::Infinite(), - s_onSurfaceTolerance); - BOOST_CHECK_EQUAL(state.stepSize.value(ConstrainedStep::actor), distance); + s_onSurfaceTolerance, ConstrainedStep::navigator); + BOOST_CHECK_EQUAL(state.stepSize.value(ConstrainedStep::navigator), distance); // test the step size modification in the context of a surface stepper.updateStepSize(state, @@ -621,18 +621,19 @@ BOOST_AUTO_TEST_CASE(StepSizeSurface) { navDir * stepper.direction(state), BoundaryTolerance::Infinite()) .closest(), - navDir, false); + navDir, ConstrainedStep::navigator); BOOST_CHECK_EQUAL(state.stepSize.value(), distance); // start with a different step size state.stepSize.setUser(navDir * stepSize); + stepper.releaseStepSize(state, ConstrainedStep::navigator); stepper.updateStepSize(state, target ->intersect(geoCtx, stepper.position(state), navDir * stepper.direction(state), BoundaryTolerance::Infinite()) .closest(), - navDir, true); + navDir, ConstrainedStep::navigator); BOOST_CHECK_EQUAL(state.stepSize.value(), navDir * stepSize); } diff --git a/Tests/UnitTests/Core/Propagator/ConstrainedStepTests.cpp b/Tests/UnitTests/Core/Propagator/ConstrainedStepTests.cpp index ecbcf32054f..86325c27ed1 100644 --- a/Tests/UnitTests/Core/Propagator/ConstrainedStepTests.cpp +++ b/Tests/UnitTests/Core/Propagator/ConstrainedStepTests.cpp @@ -22,9 +22,9 @@ BOOST_AUTO_TEST_CASE(ConstrainedStepTest) { // All of the types should be 0.25 now BOOST_CHECK_EQUAL(stepSize_p.accuracy(), std::numeric_limits::max()); - BOOST_CHECK_EQUAL(stepSize_p.value(ConstrainedStep::actor), + BOOST_CHECK_EQUAL(stepSize_p.value(ConstrainedStep::navigator), std::numeric_limits::max()); - BOOST_CHECK_EQUAL(stepSize_p.value(ConstrainedStep::aborter), + BOOST_CHECK_EQUAL(stepSize_p.value(ConstrainedStep::actor), std::numeric_limits::max()); BOOST_CHECK_EQUAL(stepSize_p.value(ConstrainedStep::user), 0.25); @@ -36,14 +36,15 @@ BOOST_AUTO_TEST_CASE(ConstrainedStepTest) { BOOST_CHECK_EQUAL(stepSize_p.value(), 0.1); // now we update the actor to smaller - stepSize_p.update(0.05, ConstrainedStep::actor); + stepSize_p.update(0.05, ConstrainedStep::navigator); BOOST_CHECK_EQUAL(stepSize_p.value(), 0.05); // we increase the actor, but do not release the step size - stepSize_p.update(0.15, ConstrainedStep::actor, false); + stepSize_p.update(0.15, ConstrainedStep::navigator); BOOST_CHECK_EQUAL(stepSize_p.value(), 0.05); // we increase the actor, but now DO release the step size // it falls back to the accuracy - stepSize_p.update(0.15, ConstrainedStep::actor, true); + stepSize_p.release(ConstrainedStep::navigator); + stepSize_p.update(0.15, ConstrainedStep::navigator); BOOST_CHECK_EQUAL(stepSize_p.value(), 0.1); // now set two and update them diff --git a/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp b/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp index d4197d7f61c..a96df18fa52 100644 --- a/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp @@ -260,11 +260,11 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { // Step size modifies const std::string originalStepSize = esState.stepSize.toString(); - es.updateStepSize(esState, -1337., ConstrainedStep::actor, true); + es.updateStepSize(esState, -1337., ConstrainedStep::navigator); BOOST_CHECK_EQUAL(esState.previousStepSize, stepSize); BOOST_CHECK_EQUAL(esState.stepSize.value(), -1337.); - es.releaseStepSize(esState, ConstrainedStep::actor); + es.releaseStepSize(esState, ConstrainedStep::navigator); BOOST_CHECK_EQUAL(esState.stepSize.value(), stepSize); BOOST_CHECK_EQUAL(es.outputStepSize(esState), originalStepSize); @@ -449,9 +449,10 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { auto targetSurface = CurvilinearSurface(pos + navDir * 2. * dir, dir).planeSurface(); es.updateSurfaceStatus(esState, *targetSurface, 0, navDir, - BoundaryTolerance::Infinite(), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(esState.stepSize.value(ConstrainedStep::actor), navDir * 2., - eps); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator); + CHECK_CLOSE_ABS(esState.stepSize.value(ConstrainedStep::navigator), + navDir * 2., eps); // Test the step size modification in the context of a surface es.updateStepSize(esState, @@ -460,16 +461,17 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { navDir * es.direction(esState), BoundaryTolerance::Infinite()) .closest(), - navDir); + navDir, ConstrainedStep::navigator); CHECK_CLOSE_ABS(esState.stepSize.value(), 2., eps); esState.stepSize.setUser(navDir * stepSize); + es.releaseStepSize(esState, ConstrainedStep::navigator); es.updateStepSize(esState, targetSurface ->intersect(tgContext, es.position(esState), navDir * es.direction(esState), BoundaryTolerance::Infinite()) .closest(), - navDir); + navDir, ConstrainedStep::navigator); CHECK_CLOSE_ABS(esState.stepSize.value(), 2., eps); // Test the bound state construction diff --git a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp index a1d4c89fdc5..f8d46e84d42 100644 --- a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp @@ -508,7 +508,8 @@ void test_multi_stepper_surface_status_update() { { auto status = multi_stepper.updateSurfaceStatus( multi_state, *right_surface, 0, Direction::Forward, - BoundaryTolerance::Infinite(), s_onSurfaceTolerance); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator); BOOST_CHECK_EQUAL(status, IntersectionStatus::reachable); @@ -537,7 +538,8 @@ void test_multi_stepper_surface_status_update() { { auto status = multi_stepper.updateSurfaceStatus( multi_state, *right_surface, 0, Direction::Forward, - BoundaryTolerance::Infinite(), s_onSurfaceTolerance); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator); BOOST_CHECK_EQUAL(status, IntersectionStatus::onSurface); @@ -553,7 +555,8 @@ void test_multi_stepper_surface_status_update() { { auto status = multi_stepper.updateSurfaceStatus( multi_state, *start_surface, 0, Direction::Forward, - BoundaryTolerance::Infinite(), s_onSurfaceTolerance); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator); BOOST_CHECK_EQUAL(status, IntersectionStatus::reachable); @@ -622,14 +625,16 @@ void test_component_bound_state() { { multi_stepper.updateSurfaceStatus( multi_state, *right_surface, 0, Direction::Forward, - BoundaryTolerance::Infinite(), s_onSurfaceTolerance); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator); auto multi_prop_state = DummyPropState(Direction::Forward, multi_state); multi_stepper.step(multi_prop_state, mockNavigator); // Single stepper single_stepper.updateSurfaceStatus( single_state, *right_surface, 0, Direction::Forward, - BoundaryTolerance::Infinite(), s_onSurfaceTolerance); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator); auto single_prop_state = DummyPropState(Direction::Forward, single_state); single_stepper.step(single_prop_state, mockNavigator); } diff --git a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp index 5be6d28382c..c6f9e8e6853 100644 --- a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp +++ b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp @@ -17,6 +17,7 @@ #include "Acts/Definitions/Units.hpp" #include "Acts/EventData/GenericBoundTrackParameters.hpp" #include "Acts/EventData/TrackParameters.hpp" +#include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" #include "Acts/Geometry/TrackingVolume.hpp" @@ -42,11 +43,6 @@ #include #include -namespace Acts { -class Layer; -struct FreeToBoundCorrection; -} // namespace Acts - namespace bdata = boost::unit_test::data; using namespace Acts::UnitLiterals; using Acts::VectorHelpers::perp; @@ -148,24 +144,27 @@ struct PropagatorState { IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance, const Logger& logger) const { + double surfaceTolerance, ConstrainedStep::Type stype, + const Logger& logger) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, logger); } template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction /*direction*/, bool release = true) const { - detail::updateSingleStepSize(state, oIntersection, release); + Direction direction, + ConstrainedStep::Type stype) const { + (void)direction; + double stepSize = oIntersection.pathLength(); + updateStepSize(state, stepSize, stype); } void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype, - bool release = true) const { + ConstrainedStep::Type stype) const { state.previousStepSize = state.stepSize.value(); - state.stepSize.update(stepSize, stype, release); + state.stepSize.update(stepSize, stype); } double getStepSize(const State& state, ConstrainedStep::Type stype) const { diff --git a/Tests/UnitTests/Core/Propagator/PropagatorTests.cpp b/Tests/UnitTests/Core/Propagator/PropagatorTests.cpp index 8ec7c11948d..c48d36d6db5 100644 --- a/Tests/UnitTests/Core/Propagator/PropagatorTests.cpp +++ b/Tests/UnitTests/Core/Propagator/PropagatorTests.cpp @@ -109,13 +109,13 @@ struct SurfaceObserver { .pathLength(); // Adjust the step size so that we cannot cross the target surface state.stepping.stepSize.update(distance * state.options.direction, - ConstrainedStep::actor); + ConstrainedStep::navigator); // return true if you fall below tolerance if (std::abs(distance) <= tolerance) { ++result.surfaces_passed; result.surface_passed_r = perp(stepper.position(state.stepping)); // release the step size, will be re-adjusted - state.stepping.stepSize.release(ConstrainedStep::actor); + state.stepping.stepSize.release(ConstrainedStep::navigator); } } } diff --git a/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp b/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp index 31697d1bb67..ae61bce99ea 100644 --- a/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp @@ -149,11 +149,11 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { // Step size modifies const std::string originalStepSize = slsState.stepSize.toString(); - sls.updateStepSize(slsState, -1337., ConstrainedStep::actor, true); + sls.updateStepSize(slsState, -1337., ConstrainedStep::navigator); BOOST_CHECK_EQUAL(slsState.previousStepSize, stepSize); BOOST_CHECK_EQUAL(slsState.stepSize.value(), -1337.); - sls.releaseStepSize(slsState, ConstrainedStep::actor); + sls.releaseStepSize(slsState, ConstrainedStep::navigator); BOOST_CHECK_EQUAL(slsState.stepSize.value(), stepSize); BOOST_CHECK_EQUAL(sls.outputStepSize(slsState), originalStepSize); @@ -323,9 +323,10 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { auto targetSurface = CurvilinearSurface(pos + navDir * 2. * dir, dir).planeSurface(); sls.updateSurfaceStatus(slsState, *targetSurface, 0, navDir, - BoundaryTolerance::Infinite(), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(slsState.stepSize.value(ConstrainedStep::actor), navDir * 2., - 1e-6); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator); + CHECK_CLOSE_ABS(slsState.stepSize.value(ConstrainedStep::navigator), + navDir * 2., 1e-6); // Test the step size modification in the context of a surface sls.updateStepSize(slsState, @@ -334,16 +335,17 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { navDir * sls.direction(slsState), BoundaryTolerance::Infinite()) .closest(), - navDir); + navDir, ConstrainedStep::navigator); CHECK_CLOSE_ABS(slsState.stepSize.value(), 2, 1e-6); slsState.stepSize.setUser(navDir * stepSize); + sls.releaseStepSize(slsState, ConstrainedStep::navigator); sls.updateStepSize(slsState, targetSurface ->intersect(tgContext, sls.position(slsState), navDir * sls.direction(slsState), BoundaryTolerance::Infinite()) .closest(), - navDir); + navDir, ConstrainedStep::navigator); CHECK_CLOSE_ABS(slsState.stepSize.value(), 2, 1e-6); // Test the bound state construction diff --git a/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp b/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp index 433cb8421b6..207504cf453 100644 --- a/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp @@ -234,11 +234,11 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) { // Step size modifies const std::string originalStepSize = esState.stepSize.toString(); - es.updateStepSize(esState, -1337., ConstrainedStep::actor, true); + es.updateStepSize(esState, -1337., ConstrainedStep::navigator); BOOST_CHECK_EQUAL(esState.previousStepSize, stepSize); BOOST_CHECK_EQUAL(esState.stepSize.value(), -1337.); - es.releaseStepSize(esState, ConstrainedStep::actor); + es.releaseStepSize(esState, ConstrainedStep::navigator); BOOST_CHECK_EQUAL(esState.stepSize.value(), stepSize); BOOST_CHECK_EQUAL(es.outputStepSize(esState), originalStepSize); @@ -421,9 +421,10 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) { auto targetSurface = CurvilinearSurface(pos + navDir * 2. * dir, dir).planeSurface(); es.updateSurfaceStatus(esState, *targetSurface, 0, navDir, - BoundaryTolerance::None(), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(esState.stepSize.value(ConstrainedStep::actor), navDir * 2., - eps); + BoundaryTolerance::None(), s_onSurfaceTolerance, + ConstrainedStep::navigator); + CHECK_CLOSE_ABS(esState.stepSize.value(ConstrainedStep::navigator), + navDir * 2., eps); // Test the step size modification in the context of a surface es.updateStepSize( @@ -432,16 +433,17 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) { ->intersect(tgContext, es.position(esState), navDir * es.direction(esState), BoundaryTolerance::None()) .closest(), - navDir); + navDir, ConstrainedStep::navigator); CHECK_CLOSE_ABS(esState.stepSize.value(), 2., eps); esState.stepSize.setUser(navDir * stepSize); + es.releaseStepSize(esState, ConstrainedStep::navigator); es.updateStepSize( esState, targetSurface ->intersect(tgContext, es.position(esState), navDir * es.direction(esState), BoundaryTolerance::None()) .closest(), - navDir); + navDir, ConstrainedStep::navigator); CHECK_CLOSE_ABS(esState.stepSize.value(), 2., eps); // Test the bound state construction diff --git a/Tests/UnitTests/Core/Seeding/PathSeederTest.cpp b/Tests/UnitTests/Core/Seeding/PathSeederTest.cpp index 1a347344592..0162fb78525 100644 --- a/Tests/UnitTests/Core/Seeding/PathSeederTest.cpp +++ b/Tests/UnitTests/Core/Seeding/PathSeederTest.cpp @@ -265,7 +265,7 @@ std::shared_ptr constructTelescopeDetector() { // Connect the volumes auto portalContainer = Experimental::detail::CuboidalDetectorHelper::connect( - gctx, volumes, BinningValue::binX, {}, Logging::INFO); + gctx, volumes, AxisDirection::AxisX, {}, Logging::INFO); // Make sure that the geometry ids are // independent of the potential Id generation diff --git a/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp index 4e037a105ba..3c9e114c05e 100644 --- a/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp @@ -103,11 +103,11 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceProperties) { /// Test type (redundant) BOOST_CHECK_EQUAL(coneSurfaceObject->type(), Surface::Cone); - /// Test binningPosition - Vector3 binningPosition{0., 1., 2.}; + /// Test referencePosition + Vector3 referencePosition{0., 1., 2.}; CHECK_CLOSE_ABS( - coneSurfaceObject->binningPosition(tgContext, BinningValue::binPhi), - binningPosition, 1e-6); + coneSurfaceObject->referencePosition(tgContext, AxisDirection::AxisPhi), + referencePosition, 1e-6); /// Test referenceFrame Vector3 globalPosition{2., 2., 2.}; @@ -225,21 +225,21 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceExtent) { auto pConeExtent = pCone->polyhedronRepresentation(tgContext, 1).extent(); double rMax = zMax * std::tan(alpha); - CHECK_CLOSE_ABS(zMin, pConeExtent.min(BinningValue::binZ), + CHECK_CLOSE_ABS(zMin, pConeExtent.min(AxisDirection::AxisZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(zMax, pConeExtent.max(BinningValue::binZ), + CHECK_CLOSE_ABS(zMax, pConeExtent.max(AxisDirection::AxisZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(0., pConeExtent.min(BinningValue::binR), + CHECK_CLOSE_ABS(0., pConeExtent.min(AxisDirection::AxisR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pConeExtent.max(BinningValue::binR), + CHECK_CLOSE_ABS(rMax, pConeExtent.max(AxisDirection::AxisR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pConeExtent.min(BinningValue::binX), + CHECK_CLOSE_ABS(-rMax, pConeExtent.min(AxisDirection::AxisX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pConeExtent.max(BinningValue::binX), + CHECK_CLOSE_ABS(rMax, pConeExtent.max(AxisDirection::AxisX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pConeExtent.min(BinningValue::binY), + CHECK_CLOSE_ABS(-rMax, pConeExtent.min(AxisDirection::AxisY), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pConeExtent.max(BinningValue::binY), + CHECK_CLOSE_ABS(rMax, pConeExtent.max(AxisDirection::AxisY), s_onSurfaceTolerance); /// Now a sector @@ -248,13 +248,13 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceExtent) { pCone = Surface::makeShared(pTransform, pConeBounds); pConeExtent = pCone->polyhedronRepresentation(tgContext, 1).extent(); - CHECK_CLOSE_ABS(zMin, pConeExtent.min(BinningValue::binZ), + CHECK_CLOSE_ABS(zMin, pConeExtent.min(AxisDirection::AxisZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(zMax, pConeExtent.max(BinningValue::binZ), + CHECK_CLOSE_ABS(zMax, pConeExtent.max(AxisDirection::AxisZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(0., pConeExtent.min(BinningValue::binR), + CHECK_CLOSE_ABS(0., pConeExtent.min(AxisDirection::AxisR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pConeExtent.max(BinningValue::binR), + CHECK_CLOSE_ABS(rMax, pConeExtent.max(AxisDirection::AxisR), s_onSurfaceTolerance); } diff --git a/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp index e37b339d00c..073f743ad29 100644 --- a/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp @@ -107,11 +107,11 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceProperties) { /// Test type (redundant) BOOST_CHECK_EQUAL(cylinderSurfaceObject->type(), Surface::Cylinder); - /// Test binningPosition - Vector3 binningPosition{0., 1., 2.}; - CHECK_CLOSE_ABS( - cylinderSurfaceObject->binningPosition(testContext, BinningValue::binPhi), - binningPosition, 1e-9); + /// Test referencePosition + Vector3 referencePosition{0., 1., 2.}; + CHECK_CLOSE_ABS(cylinderSurfaceObject->referencePosition( + testContext, AxisDirection::AxisPhi), + referencePosition, 1e-9); /// Test referenceFrame const double invSqrt2 = 1. / std::numbers::sqrt2; @@ -254,6 +254,8 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceEqualityOperators) { /// Unit test for testing CylinderSurface properties BOOST_AUTO_TEST_CASE(CylinderSurfaceExtent) { + using enum AxisDirection; + // Some radius and half length const double radius = 1.; const double halfZ = 10.; @@ -266,22 +268,14 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceExtent) { auto cylinderExtent = cylinderSurface->polyhedronRepresentation(testContext, 1).extent(); - CHECK_CLOSE_ABS(-8, cylinderExtent.min(BinningValue::binZ), - s_onSurfaceTolerance); - CHECK_CLOSE_ABS(12, cylinderExtent.max(BinningValue::binZ), - s_onSurfaceTolerance); - CHECK_CLOSE_ABS(radius, cylinderExtent.min(BinningValue::binR), - s_onSurfaceTolerance); - CHECK_CLOSE_ABS(radius, cylinderExtent.max(BinningValue::binR), - s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-radius, cylinderExtent.min(BinningValue::binX), - s_onSurfaceTolerance); - CHECK_CLOSE_ABS(radius, cylinderExtent.max(BinningValue::binX), - s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-radius, cylinderExtent.min(BinningValue::binY), - s_onSurfaceTolerance); - CHECK_CLOSE_ABS(radius, cylinderExtent.max(BinningValue::binY), - s_onSurfaceTolerance); + CHECK_CLOSE_ABS(-8, cylinderExtent.min(AxisZ), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(12, cylinderExtent.max(AxisZ), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(radius, cylinderExtent.min(AxisR), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(radius, cylinderExtent.max(AxisR), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(-radius, cylinderExtent.min(AxisX), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(radius, cylinderExtent.max(AxisX), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(-radius, cylinderExtent.min(AxisY), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(radius, cylinderExtent.max(AxisY), s_onSurfaceTolerance); } /// Unit test for testing CylinderSurface alignment derivatives @@ -331,23 +325,23 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceBinningPosition) { Vector3 exp = Vector3{r * std::cos(averagePhi), r * std::sin(averagePhi), 0}; exp = trf * exp; - Vector3 bp = cylinder->binningPosition(testContext, BinningValue::binR); + Vector3 bp = cylinder->referencePosition(testContext, AxisDirection::AxisR); CHECK_CLOSE_ABS(bp, exp, 1e-10); CHECK_CLOSE_ABS( - cylinder->binningPositionValue(testContext, BinningValue::binR), + cylinder->referencePositionValue(testContext, AxisDirection::AxisR), VectorHelpers::perp(exp), 1e-10); - bp = cylinder->binningPosition(testContext, BinningValue::binRPhi); + bp = cylinder->referencePosition(testContext, AxisDirection::AxisRPhi); CHECK_CLOSE_ABS(bp, exp, 1e-10); CHECK_CLOSE_ABS( - cylinder->binningPositionValue(testContext, BinningValue::binRPhi), + cylinder->referencePositionValue(testContext, AxisDirection::AxisRPhi), VectorHelpers::phi(exp) * VectorHelpers::perp(exp), 1e-10); - for (auto b : - {BinningValue::binX, BinningValue::binY, BinningValue::binZ, - BinningValue::binEta, BinningValue::binH, BinningValue::binMag}) { + for (auto b : {AxisDirection::AxisX, AxisDirection::AxisY, + AxisDirection::AxisZ, AxisDirection::AxisEta, + AxisDirection::AxisTheta, AxisDirection::AxisMag}) { BOOST_TEST_CONTEXT("binValue: " << b) { - BOOST_CHECK_EQUAL(cylinder->binningPosition(testContext, b), + BOOST_CHECK_EQUAL(cylinder->referencePosition(testContext, b), cylinder->center(testContext)); } } @@ -363,7 +357,7 @@ BOOST_AUTO_TEST_CASE(InvalidDetectorElement) { auto cyl2 = Surface::makeShared(bounds, detElem); BOOST_CHECK_THROW( - cyl1->mergedWith(*cyl2, Acts::BinningValue::binR, false, *logger), + cyl1->mergedWith(*cyl2, Acts::AxisDirection::AxisR, false, *logger), SurfaceMergingException); } @@ -385,28 +379,28 @@ BOOST_DATA_TEST_CASE(IncompatibleZDirection, base * Translation3{Vector3::UnitZ() * 200_mm}, 30_mm, 100_mm); BOOST_CHECK_THROW( - cyl->mergedWith(*cyl2, Acts::BinningValue::binPhi, false, *logger), + cyl->mergedWith(*cyl2, Acts::AxisDirection::AxisPhi, false, *logger), SurfaceMergingException); auto cylShiftedXy = Surface::makeShared( base * Translation3{Vector3{1_mm, 2_mm, 200_mm}}, 30_mm, 100_mm); - BOOST_CHECK_THROW( - cyl->mergedWith(*cylShiftedXy, Acts::BinningValue::binZ, false, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cyl->mergedWith(*cylShiftedXy, Acts::AxisDirection::AxisZ, + false, *logger), + SurfaceMergingException); auto cylRotatedX = Surface::makeShared( base * AngleAxis3{10_degree, Vector3::UnitX()} * Translation3{Vector3::UnitZ() * 200_mm}, 30_mm, 100_mm); BOOST_CHECK_THROW( - cyl->mergedWith(*cylRotatedX, Acts::BinningValue::binZ, false, *logger), + cyl->mergedWith(*cylRotatedX, Acts::AxisDirection::AxisZ, false, *logger), SurfaceMergingException); // Cylinder with different radius auto cyl3 = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 200_mm}, 35_mm, 100_mm); BOOST_CHECK_THROW( - cyl->mergedWith(*cyl3, Acts::BinningValue::binZ, false, *logger), + cyl->mergedWith(*cyl3, Acts::AxisDirection::AxisZ, false, *logger), SurfaceMergingException); // Cylinder with bevel @@ -414,28 +408,28 @@ BOOST_DATA_TEST_CASE(IncompatibleZDirection, base * Translation3{Vector3::UnitZ() * 200_mm}, 30_mm, 100_mm, std::numbers::pi, 0, std::numbers::pi / 8.); BOOST_CHECK_THROW( - cyl->mergedWith(*cyl4, Acts::BinningValue::binZ, false, *logger), + cyl->mergedWith(*cyl4, Acts::AxisDirection::AxisZ, false, *logger), SurfaceMergingException); auto cyl5 = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 200_mm}, 30_mm, 100_mm, std::numbers::pi, 0, 0, std::numbers::pi / 8.); BOOST_CHECK_THROW( - cyl->mergedWith(*cyl5, Acts::BinningValue::binZ, false, *logger), + cyl->mergedWith(*cyl5, Acts::AxisDirection::AxisZ, false, *logger), SurfaceMergingException); // Cylinder with overlap in z auto cyl6 = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 150_mm}, 30_mm, 100_mm); BOOST_CHECK_THROW( - cyl->mergedWith(*cyl6, Acts::BinningValue::binZ, false, *logger), + cyl->mergedWith(*cyl6, Acts::AxisDirection::AxisZ, false, *logger), SurfaceMergingException); // Cylinder with gap in z auto cyl7 = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 250_mm}, 30_mm, 100_mm); BOOST_CHECK_THROW( - cyl->mergedWith(*cyl7, Acts::BinningValue::binZ, false, *logger), + cyl->mergedWith(*cyl7, Acts::AxisDirection::AxisZ, false, *logger), SurfaceMergingException); // Cylinder with phi sector and relative z rotation @@ -444,7 +438,7 @@ BOOST_DATA_TEST_CASE(IncompatibleZDirection, Translation3{Vector3::UnitZ() * 200_mm}, 30_mm, 100_mm, 10_degree, 40_degree); BOOST_CHECK_THROW( - cyl->mergedWith(*cyl8, Acts::BinningValue::binZ, false, *logger), + cyl->mergedWith(*cyl8, Acts::AxisDirection::AxisZ, false, *logger), SurfaceMergingException); auto cylPhi1 = Surface::makeShared(Transform3::Identity(), @@ -453,7 +447,7 @@ BOOST_DATA_TEST_CASE(IncompatibleZDirection, Transform3{Translation3{Vector3::UnitZ() * 150_mm}}, 30_mm, 50_mm, 55_degree); BOOST_CHECK_THROW( - cylPhi1->mergedWith(*cylPhi2, Acts::BinningValue::binZ, false, *logger), + cylPhi1->mergedWith(*cylPhi2, Acts::AxisDirection::AxisZ, false, *logger), SurfaceMergingException); } @@ -476,12 +470,12 @@ BOOST_DATA_TEST_CASE(ZDirection, 30_mm, 100_mm); auto [cyl3, reversed] = - cyl->mergedWith(*cyl2, Acts::BinningValue::binZ, false, *logger); + cyl->mergedWith(*cyl2, Acts::AxisDirection::AxisZ, false, *logger); BOOST_REQUIRE_NE(cyl3, nullptr); BOOST_CHECK(!reversed); auto [cyl3Reversed, reversed2] = - cyl2->mergedWith(*cyl, Acts::BinningValue::binZ, false, *logger); + cyl2->mergedWith(*cyl, Acts::AxisDirection::AxisZ, false, *logger); BOOST_REQUIRE_NE(cyl3Reversed, nullptr); BOOST_CHECK(cyl3->bounds() == cyl3Reversed->bounds()); BOOST_CHECK(reversed2); @@ -509,7 +503,7 @@ BOOST_DATA_TEST_CASE(ZDirection, 45_degree); auto [cylPhi12, reversedPhy12] = - cylPhi1->mergedWith(*cylPhi2, Acts::BinningValue::binZ, false, *logger); + cylPhi1->mergedWith(*cylPhi2, Acts::AxisDirection::AxisZ, false, *logger); BOOST_REQUIRE_NE(cylPhi12, nullptr); auto boundsPhi12 = cylPhi12->bounds(); @@ -542,31 +536,31 @@ BOOST_DATA_TEST_CASE(IncompatibleRPhiDirection, // Cylinder with overlap in phi auto cylPhi2 = Surface::makeShared(base, 30_mm, 100_mm, 45_degree, a(85_degree)); - BOOST_CHECK_THROW( - cylPhi->mergedWith(*cylPhi2, Acts::BinningValue::binRPhi, false, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cylPhi->mergedWith(*cylPhi2, Acts::AxisDirection::AxisRPhi, + false, *logger), + SurfaceMergingException); // Cylinder with gap in phi auto cylPhi3 = Surface::makeShared(base, 30_mm, 100_mm, 45_degree, a(105_degree)); - BOOST_CHECK_THROW( - cylPhi->mergedWith(*cylPhi3, Acts::BinningValue::binRPhi, false, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cylPhi->mergedWith(*cylPhi3, Acts::AxisDirection::AxisRPhi, + false, *logger), + SurfaceMergingException); // Cylinder with a z shift auto cylPhi4 = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 20_mm}, 30_mm, 100_mm, 45_degree, a(95_degree)); - BOOST_CHECK_THROW( - cylPhi->mergedWith(*cylPhi4, Acts::BinningValue::binRPhi, false, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cylPhi->mergedWith(*cylPhi4, Acts::AxisDirection::AxisRPhi, + false, *logger), + SurfaceMergingException); // Test phi sector with different z halflengths auto cylPhi5 = Surface::makeShared(base, 30_mm, 110_mm, 45_degree, a(95_degree)); - BOOST_CHECK_THROW( - cylPhi->mergedWith(*cylPhi5, Acts::BinningValue::binRPhi, false, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cylPhi->mergedWith(*cylPhi5, Acts::AxisDirection::AxisRPhi, + false, *logger), + SurfaceMergingException); } BOOST_DATA_TEST_CASE(RPhiDirection, @@ -592,13 +586,13 @@ BOOST_DATA_TEST_CASE(RPhiDirection, 45_degree, a(95_degree)); auto [cyl3, reversed] = - cyl->mergedWith(*cyl2, Acts::BinningValue::binRPhi, false, *logger); + cyl->mergedWith(*cyl2, Acts::AxisDirection::AxisRPhi, false, *logger); BOOST_REQUIRE_NE(cyl3, nullptr); BOOST_CHECK_EQUAL(base.matrix(), cyl3->transform(testContext).matrix()); BOOST_CHECK(reversed); auto [cyl3Reversed, reversed2] = - cyl2->mergedWith(*cyl, Acts::BinningValue::binRPhi, false, *logger); + cyl2->mergedWith(*cyl, Acts::AxisDirection::AxisRPhi, false, *logger); BOOST_REQUIRE_NE(cyl3Reversed, nullptr); BOOST_CHECK(*cyl3 == *cyl3Reversed); BOOST_CHECK(!reversed2); @@ -617,13 +611,13 @@ BOOST_DATA_TEST_CASE(RPhiDirection, auto cyl5 = Surface::makeShared(base, 30_mm, 100_mm, 10_degree, a(-160_degree)); auto [cyl45, reversed45] = - cyl4->mergedWith(*cyl5, Acts::BinningValue::binRPhi, false, *logger); + cyl4->mergedWith(*cyl5, Acts::AxisDirection::AxisRPhi, false, *logger); BOOST_REQUIRE_NE(cyl45, nullptr); BOOST_CHECK_EQUAL(base.matrix(), cyl45->transform(testContext).matrix()); BOOST_CHECK(reversed45); auto [cyl54, reversed54] = - cyl5->mergedWith(*cyl4, Acts::BinningValue::binRPhi, false, *logger); + cyl5->mergedWith(*cyl4, Acts::AxisDirection::AxisRPhi, false, *logger); BOOST_REQUIRE_NE(cyl54, nullptr); BOOST_CHECK(!reversed54); @@ -642,12 +636,12 @@ BOOST_DATA_TEST_CASE(RPhiDirection, 90_degree, a(-90_degree)); auto [cyl67, reversed67] = - cyl6->mergedWith(*cyl7, Acts::BinningValue::binRPhi, false, *logger); + cyl6->mergedWith(*cyl7, Acts::AxisDirection::AxisRPhi, false, *logger); BOOST_REQUIRE_NE(cyl67, nullptr); BOOST_CHECK_EQUAL(base.matrix(), cyl67->transform(testContext).matrix()); auto [cyl76, reversed76] = - cyl7->mergedWith(*cyl6, Acts::BinningValue::binRPhi, false, *logger); + cyl7->mergedWith(*cyl6, Acts::AxisDirection::AxisRPhi, false, *logger); BOOST_REQUIRE_NE(cyl76, nullptr); BOOST_CHECK_EQUAL(base.matrix(), cyl76->transform(testContext).matrix()); @@ -674,7 +668,7 @@ BOOST_DATA_TEST_CASE(RPhiDirection, 45_degree, 0_degree); auto [cyl3, reversed] = - cyl1->mergedWith(*cyl2, Acts::BinningValue::binRPhi, true, *logger); + cyl1->mergedWith(*cyl2, Acts::AxisDirection::AxisRPhi, true, *logger); BOOST_REQUIRE_NE(cyl3, nullptr); Transform3 trfExpected12 = @@ -694,7 +688,7 @@ BOOST_DATA_TEST_CASE(RPhiDirection, auto cyl5 = Surface::makeShared(trf5, 30_mm, 100_mm, 10_degree, 0_degree); auto [cyl45, reversed45] = - cyl4->mergedWith(*cyl5, Acts::BinningValue::binRPhi, true, *logger); + cyl4->mergedWith(*cyl5, Acts::AxisDirection::AxisRPhi, true, *logger); BOOST_REQUIRE_NE(cyl45, nullptr); Transform3 trfExpected45 = base * AngleAxis3(a(180_degree), Vector3::UnitZ()); @@ -703,7 +697,7 @@ BOOST_DATA_TEST_CASE(RPhiDirection, BOOST_CHECK(reversed45); auto [cyl54, reversed54] = - cyl5->mergedWith(*cyl4, Acts::BinningValue::binRPhi, true, *logger); + cyl5->mergedWith(*cyl4, Acts::AxisDirection::AxisRPhi, true, *logger); BOOST_REQUIRE_NE(cyl54, nullptr); BOOST_CHECK(!reversed54); @@ -721,14 +715,14 @@ BOOST_DATA_TEST_CASE(RPhiDirection, 90_degree, 0_degree); auto [cyl67, reversed67] = - cyl6->mergedWith(*cyl7, Acts::BinningValue::binRPhi, true, *logger); + cyl6->mergedWith(*cyl7, Acts::AxisDirection::AxisRPhi, true, *logger); BOOST_REQUIRE_NE(cyl67, nullptr); Transform3 expected67 = trf6 * AngleAxis3(90_degree, Vector3::UnitZ()); CHECK_CLOSE_OR_SMALL(cyl67->transform(testContext).matrix(), expected67.matrix(), 1e-6, 1e-10); auto [cyl76, reversed76] = - cyl7->mergedWith(*cyl6, Acts::BinningValue::binRPhi, true, *logger); + cyl7->mergedWith(*cyl6, Acts::AxisDirection::AxisRPhi, true, *logger); BOOST_REQUIRE_NE(cyl76, nullptr); Transform3 expected76 = trf7 * AngleAxis3(90_degree, Vector3::UnitZ()); CHECK_CLOSE_OR_SMALL(cyl76->transform(testContext).matrix(), diff --git a/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp index 15140f73c7a..4a304f23510 100644 --- a/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp @@ -106,9 +106,9 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceProperties) { Vector2 lpos(2., 0.05); BOOST_CHECK_EQUAL(discSurfaceObject->normal(tgContext, lpos), zAxis); - /// Test binningPosition + /// Test referencePosition BOOST_CHECK_EQUAL( - discSurfaceObject->binningPosition(tgContext, BinningValue::binRPhi), + discSurfaceObject->referencePosition(tgContext, AxisDirection::AxisRPhi), origin3D); /// Test bounds @@ -248,46 +248,46 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceExtent) { Surface::makeShared(Transform3::Identity(), 0., rMax); auto pDiscExtent = pDisc->polyhedronRepresentation(tgContext, 1).extent(); - CHECK_CLOSE_ABS(0., pDiscExtent.min(BinningValue::binZ), + CHECK_CLOSE_ABS(0., pDiscExtent.min(AxisDirection::AxisZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(0., pDiscExtent.max(BinningValue::binZ), + CHECK_CLOSE_ABS(0., pDiscExtent.max(AxisDirection::AxisZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(0., pDiscExtent.min(BinningValue::binR), + CHECK_CLOSE_ABS(0., pDiscExtent.min(AxisDirection::AxisR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pDiscExtent.max(BinningValue::binR), + CHECK_CLOSE_ABS(rMax, pDiscExtent.max(AxisDirection::AxisR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pDiscExtent.min(BinningValue::binX), + CHECK_CLOSE_ABS(-rMax, pDiscExtent.min(AxisDirection::AxisX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pDiscExtent.max(BinningValue::binX), + CHECK_CLOSE_ABS(rMax, pDiscExtent.max(AxisDirection::AxisX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pDiscExtent.min(BinningValue::binY), + CHECK_CLOSE_ABS(-rMax, pDiscExtent.min(AxisDirection::AxisY), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pDiscExtent.max(BinningValue::binY), + CHECK_CLOSE_ABS(rMax, pDiscExtent.max(AxisDirection::AxisY), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-std::numbers::pi, pDiscExtent.min(BinningValue::binPhi), + CHECK_CLOSE_ABS(-std::numbers::pi, pDiscExtent.min(AxisDirection::AxisPhi), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(std::numbers::pi, pDiscExtent.max(BinningValue::binPhi), + CHECK_CLOSE_ABS(std::numbers::pi, pDiscExtent.max(AxisDirection::AxisPhi), s_onSurfaceTolerance); auto pRing = Surface::makeShared(Transform3::Identity(), rMin, rMax); auto pRingExtent = pRing->polyhedronRepresentation(tgContext, 1).extent(); - CHECK_CLOSE_ABS(0., pRingExtent.min(BinningValue::binZ), + CHECK_CLOSE_ABS(0., pRingExtent.min(AxisDirection::AxisZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(0., pRingExtent.max(BinningValue::binZ), + CHECK_CLOSE_ABS(0., pRingExtent.max(AxisDirection::AxisZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMin, pRingExtent.min(BinningValue::binR), + CHECK_CLOSE_ABS(rMin, pRingExtent.min(AxisDirection::AxisR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pRingExtent.max(BinningValue::binR), + CHECK_CLOSE_ABS(rMax, pRingExtent.max(AxisDirection::AxisR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pRingExtent.min(BinningValue::binX), + CHECK_CLOSE_ABS(-rMax, pRingExtent.min(AxisDirection::AxisX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pRingExtent.max(BinningValue::binX), + CHECK_CLOSE_ABS(rMax, pRingExtent.max(AxisDirection::AxisX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pRingExtent.min(BinningValue::binY), + CHECK_CLOSE_ABS(-rMax, pRingExtent.min(AxisDirection::AxisY), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pRingExtent.max(BinningValue::binY), + CHECK_CLOSE_ABS(rMax, pRingExtent.max(AxisDirection::AxisY), s_onSurfaceTolerance); } @@ -349,27 +349,29 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceBinningPosition) { std::make_shared(minR, maxR, std::numbers::pi / 8, 0.1); auto disc = Acts::Surface::makeShared(trf, bounds); - Vector3 bp = disc->binningPosition(tgContext, BinningValue::binR); + Vector3 bp = disc->referencePosition(tgContext, AxisDirection::AxisR); double r = (bounds->rMax() + bounds->rMin()) / 2.0; double phi = bounds->get(RadialBounds::eAveragePhi); Vector3 exp = Vector3{r * std::cos(phi), r * std::sin(phi), 0}; exp = trf * exp; BOOST_CHECK_EQUAL(bp, exp); - BOOST_CHECK_EQUAL(disc->binningPositionValue(tgContext, BinningValue::binR), - VectorHelpers::perp(exp)); + BOOST_CHECK_EQUAL( + disc->referencePositionValue(tgContext, AxisDirection::AxisR), + VectorHelpers::perp(exp)); - bp = disc->binningPosition(tgContext, BinningValue::binPhi); + bp = disc->referencePosition(tgContext, AxisDirection::AxisPhi); BOOST_CHECK_EQUAL(bp, exp); BOOST_CHECK_EQUAL( - disc->binningPositionValue(tgContext, BinningValue::binPhi), + disc->referencePositionValue(tgContext, AxisDirection::AxisPhi), VectorHelpers::phi(exp)); - for (auto b : {BinningValue::binX, BinningValue::binY, BinningValue::binZ, - BinningValue::binEta, BinningValue::binRPhi, - BinningValue::binH, BinningValue::binMag}) { + for (auto b : + {AxisDirection::AxisX, AxisDirection::AxisY, AxisDirection::AxisZ, + AxisDirection::AxisEta, AxisDirection::AxisRPhi, + AxisDirection::AxisTheta, AxisDirection::AxisMag}) { BOOST_TEST_CONTEXT("binValue: " << b) { - BOOST_CHECK_EQUAL(disc->binningPosition(tgContext, b), + BOOST_CHECK_EQUAL(disc->referencePosition(tgContext, b), disc->center(tgContext)); } } @@ -385,7 +387,7 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceBinningPosition) { auto disc = Acts::Surface::makeShared(trf, bounds); - Vector3 bp = disc->binningPosition(tgContext, BinningValue::binR); + Vector3 bp = disc->referencePosition(tgContext, AxisDirection::AxisR); double r = (bounds->rMax() + bounds->rMin()) / 2.0; double phi = bounds->get(AnnulusBounds::eAveragePhi); Vector3 exp = Vector3{r * std::cos(phi), r * std::sin(phi), 0}; @@ -393,14 +395,15 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceBinningPosition) { BOOST_CHECK_EQUAL(bp, exp); - bp = disc->binningPosition(tgContext, BinningValue::binPhi); + bp = disc->referencePosition(tgContext, AxisDirection::AxisPhi); BOOST_CHECK_EQUAL(bp, exp); - for (auto b : {BinningValue::binX, BinningValue::binY, BinningValue::binZ, - BinningValue::binEta, BinningValue::binRPhi, - BinningValue::binH, BinningValue::binMag}) { + for (auto b : + {AxisDirection::AxisX, AxisDirection::AxisY, AxisDirection::AxisZ, + AxisDirection::AxisEta, AxisDirection::AxisRPhi, + AxisDirection::AxisTheta, AxisDirection::AxisMag}) { BOOST_TEST_CONTEXT("binValue: " << b) { - BOOST_CHECK_EQUAL(disc->binningPosition(tgContext, b), + BOOST_CHECK_EQUAL(disc->referencePosition(tgContext, b), disc->center(tgContext)); } } @@ -430,12 +433,12 @@ BOOST_AUTO_TEST_CASE(IncompatibleBounds) { Surface::makeShared(base, 20_mm, 40_mm, 30_mm, 100_mm); BOOST_CHECK_THROW( - discRadial->mergedWith(*discTrap, BinningValue::binR, false, *logger), + discRadial->mergedWith(*discTrap, AxisDirection::AxisR, false, *logger), SurfaceMergingException); BOOST_CHECK_THROW( - discTrap2->mergedWith(*discTrap, BinningValue::binR, false, *logger), + discTrap2->mergedWith(*discTrap, AxisDirection::AxisR, false, *logger), SurfaceMergingException); } @@ -449,7 +452,7 @@ BOOST_AUTO_TEST_CASE(InvalidDetectorElement) { auto disc2 = Surface::makeShared(bounds2, detElem); BOOST_CHECK_THROW( - disc1->mergedWith(*disc2, BinningValue::binR, false, *logger), + disc1->mergedWith(*disc2, AxisDirection::AxisR, false, *logger), SurfaceMergingException); } @@ -470,50 +473,50 @@ BOOST_DATA_TEST_CASE(IncompatibleRDirection, // Disc with overlap in r auto discOverlap = makeDisc(base, 90_mm, 150_mm); - BOOST_CHECK_THROW( - disc->mergedWith(*discOverlap, Acts::BinningValue::binR, false, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(disc->mergedWith(*discOverlap, Acts::AxisDirection::AxisR, + false, *logger), + SurfaceMergingException); // Disc with gap in r auto discGap = makeDisc(base, 110_mm, 150_mm); BOOST_CHECK_THROW( - disc->mergedWith(*discGap, Acts::BinningValue::binR, false, *logger), + disc->mergedWith(*discGap, Acts::AxisDirection::AxisR, false, *logger), SurfaceMergingException); auto discShiftedZ = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 10_mm}, 100_mm, 150_mm); - BOOST_CHECK_THROW( - disc->mergedWith(*discShiftedZ, Acts::BinningValue::binR, false, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(disc->mergedWith(*discShiftedZ, Acts::AxisDirection::AxisR, + false, *logger), + SurfaceMergingException); auto discShiftedXy = makeDisc( base * Translation3{Vector3{1_mm, 2_mm, 200_mm}}, 100_mm, 150_mm); - BOOST_CHECK_THROW(disc->mergedWith(*discShiftedXy, Acts::BinningValue::binZ, + BOOST_CHECK_THROW(disc->mergedWith(*discShiftedXy, Acts::AxisDirection::AxisZ, false, *logger), SurfaceMergingException); auto discRotatedZ = makeDisc(base * AngleAxis3{10_degree, Vector3::UnitZ()}, 100_mm, 150_mm, 60_degree, 0_degree); - BOOST_CHECK_THROW( - disc->mergedWith(*discRotatedZ, Acts::BinningValue::binR, false, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(disc->mergedWith(*discRotatedZ, Acts::AxisDirection::AxisR, + false, *logger), + SurfaceMergingException); auto discRotatedX = makeDisc(base * AngleAxis3{10_degree, Vector3::UnitX()}, 100_mm, 150_mm); - BOOST_CHECK_THROW( - disc->mergedWith(*discRotatedX, Acts::BinningValue::binR, false, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(disc->mergedWith(*discRotatedX, Acts::AxisDirection::AxisR, + false, *logger), + SurfaceMergingException); // Test not same phi sector auto discPhi1 = makeDisc(base, 30_mm, 100_mm, 10_degree, 40_degree); auto discPhi2 = makeDisc(base, 100_mm, 160_mm, 20_degree, 40_degree); auto discPhi3 = makeDisc(base, 100_mm, 160_mm, 10_degree, 50_degree); BOOST_CHECK_THROW( - discPhi1->mergedWith(*discPhi2, BinningValue::binR, false, *logger), + discPhi1->mergedWith(*discPhi2, AxisDirection::AxisR, false, *logger), SurfaceMergingException); BOOST_CHECK_THROW( - discPhi1->mergedWith(*discPhi3, BinningValue::binR, false, *logger), + discPhi1->mergedWith(*discPhi3, AxisDirection::AxisR, false, *logger), SurfaceMergingException); } @@ -534,12 +537,12 @@ BOOST_DATA_TEST_CASE(RDirection, makeDisc(base * AngleAxis3(14_degree, Vector3::UnitZ()), 100_mm, 150_mm); auto [disc3, reversed] = - disc->mergedWith(*disc2, Acts::BinningValue::binR, false, *logger); + disc->mergedWith(*disc2, Acts::AxisDirection::AxisR, false, *logger); BOOST_REQUIRE_NE(disc3, nullptr); BOOST_CHECK(!reversed); auto [disc3Reversed, reversed2] = - disc2->mergedWith(*disc, Acts::BinningValue::binR, false, *logger); + disc2->mergedWith(*disc, Acts::AxisDirection::AxisR, false, *logger); BOOST_REQUIRE_NE(disc3Reversed, nullptr); BOOST_CHECK(disc3->bounds() == disc3Reversed->bounds()); BOOST_CHECK(reversed2); @@ -565,7 +568,7 @@ BOOST_DATA_TEST_CASE(RDirection, auto discPhi1 = makeDisc(base, 30_mm, 100_mm, 10_degree, 40_degree); auto discPhi2 = makeDisc(base, 100_mm, 160_mm, 10_degree, 40_degree); auto [discPhi12, reversedPhi12] = - discPhi1->mergedWith(*discPhi2, BinningValue::binR, false, *logger); + discPhi1->mergedWith(*discPhi2, AxisDirection::AxisR, false, *logger); BOOST_REQUIRE_NE(discPhi12, nullptr); const auto* boundsPhi12 = @@ -598,26 +601,26 @@ BOOST_DATA_TEST_CASE(IncompatiblePhiDirection, // Disc with overlap in phi auto discPhi2 = makeDisc(base, 30_mm, 100_mm, 45_degree, a(85_degree)); - BOOST_CHECK_THROW(discPhi->mergedWith(*discPhi2, Acts::BinningValue::binPhi, + BOOST_CHECK_THROW(discPhi->mergedWith(*discPhi2, Acts::AxisDirection::AxisPhi, false, *logger), SurfaceMergingException); // Disc with gap in phi auto discPhi3 = makeDisc(base, 30_mm, 100_mm, 45_degree, a(105_degree)); - BOOST_CHECK_THROW(discPhi->mergedWith(*discPhi3, Acts::BinningValue::binPhi, + BOOST_CHECK_THROW(discPhi->mergedWith(*discPhi3, Acts::AxisDirection::AxisPhi, false, *logger), SurfaceMergingException); // Disc with a z shift auto discPhi4 = makeDisc(base * Translation3{Vector3::UnitZ() * 20_mm}, 30_mm, 100_mm, 45_degree, a(95_degree)); - BOOST_CHECK_THROW(discPhi->mergedWith(*discPhi4, Acts::BinningValue::binPhi, + BOOST_CHECK_THROW(discPhi->mergedWith(*discPhi4, Acts::AxisDirection::AxisPhi, false, *logger), SurfaceMergingException); // Disc with different r bounds: could be merged in r but not in phi auto discPhi5 = makeDisc(base, 100_mm, 150_mm, 45_degree, a(95_degree)); - BOOST_CHECK_THROW(discPhi->mergedWith(*discPhi5, Acts::BinningValue::binPhi, + BOOST_CHECK_THROW(discPhi->mergedWith(*discPhi5, Acts::AxisDirection::AxisPhi, false, *logger), SurfaceMergingException); } @@ -643,13 +646,13 @@ BOOST_DATA_TEST_CASE(PhiDirection, auto disc2 = makeDisc(base, 30_mm, 100_mm, 45_degree, a(95_degree)); auto [disc3, reversed] = - disc->mergedWith(*disc2, Acts::BinningValue::binPhi, false, *logger); + disc->mergedWith(*disc2, Acts::AxisDirection::AxisPhi, false, *logger); BOOST_REQUIRE_NE(disc3, nullptr); BOOST_CHECK_EQUAL(base.matrix(), disc3->transform(tgContext).matrix()); BOOST_CHECK(reversed); auto [disc3Reversed, reversed2] = - disc2->mergedWith(*disc, Acts::BinningValue::binPhi, false, *logger); + disc2->mergedWith(*disc, Acts::AxisDirection::AxisPhi, false, *logger); BOOST_REQUIRE_NE(disc3Reversed, nullptr); BOOST_CHECK(*disc3 == *disc3Reversed); BOOST_CHECK(!reversed2); @@ -667,13 +670,13 @@ BOOST_DATA_TEST_CASE(PhiDirection, auto disc4 = makeDisc(base, 30_mm, 100_mm, 20_degree, a(170_degree)); auto disc5 = makeDisc(base, 30_mm, 100_mm, 10_degree, a(-160_degree)); auto [disc45, reversed45] = - disc4->mergedWith(*disc5, Acts::BinningValue::binPhi, false, *logger); + disc4->mergedWith(*disc5, Acts::AxisDirection::AxisPhi, false, *logger); BOOST_REQUIRE_NE(disc45, nullptr); BOOST_CHECK_EQUAL(base.matrix(), disc45->transform(tgContext).matrix()); BOOST_CHECK(reversed45); auto [disc54, reversed54] = - disc5->mergedWith(*disc4, Acts::BinningValue::binPhi, false, *logger); + disc5->mergedWith(*disc4, Acts::AxisDirection::AxisPhi, false, *logger); BOOST_REQUIRE_NE(disc54, nullptr); BOOST_CHECK(!reversed54); @@ -693,14 +696,14 @@ BOOST_DATA_TEST_CASE(PhiDirection, auto disc7 = makeDisc(base, 30_mm, 100_mm, 90_degree, a(180_degree)); auto [disc67, reversed67] = - disc6->mergedWith(*disc7, Acts::BinningValue::binPhi, false, *logger); + disc6->mergedWith(*disc7, Acts::AxisDirection::AxisPhi, false, *logger); BOOST_REQUIRE_NE(disc67, nullptr); CHECK_CLOSE_OR_SMALL(disc67->transform(tgContext).matrix(), base.matrix(), 1e-6, 1e-10); BOOST_CHECK(!reversed67); auto [disc76, reversed76] = - disc7->mergedWith(*disc6, Acts::BinningValue::binPhi, false, *logger); + disc7->mergedWith(*disc6, Acts::AxisDirection::AxisPhi, false, *logger); BOOST_REQUIRE_NE(disc76, nullptr); // surfaces are not equal because bounds are not equal BOOST_CHECK(*disc76 != *disc67); @@ -729,7 +732,7 @@ BOOST_DATA_TEST_CASE(PhiDirection, auto disc2 = makeDisc(trf2, 30_mm, 100_mm, 45_degree, 0_degree); auto [disc3, reversed] = - disc->mergedWith(*disc2, Acts::BinningValue::binPhi, true, *logger); + disc->mergedWith(*disc2, Acts::AxisDirection::AxisPhi, true, *logger); BOOST_REQUIRE_NE(disc3, nullptr); Transform3 trfExpected12 = base * AngleAxis3(a(85_degree), Vector3::UnitZ()); @@ -738,7 +741,7 @@ BOOST_DATA_TEST_CASE(PhiDirection, BOOST_CHECK(reversed); auto [disc3Reversed, reversed2] = - disc2->mergedWith(*disc, Acts::BinningValue::binPhi, true, *logger); + disc2->mergedWith(*disc, Acts::AxisDirection::AxisPhi, true, *logger); BOOST_REQUIRE_NE(disc3Reversed, nullptr); BOOST_CHECK(*disc3 == *disc3Reversed); BOOST_CHECK(!reversed2); @@ -755,7 +758,7 @@ BOOST_DATA_TEST_CASE(PhiDirection, Transform3 trf5 = base * AngleAxis3(a(-160_degree), Vector3::UnitZ()); auto disc5 = makeDisc(trf5, 30_mm, 100_mm, 10_degree, 0_degree); auto [disc45, reversed45] = - disc4->mergedWith(*disc5, Acts::BinningValue::binPhi, true, *logger); + disc4->mergedWith(*disc5, Acts::AxisDirection::AxisPhi, true, *logger); BOOST_REQUIRE_NE(disc45, nullptr); Transform3 trfExpected45 = base * AngleAxis3(a(180_degree), Vector3::UnitZ()); @@ -764,7 +767,7 @@ BOOST_DATA_TEST_CASE(PhiDirection, BOOST_CHECK(reversed45); auto [disc54, reversed54] = - disc5->mergedWith(*disc4, Acts::BinningValue::binPhi, true, *logger); + disc5->mergedWith(*disc4, Acts::AxisDirection::AxisPhi, true, *logger); BOOST_REQUIRE_NE(disc54, nullptr); BOOST_CHECK(!reversed54); @@ -782,7 +785,7 @@ BOOST_DATA_TEST_CASE(PhiDirection, Transform3 trf7 = base * AngleAxis3(a(180_degree), Vector3::UnitZ()); auto disc7 = makeDisc(trf7, 30_mm, 100_mm, 90_degree, 0_degree); auto [disc67, reversed67] = - disc6->mergedWith(*disc7, Acts::BinningValue::binPhi, true, *logger); + disc6->mergedWith(*disc7, Acts::AxisDirection::AxisPhi, true, *logger); BOOST_REQUIRE_NE(disc67, nullptr); Transform3 trfExpected67 = base * AngleAxis3(a(90_degree), Vector3::UnitZ()); @@ -791,7 +794,7 @@ BOOST_DATA_TEST_CASE(PhiDirection, BOOST_CHECK(!reversed67); auto [disc76, reversed76] = - disc7->mergedWith(*disc6, Acts::BinningValue::binPhi, true, *logger); + disc7->mergedWith(*disc6, Acts::AxisDirection::AxisPhi, true, *logger); BOOST_REQUIRE_NE(disc76, nullptr); // surfaces are not equal due to different transforms BOOST_CHECK(*disc76 != *disc67); diff --git a/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp index 0721039acef..b1e4e3d9a93 100644 --- a/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp @@ -92,13 +92,14 @@ BOOST_AUTO_TEST_CASE(LineSurface_Constructors_test) { /// Unit tests of all named methods BOOST_AUTO_TEST_CASE(LineSurface_allNamedMethods_test) { - // binningPosition() + // referencePosition() Translation3 translation{0., 1., 2.}; Transform3 transform(translation); LineSurfaceStub line(transform, 2., 20.); Vector3 referencePosition{0., 1., 2.}; CHECK_CLOSE_ABS(referencePosition, - line.binningPosition(tgContext, BinningValue::binX), 1e-6); + line.referencePosition(tgContext, AxisDirection::AxisX), + 1e-6); // bounds() auto pLineBounds = std::make_shared(2., 10.); diff --git a/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp index b62517f3e2c..6c09e65ab65 100644 --- a/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp @@ -97,11 +97,11 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceProperties) { /// Test type (redundant) BOOST_CHECK_EQUAL(planeSurfaceObject->type(), Surface::Plane); - /// Test binningPosition - Vector3 binningPosition{0., 1., 2.}; + /// Test referencePosition + Vector3 referencePosition{0., 1., 2.}; BOOST_CHECK_EQUAL( - planeSurfaceObject->binningPosition(tgContext, BinningValue::binX), - binningPosition); + planeSurfaceObject->referencePosition(tgContext, AxisDirection::AxisX), + referencePosition); /// Test referenceFrame Vector3 arbitraryGlobalPosition{2., 2., 2.}; @@ -246,21 +246,21 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceExtent) { auto planeExtent = plane->polyhedronRepresentation(tgContext, 1).extent(); - CHECK_CLOSE_ABS(planeExtent.min(BinningValue::binZ), -rHx, + CHECK_CLOSE_ABS(planeExtent.min(AxisDirection::AxisZ), -rHx, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.max(BinningValue::binZ), rHx, + CHECK_CLOSE_ABS(planeExtent.max(AxisDirection::AxisZ), rHx, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.min(BinningValue::binX), -rHy, + CHECK_CLOSE_ABS(planeExtent.min(AxisDirection::AxisX), -rHy, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.max(BinningValue::binX), rHy, + CHECK_CLOSE_ABS(planeExtent.max(AxisDirection::AxisX), rHy, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.min(BinningValue::binY), yPs, + CHECK_CLOSE_ABS(planeExtent.min(AxisDirection::AxisY), yPs, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.max(BinningValue::binY), yPs, + CHECK_CLOSE_ABS(planeExtent.max(AxisDirection::AxisY), yPs, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.min(BinningValue::binR), yPs, + CHECK_CLOSE_ABS(planeExtent.min(AxisDirection::AxisR), yPs, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.max(BinningValue::binR), std::hypot(yPs, rHy), + CHECK_CLOSE_ABS(planeExtent.max(AxisDirection::AxisR), std::hypot(yPs, rHy), s_onSurfaceTolerance); // Now rotate @@ -272,20 +272,20 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceExtent) { auto planeExtentRot = planeRot->polyhedronRepresentation(tgContext, 1).extent(); - CHECK_CLOSE_ABS(planeExtentRot.min(BinningValue::binZ), -rHx, + CHECK_CLOSE_ABS(planeExtentRot.min(AxisDirection::AxisZ), -rHx, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.max(BinningValue::binZ), rHx, + CHECK_CLOSE_ABS(planeExtentRot.max(AxisDirection::AxisZ), rHx, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.min(BinningValue::binX), + CHECK_CLOSE_ABS(planeExtentRot.min(AxisDirection::AxisX), -rHy * std::cos(alpha), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.max(BinningValue::binX), rHy * std::cos(alpha), - s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.min(BinningValue::binY), + CHECK_CLOSE_ABS(planeExtentRot.max(AxisDirection::AxisX), + rHy * std::cos(alpha), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtentRot.min(AxisDirection::AxisY), yPs - rHy * std::sin(alpha), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.max(BinningValue::binY), + CHECK_CLOSE_ABS(planeExtentRot.max(AxisDirection::AxisY), yPs + rHy * std::sin(alpha), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.min(BinningValue::binR), yPs * std::cos(alpha), - s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtentRot.min(AxisDirection::AxisR), + yPs * std::cos(alpha), s_onSurfaceTolerance); } BOOST_AUTO_TEST_CASE(RotatedTrapezoid) { diff --git a/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp b/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp index 8029a53426b..fc8a865f813 100644 --- a/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp @@ -70,14 +70,14 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { auto oneConePh = oneCone->polyhedronRepresentation(tgContext, segments); const auto extent = oneConePh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0_mm, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0_mm, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hzPos, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 0_mm, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0_mm, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), hzPos, epsAbs); const unsigned int expectedFaces = 4 * segments; BOOST_CHECK_EQUAL(oneConePh.faces.size(), expectedFaces); @@ -97,14 +97,14 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { oneConePiece->polyhedronRepresentation(tgContext, segments); const auto extent = oneConePiecePh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), rMin, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), hzpMin, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hzPos, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), rMin, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), hzpMin, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), hzPos, epsAbs); const unsigned int expectedFaces = 4 * segments; BOOST_CHECK_EQUAL(oneConePiecePh.faces.size(), expectedFaces); @@ -119,14 +119,14 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { auto twoConesPh = twoCones->polyhedronRepresentation(tgContext, segments); const auto extent = twoConesPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0_mm, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), hzNeg, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hzPos, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 0_mm, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), hzNeg, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), hzPos, epsAbs); const unsigned int expectedFaces = 2 * segments * 4; const unsigned int expectedVertices = 2 * (4 * segments + 1) + 1; @@ -147,16 +147,16 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { sectoralCones->polyhedronRepresentation(tgContext, segments); const auto extent = sectoralConesPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), 0, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), 0, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -rMax * std::sin(phiSector), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), rMax * std::sin(phiSector), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0_mm, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), hzNeg, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hzPos, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 0_mm, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), rMax, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), hzNeg, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), hzPos, epsAbs); // Segment numbers are further checked with the VertexHelper checks } @@ -185,14 +185,14 @@ BOOST_AUTO_TEST_CASE(CylinderSurfacePolyhedrons) { fullCylinder->polyhedronRepresentation(tgContext, segments); const auto extent = fullCylinderPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -r, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -r, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), -hZ, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hZ, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -r, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), r, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -r, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), r, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), r, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), r, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), -hZ, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), hZ, epsAbs); const unsigned int expectedFaces = 4 * segments; const unsigned int expectedVertices = (4 * segments + 1) * 2; @@ -211,17 +211,17 @@ BOOST_AUTO_TEST_CASE(CylinderSurfacePolyhedrons) { centerSectoredCylinder->polyhedronRepresentation(tgContext, segments); const auto extent = centerSectoredCylinderPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), r * std::cos(phiSector), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), r, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -r * std::sin(phiSector), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), r * std::sin(phiSector), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), -hZ, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hZ, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), r, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), r, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), -hZ, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), hZ, epsAbs); } } } @@ -247,14 +247,16 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { auto fullDiscPh = fullDisc->polyhedronRepresentation(tgContext, segments); const auto extent = fullDiscPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -outerR, + epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -outerR, + epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); const unsigned int expectedFaces = 1; // Segments + overlap + center @@ -270,14 +272,16 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { auto radialPh = radialDisc->polyhedronRepresentation(tgContext, segments); const auto extent = radialPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), innerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -outerR, + epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -outerR, + epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), innerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); } /// Sectoral disc - around 0. @@ -287,16 +291,16 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { auto sectorPh = sectorDisc->polyhedronRepresentation(tgContext, segments); const auto extent = sectorPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -outerR * std::sin(phiSector), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), outerR * std::sin(phiSector), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); } /// Sectoral ring - around 0. @@ -309,17 +313,17 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { sectorRingDisc->polyhedronRepresentation(tgContext, segments); const auto extent = sectorRingDiscPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), innerR * std::cos(phiSector), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -outerR * std::sin(phiSector), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), outerR * std::sin(phiSector), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), innerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), innerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); } /// Trapezoid for a disc @@ -335,19 +339,20 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { trapezoidDiscSf->polyhedronRepresentation(tgContext, segments); const auto extent = trapezoidDiscSfPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -std::abs(outerR - innerR) / 2., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), std::abs(outerR - innerR) / 2., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -halfXmax, + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -halfXmax, + epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), halfXmax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), halfXmax, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), std::hypot(std::abs(outerR - innerR) / 2., halfXmax), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); } /// AnnulusBounds for a disc @@ -364,12 +369,12 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { auto annulusDiscPh = annulusDisc->polyhedronRepresentation(tgContext, segments); const auto extent = annulusDiscPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), minRadius, + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), minRadius, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), maxRadius, + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), maxRadius, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); } } } @@ -396,15 +401,15 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { rectangularPlane->polyhedronRepresentation(tgContext, segments); const auto extent = rectangularPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -rhX, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), rhX, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -rhY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), rhY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -rhX, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), rhX, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -rhY, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), rhY, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), std::hypot(rhX, rhY), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); BOOST_CHECK_EQUAL(rectangularPh.vertices.size(), 4); BOOST_CHECK_EQUAL(rectangularPh.faces.size(), 1); @@ -426,17 +431,17 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { trapezoidalPlane->polyhedronRepresentation(tgContext, segments); const auto extent = trapezoidalPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -std::max(thX1, thX2), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), std::max(thX1, thX2), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -thY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), thY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -thY, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), thY, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), std::hypot(std::max(thX1, thX2), thY), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); BOOST_CHECK_EQUAL(trapezoidalPh.vertices.size(), 4); BOOST_CHECK_EQUAL(trapezoidalPh.faces.size(), 1); @@ -459,16 +464,16 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { ellipsoidPlane->polyhedronRepresentation(tgContext, segments); const auto extent = ellipsoidPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -rMaxX, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), rMaxX, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -rMaxY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), rMaxY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -rMaxX, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), rMaxX, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -rMaxY, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), rMaxY, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), std::min(rMinX, rMinY), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), std::max(rMaxX, rMaxY), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); } { @@ -484,16 +489,16 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { ellipsoidRingPlane->polyhedronRepresentation(tgContext, segments); const auto extent = ellipsoidRingPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -rMaxX, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), rMaxX, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -rMaxY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), rMaxY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -rMaxX, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), rMaxX, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -rMaxY, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), rMaxY, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), std::min(rMinX, rMinY), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), std::max(rMaxX, rMaxY), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); } /// ConvexPolygonBounds test @@ -509,15 +514,15 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { hexagonPlane->polyhedronRepresentation(tgContext, segments); const auto extent = hexagonPlanePh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -40, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), 30, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -30, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), 50, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), std::sqrt(2900), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -40, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), 30, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -30, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), 50, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 0, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), std::sqrt(2900), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); } /// Diamond shaped plane @@ -535,15 +540,15 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { diamondPlane->polyhedronRepresentation(tgContext, segments); const auto extent = diamondPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -hMedX, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), hMedX, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -hMinY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), hMaxY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -hMedX, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), hMedX, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -hMinY, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), hMaxY, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), std::hypot(hMaxX, hMaxY), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); BOOST_CHECK_EQUAL(diamondPh.vertices.size(), 6); BOOST_CHECK_EQUAL(diamondPh.faces.size(), 1); @@ -578,17 +583,17 @@ BOOST_AUTO_TEST_CASE(ShiftedSurfacePolyhedrons) { rectangularPlane->polyhedronRepresentation(tgContext, segments); const auto extent = rectangularPh.extent(); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), -rhX, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), rhX, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -rhY + shiftY, + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).min(), -rhX, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisX).max(), rhX, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).min(), -rhY + shiftY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), rhY + shiftY, + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisY).max(), rhY + shiftY, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 25, epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).min(), 25, epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisR).max(), std::hypot(rhX, rhY + shiftY), epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(AxisDirection::AxisZ).max(), 0., epsAbs); BOOST_CHECK_EQUAL(rectangularPh.vertices.size(), 4); BOOST_CHECK_EQUAL(rectangularPh.faces.size(), 1); diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceArrayTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceArrayTests.cpp index 732e7d9ff6a..bf2474d3101 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceArrayTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceArrayTests.cpp @@ -16,7 +16,7 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceArray.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Helpers.hpp" @@ -208,7 +208,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArray_create, SurfaceArrayFixture) { sa.toStream(tgContext, std::cout); for (const auto& srf : brl) { - Vector3 ctr = srf->binningPosition(tgContext, BinningValue::binR); + Vector3 ctr = srf->referencePosition(tgContext, AxisDirection::AxisR); std::vector binContent = sa.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 1u); @@ -228,7 +228,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArray_create, SurfaceArrayFixture) { SurfaceArray sa2(std::move(sl2), brl); sa.toStream(tgContext, std::cout); for (const auto& srf : brl) { - Vector3 ctr = srf->binningPosition(tgContext, BinningValue::binR); + Vector3 ctr = srf->referencePosition(tgContext, AxisDirection::AxisR); std::vector binContent = sa2.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 1u); diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp b/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp index 647372e124c..4815420aa1c 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp @@ -76,8 +76,8 @@ class SurfaceStub : public RegularSurface { } /// Inherited from GeometryObject base - Vector3 binningPosition(const GeometryContext& /*txt*/, - BinningValue /*bValue*/) const final { + Vector3 referencePosition(const GeometryContext& /*txt*/, + AxisDirection /*bValue*/) const final { const Vector3 v{0., 0., 0.}; return v; } diff --git a/Tests/UnitTests/Core/TrackFinding/TrackParamsLookupAccumulatorTests.cpp b/Tests/UnitTests/Core/TrackFinding/TrackParamsLookupAccumulatorTests.cpp index 358753810db..af442f428d9 100644 --- a/Tests/UnitTests/Core/TrackFinding/TrackParamsLookupAccumulatorTests.cpp +++ b/Tests/UnitTests/Core/TrackFinding/TrackParamsLookupAccumulatorTests.cpp @@ -19,7 +19,7 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/TrackFinding/TrackParamsLookupAccumulator.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/GridAxisGenerators.hpp" diff --git a/Tests/UnitTests/Core/Utilities/AxesTests.cpp b/Tests/UnitTests/Core/Utilities/AxesTests.cpp index 5c849e777ba..c777b763630 100644 --- a/Tests/UnitTests/Core/Utilities/AxesTests.cpp +++ b/Tests/UnitTests/Core/Utilities/AxesTests.cpp @@ -10,7 +10,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include #include @@ -271,6 +271,8 @@ BOOST_AUTO_TEST_CASE(neighborhood) { bins_t({8, 9, 10, 1, 2})); BOOST_CHECK(a4.neighborHoodIndices(5, 2).collect() == bins_t({3, 4, 5, 6, 7})); + BOOST_CHECK(a4.neighborHoodIndices(3, 2).collect() == + bins_t({1, 2, 3, 4, 5})); Axis a5( {0.0, 2.0, 4.0, 9.0, 9.5, 10.0}); @@ -442,6 +444,152 @@ BOOST_AUTO_TEST_CASE(AxisVisit) { std::vector edges = varClosed.visit([](const auto& axis) { return axis.getBinEdges(); }); BOOST_CHECK_EQUAL(edges.size(), varClosed.getBinEdges().size()); + + // Test return values from visit method with type-dependent values + int typeValue = eqOpen.visit([](const auto& axis) { + if constexpr (std::is_same_v, + Axis>) { + return 1; + } else if constexpr (std::is_same_v, + Axis>) { + return 2; + } else if constexpr (std::is_same_v, + Axis>) { + return 3; + } else if constexpr (std::is_same_v, + Axis>) { + return 4; + } else if constexpr (std::is_same_v, + Axis>) { + return 5; + } else { + return 6; // Variable, Closed + } + }); + BOOST_CHECK_EQUAL(typeValue, 1); // Should be Equidistant, Open + + typeValue = eqBound.visit([](const auto& axis) { + if constexpr (std::is_same_v, + Axis>) { + return 1; + } else if constexpr (std::is_same_v, + Axis>) { + return 2; + } else if constexpr (std::is_same_v, + Axis>) { + return 3; + } else if constexpr (std::is_same_v, + Axis>) { + return 4; + } else if constexpr (std::is_same_v, + Axis>) { + return 5; + } else { + return 6; // Variable, Closed + } + }); + BOOST_CHECK_EQUAL(typeValue, 2); // Should be Equidistant, Bound + + typeValue = eqClosed.visit([](const auto& axis) { + if constexpr (std::is_same_v, + Axis>) { + return 1; + } else if constexpr (std::is_same_v, + Axis>) { + return 2; + } else if constexpr (std::is_same_v, + Axis>) { + return 3; + } else if constexpr (std::is_same_v, + Axis>) { + return 4; + } else if constexpr (std::is_same_v, + Axis>) { + return 5; + } else { + return 6; // Variable, Closed + } + }); + BOOST_CHECK_EQUAL(typeValue, 3); // Should be Equidistant, Closed + + typeValue = varOpen.visit([](const auto& axis) { + if constexpr (std::is_same_v, + Axis>) { + return 1; + } else if constexpr (std::is_same_v, + Axis>) { + return 2; + } else if constexpr (std::is_same_v, + Axis>) { + return 3; + } else if constexpr (std::is_same_v, + Axis>) { + return 4; + } else if constexpr (std::is_same_v, + Axis>) { + return 5; + } else { + return 6; // Variable, Closed + } + }); + BOOST_CHECK_EQUAL(typeValue, 4); // Should be Variable, Open + + typeValue = varBound.visit([](const auto& axis) { + if constexpr (std::is_same_v, + Axis>) { + return 1; + } else if constexpr (std::is_same_v, + Axis>) { + return 2; + } else if constexpr (std::is_same_v, + Axis>) { + return 3; + } else if constexpr (std::is_same_v, + Axis>) { + return 4; + } else if constexpr (std::is_same_v, + Axis>) { + return 5; + } else { + return 6; // Variable, Closed + } + }); + BOOST_CHECK_EQUAL(typeValue, 5); // Should be Variable, Bound + + typeValue = varClosed.visit([](const auto& axis) { + if constexpr (std::is_same_v, + Axis>) { + return 1; + } else if constexpr (std::is_same_v, + Axis>) { + return 2; + } else if constexpr (std::is_same_v, + Axis>) { + return 3; + } else if constexpr (std::is_same_v, + Axis>) { + return 4; + } else if constexpr (std::is_same_v, + Axis>) { + return 5; + } else { + return 6; // Variable, Closed + } + }); + BOOST_CHECK_EQUAL(typeValue, 6); // Should be Variable, Closed + + // Test return value using axis properties + double minValue = + eqOpen.visit([](const auto& axis) { return axis.getMin(); }); + BOOST_CHECK_EQUAL(minValue, 0.0); + + double maxValue = + eqBound.visit([](const auto& axis) { return axis.getMax(); }); + BOOST_CHECK_EQUAL(maxValue, 10.0); + + std::size_t nBins = + varClosed.visit([](const auto& axis) { return axis.getNBins(); }); + BOOST_CHECK_EQUAL(nBins, 4u); } BOOST_AUTO_TEST_CASE(Output) { diff --git a/Tests/UnitTests/Core/Utilities/BinAdjustmentTests.cpp b/Tests/UnitTests/Core/Utilities/BinAdjustmentTests.cpp index 1db5ee9ccfe..ecf8d4ca457 100644 --- a/Tests/UnitTests/Core/Utilities/BinAdjustmentTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinAdjustmentTests.cpp @@ -28,8 +28,8 @@ namespace Acts::Test { BOOST_AUTO_TEST_CASE(BinAdjustment_Radial) { RadialBounds bound(50, 75, std::numbers::pi, 0); BinUtility bu; - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binR); - bu += BinUtility(1, 0, 1, Acts::closed, Acts::BinningValue::binPhi); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisR); + bu += BinUtility(1, 0, 1, Acts::closed, Acts::AxisDirection::AxisPhi); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); @@ -43,8 +43,8 @@ BOOST_AUTO_TEST_CASE(BinAdjustment_Radial) { BOOST_AUTO_TEST_CASE(BinAdjustment_Cylinder) { CylinderBounds bound(25, 50, std::numbers::pi / 4, 0); BinUtility bu; - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binPhi); - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binZ); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisPhi); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); @@ -60,8 +60,8 @@ BOOST_AUTO_TEST_CASE(BinAdjustment_Cylinder) { BOOST_AUTO_TEST_CASE(BinAdjustment_Rectangle) { RectangleBounds bound(20, 30); BinUtility bu; - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binX); - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binY); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisX); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisY); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); @@ -75,8 +75,8 @@ BOOST_AUTO_TEST_CASE(BinAdjustment_Rectangle) { BOOST_AUTO_TEST_CASE(BinAdjustment_Trapezoid) { TrapezoidBounds bound(5, 15, 30); BinUtility bu; - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binX); - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binY); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisX); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisY); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); diff --git a/Tests/UnitTests/Core/Utilities/BinAdjustmentVolumeTests.cpp b/Tests/UnitTests/Core/Utilities/BinAdjustmentVolumeTests.cpp index 1b91120dd7f..2d6aa35e867 100644 --- a/Tests/UnitTests/Core/Utilities/BinAdjustmentVolumeTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinAdjustmentVolumeTests.cpp @@ -27,9 +27,9 @@ namespace Acts::Test { BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_Cylinder) { CylinderVolumeBounds bound(10, 50, 150, std::numbers::pi / 2., 0); BinUtility bu; - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binR); - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binPhi); - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binZ); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisR); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisPhi); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); @@ -47,9 +47,9 @@ BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_Cylinder) { BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_CutoutCylinder) { CutoutCylinderVolumeBounds bound(10, 20, 50, 100, 15); BinUtility bu; - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binR); - bu += BinUtility(1, 0, 1, Acts::closed, Acts::BinningValue::binPhi); - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binZ); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisR); + bu += BinUtility(1, 0, 1, Acts::closed, Acts::AxisDirection::AxisPhi); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); @@ -65,9 +65,9 @@ BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_CutoutCylinder) { BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_Cuboid) { CuboidVolumeBounds bound(13, 23, 42); BinUtility bu; - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binX); - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binY); - bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binZ); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisX); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisY); + bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); diff --git a/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp b/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp index b44d939831f..ab38d7bd78a 100644 --- a/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp @@ -27,12 +27,12 @@ BOOST_AUTO_TEST_CASE(BinUtility_equidistant_binning) { Vector3 edgePosition(0.5, 0.5, 0.5); // | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | - BinUtility xUtil_eq(10, 0., 10., open, BinningValue::binX); - BinUtility yUtil_eq(10, 0., 10., open, BinningValue::binY); - BinUtility zUtil_eq(10, 0., 10., open, BinningValue::binZ); + BinUtility xUtil_eq(10, 0., 10., open, AxisDirection::AxisX); + BinUtility yUtil_eq(10, 0., 10., open, AxisDirection::AxisY); + BinUtility zUtil_eq(10, 0., 10., open, AxisDirection::AxisZ); BOOST_CHECK_EQUAL(xUtil_eq.bins(), std::size_t{10}); // make it 2-dim - BinUtility xyUtil_eq(10, 0., 10., open, BinningValue::binX); + BinUtility xyUtil_eq(10, 0., 10., open, AxisDirection::AxisX); xyUtil_eq += yUtil_eq; BOOST_CHECK_EQUAL(xyUtil_eq.bins(), 100u); // make it 3-dim @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(BinUtility_equidistant_binning) { BOOST_CHECK_EQUAL(xyzUtil_eq.dimensions(), 3u); // check equality operator - BinUtility xUtil_eq_copy(10, 0., 10., open, BinningValue::binX); + BinUtility xUtil_eq_copy(10, 0., 10., open, AxisDirection::AxisX); BOOST_CHECK_EQUAL(xUtil_eq_copy, xUtil_eq); BOOST_CHECK_NE(yUtil_eq, xUtil_eq); @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(BinUtility_equidistant_binning) { // OPEN - equidistant binning tests BOOST_AUTO_TEST_CASE(BinUtility_arbitrary_binning) { std::vector bvalues = {-5., 0., 1., 1.1, 8.}; - BinUtility xUtil(bvalues, Acts::open, Acts::BinningValue::binX); + BinUtility xUtil(bvalues, Acts::open, Acts::AxisDirection::AxisX); // Underflow BOOST_CHECK_EQUAL(xUtil.bin(Vector3(-6., 0., 0.)), 0u); @@ -95,10 +95,10 @@ BOOST_AUTO_TEST_CASE(BinUtility_transform) { Transform3 transform_GtoL = transform_LtoG.inverse(); - BinUtility rUtil(10, 0., 100., open, BinningValue::binR); + BinUtility rUtil(10, 0., 100., open, AxisDirection::AxisR); BinUtility phiUtil(10, -std::numbers::pi, std::numbers::pi, closed, - BinningValue::binPhi); - BinUtility zUtil(10, -100., 100., open, BinningValue::binZ); + AxisDirection::AxisPhi); + BinUtility zUtil(10, -100., 100., open, AxisDirection::AxisZ); BinUtility noTranform; noTranform += rUtil; diff --git a/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp b/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp index 95de3899f92..ff99a53f709 100644 --- a/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp @@ -37,36 +37,36 @@ Vector2 rphiPosition(3.5, std::numbers::pi / 8.); // x/y/zData // bin boundaries // | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -BinningData xData_eq(open, BinningValue::binX, 10, 0., 10.); -BinningData yData_eq(open, BinningValue::binY, 10, 0., 10.); -BinningData zData_eq(open, BinningValue::binZ, 10, 0., 10.); +BinningData xData_eq(open, AxisDirection::AxisX, 10, 0., 10.); +BinningData yData_eq(open, AxisDirection::AxisY, 10, 0., 10.); +BinningData zData_eq(open, AxisDirection::AxisZ, 10, 0., 10.); // r/phi/rphiData // bin boundaries // | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -BinningData rData_eq(open, BinningValue::binR, 10, 0., 10.); +BinningData rData_eq(open, AxisDirection::AxisR, 10, 0., 10.); // bin boundaries // > -PI | -3/5 PI | -1/5 PI | 1/5 PI | 3/5 PI | PI < -BinningData phiData_eq(closed, BinningValue::binPhi, 5, -std::numbers::pi, +BinningData phiData_eq(closed, AxisDirection::AxisPhi, 5, -std::numbers::pi, std::numbers::pi); -// BinningData rPhiData_eq(closed, BinningValue::binRPhi, 5, -std::numbers::pi, -// std::numbers::pi); h/etaData bin boundaries | 0 | 2 | 4 | 6 | 8 | 10 | -// BinningData hData_eq(open, BinningValue::binH, 5, 0., 10.); -// | -2.5 | -1.5 | -0.5 | 0.5 | 1.5 | 2.5 | -BinningData etaData_eq(open, BinningValue::binEta, 5, -2.5, 2.5); +// BinningData rPhiData_eq(closed, AxisDirection::AxisRPhi, 5, +// -std::numbers::pi, std::numbers::pi); h/etaData bin boundaries | 0 | 2 | 4 | +// 6 | 8 | 10 | BinningData hData_eq(open, AxisDirection::AxisTheta, 5, +// 0., 10.); | -2.5 | -1.5 | -0.5 | 0.5 | 1.5 | 2.5 | +BinningData etaData_eq(open, AxisDirection::AxisEta, 5, -2.5, 2.5); // Fest equality operator -BinningData xData_eq_copy(open, BinningValue::binX, 10, 0., 10.); +BinningData xData_eq_copy(open, AxisDirection::AxisX, 10, 0., 10.); // the binnings - arbitrary std::vector values = {0., 1., 2., 3., 4., 10.}; // bin boundaries // | 0 | 1 | 2 | 3 | 4 | 10 | -BinningData xData_arb(open, BinningValue::binX, values); -BinningData yData_arb(open, BinningValue::binY, values); +BinningData xData_arb(open, AxisDirection::AxisX, values); +BinningData yData_arb(open, AxisDirection::AxisY, values); // | -PI | -2 | -1 | 1 | 2 | PI | std::vector phiValues = {-std::numbers::pi, -2., -1., 1., 2., std::numbers::pi}; -BinningData phiData_arb(closed, BinningValue::binPhi, phiValues); +BinningData phiData_arb(closed, AxisDirection::AxisPhi, phiValues); // the binnings - arbitrary when switching to binary search - for boundary // sizes >= 50 @@ -80,24 +80,24 @@ double phiDelta = 0.1064; std::vector sstr = {0., 1., 1.5, 2., 3.}; // multiplicative auto xData_sstr_mult = - std::make_unique(open, BinningValue::binX, sstr); + std::make_unique(open, AxisDirection::AxisX, sstr); // | 0 | 1 | 1.5 | 2 | 3 | 4 | 4.5 | 5 | 6 | 7 | 7.5 | 8 | 9 | -BinningData xData_mult(open, BinningValue::binX, 3, 0., 9., +BinningData xData_mult(open, AxisDirection::AxisX, 3, 0., 9., std::move(xData_sstr_mult)); /// additive // | 0 | 1 | 1.5 | 2 | 3 | 4 | 5 | std::vector main_sstr = {0., 3., 4., 5.}; auto xData_sstr_add = - std::make_unique(open, BinningValue::binX, sstr); -BinningData xData_add(open, BinningValue::binX, main_sstr, + std::make_unique(open, AxisDirection::AxisX, sstr); +BinningData xData_add(open, AxisDirection::AxisX, main_sstr, std::move(xData_sstr_add)); -// enum BinningValue { BinningValue::binX, BinningValue::binY, -// BinningValue::binZ, BinningValue::binR, BinningValue::binPhi, -// BinningValue::binRPhi, BinningValue::binH, BinningValue::binEta } +// enum AxisDirection { AxisDirection::AxisX, AxisDirection::AxisY, +// AxisDirection::AxisZ, AxisDirection::AxisR, AxisDirection::AxisPhi, +// AxisDirection::AxisRPhi, AxisDirection::AxisTheta, AxisDirection::AxisEta } // // test the different binning values -BOOST_AUTO_TEST_CASE(BinningData_BinningValue) { +BOOST_AUTO_TEST_CASE(BinningData_AxisDirection) { // the binnings - arbitrary when switching to binary search - for boundary // sizes >= 50 std::vector values_binary; @@ -107,8 +107,8 @@ BOOST_AUTO_TEST_CASE(BinningData_BinningValue) { phiValues_binary.push_back(phiMin + i * phiDelta); } // bin boundaries when switching to binary search - for boundary sizes >= 50 - BinningData xData_arb_binary(open, BinningValue::binX, values_binary); - BinningData phiData_arb_binary(closed, BinningValue::binPhi, + BinningData xData_arb_binary(open, AxisDirection::AxisX, values_binary); + BinningData phiData_arb_binary(closed, AxisDirection::AxisPhi, phiValues_binary); /// x/y/zData /// check the global position requests @@ -170,8 +170,8 @@ BOOST_AUTO_TEST_CASE(BinningData_bins) { phiValues_binary.push_back(phiMin + i * phiDelta); } // bin boundaries when switching to binary search - for boundary sizes >= 50 - BinningData xData_arb_binary(open, BinningValue::binX, values_binary); - BinningData phiData_arb_binary(closed, BinningValue::binPhi, + BinningData xData_arb_binary(open, AxisDirection::AxisX, values_binary); + BinningData phiData_arb_binary(closed, AxisDirection::AxisPhi, phiValues_binary); /// x/y/zData /// check the global position requests @@ -239,8 +239,8 @@ BOOST_AUTO_TEST_CASE(BinningData_inside_outside) { phiValues_binary.push_back(phiMin + i * phiDelta); } // bin boundaries when switching to binary search - for boundary sizes >= 50 - BinningData xData_arb_binary(open, BinningValue::binX, values_binary); - BinningData phiData_arb_binary(closed, BinningValue::binPhi, + BinningData xData_arb_binary(open, AxisDirection::AxisX, values_binary); + BinningData phiData_arb_binary(closed, AxisDirection::AxisPhi, phiValues_binary); // check the global inside BOOST_CHECK_EQUAL(xData_eq.inside(xyzPosition), true); @@ -283,8 +283,8 @@ BOOST_AUTO_TEST_CASE(BinningData_open_close) { phiValues_binary.push_back(phiMin + i * phiDelta); } // bin boundaries when switching to binary search - for boundary sizes >= 50 - BinningData xData_arb_binary(open, BinningValue::binX, values_binary); - BinningData phiData_arb_binary(closed, BinningValue::binPhi, + BinningData xData_arb_binary(open, AxisDirection::AxisX, values_binary); + BinningData phiData_arb_binary(closed, AxisDirection::AxisPhi, phiValues_binary); // open values BOOST_CHECK_EQUAL(xData_eq.searchGlobal(xyzPositionOutside), std::size_t{9}); @@ -336,8 +336,8 @@ BOOST_AUTO_TEST_CASE(BinningData_bincenter) { phiValues_binary.push_back(phiMin + i * phiDelta); } // bin boundaries when switching to binary search - for boundary sizes >= 50 - BinningData xData_arb_binary(open, BinningValue::binX, values_binary); - BinningData phiData_arb_binary(closed, BinningValue::binPhi, + BinningData xData_arb_binary(open, AxisDirection::AxisX, values_binary); + BinningData phiData_arb_binary(closed, AxisDirection::AxisPhi, phiValues_binary); /// check the global position requests // | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | @@ -383,7 +383,7 @@ BOOST_AUTO_TEST_CASE(BinningData_phi_modules) { // n phi modules with phi boundary at -pi/+pi are checked above one module // expands over -pi/+pi const float deltaPhi = 0.1; - BinningData phiData_mod(closed, BinningValue::binPhi, 5, + BinningData phiData_mod(closed, AxisDirection::AxisPhi, 5, -std::numbers::pi + deltaPhi, std::numbers::pi + deltaPhi); diff --git a/Tests/UnitTests/Core/Utilities/GridAccessHelpersTests.cpp b/Tests/UnitTests/Core/Utilities/GridAccessHelpersTests.cpp index 5fbe3b1ffa4..cc310f7e37a 100644 --- a/Tests/UnitTests/Core/Utilities/GridAccessHelpersTests.cpp +++ b/Tests/UnitTests/Core/Utilities/GridAccessHelpersTests.cpp @@ -44,9 +44,9 @@ BOOST_AUTO_TEST_CASE(Grid1DAccess) { // Global access Vector3 gPosition{0.5, 3.5, 6.5}; - std::vector fCast = {Acts::BinningValue::binX}; - std::vector sCast = {Acts::BinningValue::binY}; - std::vector tCast = {Acts::BinningValue::binZ}; + std::vector fCast = {Acts::AxisDirection::AxisX}; + std::vector sCast = {Acts::AxisDirection::AxisY}; + std::vector tCast = {Acts::AxisDirection::AxisZ}; auto fgAccess = GridAccessHelpers::castPosition(gPosition, fCast); auto sgAccess = GridAccessHelpers::castPosition(gPosition, sCast); @@ -57,10 +57,10 @@ BOOST_AUTO_TEST_CASE(Grid1DAccess) { // Can this go into a delegate? auto gsu = std::make_unique< - const Acts::GridAccess::GlobalSubspace>(); + const Acts::GridAccess::GlobalSubspace>(); Acts::GridAccess::GlobalToGridLocal1DimDelegate gsuDelegate; gsuDelegate.connect< - &Acts::GridAccess::GlobalSubspace::toGridLocal>( + &Acts::GridAccess::GlobalSubspace::toGridLocal>( std::move(gsu)); BOOST_CHECK(gsuDelegate.connected()); @@ -88,26 +88,26 @@ BOOST_AUTO_TEST_CASE(Grid2DAccess) { // Global access Vector3 gPosition{0.5, 3.5, 6.5}; - std::vector fCast = {Acts::BinningValue::binX, - Acts::BinningValue::binY}; + std::vector fCast = {Acts::AxisDirection::AxisX, + Acts::AxisDirection::AxisY}; auto fgAccess = GridAccessHelpers::castPosition(gPosition, fCast); BOOST_CHECK_EQUAL(grid.atPosition(fgAccess), 300u); } BOOST_AUTO_TEST_CASE(GlobalToGridLocalTests) { - Acts::GridAccess::GlobalSubspace + Acts::GridAccess::GlobalSubspace gssXY; auto xy = gssXY.toGridLocal(Vector3{1., 2., 3.}); BOOST_CHECK_EQUAL(xy[0], 1.); BOOST_CHECK_EQUAL(xy[1], 2.); - Acts::GridAccess::GlobalSubspace gssZ; + Acts::GridAccess::GlobalSubspace gssZ; auto z = gssZ.toGridLocal(Vector3{1., 2., 3.}); BOOST_CHECK_EQUAL(z[0], 3.); Acts::GridAccess::Affine3Transformed< - Acts::GridAccess::GlobalSubspace> + Acts::GridAccess::GlobalSubspace> gssZT(gssZ, Acts::Transform3{Acts::Transform3::Identity()}.pretranslate( Vector3{0., 0., 100.})); diff --git a/Tests/UnitTests/Core/Utilities/GridAxisGeneratorsTests.cpp b/Tests/UnitTests/Core/Utilities/GridAxisGeneratorsTests.cpp index 4cfb0ea6088..5d865047d28 100644 --- a/Tests/UnitTests/Core/Utilities/GridAxisGeneratorsTests.cpp +++ b/Tests/UnitTests/Core/Utilities/GridAxisGeneratorsTests.cpp @@ -10,7 +10,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/GridAxisGenerators.hpp" diff --git a/Tests/UnitTests/Core/Utilities/GridIterationTests.cpp b/Tests/UnitTests/Core/Utilities/GridIterationTests.cpp index 82a92a4be4a..30698c02435 100644 --- a/Tests/UnitTests/Core/Utilities/GridIterationTests.cpp +++ b/Tests/UnitTests/Core/Utilities/GridIterationTests.cpp @@ -8,7 +8,7 @@ #include -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/GridIterator.hpp" diff --git a/Tests/UnitTests/Core/Utilities/GridTests.cpp b/Tests/UnitTests/Core/Utilities/GridTests.cpp index eceec2e6468..494c406bedc 100644 --- a/Tests/UnitTests/Core/Utilities/GridTests.cpp +++ b/Tests/UnitTests/Core/Utilities/GridTests.cpp @@ -11,7 +11,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/Axis.hpp" -#include "Acts/Utilities/AxisFwd.hpp" +#include "Acts/Utilities/AxisDefinitions.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/detail/grid_helper.hpp" diff --git a/Tests/UnitTests/Examples/Algorithms/Digitization/ModuleClustersTests.cpp b/Tests/UnitTests/Examples/Algorithms/Digitization/ModuleClustersTests.cpp index a1947cde17e..c2e41bd063c 100644 --- a/Tests/UnitTests/Examples/Algorithms/Digitization/ModuleClustersTests.cpp +++ b/Tests/UnitTests/Examples/Algorithms/Digitization/ModuleClustersTests.cpp @@ -8,6 +8,7 @@ #include +#include "Acts/Utilities/BinUtility.hpp" #include "Acts/Utilities/BinningData.hpp" #include "ActsExamples/Digitization/ModuleClusters.hpp" #include "ActsFatras/Digitization/Segmentizer.hpp" @@ -46,10 +47,10 @@ DigitizedParameters makeDigitizationParameters(const Vector2 &position, auto testDigitizedParametersWithTwoClusters(bool merge, const Vector2 &firstHit, const Vector2 &secondHit) { BinUtility binUtility; - binUtility += - BinningData(BinningOption::open, BinningValue::binX, 20, -10.0f, 10.0f); - binUtility += - BinningData(BinningOption::open, BinningValue::binY, 20, -10.0f, 10.0f); + binUtility += BinUtility(BinningData( + BinningOption::open, AxisDirection::AxisX, 20, -10.0f, 10.0f)); + binUtility += BinUtility(BinningData( + BinningOption::open, AxisDirection::AxisY, 20, -10.0f, 10.0f)); std::vector boundIndices = {eBoundLoc0, eBoundLoc1}; double nsigma = 1; bool commonCorner = true; diff --git a/Tests/UnitTests/Examples/Io/Json/JsonDigitizationConfigTests.cpp b/Tests/UnitTests/Examples/Io/Json/JsonDigitizationConfigTests.cpp index f7c1db0f496..dfa8978f17c 100644 --- a/Tests/UnitTests/Examples/Io/Json/JsonDigitizationConfigTests.cpp +++ b/Tests/UnitTests/Examples/Io/Json/JsonDigitizationConfigTests.cpp @@ -157,9 +157,9 @@ BOOST_AUTO_TEST_CASE(DigitizationConfigRoundTrip) { Acts::BinUtility segmentation; segmentation += - Acts::BinUtility(336, -8.4, 8.4, Acts::open, Acts::BinningValue::binX); + Acts::BinUtility(336, -8.4, 8.4, Acts::open, Acts::AxisDirection::AxisX); segmentation += - Acts::BinUtility(1280, -36, 36, Acts::open, Acts::BinningValue::binY); + Acts::BinUtility(1280, -36, 36, Acts::open, Acts::AxisDirection::AxisY); gdc.segmentation = segmentation; gdc.threshold = 0.01; diff --git a/Tests/UnitTests/Fatras/Digitization/ChannelizerTests.cpp b/Tests/UnitTests/Fatras/Digitization/ChannelizerTests.cpp index b1d142cc545..72443aa02c4 100644 --- a/Tests/UnitTests/Fatras/Digitization/ChannelizerTests.cpp +++ b/Tests/UnitTests/Fatras/Digitization/ChannelizerTests.cpp @@ -40,9 +40,9 @@ struct Helper { float max = 200_um; int bins = static_cast((max - min) / pitchSize); segmentation = Acts::BinUtility(bins, min, max, Acts::BinningOption::open, - Acts::BinningValue::binX); + Acts::AxisDirection::AxisX); segmentation += Acts::BinUtility(bins, min, max, Acts::BinningOption::open, - Acts::BinningValue::binY); + Acts::AxisDirection::AxisY); } auto channelize(const Acts::Vector3 &pos3, const Acts::Vector3 &dir3) const { diff --git a/Tests/UnitTests/Fatras/Digitization/PlanarSurfaceTestBeds.hpp b/Tests/UnitTests/Fatras/Digitization/PlanarSurfaceTestBeds.hpp index 42327d7e5eb..c7185dab920 100644 --- a/Tests/UnitTests/Fatras/Digitization/PlanarSurfaceTestBeds.hpp +++ b/Tests/UnitTests/Fatras/Digitization/PlanarSurfaceTestBeds.hpp @@ -54,9 +54,9 @@ struct PlanarSurfaceTestBeds { auto rSurface = Acts::Surface::makeShared( Acts::Transform3::Identity(), rectangle); Acts::BinUtility pixelated(15, -xhalf, xhalf, Acts::open, - Acts::BinningValue::binX); + Acts::AxisDirection::AxisX); pixelated += Acts::BinUtility(26, -yhalf, yhalf, Acts::open, - Acts::BinningValue::binY); + Acts::AxisDirection::AxisY); RectangleRandom rRandom(xhalf * rScale, yhalf * rScale); // Cartesian strip test in Trapezoid @@ -68,9 +68,9 @@ struct PlanarSurfaceTestBeds { auto tSurface = Acts::Surface::makeShared( Acts::Transform3::Identity(), trapezoid); Acts::BinUtility stripsX(35, -xhalfmaxy, xhalfmaxy, Acts::open, - Acts::BinningValue::binX); + Acts::AxisDirection::AxisX); stripsX += Acts::BinUtility(1, -yhalf, yhalf, Acts::open, - Acts::BinningValue::binY); + Acts::AxisDirection::AxisY); TrapezoidRandom tRandom(xhalfminy * rScale, xhalfmaxy * rScale, yhalf * rScale); @@ -87,10 +87,10 @@ struct PlanarSurfaceTestBeds { auto dtSurface = Acts::Surface::makeShared( Acts::Transform3::Identity(), discTrapezoid); Acts::BinUtility stripsPhi(1, rmin, rmax, Acts::open, - Acts::BinningValue::binR); + Acts::AxisDirection::AxisR); stripsPhi += Acts::BinUtility(25, std::numbers::pi / 2. - alpha, std::numbers::pi / 2. + alpha, Acts::open, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); TrapezoidRandom dtRandom(xmin * rScale, xmax * rScale, rmin * irScale, ymax * rScale); @@ -100,11 +100,11 @@ struct PlanarSurfaceTestBeds { auto dSurface = Acts::Surface::makeShared( Acts::Transform3::Identity(), discRadial); Acts::BinUtility rphiseg(10, rmin, rmax, Acts::open, - Acts::BinningValue::binR); + Acts::AxisDirection::AxisR); rphiseg += Acts::BinUtility(20, (std::numbers::pi / 2. - std::numbers::pi / 4.), (std::numbers::pi / 2. + std::numbers::pi / 4.), - Acts::open, Acts::BinningValue::binPhi); + Acts::open, Acts::AxisDirection::AxisPhi); DiscRandom dRandom( rmin * irScale, rmax * rScale, @@ -132,9 +132,9 @@ struct PlanarSurfaceTestBeds { }); Acts::BinUtility stripsPhiA(1, rmin, rmax, Acts::open, - Acts::BinningValue::binR); + Acts::AxisDirection::AxisR); stripsPhiA += Acts::BinUtility(12, phimin, phimax, Acts::open, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); AnnulusRandom aRandom(rmin * irScale, rmax * rScale, phimin * rScale, phimax * rScale, aorigin.x(), aorigin.y()); diff --git a/Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp b/Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp index ad74a9024d1..9afa5b0d938 100644 --- a/Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp +++ b/Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp @@ -47,9 +47,10 @@ BOOST_AUTO_TEST_CASE(SegmentizerCartesian) { Acts::Transform3::Identity(), rectangleBounds); // The segmentation - Acts::BinUtility pixelated(20, -1., 1., Acts::open, Acts::BinningValue::binX); + Acts::BinUtility pixelated(20, -1., 1., Acts::open, + Acts::AxisDirection::AxisX); pixelated += - Acts::BinUtility(20, -1., 1., Acts::open, Acts::BinningValue::binY); + Acts::BinUtility(20, -1., 1., Acts::open, Acts::AxisDirection::AxisY); Segmentizer cl; @@ -92,9 +93,9 @@ BOOST_AUTO_TEST_CASE(SegmentizerPolarRadial) { Acts::Transform3::Identity(), radialBounds); // The segmentation - Acts::BinUtility strips(2, 5., 10., Acts::open, Acts::BinningValue::binR); + Acts::BinUtility strips(2, 5., 10., Acts::open, Acts::AxisDirection::AxisR); strips += Acts::BinUtility(250, -0.25, 0.25, Acts::open, - Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisPhi); Segmentizer cl; @@ -169,8 +170,10 @@ BOOST_DATA_TEST_CASE( } // 1 - write the grid grid.open("Segmentizer" + name + "Grid.csv"); - if (segmentation.binningData()[0].binvalue == Acts::BinningValue::binX && - segmentation.binningData()[1].binvalue == Acts::BinningValue::binY) { + if (segmentation.binningData()[0].binvalue == + Acts::AxisDirection::AxisX && + segmentation.binningData()[1].binvalue == + Acts::AxisDirection::AxisY) { double bxmin = segmentation.binningData()[0].min; double bxmax = segmentation.binningData()[0].max; double bymin = segmentation.binningData()[1].min; @@ -184,9 +187,9 @@ BOOST_DATA_TEST_CASE( csvHelper.writeLine(grid, {bxmin, yval}, {bxmax, yval}); } } else if (segmentation.binningData()[0].binvalue == - Acts::BinningValue::binR && + Acts::AxisDirection::AxisR && segmentation.binningData()[1].binvalue == - Acts::BinningValue::binPhi) { + Acts::AxisDirection::AxisPhi) { double brmin = segmentation.binningData()[0].min; double brmax = segmentation.binningData()[0].max; double bphimin = segmentation.binningData()[1].min; diff --git a/Tests/UnitTests/Plugins/ActSVG/DetectorVolumeSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/DetectorVolumeSvgConverterTests.cpp index c1ed95854f8..b3ba0f4f5fc 100644 --- a/Tests/UnitTests/Plugins/ActSVG/DetectorVolumeSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/DetectorVolumeSvgConverterTests.cpp @@ -150,7 +150,7 @@ BOOST_AUTO_TEST_CASE(EndcapVolumeWithSurfaces) { lsConfig.auxiliary = "*** Endcap with 22 surfaces ***"; lsConfig.surfacesProvider = endcapSurfaces; lsConfig.binnings = {Acts::Experimental::ProtoBinning( - Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, + Acts::AxisDirection::AxisPhi, Acts::AxisBoundaryType::Closed, -std::numbers::pi, std::numbers::pi, 22u, 1u)}; auto layerBuilder = @@ -220,11 +220,11 @@ BOOST_AUTO_TEST_CASE(BarrelVolumeWithSurfaces) { lsConfig.auxiliary = "*** Barrel with 448 surfaces ***"; lsConfig.surfacesProvider = barrelSurfaces; lsConfig.binnings = { - Acts::Experimental::ProtoBinning{Acts::BinningValue::binZ, + Acts::Experimental::ProtoBinning{Acts::AxisDirection::AxisZ, Acts::AxisBoundaryType::Bound, -480., 480., 14u, 1u}, Acts::Experimental::ProtoBinning( - Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, + Acts::AxisDirection::AxisPhi, Acts::AxisBoundaryType::Closed, -std::numbers::pi, std::numbers::pi, 32u, 1u)}; auto barrelBuilder = diff --git a/Tests/UnitTests/Plugins/ActSVG/GridSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/GridSvgConverterTests.cpp index 2fc643b6a53..16e49c7356e 100644 --- a/Tests/UnitTests/Plugins/ActSVG/GridSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/GridSvgConverterTests.cpp @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(BoundGridXY) { Svg::GridConverter::Options cOptions; auto pGrid = Svg::GridConverter::convert( - gridXY, {BinningValue::binX, BinningValue::binY}, cOptions); + gridXY, {AxisDirection::AxisX, AxisDirection::AxisY}, cOptions); BOOST_CHECK_EQUAL(pGrid._type, actsvg::proto::grid::type::e_x_y); // Labelling the grid tiles @@ -110,8 +110,10 @@ BOOST_AUTO_TEST_CASE(BoundGridXY) { std::vector captionText = { "Binning schema for global and local bins: ", - "- axis 0 : AxisBoundaryType::Bound, (-200., 200, 4), BinningValue::binX", - "- axis 1 : AxisBoundaryType::Bound, (-200, 200, 6), BinningValue::binY"}; + "- axis 0 : AxisBoundaryType::Bound, (-200., 200, 4), " + "AxisDirection::AxisX", + "- axis 1 : AxisBoundaryType::Bound, (-200, 200, 6), " + "AxisDirection::AxisY"}; auto caption = actsvg::draw::text("caption", {-180, -220}, captionText); @@ -135,7 +137,7 @@ BOOST_AUTO_TEST_CASE(OpenGridXY) { Svg::GridConverter::Options cOptions; auto pGrid = Svg::GridConverter::convert( - gridXY, {BinningValue::binX, BinningValue::binY}, cOptions); + gridXY, {AxisDirection::AxisX, AxisDirection::AxisY}, cOptions); BOOST_CHECK_EQUAL(pGrid._type, actsvg::proto::grid::type::e_x_y); // Labelling the grid tiles @@ -186,8 +188,10 @@ BOOST_AUTO_TEST_CASE(OpenGridXY) { std::vector captionText = { "Binning schema for global and local bins: ", - "- axis 0 : AxisBoundaryType::Open, (-200., 200, 4), BinningValue::binX", - "- axis 1 : AxisBoundaryType::Open, (-200, 200, 6), BinningValue::binY"}; + "- axis 0 : AxisBoundaryType::Open, (-200., 200, 4), " + "AxisDirection::AxisX", + "- axis 1 : AxisBoundaryType::Open, (-200, 200, 6), " + "AxisDirection::AxisY"}; auto caption = actsvg::draw::text("caption", {-180, -220}, captionText); auto oGrid = actsvg::display::grid("OpenGridXY", pGrid); @@ -212,7 +216,7 @@ BOOST_AUTO_TEST_CASE(ClosedCylinderGridZPhi) { Svg::GridConverter::Options cOptions; auto pGrid = Svg::GridConverter::convert( - gridZPhi, {BinningValue::binZ, BinningValue::binPhi}, cOptions); + gridZPhi, {AxisDirection::AxisZ, AxisDirection::AxisPhi}, cOptions); BOOST_CHECK_EQUAL(pGrid._type, actsvg::proto::grid::type::e_z_phi); pGrid._reference_r = 80.; @@ -264,8 +268,10 @@ BOOST_AUTO_TEST_CASE(ClosedCylinderGridZPhi) { std::vector captionText = { "Binning schema for global and local bins: ", - "- axis 0 : AxisBoundaryType::Bound, (-200., 200, 3), BinningValue::binZ", - "- axis 1 : AxisBoundaryType::Closed, (-PI, PI, 6), BinningValue::binPhi", + "- axis 0 : AxisBoundaryType::Bound, (-200., 200, 3), " + "AxisDirection::AxisZ", + "- axis 1 : AxisBoundaryType::Closed, (-PI, PI, 6), " + "AxisDirection::AxisPhi", "- draw reference radius set to 80"}; auto caption = actsvg::draw::text("caption", {-180, -270}, captionText); @@ -291,7 +297,7 @@ BOOST_AUTO_TEST_CASE(ClosedDiscGridRPhi) { Svg::GridConverter::Options cOptions; auto pGrid = Svg::GridConverter::convert( - gridRPhi, {BinningValue::binR, BinningValue::binPhi}, cOptions); + gridRPhi, {AxisDirection::AxisR, AxisDirection::AxisPhi}, cOptions); BOOST_CHECK_EQUAL(pGrid._type, actsvg::proto::grid::type::e_r_phi); // Labelling the grid tiles @@ -347,7 +353,7 @@ BOOST_AUTO_TEST_CASE(ClosedDiscGridRPhi) { std::vector captionText = { "Binning schema for global and local bins: ", - "- axis 0 : AxisBoundaryType::Bound, (100., 400, 3), binR", + "- axis 0 : AxisBoundaryType::Bound, (100., 400, 3), AxisR", "- axis 1 : AxisBoundaryType::Closed, (-PI, PI, 4), " "binPhi"}; diff --git a/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp index f7f7e247bbb..21066266404 100644 --- a/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(RingDisc1D) { 55., 0., 2., 22u); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {BinningValue::binPhi}}; + irSurfaces{rSurfaces, {}, {AxisDirection::AxisPhi}}; GridAxisGenerators::EqClosed aGenerator{{-std::numbers::pi, std::numbers::pi}, 44u}; @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(RingDisc1DWithSupport) { rSurfaces.push_back(dSurface.get()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {rSurfaces.size() - 1u}, {BinningValue::binPhi}}; + irSurfaces{rSurfaces, {rSurfaces.size() - 1u}, {AxisDirection::AxisPhi}}; GridAxisGenerators::EqClosed aGenerator{{-std::numbers::pi, std::numbers::pi}, 44u}; @@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(RingDisc2D) { rSurfaces.insert(rSurfaces.end(), rSurfacesR1.begin(), rSurfacesR1.end()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}}; + irSurfaces{rSurfaces, {}, {AxisDirection::AxisR, AxisDirection::AxisPhi}}; GridAxisGenerators::VarBoundEqClosed aGenerator{ {24., 74., 110.}, {-std::numbers::pi, std::numbers::pi}, 44u}; @@ -161,7 +161,7 @@ BOOST_AUTO_TEST_CASE(RingDisc2DFine) { rSurfaces.insert(rSurfaces.end(), rSurfacesR2.begin(), rSurfacesR2.end()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}}; + irSurfaces{rSurfaces, {}, {AxisDirection::AxisR, AxisDirection::AxisPhi}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {24., 152}, 8u, {-std::numbers::pi, std::numbers::pi}, 88u}; @@ -193,8 +193,10 @@ BOOST_AUTO_TEST_CASE(RingDisc2DFineExpanded) { rSurfaces.insert(rSurfaces.end(), rSurfacesR2.begin(), rSurfacesR2.end()); IndexedSurfacesGenerator - irSurfaces{ - rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}, {2u, 4u}}; + irSurfaces{rSurfaces, + {}, + {AxisDirection::AxisR, AxisDirection::AxisPhi}, + {2u, 4u}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {24., 152}, 8u, {-std::numbers::pi, std::numbers::pi}, 88u}; @@ -215,8 +217,10 @@ BOOST_AUTO_TEST_CASE(Cylinder2D) { 116., 3., 2., {52, 14}); IndexedSurfacesGenerator - icSurfaces{ - surfaces, {}, {BinningValue::binZ, BinningValue::binPhi}, {1u, 1u}}; + icSurfaces{surfaces, + {}, + {AxisDirection::AxisZ, AxisDirection::AxisPhi}, + {1u, 1u}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {-500., 500}, 28, {-std::numbers::pi, std::numbers::pi}, 52u}; diff --git a/Tests/UnitTests/Plugins/DD4hep/DD4hepCylinderLayerStructureTests.cpp b/Tests/UnitTests/Plugins/DD4hep/DD4hepCylinderLayerStructureTests.cpp index 994ac8bb927..0bc4e5c97c0 100644 --- a/Tests/UnitTests/Plugins/DD4hep/DD4hepCylinderLayerStructureTests.cpp +++ b/Tests/UnitTests/Plugins/DD4hep/DD4hepCylinderLayerStructureTests.cpp @@ -295,16 +295,16 @@ BOOST_AUTO_TEST_CASE(DD4hepPluginCylinderLayerStructureAutoRange) { lsOptions.name = "AutoRangeLayer"; auto extent = Acts::Extent(); lsOptions.extent = extent; - lsOptions.extentConstraints = {Acts::BinningValue::binZ, - Acts::BinningValue::binR}; + lsOptions.extentConstraints = {Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR}; lsOptions.logLevel = Acts::Logging::VERBOSE; auto [barrelInternalsBuilder, barrelExt] = barrelStructure.builder(dd4hepStore, tContext, world, lsOptions); BOOST_CHECK(barrelExt != std::nullopt); - BOOST_CHECK(barrelExt.value().constrains(Acts::BinningValue::binZ)); - BOOST_CHECK(barrelExt.value().constrains(Acts::BinningValue::binR)); + BOOST_CHECK(barrelExt.value().constrains(Acts::AxisDirection::AxisZ)); + BOOST_CHECK(barrelExt.value().constrains(Acts::AxisDirection::AxisR)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Plugins/Detray/DetrayMaterialConverterTests.cpp b/Tests/UnitTests/Plugins/Detray/DetrayMaterialConverterTests.cpp index 28fe7571b54..f5cb3b2ae82 100644 --- a/Tests/UnitTests/Plugins/Detray/DetrayMaterialConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Detray/DetrayMaterialConverterTests.cpp @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(DetrayHomogeneousMaterialConversion) { BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionX) { // Create a binned material in 4 bins in x direction Acts::BinUtility binUtility(4u, -2., 2., Acts::BinningOption::open, - Acts::BinningValue::binX); + Acts::AxisDirection::AxisX); std::vector materialSlabs = { materialSlab12345, materialSlab678910, materialSlab54321, @@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionX) { BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionY) { // Create a binned material in 4 bins in y direction Acts::BinUtility binUtility(4u, -2., 2., Acts::BinningOption::open, - Acts::BinningValue::binY); + Acts::AxisDirection::AxisY); std::vector materialSlabs = { materialSlab12345, materialSlab678910, materialSlab54321, @@ -212,9 +212,9 @@ BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionY) { BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionXY) { // Create a binned material in 2 x2 bins in x-y direction Acts::BinUtility binUtility(2u, -1., 1., Acts::BinningOption::open, - Acts::BinningValue::binX); + Acts::AxisDirection::AxisX); binUtility += Acts::BinUtility(2u, -2., 2., Acts::BinningOption::open, - Acts::BinningValue::binY); + Acts::AxisDirection::AxisY); std::vector materialSlabs0 = {materialSlab12345, materialSlab678910}; @@ -269,7 +269,7 @@ BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionR) { // Create a binned material in 4 bins (irregularly) in r direction std::vector binEdges = {0., 5., 10., 15., 20.}; Acts::BinUtility binUtility(binEdges, Acts::BinningOption::open, - Acts::BinningValue::binR); + Acts::AxisDirection::AxisR); std::vector materialSlabs = { materialSlab12345, materialSlab678910, materialSlab54321, @@ -308,10 +308,10 @@ BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionRPhi) { // Create a binned material in 2 bins - irregularly in r, 2 bins in phi std::vector binEdges = {0., 5., 20.}; Acts::BinUtility binUtility(binEdges, Acts::BinningOption::open, - Acts::BinningValue::binR); - binUtility += - Acts::BinUtility(2u, -std::numbers::pi, std::numbers::pi, - Acts::BinningOption::closed, Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisR); + binUtility += Acts::BinUtility(2u, -std::numbers::pi, std::numbers::pi, + Acts::BinningOption::closed, + Acts::AxisDirection::AxisPhi); std::vector materialSlabs0 = {materialSlab12345, materialSlab678910}; @@ -347,7 +347,7 @@ BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionZ) { // Create a binned material in 4 bins in x direction std::vector binEdges = {-20, 0, 25, 50, 100}; Acts::BinUtility binUtility(binEdges, Acts::BinningOption::open, - Acts::BinningValue::binZ); + Acts::AxisDirection::AxisZ); std::vector materialSlabs = { materialSlab12345, materialSlab678910, materialSlab54321, @@ -386,10 +386,10 @@ BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionZ) { BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionZPhi) { // Create a binned material in 2 x2 bins in x-y direction Acts::BinUtility binUtility(2u, -1., 1., Acts::BinningOption::open, - Acts::BinningValue::binZ); - binUtility += - Acts::BinUtility(2u, -std::numbers::pi, std::numbers::pi, - Acts::BinningOption::closed, Acts::BinningValue::binPhi); + Acts::AxisDirection::AxisZ); + binUtility += Acts::BinUtility(2u, -std::numbers::pi, std::numbers::pi, + Acts::BinningOption::closed, + Acts::AxisDirection::AxisPhi); std::vector materialSlabs0 = {materialSlab12345, materialSlab678910}; @@ -418,9 +418,9 @@ BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionZPhi) { BOOST_AUTO_TEST_CASE(DetrayBinnedMaterialConversionInvalid) { // Create a binned material in 4 bins in x direction Acts::BinUtility binUtility(2u, -1., 1., Acts::BinningOption::open, - Acts::BinningValue::binR); + Acts::AxisDirection::AxisR); binUtility += Acts::BinUtility(2u, -2., 2., Acts::BinningOption::open, - Acts::BinningValue::binEta); + Acts::AxisDirection::AxisEta); std::vector materialSlabs0 = {materialSlab12345, materialSlab678910}; diff --git a/Tests/UnitTests/Plugins/Geant4/Geant4SurfaceProviderTests.cpp b/Tests/UnitTests/Plugins/Geant4/Geant4SurfaceProviderTests.cpp index 7508fe9a148..e1846e108c7 100644 --- a/Tests/UnitTests/Plugins/Geant4/Geant4SurfaceProviderTests.cpp +++ b/Tests/UnitTests/Plugins/Geant4/Geant4SurfaceProviderTests.cpp @@ -32,17 +32,17 @@ /// @brief Convert Acts binning value to Geant4 axis /// as Geant4 uses a different axis convention /// @param bv the Acts binning value -EAxis binToGeant4Axis(const Acts::BinningValue& bv) { +EAxis binToGeant4Axis(const Acts::AxisDirection& bv) { switch (bv) { - case Acts::BinningValue::binX: + case Acts::AxisDirection::AxisX: return EAxis::kXAxis; - case Acts::BinningValue::binY: + case Acts::AxisDirection::AxisY: return EAxis::kYAxis; - case Acts::BinningValue::binZ: + case Acts::AxisDirection::AxisZ: return EAxis::kZAxis; - case Acts::BinningValue::binR: + case Acts::AxisDirection::AxisR: return EAxis::kRho; - case Acts::BinningValue::binPhi: + case Acts::AxisDirection::AxisPhi: return EAxis::kPhi; default: throw std::invalid_argument( @@ -225,7 +225,7 @@ BOOST_AUTO_TEST_CASE(Geant4SurfaceProviderRanges) { auto kdt1DOpt = Acts::Experimental::Geant4SurfaceProvider<1>::kdtOptions(); kdt1DOpt.range = Acts::RangeXD<1, double>(); kdt1DOpt.range[0].set(8, 12); - kdt1DOpt.binningValues = {Acts::BinningValue::binZ}; + kdt1DOpt.binningValues = {Acts::AxisDirection::AxisZ}; auto sp1D = std::make_shared>( sp1DCfg, kdt1DOpt); @@ -260,7 +260,7 @@ BOOST_AUTO_TEST_CASE(Geant4SurfaceProviderRanges) { kdt2DOpt.range = Acts::RangeXD<2, double>(); kdt2DOpt.range[0].set(8, 12); kdt2DOpt.range[1].set(armOffset - 5, armOffset + 100); - kdt2DOpt.binningValues = {Acts::BinningValue::binZ}; + kdt2DOpt.binningValues = {Acts::AxisDirection::AxisZ}; auto sp2D = std::make_shared>( sp2DCfg, kdt2DOpt); @@ -289,8 +289,8 @@ BOOST_AUTO_TEST_CASE(Geant4SurfaceProviderRanges) { std::map> ranges; std::array g4Axes{0}; - for (auto& bv : {Acts::BinningValue::binX, Acts::BinningValue::binY, - Acts::BinningValue::binZ}) { + for (auto& bv : {Acts::AxisDirection::AxisX, Acts::AxisDirection::AxisY, + Acts::AxisDirection::AxisZ}) { g4Axes[toUnderlying(bv)] = binToGeant4Axis(bv); } @@ -390,7 +390,7 @@ BOOST_AUTO_TEST_CASE(Geant4RectangleFromGDML) { auto kdt1DOpt = Acts::Experimental::Geant4SurfaceProvider<1>::kdtOptions(); kdt1DOpt.range = Acts::RangeXD<1, double>(); kdt1DOpt.range[0].set(-100, 100); - kdt1DOpt.binningValues = {Acts::BinningValue::binZ}; + kdt1DOpt.binningValues = {Acts::AxisDirection::AxisZ}; auto tContext = Acts::GeometryContext(); diff --git a/Tests/UnitTests/Plugins/Json/DetectorJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/DetectorJsonConverterTests.cpp index 7195c38eb9a..9a9cbcccb67 100644 --- a/Tests/UnitTests/Plugins/Json/DetectorJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/DetectorJsonConverterTests.cpp @@ -169,7 +169,7 @@ BOOST_AUTO_TEST_CASE(BeamPipeEndcapBarrelDetector) { lsConfig.auxiliary = "*** Endcap with 22 surfaces ***"; lsConfig.surfacesProvider = endcapSurfaces; lsConfig.binnings = {Acts::Experimental::ProtoBinning( - Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, + Acts::AxisDirection::AxisPhi, Acts::AxisBoundaryType::Closed, -std::numbers::pi, std::numbers::pi, 22u, 1u)}; auto layerBuilder = @@ -231,11 +231,11 @@ BOOST_AUTO_TEST_CASE(BeamPipeEndcapBarrelDetector) { lsConfig.auxiliary = "*** Barrel with 448 surfaces ***"; lsConfig.surfacesProvider = barrelSurfaces; lsConfig.binnings = { - Acts::Experimental::ProtoBinning{Acts::BinningValue::binZ, + Acts::Experimental::ProtoBinning{Acts::AxisDirection::AxisZ, Acts::AxisBoundaryType::Bound, -480., 480., 14u, 1u}, Acts::Experimental::ProtoBinning( - Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, + Acts::AxisDirection::AxisPhi, Acts::AxisBoundaryType::Closed, -std::numbers::pi, std::numbers::pi, 32u, 1u)}; auto barrelBuilder = @@ -280,7 +280,7 @@ BOOST_AUTO_TEST_CASE(BeamPipeEndcapBarrelDetector) { // Build the combined barrel Acts::Experimental::CylindricalContainerBuilder::Config ccBarrelBuilderCfg; ccBarrelBuilderCfg.builders = {ivBuilder, dvBuilder, ovBuilder}; - ccBarrelBuilderCfg.binning = {Acts::BinningValue::binR}; + ccBarrelBuilderCfg.binning = {Acts::AxisDirection::AxisR}; auto ccBarrelBuilder = std::make_shared( @@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE(BeamPipeEndcapBarrelDetector) { Acts::Experimental::CylindricalContainerBuilder::Config ccBarrelEcBuilderCfg; ccBarrelEcBuilderCfg.builders = {endcapBuilders[0u], ccBarrelBuilder, endcapBuilders[1u]}; - ccBarrelEcBuilderCfg.binning = {Acts::BinningValue::binZ}; + ccBarrelEcBuilderCfg.binning = {Acts::AxisDirection::AxisZ}; auto ccBarrelEndcapBuilder = std::make_shared( @@ -318,7 +318,7 @@ BOOST_AUTO_TEST_CASE(BeamPipeEndcapBarrelDetector) { // Full detector Acts::Experimental::CylindricalContainerBuilder::Config detCompBuilderCfg; detCompBuilderCfg.builders = {bpBuilder, ccBarrelEndcapBuilder}; - detCompBuilderCfg.binning = {Acts::BinningValue::binR}; + detCompBuilderCfg.binning = {Acts::AxisDirection::AxisR}; auto detCompBuilder = std::make_shared( diff --git a/Tests/UnitTests/Plugins/Json/DetectorVolumeFinderJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/DetectorVolumeFinderJsonConverterTests.cpp index 1d4aca927d9..88cfc784059 100644 --- a/Tests/UnitTests/Plugins/Json/DetectorVolumeFinderJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/DetectorVolumeFinderJsonConverterTests.cpp @@ -51,8 +51,8 @@ BOOST_AUTO_TEST_CASE(RzVolumes) { grid.atPosition(p22) = 22u; grid.atPosition(p23) = 23u; - auto casts = std::array{Acts::BinningValue::binZ, - Acts::BinningValue::binR}; + auto casts = std::array{Acts::AxisDirection::AxisZ, + Acts::AxisDirection::AxisR}; using IndexedDetectorVolumesImpl = Acts::Experimental::IndexedGridNavigation< Acts::Experimental::IExternalNavigation, GridType, diff --git a/Tests/UnitTests/Plugins/Json/DetectorVolumeJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/DetectorVolumeJsonConverterTests.cpp index b1701f06128..3713cc46f90 100644 --- a/Tests/UnitTests/Plugins/Json/DetectorVolumeJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/DetectorVolumeJsonConverterTests.cpp @@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE(EndcapVolumeWithSurfaces) { lsConfig.auxiliary = "*** Endcap with 22 surfaces ***"; lsConfig.surfacesProvider = endcapSurfaces; lsConfig.binnings = {Acts::Experimental::ProtoBinning( - Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, + Acts::AxisDirection::AxisPhi, Acts::AxisBoundaryType::Closed, -std::numbers::pi, std::numbers::pi, 22u, 1u)}; auto layerBuilder = @@ -228,11 +228,11 @@ BOOST_AUTO_TEST_CASE(BarrelVolumeWithSurfaces) { lsConfig.auxiliary = "*** Barrel with 448 surfaces ***"; lsConfig.surfacesProvider = barrelSurfaces; lsConfig.binnings = { - Acts::Experimental::ProtoBinning{Acts::BinningValue::binZ, + Acts::Experimental::ProtoBinning{Acts::AxisDirection::AxisZ, Acts::AxisBoundaryType::Bound, -480., 480., 14u, 1u}, Acts::Experimental::ProtoBinning( - Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, + Acts::AxisDirection::AxisPhi, Acts::AxisBoundaryType::Closed, -std::numbers::pi, std::numbers::pi, 32u, 1u)}; auto barrelBuilder = diff --git a/Tests/UnitTests/Plugins/Json/EqualityHelpers.hpp b/Tests/UnitTests/Plugins/Json/EqualityHelpers.hpp index 1544941002d..1a8286aa05c 100644 --- a/Tests/UnitTests/Plugins/Json/EqualityHelpers.hpp +++ b/Tests/UnitTests/Plugins/Json/EqualityHelpers.hpp @@ -91,7 +91,7 @@ inline static bool isEqual(const Acts::Extent& ea, const Acts::Extent& eb, double tolerance = 0.) { bool equalConstrains = true; bool equalRange = true; - for (auto& bVal : allBinningValues()) { + for (auto& bVal : allAxisDirections()) { equalConstrains = equalConstrains && (ea.constrains(bVal) == eb.constrains(bVal)); BOOST_CHECK(equalConstrains); diff --git a/Tests/UnitTests/Plugins/Json/ExtentJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/ExtentJsonConverterTests.cpp index 3fc16ad0ccf..7c1884d5a3a 100644 --- a/Tests/UnitTests/Plugins/Json/ExtentJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/ExtentJsonConverterTests.cpp @@ -22,8 +22,8 @@ BOOST_AUTO_TEST_SUITE(ExtentJsonConverter) BOOST_AUTO_TEST_CASE(ExtentRoundtripTests) { Extent e; - e.set(BinningValue::binR, 0, 200); - e.set(BinningValue::binZ, -50, 50); + e.set(AxisDirection::AxisR, 0, 200); + e.set(AxisDirection::AxisZ, -50, 50); nlohmann::json j; j["extent"] = e; @@ -32,13 +32,13 @@ BOOST_AUTO_TEST_CASE(ExtentRoundtripTests) { Extent eIn = j["extent"]; - CHECK_CLOSE_ABS(eIn.min(BinningValue::binR), e.min(BinningValue::binR), + CHECK_CLOSE_ABS(eIn.min(AxisDirection::AxisR), e.min(AxisDirection::AxisR), 10e-5); - CHECK_CLOSE_ABS(eIn.max(BinningValue::binR), e.max(BinningValue::binR), + CHECK_CLOSE_ABS(eIn.max(AxisDirection::AxisR), e.max(AxisDirection::AxisR), 10e-5); - CHECK_CLOSE_ABS(eIn.min(BinningValue::binZ), e.min(BinningValue::binZ), + CHECK_CLOSE_ABS(eIn.min(AxisDirection::AxisZ), e.min(AxisDirection::AxisZ), 10e-5); - CHECK_CLOSE_ABS(eIn.max(BinningValue::binZ), e.max(BinningValue::binZ), + CHECK_CLOSE_ABS(eIn.max(AxisDirection::AxisZ), e.max(AxisDirection::AxisZ), 10e-5); } diff --git a/Tests/UnitTests/Plugins/Json/GridJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/GridJsonConverterTests.cpp index cac514a18ac..98c0c731021 100644 --- a/Tests/UnitTests/Plugins/Json/GridJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/GridJsonConverterTests.cpp @@ -363,12 +363,13 @@ void checkGlobalSubspaceTuple(const SubspactTuple& sstuple) { BOOST_AUTO_TEST_CASE(GlobalSubSpaceTests1D) { // One dimensional sub spaces - const std::tuple, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace> + const std::tuple< + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace> sspace1D; // Check the tuple for 1D @@ -377,26 +378,27 @@ BOOST_AUTO_TEST_CASE(GlobalSubSpaceTests1D) { BOOST_AUTO_TEST_CASE(GlobalSubSpaceTests2D) { // Two dimensional sub spaces - const std::tuple, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace, - Acts::GridAccess::GlobalSubspace> + const std::tuple< + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace, + Acts::GridAccess::GlobalSubspace> sspace2D = {}; // Check the tuple for 2D diff --git a/Tests/UnitTests/Plugins/Json/MaterialJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/MaterialJsonConverterTests.cpp index 6647ee69fe4..b7f982de739 100644 --- a/Tests/UnitTests/Plugins/Json/MaterialJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/MaterialJsonConverterTests.cpp @@ -55,11 +55,10 @@ BOOST_AUTO_TEST_CASE(IndexedSurfaceMaterial1DTests) { std::move(localX)); auto globalX = std::make_unique< - const Acts::GridAccess::GlobalSubspace>(); + const Acts::GridAccess::GlobalSubspace>(); Acts::IndexedSurfaceMaterial::GlobalToGridLocalDelegate gToX; - gToX.connect< - &Acts::GridAccess::GlobalSubspace::toGridLocal>( - std::move(globalX)); + gToX.connect<&Acts::GridAccess::GlobalSubspace< + Acts::AxisDirection::AxisX>::toGridLocal>(std::move(globalX)); Acts::IndexedSurfaceMaterial ism( std::move(eqGrid), Acts::IndexedMaterialAccessor{std::move(material)}, @@ -132,10 +131,10 @@ BOOST_AUTO_TEST_CASE(IndexedSurfaceMaterial2DTests) { // With z shift 10 auto globalToGrid = std::make_unique>(); + Acts::AxisDirection::AxisZ, Acts::AxisDirection::AxisPhi>>(); Acts::IndexedSurfaceMaterial::GlobalToGridLocalDelegate gToZphi; gToZphi.connect<&Acts::GridAccess::GlobalSubspace< - Acts::BinningValue::binZ, Acts::BinningValue::binPhi>::toGridLocal>( + Acts::AxisDirection::AxisZ, Acts::AxisDirection::AxisPhi>::toGridLocal>( std::move(globalToGrid)); // Create the indexed material grid diff --git a/Tests/UnitTests/Plugins/Json/PortalJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/PortalJsonConverterTests.cpp index 770076c1a0e..c52b72f2b60 100644 --- a/Tests/UnitTests/Plugins/Json/PortalJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/PortalJsonConverterTests.cpp @@ -129,7 +129,8 @@ BOOST_AUTO_TEST_CASE(PortalMultiConnected) { Acts::Experimental::detail::PortalHelper::attachDetectorVolumesUpdater( tContext, *portal, {forwardVolumeA, forwardVolumeB, forwardVolumeC}, - Acts::Direction::Forward, {-100, 10, 20, 200}, Acts::BinningValue::binX); + Acts::Direction::Forward, {-100, 10, 20, 200}, + Acts::AxisDirection::AxisX); std::vector detectorVolumes = { forwardVolumeA.get(), forwardVolumeB.get(), forwardVolumeC.get(), diff --git a/Tests/UnitTests/Plugins/Json/ProtoDetectorJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/ProtoDetectorJsonConverterTests.cpp index 5cf5f75ce58..1e97184801b 100644 --- a/Tests/UnitTests/Plugins/Json/ProtoDetectorJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/ProtoDetectorJsonConverterTests.cpp @@ -117,66 +117,66 @@ BOOST_AUTO_TEST_SUITE(ProtoDetectorJsonConverter) BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ExtentEnvelope cylinderLayerEnvelope = ExtentEnvelope::Zero(); - cylinderLayerEnvelope[Acts::BinningValue::binR] = {1., 1.}; - cylinderLayerEnvelope[Acts::BinningValue::binZ] = {2., 2.}; + cylinderLayerEnvelope[Acts::AxisDirection::AxisR] = {1., 1.}; + cylinderLayerEnvelope[Acts::AxisDirection::AxisZ] = {2., 2.}; Acts::ExtentEnvelope discLayerEnvelope = ExtentEnvelope::Zero(); - discLayerEnvelope[Acts::BinningValue::binR] = {1., 1.}; - discLayerEnvelope[Acts::BinningValue::binZ] = {1., 1.}; + discLayerEnvelope[Acts::AxisDirection::AxisR] = {1., 1.}; + discLayerEnvelope[Acts::AxisDirection::AxisZ] = {1., 1.}; // Beam Pipe container Acts::ProtoVolume beamPipeContainer; beamPipeContainer.name = "odd-beam-pipe"; - beamPipeContainer.extent.set(Acts::BinningValue::binR, 0., 25); + beamPipeContainer.extent.set(Acts::AxisDirection::AxisR, 0., 25); Acts::ProtoVolume beamPipe; beamPipe.name = "odd-beam-pipe-l"; - beamPipe.extent.set(Acts::BinningValue::binR, 2., 24.); + beamPipe.extent.set(Acts::AxisDirection::AxisR, 2., 24.); beamPipe.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; beamPipeContainer.container = Acts::ProtoVolume::ContainerStructure{ {beamPipe}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1.})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 1.})}, true}; // Pixel section Acts::ProtoVolume pixelContainer; pixelContainer.name = "odd-pixel"; - pixelContainer.extent.set(Acts::BinningValue::binR, 25., 200); + pixelContainer.extent.set(Acts::AxisDirection::AxisR, 25., 200); Acts::ProtoVolume pixelNec; pixelNec.name = "odd-pixel-nec"; - pixelNec.extent.set(Acts::BinningValue::binZ, -3100., -580); + pixelNec.extent.set(Acts::AxisDirection::AxisZ, -3100., -580); Acts::ProtoVolume pixNecD6; pixNecD6.name = "odd-pixel-nec-d6"; - pixNecD6.extent.set(Acts::BinningValue::binZ, -1540., -1500); + pixNecD6.extent.set(Acts::AxisDirection::AxisZ, -1540., -1500); Acts::ProtoVolume pixNecD5; pixNecD5.name = "odd-pixel-nec-d5"; - pixNecD5.extent.set(Acts::BinningValue::binZ, -1340., -1300); + pixNecD5.extent.set(Acts::AxisDirection::AxisZ, -1340., -1300); Acts::ProtoVolume pixNecD4; pixNecD4.name = "odd-pixel-nec-d4"; - pixNecD4.extent.set(Acts::BinningValue::binZ, -1140., -1100); + pixNecD4.extent.set(Acts::AxisDirection::AxisZ, -1140., -1100); Acts::ProtoVolume pixNecD3; pixNecD3.name = "odd-pixel-nec-d3"; - pixNecD3.extent.set(Acts::BinningValue::binZ, -1000., -960.); + pixNecD3.extent.set(Acts::AxisDirection::AxisZ, -1000., -960.); Acts::ProtoVolume pixNecD2; pixNecD2.name = "odd-pixel-nec-d2"; - pixNecD2.extent.set(Acts::BinningValue::binZ, -860., -820); + pixNecD2.extent.set(Acts::AxisDirection::AxisZ, -860., -820); Acts::ProtoVolume pixNecD1; pixNecD1.name = "odd-pixel-nec-d1"; - pixNecD1.extent.set(Acts::BinningValue::binZ, -740., -700); + pixNecD1.extent.set(Acts::AxisDirection::AxisZ, -740., -700); Acts::ProtoVolume pixNecD0; pixNecD0.name = "odd-pixel-nec-d0"; - pixNecD0.extent.set(Acts::BinningValue::binZ, -640., -600); + pixNecD0.extent.set(Acts::AxisDirection::AxisZ, -640., -600); pixelNec.container = Acts::ProtoVolume::ContainerStructure{ {pixNecD6, pixNecD5, pixNecD4, pixNecD3, pixNecD2, pixNecD1, pixNecD0}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1.})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {0., 1.})}, true}; Acts::BinningData pixEcBinningR = - Acts::BinningData(Acts::open, Acts::BinningValue::binR, 2., 0., 1.); + Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, 2., 0., 1.); Acts::BinningData pixEcBinningPhi = - Acts::BinningData(Acts::closed, Acts::BinningValue::binPhi, 30., + Acts::BinningData(Acts::closed, Acts::AxisDirection::AxisPhi, 30., -std::numbers::pi, std::numbers::pi); for (auto& cv : pixelNec.container.value().constituentVolumes) { @@ -187,28 +187,28 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume pixelBarrel; pixelBarrel.name = "odd-pixel-barrel"; - pixelBarrel.extent.set(Acts::BinningValue::binZ, -580., 580); + pixelBarrel.extent.set(Acts::AxisDirection::AxisZ, -580., 580); Acts::ProtoVolume pixBarrelL0; pixBarrelL0.name = "odd-pixel-barrel-l0"; - pixBarrelL0.extent.set(Acts::BinningValue::binR, 28., 48.); - pixBarrelL0.extent.set(Acts::BinningValue::binZ, -580., 580); + pixBarrelL0.extent.set(Acts::AxisDirection::AxisR, 28., 48.); + pixBarrelL0.extent.set(Acts::AxisDirection::AxisZ, -580., 580); Acts::ProtoVolume pixBarrelL1; pixBarrelL1.name = "odd-pixel-barrel-l1"; - pixBarrelL1.extent.set(Acts::BinningValue::binR, 62., 76); - pixBarrelL1.extent.set(Acts::BinningValue::binZ, -580., 580); + pixBarrelL1.extent.set(Acts::AxisDirection::AxisR, 62., 76); + pixBarrelL1.extent.set(Acts::AxisDirection::AxisZ, -580., 580); Acts::ProtoVolume pixBarrelL2; pixBarrelL2.name = "odd-pixel-barrel-l2"; - pixBarrelL2.extent.set(Acts::BinningValue::binR, 100., 120.); - pixBarrelL2.extent.set(Acts::BinningValue::binZ, -580., 580); + pixBarrelL2.extent.set(Acts::AxisDirection::AxisR, 100., 120.); + pixBarrelL2.extent.set(Acts::AxisDirection::AxisZ, -580., 580); Acts::ProtoVolume pixBarrelL3; pixBarrelL3.name = "odd-pixel-barrel-l3"; - pixBarrelL3.extent.set(Acts::BinningValue::binR, 160., 180.); - pixBarrelL3.extent.set(Acts::BinningValue::binZ, -580., 580); + pixBarrelL3.extent.set(Acts::AxisDirection::AxisR, 160., 180.); + pixBarrelL3.extent.set(Acts::AxisDirection::AxisZ, -580., 580); pixelBarrel.container = Acts::ProtoVolume::ContainerStructure{ {pixBarrelL0, pixBarrelL1, pixBarrelL2, pixBarrelL3}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 1})}, true}; for (auto& cv : pixelBarrel.container.value().constituentVolumes) { @@ -219,33 +219,33 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume pixelPec; pixelPec.name = "odd-pixel-pec"; - pixelPec.extent.set(Acts::BinningValue::binZ, 580., 3100.); + pixelPec.extent.set(Acts::AxisDirection::AxisZ, 580., 3100.); Acts::ProtoVolume pixPecD0; pixPecD0.name = "odd-pixel-pec-d0"; - pixPecD0.extent.set(Acts::BinningValue::binZ, 600., 640); + pixPecD0.extent.set(Acts::AxisDirection::AxisZ, 600., 640); Acts::ProtoVolume pixPecD1; pixPecD1.name = "odd-pixel-pec-d1"; - pixPecD1.extent.set(Acts::BinningValue::binZ, 700., 740); + pixPecD1.extent.set(Acts::AxisDirection::AxisZ, 700., 740); Acts::ProtoVolume pixPecD2; pixPecD2.name = "odd-pixel-pec-d2"; - pixPecD2.extent.set(Acts::BinningValue::binZ, 820., 860.); + pixPecD2.extent.set(Acts::AxisDirection::AxisZ, 820., 860.); Acts::ProtoVolume pixPecD3; pixPecD3.name = "odd-pixel-pec-d3"; - pixPecD3.extent.set(Acts::BinningValue::binZ, 960., 1000.); + pixPecD3.extent.set(Acts::AxisDirection::AxisZ, 960., 1000.); Acts::ProtoVolume pixPecD4; pixPecD4.name = "odd-pixel-pec-d4"; - pixPecD4.extent.set(Acts::BinningValue::binZ, 1100., 1140); + pixPecD4.extent.set(Acts::AxisDirection::AxisZ, 1100., 1140); Acts::ProtoVolume pixPecD5; pixPecD5.name = "odd-pixel-pec-d5"; - pixPecD5.extent.set(Acts::BinningValue::binZ, 1300., 1340.); + pixPecD5.extent.set(Acts::AxisDirection::AxisZ, 1300., 1340.); Acts::ProtoVolume pixPecD6; pixPecD6.name = "odd-pixel-pec-d6"; - pixPecD6.extent.set(Acts::BinningValue::binZ, 1500., 1540.); + pixPecD6.extent.set(Acts::AxisDirection::AxisZ, 1500., 1540.); pixelPec.container = Acts::ProtoVolume::ContainerStructure{ {pixPecD0, pixPecD1, pixPecD2, pixPecD3, pixPecD4, pixPecD5, pixPecD6}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {0., 1})}, true}; for (auto& cv : pixelPec.container.value().constituentVolumes) { @@ -256,60 +256,60 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { pixelContainer.container = Acts::ProtoVolume::ContainerStructure{ {pixelNec, pixelBarrel, pixelPec}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {-3100., -580., 580., 3100.})}}; // Short Strip section Acts::ProtoVolume pstContainer; pstContainer.name = "odd-pst"; - pstContainer.extent.set(Acts::BinningValue::binR, 200., 210.); + pstContainer.extent.set(Acts::AxisDirection::AxisR, 200., 210.); Acts::ProtoVolume pst; pst.name = "odd-pst-l"; - pst.extent.set(Acts::BinningValue::binR, 201., 209.); + pst.extent.set(Acts::AxisDirection::AxisR, 201., 209.); pst.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; pstContainer.container = Acts::ProtoVolume::ContainerStructure{ {pst}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1.})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 1.})}, true}; // Short Strip section Acts::ProtoVolume sstripContainer; sstripContainer.name = "odd-sstrip"; - sstripContainer.extent.set(Acts::BinningValue::binR, 210., 720); + sstripContainer.extent.set(Acts::AxisDirection::AxisR, 210., 720); Acts::BinningData sstripEcBinningR = - Acts::BinningData(Acts::open, Acts::BinningValue::binR, 3., 0., 1.); + Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, 3., 0., 1.); Acts::BinningData sstripEcBinningPhi = - Acts::BinningData(Acts::closed, Acts::BinningValue::binPhi, 42., + Acts::BinningData(Acts::closed, Acts::AxisDirection::AxisPhi, 42., -std::numbers::pi, std::numbers::pi); Acts::ProtoVolume sstripNec; sstripNec.name = "odd-sstrip-nec"; - sstripNec.extent.set(Acts::BinningValue::binZ, -3100., -1200); + sstripNec.extent.set(Acts::AxisDirection::AxisZ, -3100., -1200); Acts::ProtoVolume sstripNecD5; sstripNecD5.name = "odd-sstrip-nec-d5"; - sstripNecD5.extent.set(Acts::BinningValue::binZ, -3000, -2900.); + sstripNecD5.extent.set(Acts::AxisDirection::AxisZ, -3000, -2900.); Acts::ProtoVolume sstripNecD4; sstripNecD4.name = "odd-sstrip-nec-d4"; - sstripNecD4.extent.set(Acts::BinningValue::binZ, -2600., -2500.); + sstripNecD4.extent.set(Acts::AxisDirection::AxisZ, -2600., -2500.); Acts::ProtoVolume sstripNecD3; sstripNecD3.name = "odd-sstrip-nec-d3"; - sstripNecD3.extent.set(Acts::BinningValue::binZ, -2250, -2150.); + sstripNecD3.extent.set(Acts::AxisDirection::AxisZ, -2250, -2150.); Acts::ProtoVolume sstripNecD2; sstripNecD2.name = "odd-sstrip-nec-d2"; - sstripNecD2.extent.set(Acts::BinningValue::binZ, -1900, -1800.); + sstripNecD2.extent.set(Acts::AxisDirection::AxisZ, -1900, -1800.); Acts::ProtoVolume sstripNecD1; sstripNecD1.name = "odd-sstrip-nec-d1"; - sstripNecD1.extent.set(Acts::BinningValue::binZ, -1600., -1500.); + sstripNecD1.extent.set(Acts::AxisDirection::AxisZ, -1600., -1500.); Acts::ProtoVolume sstripNecD0; sstripNecD0.name = "odd-sstrip-nec-d0"; - sstripNecD0.extent.set(Acts::BinningValue::binZ, -1350., -1250.); + sstripNecD0.extent.set(Acts::AxisDirection::AxisZ, -1350., -1250.); sstripNec.container = Acts::ProtoVolume::ContainerStructure{ {sstripNecD5, sstripNecD4, sstripNecD3, sstripNecD2, sstripNecD1, sstripNecD0}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {0., 1})}, true}; for (auto& cv : sstripNec.container.value().constituentVolumes) { @@ -321,24 +321,24 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume sstripBarrel; sstripBarrel.name = "odd-sstrip-barrel"; - sstripBarrel.extent.set(Acts::BinningValue::binZ, -1200., 1200); + sstripBarrel.extent.set(Acts::AxisDirection::AxisZ, -1200., 1200); Acts::ProtoVolume sstripBarrelL0; sstripBarrelL0.name = "odd-sstrip-barrel-l0"; - sstripBarrelL0.extent.set(Acts::BinningValue::binR, 240., 280.); + sstripBarrelL0.extent.set(Acts::AxisDirection::AxisR, 240., 280.); Acts::ProtoVolume sstripBarrelL1; sstripBarrelL1.name = "odd-sstrip-barrel-l1"; - sstripBarrelL1.extent.set(Acts::BinningValue::binR, 340., 380.); + sstripBarrelL1.extent.set(Acts::AxisDirection::AxisR, 340., 380.); Acts::ProtoVolume sstripBarrelL2; sstripBarrelL2.name = "odd-sstrip-barrel-l2"; - sstripBarrelL2.extent.set(Acts::BinningValue::binR, 480., 520.); + sstripBarrelL2.extent.set(Acts::AxisDirection::AxisR, 480., 520.); Acts::ProtoVolume sstripBarrelL3; sstripBarrelL3.name = "odd-sstrip-barrel-l3"; - sstripBarrelL3.extent.set(Acts::BinningValue::binR, 640., 680.); + sstripBarrelL3.extent.set(Acts::AxisDirection::AxisR, 640., 680.); sstripBarrel.container = Acts::ProtoVolume::ContainerStructure{ {sstripBarrelL0, sstripBarrelL1, sstripBarrelL2, sstripBarrelL3}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 1})}, true}; for (auto& cv : sstripBarrel.container.value().constituentVolumes) { @@ -349,31 +349,31 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume sstripPec; sstripPec.name = "odd-sstrip-pec"; - sstripPec.extent.set(Acts::BinningValue::binZ, 1200., 3100); + sstripPec.extent.set(Acts::AxisDirection::AxisZ, 1200., 3100); Acts::ProtoVolume sstripPecD0; sstripPecD0.name = "odd-sstrip-pec-d0"; - sstripPecD0.extent.set(Acts::BinningValue::binZ, 1250., 1350); + sstripPecD0.extent.set(Acts::AxisDirection::AxisZ, 1250., 1350); Acts::ProtoVolume sstripPecD1; sstripPecD1.name = "odd-sstrip-pec-d1"; - sstripPecD1.extent.set(Acts::BinningValue::binZ, 1500., 1600.); + sstripPecD1.extent.set(Acts::AxisDirection::AxisZ, 1500., 1600.); Acts::ProtoVolume sstripPecD2; sstripPecD2.name = "odd-sstrip-pec-d2"; - sstripPecD2.extent.set(Acts::BinningValue::binZ, 1800., 1900.); + sstripPecD2.extent.set(Acts::AxisDirection::AxisZ, 1800., 1900.); Acts::ProtoVolume sstripPecD3; sstripPecD3.name = "odd-sstrip-pec-d3"; - sstripPecD3.extent.set(Acts::BinningValue::binZ, 2150., 2250.); + sstripPecD3.extent.set(Acts::AxisDirection::AxisZ, 2150., 2250.); Acts::ProtoVolume sstripPecD4; sstripPecD4.name = "odd-sstrip-pec-d4"; - sstripPecD4.extent.set(Acts::BinningValue::binZ, 2500., 2600.); + sstripPecD4.extent.set(Acts::AxisDirection::AxisZ, 2500., 2600.); Acts::ProtoVolume sstripPecD5; sstripPecD5.name = "odd-sstrip-pec-d5"; - sstripPecD5.extent.set(Acts::BinningValue::binZ, 2900., 3000.); + sstripPecD5.extent.set(Acts::AxisDirection::AxisZ, 2900., 3000.); sstripPec.container = Acts::ProtoVolume::ContainerStructure{ {sstripPecD0, sstripPecD1, sstripPecD2, sstripPecD3, sstripPecD4, sstripPecD5}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {0., 1})}, true}; for (auto& cv : sstripPec.container.value().constituentVolumes) { cv.extent.setEnvelope(discLayerEnvelope); @@ -384,40 +384,40 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { sstripContainer.container = Acts::ProtoVolume::ContainerStructure{ {sstripNec, sstripBarrel, sstripPec}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {-3100., -1200., 1200., 3100.})}}; // Long Strip section Acts::ProtoVolume lstripContainer; lstripContainer.name = "odd-lstrip"; - lstripContainer.extent.set(Acts::BinningValue::binR, 720, 1100.); + lstripContainer.extent.set(Acts::AxisDirection::AxisR, 720, 1100.); Acts::ProtoVolume lstripNec; lstripNec.name = "odd-lstrip-nec"; - lstripNec.extent.set(Acts::BinningValue::binZ, -3100., -1200); + lstripNec.extent.set(Acts::AxisDirection::AxisZ, -3100., -1200); Acts::ProtoVolume lstripNecD5; lstripNecD5.name = "odd-lstrip-nec-d5"; - lstripNecD5.extent.set(Acts::BinningValue::binZ, -3050, -2900.); + lstripNecD5.extent.set(Acts::AxisDirection::AxisZ, -3050, -2900.); Acts::ProtoVolume lstripNecD4; lstripNecD4.name = "odd-lstrip-nec-d4"; - lstripNecD4.extent.set(Acts::BinningValue::binZ, -2650., -2500.); + lstripNecD4.extent.set(Acts::AxisDirection::AxisZ, -2650., -2500.); Acts::ProtoVolume lstripNecD3; lstripNecD3.name = "odd-lstrip-nec-d3"; - lstripNecD3.extent.set(Acts::BinningValue::binZ, -2300, -2150.); + lstripNecD3.extent.set(Acts::AxisDirection::AxisZ, -2300, -2150.); Acts::ProtoVolume lstripNecD2; lstripNecD2.name = "odd-lstrip-nec-d2"; - lstripNecD2.extent.set(Acts::BinningValue::binZ, -1950, -1800.); + lstripNecD2.extent.set(Acts::AxisDirection::AxisZ, -1950, -1800.); Acts::ProtoVolume lstripNecD1; lstripNecD1.name = "odd-lstrip-nec-d1"; - lstripNecD1.extent.set(Acts::BinningValue::binZ, -1650., -1500.); + lstripNecD1.extent.set(Acts::AxisDirection::AxisZ, -1650., -1500.); Acts::ProtoVolume lstripNecD0; lstripNecD0.name = "odd-lstrip-nec-d0"; - lstripNecD0.extent.set(Acts::BinningValue::binZ, -1400., -1250.); + lstripNecD0.extent.set(Acts::AxisDirection::AxisZ, -1400., -1250.); lstripNec.container = Acts::ProtoVolume::ContainerStructure{ {lstripNecD5, lstripNecD4, lstripNecD3, lstripNecD2, lstripNecD1, lstripNecD0}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {0., 1})}, true}; for (auto& cv : lstripNec.container.value().constituentVolumes) { @@ -428,18 +428,18 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume lstripBarrel; lstripBarrel.name = "odd-lstrip-barrel"; - lstripBarrel.extent.set(Acts::BinningValue::binZ, -1200., 1200); + lstripBarrel.extent.set(Acts::AxisDirection::AxisZ, -1200., 1200); Acts::ProtoVolume lstripBarrelL0; lstripBarrelL0.name = "odd-lstrip-barrel-l0"; - lstripBarrelL0.extent.set(Acts::BinningValue::binR, 800., 840.); + lstripBarrelL0.extent.set(Acts::AxisDirection::AxisR, 800., 840.); Acts::ProtoVolume lstripBarrelL1; lstripBarrelL1.name = "odd-lstrip-barrel-l1"; - lstripBarrelL1.extent.set(Acts::BinningValue::binR, 1000., 1050.); + lstripBarrelL1.extent.set(Acts::AxisDirection::AxisR, 1000., 1050.); lstripBarrel.container = Acts::ProtoVolume::ContainerStructure{ {lstripBarrelL0, lstripBarrelL1}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 1})}, true}; for (auto& cv : lstripBarrel.container.value().constituentVolumes) { @@ -450,31 +450,31 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume lstripPec; lstripPec.name = "odd-lstrip-pec"; - lstripPec.extent.set(Acts::BinningValue::binZ, 1200., 3100); + lstripPec.extent.set(Acts::AxisDirection::AxisZ, 1200., 3100); Acts::ProtoVolume lstripPecD0; lstripPecD0.name = "odd-lstrip-pec-d0"; - lstripPecD0.extent.set(Acts::BinningValue::binZ, 1250., 1400); + lstripPecD0.extent.set(Acts::AxisDirection::AxisZ, 1250., 1400); Acts::ProtoVolume lstripPecD1; lstripPecD1.name = "odd-lstrip-pec-d1"; - lstripPecD1.extent.set(Acts::BinningValue::binZ, 1500., 1650.); + lstripPecD1.extent.set(Acts::AxisDirection::AxisZ, 1500., 1650.); Acts::ProtoVolume lstripPecD2; lstripPecD2.name = "odd-lstrip-pec-d2"; - lstripPecD2.extent.set(Acts::BinningValue::binZ, 1800., 1950.); + lstripPecD2.extent.set(Acts::AxisDirection::AxisZ, 1800., 1950.); Acts::ProtoVolume lstripPecD3; lstripPecD3.name = "odd-lstrip-pec-d3"; - lstripPecD3.extent.set(Acts::BinningValue::binZ, 2150., 2300.); + lstripPecD3.extent.set(Acts::AxisDirection::AxisZ, 2150., 2300.); Acts::ProtoVolume lstripPecD4; lstripPecD4.name = "odd-lstrip-pec-d4"; - lstripPecD4.extent.set(Acts::BinningValue::binZ, 2500., 2650.); + lstripPecD4.extent.set(Acts::AxisDirection::AxisZ, 2500., 2650.); Acts::ProtoVolume lstripPecD5; lstripPecD5.name = "odd-lstrip-pec-d5"; - lstripPecD5.extent.set(Acts::BinningValue::binZ, 2900., 3050.); + lstripPecD5.extent.set(Acts::AxisDirection::AxisZ, 2900., 3050.); lstripPec.container = Acts::ProtoVolume::ContainerStructure{ {lstripPecD0, lstripPecD1, lstripPecD2, lstripPecD3, lstripPecD4, lstripPecD5}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {0., 1})}, true}; for (auto& cv : lstripPec.container.value().constituentVolumes) { cv.internal = @@ -483,18 +483,18 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { } lstripContainer.container = Acts::ProtoVolume::ContainerStructure{ {lstripNec, lstripBarrel, lstripPec}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisZ, {-3100., -1200., 1200., 3100.})}}; // The overall container Acts::ProtoVolume detectorContainer; detectorContainer.name = "odd-light-world"; - detectorContainer.extent.set(Acts::BinningValue::binR, 0., 1100.); - detectorContainer.extent.set(Acts::BinningValue::binZ, -3100., 3100.); + detectorContainer.extent.set(Acts::AxisDirection::AxisR, 0., 1100.); + detectorContainer.extent.set(Acts::AxisDirection::AxisZ, -3100., 3100.); detectorContainer.container = Acts::ProtoVolume::ContainerStructure{ {beamPipeContainer, pixelContainer, pstContainer, sstripContainer, lstripContainer}, - {Acts::BinningData(Acts::open, Acts::BinningValue::binR, + {Acts::BinningData(Acts::open, Acts::AxisDirection::AxisR, {0., 25., 200., 210., 720., 1100.})}}; // ---------------------------------------------------------- diff --git a/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp index 41f080db7f5..db6d314df7f 100644 --- a/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp @@ -31,7 +31,7 @@ using namespace Acts; BOOST_AUTO_TEST_SUITE(UtilitiesJsonConverter) BOOST_AUTO_TEST_CASE(BinUtilityRoundTripTests) { - BinUtility reference(2, 0., 4., open, BinningValue::binR); + BinUtility reference(2, 0., 4., open, AxisDirection::AxisR); std::ofstream out; @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(BinUtilityRoundTripTests) { // Increase to two dimensions reference += BinUtility(10., -std::numbers::pi, std::numbers::pi, closed, - BinningValue::binPhi); + AxisDirection::AxisPhi); nlohmann::json jtwoDimOut; to_json(jtwoDimOut, reference); out.open("BinUtility_2D.json"); @@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(BinUtilityRoundTripTests) { // Increase to three dimensions std::vector boundaries = {-4., -1.5, 0., 10.}; - reference += BinUtility(boundaries, open, BinningValue::binZ); + reference += BinUtility(boundaries, open, AxisDirection::AxisZ); nlohmann::json jthreeDimOut; to_json(jthreeDimOut, reference); out.open("BinUtility_3D.json"); diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoLayerBuilderTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoLayerBuilderTests.cpp index b45e188f9ec..abfe5461fc9 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoLayerBuilderTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoLayerBuilderTests.cpp @@ -56,8 +56,8 @@ BOOST_AUTO_TEST_CASE(TGeoLayerBuilderTests) { b0Config.sensorNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5", "PixelActiveo6"}; b0Config.localAxes = "XYZ"; - b0Config.parseRanges = {{BinningValue::binR, {0., 40_mm}}, - {BinningValue::binZ, {-60_mm, 15_mm}}}; + b0Config.parseRanges = {{AxisDirection::AxisR, {0., 40_mm}}, + {AxisDirection::AxisZ, {-60_mm, 15_mm}}}; b0Config.envelope = {0_mm, 0_mm}; TglConfig eAllConfig; @@ -65,9 +65,9 @@ BOOST_AUTO_TEST_CASE(TGeoLayerBuilderTests) { eAllConfig.sensorNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5", "PixelActiveo6"}; eAllConfig.localAxes = "XYZ"; - eAllConfig.parseRanges = {{BinningValue::binR, {0., 40_mm}}, - {BinningValue::binZ, {16_mm, 60_mm}}}; - eAllConfig.splitConfigs = {{BinningValue::binZ, 5_mm}}; + eAllConfig.parseRanges = {{AxisDirection::AxisR, {0., 40_mm}}, + {AxisDirection::AxisZ, {16_mm, 60_mm}}}; + eAllConfig.splitConfigs = {{AxisDirection::AxisZ, 5_mm}}; eAllConfig.envelope = {0_mm, 0_mm}; std::vector cConfigs = {b0Config}; diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoParserTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoParserTests.cpp index 1292d311b84..78fd673d0bf 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoParserTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoParserTests.cpp @@ -78,8 +78,8 @@ BOOST_AUTO_TEST_CASE(TGeoParser_Pixel_SelectInnermost) { tgpOptions.volumeNames = {volumeName}; tgpOptions.targetNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5", "PixelActiveo6"}; - tgpOptions.parseRanges.push_back({BinningValue::binR, {0., 40.}}); - tgpOptions.parseRanges.push_back({BinningValue::binZ, {-60., 15.}}); + tgpOptions.parseRanges.push_back({AxisDirection::AxisR, {0., 40.}}); + tgpOptions.parseRanges.push_back({AxisDirection::AxisZ, {-60., 15.}}); tgpOptions.unit = 10.; std::string axes = "XYZ"; diff --git a/docs/_extensions/lazy_autodoc.py b/docs/_extensions/lazy_autodoc.py index 3c9513c4268..a2f455c561a 100644 --- a/docs/_extensions/lazy_autodoc.py +++ b/docs/_extensions/lazy_autodoc.py @@ -131,9 +131,8 @@ def run() -> None: } role_instances["enum"] = { - "Acts::BinningValue", + "Acts::AxisDirection", "Acts::BinningType", - "Acts::BinningValue", "Acts::BoundIndices", "Acts::FreeIndices", "Acts::MagneticFieldError", diff --git a/docs/getting_started.md b/docs/getting_started.md index 03365dd9f40..2b99227a1e7 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -41,7 +41,6 @@ components: - [Pythia8](https://pythia.org) for some examples - [ROOT](https://root.cern.ch) >= 6.20 for the TGeo plugin and the examples - [Sphinx](https://www.sphinx-doc.org) >= 2.0 with [Breathe](https://breathe.readthedocs.io/en/latest/), [Exhale](https://exhale.readthedocs.io/en/latest/), and [recommonmark](https://recommonmark.readthedocs.io/en/latest/index.html) extensions for the documentation -- [cugraph](https://github.com/rapidsai/cugraph) for the Exa.TrkX plugin - [libtorch](https://pytorch.org/cppdocs/installing.html) for the Exa.TrkX plugin - [Pybind11](https://github.com/pybind/pybind11) for the Python bindings of the examples