From b7a3e59a8006ed7a71786ff5af36ac01c2e4d73b Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Wed, 3 Jul 2024 21:05:14 +0200 Subject: [PATCH] refactor!: BinningValue becomes a strong enum (#3337) --- Core/include/Acts/Detector/ProtoBinning.hpp | 6 +- Core/include/Acts/Detector/ProtoSupport.hpp | 4 +- .../Detector/detail/ReferenceGenerators.hpp | 2 +- .../Acts/Geometry/CuboidVolumeBounds.hpp | 3 +- .../Geometry/CutoutCylinderVolumeBounds.hpp | 3 +- .../Acts/Geometry/CylinderVolumeBounds.hpp | 3 +- Core/include/Acts/Geometry/Extent.hpp | 141 ++++++-- .../Geometry/GenericCuboidVolumeBounds.hpp | 3 +- .../Acts/Geometry/GeometryObjectSorter.hpp | 27 +- .../Acts/Geometry/ILayerArrayCreator.hpp | 2 +- .../Acts/Geometry/LayerArrayCreator.hpp | 2 +- Core/include/Acts/Geometry/ProtoLayer.hpp | 2 +- .../Acts/Geometry/SurfaceArrayCreator.hpp | 20 +- .../Acts/Geometry/SurfaceBinningMatcher.hpp | 7 +- Core/include/Acts/Geometry/VolumeBounds.hpp | 3 +- .../Acts/Seeding/SeedFinderOrthogonal.ipp | 4 +- Core/include/Acts/Surfaces/SurfaceArray.hpp | 5 +- Core/include/Acts/Utilities/BinAdjustment.hpp | 19 +- .../Acts/Utilities/BinAdjustmentVolume.hpp | 27 +- Core/include/Acts/Utilities/BinUtility.hpp | 4 +- Core/include/Acts/Utilities/BinningData.hpp | 16 +- Core/include/Acts/Utilities/BinningType.hpp | 41 ++- Core/include/Acts/Utilities/Helpers.hpp | 6 + Core/include/Acts/Utilities/VectorHelpers.hpp | 18 +- .../src/Detector/CuboidalContainerBuilder.cpp | 20 +- .../Detector/CylindricalContainerBuilder.cpp | 21 +- .../IndexedRootVolumeFinderBuilder.cpp | 6 +- Core/src/Detector/LayerStructureBuilder.cpp | 23 +- Core/src/Detector/ProtoDetector.cpp | 2 +- Core/src/Detector/VolumeStructureBuilder.cpp | 34 +- Core/src/Detector/detail/BlueprintHelper.cpp | 35 +- .../detail/CuboidalDetectorHelper.cpp | 51 +-- .../detail/CylindricalDetectorHelper.cpp | 29 +- .../detail/DetectorVolumeConsistency.cpp | 3 +- .../Detector/detail/SupportSurfacesHelper.cpp | 59 +-- Core/src/Geometry/CuboidVolumeBounds.cpp | 12 +- Core/src/Geometry/CuboidVolumeBuilder.cpp | 18 +- Core/src/Geometry/CylinderVolumeBounds.cpp | 7 +- Core/src/Geometry/CylinderVolumeBuilder.cpp | 4 +- Core/src/Geometry/CylinderVolumeHelper.cpp | 27 +- Core/src/Geometry/CylinderVolumeStack.cpp | 15 +- Core/src/Geometry/Extent.cpp | 116 +++--- .../KDTreeTrackingGeometryBuilder.cpp | 12 +- Core/src/Geometry/LayerArrayCreator.cpp | 8 +- Core/src/Geometry/LayerCreator.cpp | 180 +++++----- Core/src/Geometry/Polyhedron.cpp | 11 +- Core/src/Geometry/ProtoLayerHelper.cpp | 2 +- Core/src/Geometry/SurfaceArrayCreator.cpp | 186 +++++----- Core/src/Geometry/TrackingVolume.cpp | 19 +- .../Geometry/TrackingVolumeArrayCreator.cpp | 2 +- Core/src/Geometry/Volume.cpp | 2 +- Core/src/Material/MaterialGridHelper.cpp | 31 +- Core/src/Surfaces/ConeSurface.cpp | 7 +- Core/src/Surfaces/CylinderSurface.cpp | 15 +- Core/src/Surfaces/DiscSurface.cpp | 21 +- Core/src/Utilities/BinningType.cpp | 53 +++ Core/src/Utilities/CMakeLists.txt | 1 + Core/src/Visualization/GeometryView3D.cpp | 10 +- .../ActsExamples/Digitization/Smearers.hpp | 4 +- .../Digitization/scripts/smearing-config.py | 2 +- .../src/DigitizationConfigurator.cpp | 74 ++-- .../src/TelescopeG4DetectorConstruction.cpp | 4 +- .../MappingMaterialDecorator.hpp | 31 +- .../TrackFinding/src/SeedingAlgorithm.cpp | 4 +- .../GenericDetector/BuildGenericDetector.hpp | 14 +- .../GenericDetector/ProtoLayerCreatorT.hpp | 13 +- .../TGeoDetector/src/TGeoDetector.cpp | 27 +- Fatras/src/Digitization/Segmentizer.cpp | 3 +- .../Acts/Plugins/ActSVG/GridSvgConverter.hpp | 19 +- .../ActSVG/IndexedSurfacesSvgConverter.hpp | 21 +- Plugins/ActSVG/src/LayerSvgConverter.cpp | 3 +- Plugins/ActSVG/src/PortalSvgConverter.cpp | 6 +- .../ActSVG/src/SurfaceArraySvgConverter.cpp | 12 +- .../Plugins/DD4hep/DD4hepBinningHelpers.hpp | 16 +- Plugins/DD4hep/src/DD4hepBinningHelpers.cpp | 9 +- Plugins/DD4hep/src/DD4hepBlueprintFactory.cpp | 30 +- Plugins/DD4hep/src/DD4hepLayerBuilder.cpp | 76 ++-- Plugins/DD4hep/src/DD4hepLayerStructure.cpp | 2 +- Plugins/DD4hep/src/DD4hepMaterialHelpers.cpp | 7 +- .../GeoModel/detail/GeoModelBinningHelper.hpp | 2 +- .../GeoModel/src/GeoModelBlueprintCreater.cpp | 12 +- .../src/detail/GeoModelExtentHelper.cpp | 14 +- .../Acts/Plugins/Json/DetrayJsonHelper.hpp | 18 +- .../Plugins/Json/IndexedGridJsonHelper.hpp | 4 +- Plugins/Json/src/ExtentJsonConverter.cpp | 34 +- Plugins/Json/src/GridJsonConverter.cpp | 177 +++++---- Plugins/Json/src/MaterialJsonConverter.cpp | 20 +- Plugins/Json/src/MaterialMapJsonConverter.cpp | 42 +-- Plugins/Json/src/PortalJsonConverter.cpp | 6 +- Plugins/TGeo/src/TGeoLayerBuilder.cpp | 24 +- Tests/Benchmarks/BinUtilityBenchmark.cpp | 9 +- .../CylindricalTrackingGeometry.hpp | 6 +- .../Core/Detector/BlueprintHelperTests.cpp | 15 +- .../Core/Detector/BlueprintTests.cpp | 2 +- .../CuboidalContainerBuilderTests.cpp | 21 +- .../CuboidalDetectorFromBlueprintTests.cpp | 90 +++-- .../Detector/CuboidalDetectorHelperTests.cpp | 42 ++- .../CylindricalContainerBuilderTests.cpp | 23 +- .../CylindricalDetectorFromBlueprintTests.cpp | 12 +- .../Detector/DetectorVolumeBuilderTests.cpp | 5 +- .../DetectorVolumeConsistencyTests.cpp | 20 +- .../Core/Detector/DetectorVolumeTests.cpp | 8 +- .../IndexedRootVolumeFinderBuilderTests.cpp | 3 +- .../IndexedSurfaceGridFillerTests.cpp | 22 +- .../IndexedSurfacesGeneratorTests.cpp | 14 +- .../Detector/KdtSurfacesProviderTests.cpp | 11 +- .../Detector/LayerStructureBuilderTests.cpp | 33 +- .../MultiWireStructureBuilderTests.cpp | 9 +- .../Core/Detector/ProtoBinningTests.cpp | 41 ++- .../Core/Detector/ProtoDetectorTests.cpp | 52 +-- .../Detector/ReferenceGeneratorsTests.cpp | 4 +- .../Detector/SupportSurfacesHelperTests.cpp | 42 +-- .../Detector/VolumeStructureBuilderTests.cpp | 10 +- .../Core/Geometry/CuboidVolumeBoundsTests.cpp | 10 +- .../CutoutCylinderVolumeBoundsTests.cpp | 2 +- .../Geometry/CylinderVolumeBoundsTests.cpp | 2 +- .../Geometry/CylinderVolumeStackTests.cpp | 32 +- Tests/UnitTests/Core/Geometry/ExtentTests.cpp | 122 +++---- .../KDTreeTrackingGeometryBuilderTests.cpp | 53 +-- .../Core/Geometry/LayerCreatorTests.cpp | 26 +- .../Core/Geometry/PolyhedronTests.cpp | 51 +-- .../Core/Geometry/ProtoLayerHelperTests.cpp | 18 +- .../Core/Geometry/ProtoLayerTests.cpp | 47 +-- .../Geometry/SurfaceArrayCreatorTests.cpp | 6 +- .../Geometry/SurfaceBinningMatcherTests.cpp | 22 +- .../Core/Geometry/TrackingVolumeCreation.hpp | 9 +- Tests/UnitTests/Core/Geometry/VolumeTests.cpp | 3 +- .../AccumulatedSurfaceMaterialTests.cpp | 10 +- .../BinnedSurfaceMaterialAccumulaterTests.cpp | 6 +- .../Material/BinnedSurfaceMaterialTests.cpp | 4 +- .../Core/Material/MaterialGridHelperTests.cpp | 20 +- .../PropagatorMaterialAssignerTests.cpp | 8 +- .../Material/ProtoSurfaceMaterialTests.cpp | 4 +- .../Material/ProtoVolumeMaterialTests.cpp | 6 +- .../Material/SurfaceMaterialMapperTests.cpp | 2 +- .../Material/VolumeMaterialMapperTests.cpp | 18 +- .../Navigation/DetectorVolumeFindersTests.cpp | 4 +- .../Navigation/MultiWireNavigationTests.cpp | 9 +- .../NavigationStateUpdatersTests.cpp | 7 +- .../Core/Navigation/PortalNavigationTests.cpp | 6 +- .../Core/Surfaces/ConeSurfaceTests.cpp | 38 +- .../Core/Surfaces/CylinderSurfaceTests.cpp | 125 ++++--- .../Core/Surfaces/DiscSurfaceTests.cpp | 165 +++++---- .../Core/Surfaces/LineSurfaceTests.cpp | 4 +- .../Core/Surfaces/PlaneSurfaceTests.cpp | 41 ++- .../Core/Surfaces/PolyhedronSurfacesTests.cpp | 340 +++++++++--------- .../Core/Surfaces/SurfaceArrayTests.cpp | 4 +- .../Core/Utilities/BinAdjustmentTests.cpp | 16 +- .../Utilities/BinAdjustmentVolumeTests.cpp | 18 +- .../Core/Utilities/BinUtilityTests.cpp | 18 +- .../Core/Utilities/BinningDataTests.cpp | 70 ++-- .../Core/Utilities/GridAccessHelpersTests.cpp | 23 +- .../Io/Json/JsonDigitizationConfigTests.cpp | 6 +- .../Digitization/PlanarSurfaceTestBeds.hpp | 29 +- .../Fatras/Digitization/SegmentizerTests.cpp | 20 +- .../ActSVG/DetectorSvgConverterTests.cpp | 6 +- .../DetectorVolumeSvgConverterTests.cpp | 13 +- .../Plugins/ActSVG/GridSvgConverterTests.cpp | 27 +- .../IndexedSurfacesSvgConverterTests.cpp | 14 +- .../DD4hepCylinderLayerStructureTests.cpp | 9 +- .../Geant4/Geant4SurfaceProviderTests.cpp | 5 +- .../Json/DetectorJsonConverterTests.cpp | 19 +- ...DetectorVolumeFinderJsonConverterTests.cpp | 3 +- .../Json/DetectorVolumeJsonConverterTests.cpp | 13 +- .../Plugins/Json/EqualityHelpers.hpp | 2 +- .../Plugins/Json/ExtentJsonConverterTests.cpp | 18 +- .../Plugins/Json/GridJsonConverterTests.cpp | 42 ++- .../Json/MaterialJsonConverterTests.cpp | 15 +- .../Plugins/Json/PortalJsonConverterTests.cpp | 2 +- .../Json/ProtoDetectorJsonConverterTests.cpp | 198 +++++----- .../Json/UtilitiesJsonConverterTests.cpp | 6 +- .../Plugins/TGeo/TGeoLayerBuilderTests.cpp | 8 +- .../Plugins/TGeo/TGeoParserTests.cpp | 4 +- 173 files changed, 2536 insertions(+), 1926 deletions(-) create mode 100644 Core/src/Utilities/BinningType.cpp diff --git a/Core/include/Acts/Detector/ProtoBinning.hpp b/Core/include/Acts/Detector/ProtoBinning.hpp index cba09182a04..8d5d4db8374 100644 --- a/Core/include/Acts/Detector/ProtoBinning.hpp +++ b/Core/include/Acts/Detector/ProtoBinning.hpp @@ -28,7 +28,7 @@ namespace Acts::Experimental { /// translated into concrete axis types struct ProtoBinning { /// The binning value of this - BinningValue binValue = BinningValue::binValues; + BinningValue binValue; /// The axis type: equidistant or variable Acts::AxisType axisType = Acts::AxisType::Equidistant; /// The axis boundary type: Open, Bound or Closed @@ -73,7 +73,7 @@ struct ProtoBinning { : binValue(bValue), boundaryType(bType), expansion(exp) { if (minE >= maxE) { std::string msg = "ProtoBinning: Invalid binning for value '"; - msg += binningValueNames()[bValue]; + msg += binningValueName(bValue); msg += "', min edge (" + std::to_string(minE) + ") "; msg += " needs to be smaller than max edge ("; msg += std::to_string(maxE) + ")."; @@ -116,7 +116,7 @@ struct ProtoBinning { std::string toString() const { std::stringstream ss; ss << "ProtoBinning: " << bins() << " bins in " - << binningValueNames()[binValue]; + << binningValueName(binValue); ss << (axisType == Acts::AxisType::Variable ? ", variable " : ", equidistant "); if (!autorange) { diff --git a/Core/include/Acts/Detector/ProtoSupport.hpp b/Core/include/Acts/Detector/ProtoSupport.hpp index 1c2d5bc4899..55f8110a3a2 100644 --- a/Core/include/Acts/Detector/ProtoSupport.hpp +++ b/Core/include/Acts/Detector/ProtoSupport.hpp @@ -47,7 +47,7 @@ struct ProtoSupport { /// The volume envelope/clearance parameters: these are chosen such that the /// support surface does not touch the volume extent - ExtentEnvelope volumeClearance = zeroEnvelopes; + ExtentEnvelope volumeClearance = ExtentEnvelope::Zero(); /// The constrain(s) from the internal surfaces, done by parsing /// the polyhedron vertices of the internal objects before support building @@ -69,7 +69,7 @@ struct ProtoSupport { unsigned int splits = 1u; /// Planar placement (only valid for planar support surfaces) - BinningValue pPlacement = binZ; + BinningValue pPlacement = BinningValue::binZ; /// Indicate if the support surface(s) should always be addressed in /// navigation diff --git a/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp b/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp index ab72f16d62e..8d03d515bb3 100644 --- a/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp +++ b/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp @@ -41,7 +41,7 @@ struct CenterReferenceGenerator { /// /// This generator will provide only one filling point and hence /// only a single bin in the indexed grid. -template +template struct BinningValueReferenceGenerator { /// Helper to access a reference position based on binning value /// diff --git a/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp b/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp index 75344e256a2..d0c7a1b604d 100644 --- a/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp @@ -124,7 +124,8 @@ class CuboidVolumeBounds : public VolumeBounds { /// /// @return vector of canonical binning values std::vector canonicalBinning() const override { - return {Acts::binX, Acts::binY, Acts::binZ}; + return {Acts::BinningValue::binX, Acts::BinningValue::binY, + Acts::BinningValue::binZ}; }; /// Binning borders in ActsScalar diff --git a/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp b/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp index 949da0f778d..2930b0fb22d 100644 --- a/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp @@ -119,7 +119,8 @@ class CutoutCylinderVolumeBounds : public VolumeBounds { /// /// @return vector of canonical binning values std::vector canonicalBinning() const override { - return {Acts::binR, Acts::binPhi, Acts::binZ}; + return {Acts::BinningValue::binR, Acts::BinningValue::binPhi, + Acts::BinningValue::binZ}; }; /// Write information about this instance to an outstream diff --git a/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp b/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp index 3f16bd6a6f5..c5a28a4edb7 100644 --- a/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp @@ -163,7 +163,8 @@ class CylinderVolumeBounds : public VolumeBounds { /// /// @return vector of canonical binning values std::vector canonicalBinning() const override { - return {Acts::binR, Acts::binPhi, Acts::binZ}; + return {Acts::BinningValue::binR, Acts::BinningValue::binPhi, + Acts::BinningValue::binZ}; }; /// Binning offset - overloaded for some R-binning types diff --git a/Core/include/Acts/Geometry/Extent.hpp b/Core/include/Acts/Geometry/Extent.hpp index 2c5b2b8d9f1..ac9a01e2386 100644 --- a/Core/include/Acts/Geometry/Extent.hpp +++ b/Core/include/Acts/Geometry/Extent.hpp @@ -13,6 +13,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Enumerate.hpp" +#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/RangeXD.hpp" #include @@ -24,12 +25,74 @@ namespace Acts { using Envelope = std::array; -using ExtentEnvelope = std::array; constexpr Envelope zeroEnvelope = {0, 0}; -constexpr ExtentEnvelope zeroEnvelopes = { - zeroEnvelope, zeroEnvelope, zeroEnvelope, zeroEnvelope, - zeroEnvelope, zeroEnvelope, zeroEnvelope, zeroEnvelope}; + +/// This struct models a multi-dimensional enveloper along the binning values +struct ExtentEnvelope { + /// Access a single envelope configuration + /// @param bValue the binning value + /// @return the envelope + Envelope& operator[](BinningValue bValue) { + return m_values.at(toUnderlying(bValue)); + } + + /// Access a single envelope configuration + /// @param bValue the binning value + /// @return the envelope + const Envelope& operator[](BinningValue bValue) const { + return m_values.at(toUnderlying(bValue)); + } + + /// Constructor from a single envelope that is assigned to all values + /// @param envelope the envelope to be assigned + explicit ExtentEnvelope(const Envelope& envelope = zeroEnvelope) { + for (auto& val : m_values) { + val = envelope; + } + } + + /// Constructor from an array of envelopes + /// @param values the array of envelopes + constexpr explicit ExtentEnvelope( + const std::array& values) + : m_values(values) {} + + /// Static factory for a zero envelope + /// @return the zero envelope + constexpr static ExtentEnvelope Zero() { + return ExtentEnvelope{{ + zeroEnvelope, + zeroEnvelope, + zeroEnvelope, + zeroEnvelope, + zeroEnvelope, + zeroEnvelope, + zeroEnvelope, + zeroEnvelope, + zeroEnvelope, + }}; + } + + /// Comparison operator between envelope sets + /// @param lhs the left hand side + /// @param rhs the right hand side + /// @return true if the envelopes are equal + friend bool operator==(const ExtentEnvelope& lhs, const ExtentEnvelope& rhs) { + return lhs.m_values == rhs.m_values; + } + + /// Comparison operator between envelope sets + /// @param lhs the left hand side + /// @param rhs the right hand side + /// @return true if the envelopes are not equal + friend bool operator!=(const ExtentEnvelope& lhs, const ExtentEnvelope& rhs) { + return !(lhs.m_values == rhs.m_values); + } + + private: + 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 @@ -40,7 +103,7 @@ constexpr ExtentEnvelope zeroEnvelopes = { class Extent { public: /// Constructor with (optional) @param envelope - Extent(const ExtentEnvelope& envelope = zeroEnvelopes); + explicit Extent(const ExtentEnvelope& envelope = ExtentEnvelope::Zero()); /// Define a comparison operator bool operator==(const Extent& e) const; @@ -56,7 +119,7 @@ class Extent { /// @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 = s_binningValues, + const std::vector& bValues = allBinningValues(), bool applyEnv = true, bool fillHistograms = false); /// Extend with a set of vectors by iterators @@ -69,7 +132,7 @@ class Extent { /// to fill this extent should be stored template void extend(const vector_iterator_t& start, const vector_iterator_t& end, - const std::vector& bValues = s_binningValues, + const std::vector& bValues = allBinningValues(), bool applyEnv = true, bool fillHistograms = false) { for (vector_iterator_t vIt = start; vIt < end; ++vIt) { extend(*vIt, bValues, applyEnv, fillHistograms); @@ -91,7 +154,7 @@ class Extent { /// /// @note that the histogram values can not be filled in this call void extend(const Extent& rhs, - const std::vector& bValues = s_binningValues, + const std::vector& bValues = allBinningValues(), bool applyEnv = true); /// Constrain an extent by another one, this is @@ -102,7 +165,7 @@ class Extent { /// /// @param envelope an envelope applied to the constrained value void addConstrain(const Extent& rhs, - const ExtentEnvelope& envelope = zeroEnvelopes); + const ExtentEnvelope& envelope = ExtentEnvelope::Zero()); /// Set a range for a dedicated binning value /// @@ -126,14 +189,14 @@ class Extent { /// (re-)Set the envelope /// /// @param envelope new envelope to be set - void setEnvelope(const ExtentEnvelope& envelope = zeroEnvelopes); + void setEnvelope(const ExtentEnvelope& envelope = ExtentEnvelope::Zero()); /// Return the individual 1-dimensional range /// /// @param bValue is the binning value to be returned /// /// @return a one dimensional arrange - auto range(BinningValue bValue) { return m_range[bValue]; } + auto range(BinningValue bValue) { return m_range[toUnderlying(bValue)]; } /// Return the individual 1-dimensional range /// @@ -143,10 +206,13 @@ class Extent { Range1D range(BinningValue bValue) 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 @param binValues + /// the given binvalues + /// @tparam kSUBDIM the number of sub dimensions + /// @param binValues the binning values + /// @return the sub range template RangeXD range( const std::array& binValues) const { @@ -166,40 +232,47 @@ class Extent { /// Return the histogram store /// /// The histogram store can be used for automated binning detection - const std::array, binValues>& valueHistograms() const; + const std::array, numBinningValues()>& + valueHistograms() const; /// Access the minimum parameter /// /// @param bValue the binning identification - ActsScalar min(BinningValue bValue) const { return m_range[bValue].min(); } + ActsScalar min(BinningValue bValue) const { + return m_range[toUnderlying(bValue)].min(); + } /// Access the maximum parameter /// /// @param bValue the binning identification - ActsScalar max(BinningValue bValue) const { return m_range[bValue].max(); } + ActsScalar max(BinningValue bValue) const { + return m_range[toUnderlying(bValue)].max(); + } /// Access the midpoint /// /// @param bValue the binning identification ActsScalar medium(BinningValue bValue) const { - return 0.5 * (m_range[bValue].min() + m_range[bValue].max()); + return 0.5 * (m_range[toUnderlying(bValue)].min() + + m_range[toUnderlying(bValue)].max()); } /// Access the parameter interval (i.e. the range span) /// /// @param bValue the binning identification ActsScalar interval(BinningValue bValue) const { - return m_range[bValue].size(); + return m_range[toUnderlying(bValue)].size(); } /// Contains check /// /// @param rhs the extent that is check if it is contained - /// @param bValue is the binning value, if set to binValues + /// @param bValue is the binning value, if set to nullopt /// the check on all is done /// /// @return true if the rhs is contained - bool contains(const Extent& rhs, BinningValue bValue = binValues) const; + bool contains(const Extent& rhs, + std::optional bValue = std::nullopt) const; /// Contains check for a single point /// @@ -211,16 +284,20 @@ class Extent { /// Intersection checks /// /// @param rhs the extent that is check for intersection - /// @param bValue is the binning value, if set to binValues + /// @param bValue is the binning value, if set to nulloptr /// the check on all is done /// /// @return true if the rhs intersects - bool intersects(const Extent& rhs, BinningValue bValue = binValues) const; + bool intersects(const Extent& rhs, + std::optional bValue = std::nullopt) const; - /// Constraints check + /// Check if this object constrains a given direction /// - /// @param bValue is the binning value, if all the check on all is done - bool constrains(BinningValue bValue = binValues) const; + /// @param bValue is the binning value + bool constrains(BinningValue bValue) const; + + /// Check if this object constrains any direction + bool constrains() const; /// Convert to output stream for screen output /// @@ -229,20 +306,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 = zeroEnvelopes; + ExtentEnvelope m_envelope = ExtentEnvelope::Zero(); /// (Optional) Value histograms for bin detection - std::array, binValues> m_valueHistograms; + std::array, numBinningValues()> m_valueHistograms; }; inline Range1D Acts::Extent::range(BinningValue bValue) const { - return m_range[bValue]; + return m_range[toUnderlying(bValue)]; } -inline const RangeXD& Extent::range() const { +inline const RangeXD& Extent::range() const { return m_range; } @@ -254,7 +331,7 @@ inline const ExtentEnvelope& Extent::envelope() const { return m_envelope; } -inline const std::array, binValues>& +inline const std::array, numBinningValues()>& Extent::valueHistograms() const { return m_valueHistograms; } diff --git a/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp b/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp index 742fba0d623..a905f79f4a4 100644 --- a/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp @@ -94,7 +94,8 @@ class GenericCuboidVolumeBounds : public VolumeBounds { /// /// @return vector of canonical binning values std::vector canonicalBinning() const override { - return {Acts::binX, Acts::binY, Acts::binZ}; + return {Acts::BinningValue::binX, Acts::BinningValue::binY, + Acts::BinningValue::binZ}; }; /// @param sl is the output stream to be written into diff --git a/Core/include/Acts/Geometry/GeometryObjectSorter.hpp b/Core/include/Acts/Geometry/GeometryObjectSorter.hpp index 2daf1a66e7e..bc0def1fafd 100644 --- a/Core/include/Acts/Geometry/GeometryObjectSorter.hpp +++ b/Core/include/Acts/Geometry/GeometryObjectSorter.hpp @@ -41,30 +41,31 @@ class ObjectSorterT { using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; // switch the binning value - // - binX, binY, binZ, binR, binPhi, binRPhi, binH, binEta + // - BinningValue::binX, BinningValue::binY, BinningValue::binZ, binR, + // binPhi, binRPhi, binH, binEta switch (m_binningValue) { // compare on x - case binX: { + case BinningValue::binX: { return one.x() < two.x(); } // compare on y - case binY: { + case BinningValue::binY: { return one.y() < two.y(); } // compare on z - case binZ: { + case BinningValue::binZ: { return one.z() < two.z(); } // compare on r - case binR: { + case BinningValue::binR: { return perp(one) < perp(two); } // compare on phi - case binPhi: { + case BinningValue::binPhi: { return phi(one) < phi(two); } // compare on eta - case binEta: { + case BinningValue::binEta: { return eta(one) < eta(two); } // default for the moment @@ -109,37 +110,37 @@ class DistanceSorterT { // - binX, binY, binZ, binR, binPhi, binRPhi, binH, binEta switch (m_binningValue) { // compare on diff x - case binX: { + case BinningValue::binX: { 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 binY: { + case BinningValue::binY: { 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 binZ: { + case BinningValue::binZ: { 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 binR: { + case BinningValue::binR: { 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 binPhi: { + case BinningValue::binPhi: { double diffOnePhi = phi(one) - m_refPhi; double diffTwoPhi = phi(two) - m_refPhi; return std::abs(diffOnePhi) < std::abs(diffTwoPhi); } // compare on eta - case binEta: { + case BinningValue::binEta: { double diffOneEta = eta(one) - m_refEta; double diffTwoEta = eta(two) - m_refEta; return std::abs(diffOneEta) < std::abs(diffTwoEta); diff --git a/Core/include/Acts/Geometry/ILayerArrayCreator.hpp b/Core/include/Acts/Geometry/ILayerArrayCreator.hpp index 602c8b9397f..9cfabed7511 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 = binX) const = 0; + BinningValue bvalue = BinningValue::binX) const = 0; }; } // namespace Acts diff --git a/Core/include/Acts/Geometry/LayerArrayCreator.hpp b/Core/include/Acts/Geometry/LayerArrayCreator.hpp index 22ce71c801b..f142ec026c6 100644 --- a/Core/include/Acts/Geometry/LayerArrayCreator.hpp +++ b/Core/include/Acts/Geometry/LayerArrayCreator.hpp @@ -60,7 +60,7 @@ class LayerArrayCreator : public ILayerArrayCreator { std::unique_ptr layerArray( const GeometryContext& gctx, const LayerVector& layersInput, double min, double max, BinningType bType = arbitrary, - BinningValue bValue = binX) const override; + BinningValue bValue = BinningValue::binX) const override; /// set logging instance void setLogger(std::unique_ptr logger) { diff --git a/Core/include/Acts/Geometry/ProtoLayer.hpp b/Core/include/Acts/Geometry/ProtoLayer.hpp index cad4b6ef1bd..39f6827b23f 100644 --- a/Core/include/Acts/Geometry/ProtoLayer.hpp +++ b/Core/include/Acts/Geometry/ProtoLayer.hpp @@ -31,7 +31,7 @@ struct ProtoLayer { Extent extent; /// The envelope parameters - ExtentEnvelope envelope = zeroEnvelopes; + ExtentEnvelope envelope = ExtentEnvelope::Zero(); /// Constructor /// diff --git a/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp b/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp index 46965a8db91..6b6db768a2d 100644 --- a/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp +++ b/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp @@ -242,10 +242,10 @@ class SurfaceArrayCreator { using namespace UnitLiterals; using VectorHelpers::perp; - if (bValue == Acts::binPhi) { + if (bValue == Acts::BinningValue::binPhi) { // Take the two binning positions - auto pos1 = a->binningPosition(gctx, binR), - pos2 = b->binningPosition(gctx, binR); + auto pos1 = a->binningPosition(gctx, BinningValue::binR), + pos2 = b->binningPosition(gctx, BinningValue::binR); // Project them on the (x, y) plane, where Phi angles are calculated auto proj1 = pos1.head<2>(), proj2 = pos2.head<2>(); @@ -260,14 +260,16 @@ class SurfaceArrayCreator { return std::abs(dPhi) < M_PI / 180.; } - if (bValue == Acts::binZ) { - return (std::abs(a->binningPosition(gctx, binR).z() - - b->binningPosition(gctx, binR).z()) < 1_um); + if (bValue == Acts::BinningValue::binZ) { + return (std::abs(a->binningPosition(gctx, BinningValue::binR).z() - + b->binningPosition(gctx, BinningValue::binR).z()) < + 1_um); } - if (bValue == Acts::binR) { - return (std::abs(perp(a->binningPosition(gctx, binR)) - - perp(b->binningPosition(gctx, binR))) < 1_um); + if (bValue == Acts::BinningValue::binR) { + return (std::abs(perp(a->binningPosition(gctx, BinningValue::binR)) - + perp(b->binningPosition(gctx, BinningValue::binR))) < + 1_um); } return false; diff --git a/Core/include/Acts/Geometry/SurfaceBinningMatcher.hpp b/Core/include/Acts/Geometry/SurfaceBinningMatcher.hpp index fb98000089a..624fe01193c 100644 --- a/Core/include/Acts/Geometry/SurfaceBinningMatcher.hpp +++ b/Core/include/Acts/Geometry/SurfaceBinningMatcher.hpp @@ -20,7 +20,7 @@ namespace Acts { struct SurfaceBinningMatcher { /// The binning tolerance parameters using Range = std::pair; - std::vector tolerances{static_cast(binValues), {0., 0.}}; + std::vector tolerances{static_cast(numBinningValues()), {0., 0.}}; SurfaceBinningMatcher() = default; @@ -49,8 +49,9 @@ struct SurfaceBinningMatcher { double otherMin = otherExt.min(bValue); double otherMax = otherExt.max(bValue); - return (std::abs(oneMin - otherMin) <= tolerances[bValue].first && - std::abs(oneMax - otherMax) <= tolerances[bValue].second); + return ( + std::abs(oneMin - otherMin) <= tolerances[toUnderlying(bValue)].first && + std::abs(oneMax - otherMax) <= tolerances[toUnderlying(bValue)].second); } }; diff --git a/Core/include/Acts/Geometry/VolumeBounds.hpp b/Core/include/Acts/Geometry/VolumeBounds.hpp index ffe139bd977..f2f4407cde5 100644 --- a/Core/include/Acts/Geometry/VolumeBounds.hpp +++ b/Core/include/Acts/Geometry/VolumeBounds.hpp @@ -124,7 +124,8 @@ class VolumeBounds { /// returns the bounding box binning. Individual shapes /// should override this method virtual std::vector canonicalBinning() const { - return {Acts::binX, Acts::binY, Acts::binZ}; + return {Acts::BinningValue::binX, Acts::BinningValue::binY, + Acts::BinningValue::binZ}; }; /// Binning offset - overloaded for some R-binning types diff --git a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp index 2a0ca55decc..3447263904f 100644 --- a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp +++ b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp @@ -750,9 +750,9 @@ void SeedFinderOrthogonal::createSeeds( } // variable middle SP radial region of interest const Acts::Range1D rMiddleSPRange( - std::floor(rRangeSPExtent.min(Acts::binR) / 2) * 2 + + std::floor(rRangeSPExtent.min(Acts::BinningValue::binR) / 2) * 2 + m_config.deltaRMiddleMinSPRange, - std::floor(rRangeSPExtent.max(Acts::binR) / 2) * 2 - + std::floor(rRangeSPExtent.max(Acts::BinningValue::binR) / 2) * 2 - m_config.deltaRMiddleMaxSPRange); /* diff --git a/Core/include/Acts/Surfaces/SurfaceArray.hpp b/Core/include/Acts/Surfaces/SurfaceArray.hpp index 21cfb72115c..39f1433ba9f 100644 --- a/Core/include/Acts/Surfaces/SurfaceArray.hpp +++ b/Core/include/Acts/Surfaces/SurfaceArray.hpp @@ -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, binR); + Vector3 pos = srf->binningPosition(gctx, BinningValue::binR); lookup(pos).push_back(srf); } @@ -194,7 +194,8 @@ class SurfaceArray { Vector3 binCtr = getBinCenter(b); minPath = std::numeric_limits::max(); for (const auto& srf : surfaces) { - curPath = (binCtr - srf->binningPosition(gctx, binR)).norm(); + curPath = + (binCtr - srf->binningPosition(gctx, BinningValue::binR)).norm(); if (curPath < minPath) { minPath = curPath; diff --git a/Core/include/Acts/Utilities/BinAdjustment.hpp b/Core/include/Acts/Utilities/BinAdjustment.hpp index 5fcc53fcb2b..f83af5971a8 100644 --- a/Core/include/Acts/Utilities/BinAdjustment.hpp +++ b/Core/include/Acts/Utilities/BinAdjustment.hpp @@ -55,12 +55,12 @@ static inline BinUtility adjustBinUtility(const BinUtility& bu, // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != binR && bval != binPhi) { + } else if (bval != BinningValue::binR && bval != BinningValue::binPhi) { throw std::invalid_argument("Disc binning must be: phi, r"); } float min = 0., max = 0.; // Perform the value adjustment - if (bval == binPhi) { + if (bval == BinningValue::binPhi) { min = minPhi; max = maxPhi; } else { @@ -106,15 +106,16 @@ static inline BinUtility adjustBinUtility(const BinUtility& bu, // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != binRPhi && bval != binPhi && bval != binZ) { + } else if (bval != BinningValue::binRPhi && bval != BinningValue::binPhi && + bval != BinningValue::binZ) { throw std::invalid_argument("Cylinder binning must be: rphi, phi, z"); } float min = 0., max = 0.; // Perform the value adjustment - if (bval == binPhi) { + if (bval == BinningValue::binPhi) { min = minPhi; max = maxPhi; - } else if (bval == binRPhi) { + } else if (bval == BinningValue::binRPhi) { min = cR * minPhi; max = cR * maxPhi; } else { @@ -158,12 +159,12 @@ static inline BinUtility adjustBinUtility(const BinUtility& bu, // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != binX && bval != binY) { + } else if (bval != BinningValue::binX && bval != BinningValue::binY) { throw std::invalid_argument("Rectangle binning must be: x, y. "); } float min = 0., max = 0.; // Perform the value adjustment - if (bval == binX) { + if (bval == BinningValue::binX) { min = minX; max = maxX; } else { @@ -208,12 +209,12 @@ static inline BinUtility adjustBinUtility(const BinUtility& bu, // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != binX && bval != binY) { + } else if (bval != BinningValue::binX && bval != BinningValue::binY) { throw std::invalid_argument("Rectangle binning must be: x, y. "); } float min = 0., max = 0.; // Perform the value adjustment - if (bval == binX) { + if (bval == BinningValue::binX) { min = -1 * halfX; max = halfX; } else { diff --git a/Core/include/Acts/Utilities/BinAdjustmentVolume.hpp b/Core/include/Acts/Utilities/BinAdjustmentVolume.hpp index 9cb287ba2b1..7dfa6b77724 100644 --- a/Core/include/Acts/Utilities/BinAdjustmentVolume.hpp +++ b/Core/include/Acts/Utilities/BinAdjustmentVolume.hpp @@ -53,19 +53,20 @@ BinUtility adjustBinUtility(const BinUtility& bu, // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != binR && bval != binPhi && bval != binZ) { + } else if (bval != BinningValue::binR && bval != BinningValue::binPhi && + bval != BinningValue::binZ) { throw std::invalid_argument("Cylinder volume binning must be: phi, r, z"); } float min = 0; float max = 0; // Perform the value adjustment - if (bval == binPhi) { + if (bval == BinningValue::binPhi) { min = minPhi; max = maxPhi; - } else if (bval == binR) { + } else if (bval == BinningValue::binR) { min = minR; max = maxR; - } else if (bval == binZ) { + } else if (bval == BinningValue::binZ) { min = minZ; max = maxZ; } @@ -108,20 +109,21 @@ BinUtility adjustBinUtility(const BinUtility& bu, // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != binR && bval != binPhi && bval != binZ) { + } else if (bval != BinningValue::binR && bval != BinningValue::binPhi && + bval != BinningValue::binZ) { 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 == binPhi) { + if (bval == BinningValue::binPhi) { min = minPhi; max = maxPhi; - } else if (bval == binR) { + } else if (bval == BinningValue::binR) { min = minR; max = maxR; - } else if (bval == binZ) { + } else if (bval == BinningValue::binZ) { min = minZ; max = maxZ; } @@ -163,19 +165,20 @@ BinUtility adjustBinUtility(const BinUtility& bu, // - not equidistant if (bd.type == arbitrary) { throw std::invalid_argument("Arbitrary binning can not be adjusted."); - } else if (bval != binX && bval != binY && bval != binZ) { + } else if (bval != BinningValue::binX && bval != BinningValue::binY && + bval != BinningValue::binZ) { throw std::invalid_argument("Cylinder volume binning must be: x, y, z"); } float min = 0; float max = 0; // Perform the value adjustment - if (bval == binX) { + if (bval == BinningValue::binX) { min = minX; max = maxX; - } else if (bval == binY) { + } else if (bval == BinningValue::binY) { min = minY; max = maxY; - } else if (bval == binZ) { + } else if (bval == BinningValue::binZ) { min = minZ; max = maxZ; } diff --git a/Core/include/Acts/Utilities/BinUtility.hpp b/Core/include/Acts/Utilities/BinUtility.hpp index b4caa3af2c8..59a736dae68 100644 --- a/Core/include/Acts/Utilities/BinUtility.hpp +++ b/Core/include/Acts/Utilities/BinUtility.hpp @@ -72,7 +72,7 @@ class BinUtility { /// @param value is the binninb value : binX, binY, binZ, etc. /// @param tForm is the (optional) transform BinUtility(std::size_t bins, float min, float max, BinningOption opt = open, - BinningValue value = binX, + BinningValue value = BinningValue::binX, const Transform3& tForm = Transform3::Identity()) : m_binningData(), m_transform(tForm), m_itransform(tForm.inverse()) { m_binningData.reserve(3); @@ -86,7 +86,7 @@ class BinUtility { /// @param value is the binninb value : binX, binY, binZ, etc. /// @param tForm is the (optional) transform BinUtility(std::vector& bValues, BinningOption opt = open, - BinningValue value = binPhi, + BinningValue value = BinningValue::binPhi, const Transform3& tForm = Transform3::Identity()) : m_binningData(), m_transform(tForm), m_itransform(tForm.inverse()) { m_binningData.reserve(3); diff --git a/Core/include/Acts/Utilities/BinningData.hpp b/Core/include/Acts/Utilities/BinningData.hpp index ec6aebccfb6..01358a4f14c 100644 --- a/Core/include/Acts/Utilities/BinningData.hpp +++ b/Core/include/Acts/Utilities/BinningData.hpp @@ -10,6 +10,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/ThrowAssert.hpp" #include "Acts/Utilities/VectorHelpers.hpp" @@ -240,10 +241,11 @@ class BinningData { /// @return float value according to the binning setup float value(const Vector2& lposition) const { // ordered after occurrence - if (binvalue == binR || binvalue == binRPhi || binvalue == binX || - binvalue == binH) { + if (binvalue == BinningValue::binR || binvalue == BinningValue::binRPhi || + binvalue == BinningValue::binX || binvalue == BinningValue::binH) { return lposition[0]; } + return lposition[1]; } @@ -257,17 +259,17 @@ class BinningData { using VectorHelpers::perp; using VectorHelpers::phi; // ordered after occurrence - if (binvalue == binR || binvalue == binH) { + if (binvalue == BinningValue::binR || binvalue == BinningValue::binH) { return (perp(position)); } - if (binvalue == binRPhi) { + if (binvalue == BinningValue::binRPhi) { return (perp(position) * phi(position)); } - if (binvalue == binEta) { + if (binvalue == BinningValue::binEta) { return (eta(position)); } - if (binvalue < 3) { - return (position[binvalue]); + if (toUnderlying(binvalue) < 3) { + return position[toUnderlying(binvalue)]; } // phi gauging return phi(position); diff --git a/Core/include/Acts/Utilities/BinningType.hpp b/Core/include/Acts/Utilities/BinningType.hpp index db02077fec6..4ed8c35bbb4 100644 --- a/Core/include/Acts/Utilities/BinningType.hpp +++ b/Core/include/Acts/Utilities/BinningType.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2016-2018 CERN for the benefit of the Acts project +// Copyright (C) 2016-2024 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 @@ -8,6 +8,7 @@ #pragma once #include +#include #include namespace Acts { @@ -32,7 +33,7 @@ enum BinningType { equidistant, arbitrary }; enum BinningOption { open, closed }; /// @enum BinningValue how to take the global / local position -enum BinningValue : int { +enum class BinningValue : int { binX = 0, binY = 1, binZ = 2, @@ -41,19 +42,33 @@ enum BinningValue : int { binRPhi = 5, binH = 6, binEta = 7, - binMag = 8, - binValues = 9 + binMag = 8 }; -/// @brief static list of all binning values -static const std::vector s_binningValues = { - binX, binY, binZ, binR, binPhi, binRPhi, binH, binEta, binMag}; +/// Get all possible binning values +/// @return the binning values +const std::vector& allBinningValues(); -/// @brief screen output option -inline const std::vector& binningValueNames() { - static const std::vector _binningValueNames = { - "binX", "binY", "binZ", "binR", "binPhi", - "binRPhi", "binH", "binEta", "binMag"}; - return _binningValueNames; +/// 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/Helpers.hpp b/Core/include/Acts/Utilities/Helpers.hpp index 851a67b6048..5d9d2ab22eb 100644 --- a/Core/include/Acts/Utilities/Helpers.hpp +++ b/Core/include/Acts/Utilities/Helpers.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #define ACTS_CHECK_BIT(value, mask) ((value & mask) == mask) @@ -192,4 +193,9 @@ std::tuple range_medium(const T& tseries) { return std::tie(range, medium); } +template +constexpr std::underlying_type_t toUnderlying(enum_t value) { + return static_cast>(value); +} + } // namespace Acts diff --git a/Core/include/Acts/Utilities/VectorHelpers.hpp b/Core/include/Acts/Utilities/VectorHelpers.hpp index 84c0e6791da..ee0b04d87c8 100644 --- a/Core/include/Acts/Utilities/VectorHelpers.hpp +++ b/Core/include/Acts/Utilities/VectorHelpers.hpp @@ -154,23 +154,23 @@ inline std::array evaluateTrigonomics(const Vector3& direction) { /// binning values. inline double cast(const Vector3& position, BinningValue bval) { switch (bval) { - case binX: + case BinningValue::binX: return position[0]; - case binY: + case BinningValue::binY: return position[1]; - case binZ: + case BinningValue::binZ: return position[2]; - case binR: + case BinningValue::binR: return perp(position); - case binPhi: + case BinningValue::binPhi: return phi(position); - case binRPhi: + case BinningValue::binRPhi: return perp(position) * phi(position); - case binH: + case BinningValue::binH: return theta(position); - case binEta: + case BinningValue::binEta: return eta(position); - case binMag: + case BinningValue::binMag: return position.norm(); default: assert(false && "Invalid BinningValue enum value"); diff --git a/Core/src/Detector/CuboidalContainerBuilder.cpp b/Core/src/Detector/CuboidalContainerBuilder.cpp index 7c403d6b55d..5714cba8d0c 100644 --- a/Core/src/Detector/CuboidalContainerBuilder.cpp +++ b/Core/src/Detector/CuboidalContainerBuilder.cpp @@ -35,11 +35,13 @@ Acts::Experimental::CuboidalContainerBuilder::CuboidalContainerBuilder( "CuboidalContainerBuilder: no sub builders provided."); } // Check if binning value is correctly chosen - if (m_cfg.binning != Acts::binX && m_cfg.binning != Acts::binY && - m_cfg.binning != Acts::binZ) { + if (m_cfg.binning != Acts::BinningValue::binX && + m_cfg.binning != Acts::BinningValue::binY && + m_cfg.binning != Acts::BinningValue::binZ) { throw std::invalid_argument( - "CuboidalContainerBuilder: Invalid binning value. Only Acts::binX, " - "Acts::binY, Acts::binZ are supported."); + "CuboidalContainerBuilder: Invalid binning value. Only " + "Acts::BinningValue::binX, " + "Acts::BinningValue::binY, Acts::BinningValue::binZ are supported."); } } @@ -92,11 +94,13 @@ Acts::Experimental::CuboidalContainerBuilder::CuboidalContainerBuilder( } m_cfg.binning = bpNode.binning.at(0); // Check if binning value is correctly chosen - if (m_cfg.binning != Acts::binX && m_cfg.binning != Acts::binY && - m_cfg.binning != Acts::binZ) { + if (m_cfg.binning != Acts::BinningValue::binX && + m_cfg.binning != Acts::BinningValue::binY && + m_cfg.binning != Acts::BinningValue::binZ) { throw std::invalid_argument( - "CuboidalContainerBuilder: Invalid binning value. Only Acts::binX, " - "Acts::binY, Acts::binZ are supported."); + "CuboidalContainerBuilder: Invalid binning value. Only " + "Acts::BinningValue::binX, " + "Acts::BinningValue::binY, Acts::BinningValue::binZ 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 3f4515fee79..3949bc7e254 100644 --- a/Core/src/Detector/CylindricalContainerBuilder.cpp +++ b/Core/src/Detector/CylindricalContainerBuilder.cpp @@ -52,17 +52,17 @@ Acts::Experimental::DetectorComponent::PortalContainer connect( Acts::BinningValue bv = binning.front(); // 1-dimensional binning options switch (bv) { - case Acts::binR: { + case Acts::BinningValue::binR: { portalContainer = Acts::Experimental::detail::CylindricalDetectorHelper::connectInR( gctx, objects, {}, logLevel); } break; - case Acts::binZ: { + case Acts::BinningValue::binZ: { portalContainer = Acts::Experimental::detail::CylindricalDetectorHelper::connectInZ( gctx, objects, {}, logLevel); } break; - case Acts::binPhi: { + case Acts::BinningValue::binPhi: { portalContainer = Acts::Experimental::detail::CylindricalDetectorHelper::connectInPhi( gctx, objects, {}, logLevel); @@ -71,7 +71,8 @@ Acts::Experimental::DetectorComponent::PortalContainer connect( break; } } else if (binning == - std::vector{Acts::binZ, Acts::binR} && + std::vector{Acts::BinningValue::binZ, + Acts::BinningValue::binR} && objects.size() == 2u) { portalContainer = Acts::Experimental::detail::CylindricalDetectorHelper::wrapInZR( @@ -94,7 +95,8 @@ Acts::Experimental::CylindricalContainerBuilder::CylindricalContainerBuilder( if (m_cfg.binning.size() == 1u) { // 1-dimensional case auto b = m_cfg.binning.front(); - if (b != Acts::binR && b != Acts::binZ && b != Acts::binPhi) { + if (b != Acts::BinningValue::binR && b != Acts::BinningValue::binZ && + b != Acts::BinningValue::binPhi) { throw std::invalid_argument( "CylindricalContainerBuilder: 1D binning only supported in z, r, or " "phi"); @@ -102,7 +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::binZ, Acts::binR}) { + std::vector{Acts::BinningValue::binZ, + Acts::BinningValue::binR}) { throw std::invalid_argument( "CylindricalContainerBuilder: 2D binning only supports wrapping in " "z-r."); @@ -165,7 +168,8 @@ Acts::Experimental::CylindricalContainerBuilder::CylindricalContainerBuilder( if (m_cfg.binning.size() == 1u) { // 1-dimensional case auto b = m_cfg.binning.front(); - if (b != Acts::binR && b != Acts::binZ && b != Acts::binPhi) { + if (b != Acts::BinningValue::binR && b != Acts::BinningValue::binZ && + b != Acts::BinningValue::binPhi) { throw std::invalid_argument( "CylindricalContainerBuilder: 1D binning only supported in z, r, or " "phi"); @@ -173,7 +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::binZ, Acts::binR}) { + std::vector{Acts::BinningValue::binZ, + Acts::BinningValue::binR}) { throw std::invalid_argument( "CylindricalContainerBuilder: 2D binning only supports wrapping in " "z-r."); diff --git a/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp b/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp index fbbeb3eceb9..c6005b5c142 100644 --- a/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp +++ b/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp @@ -31,7 +31,8 @@ void fillGridIndices2D( if (ic1 > 0) { Acts::ActsScalar v1 = 0.5 * (c1 + boundaries[1u][ic1 - 1]); if (casts == - std::array{Acts::binZ, Acts::binR}) { + std::array{Acts::BinningValue::binZ, + Acts::BinningValue::binR}) { Acts::Vector3 zrPosition{v1, 0., v0}; for (const auto [iv, v] : Acts::enumerate(rootVolumes)) { if (v->inside(gctx, zrPosition)) { @@ -50,7 +51,8 @@ void fillGridIndices2D( Acts::Experimental::IndexedRootVolumeFinderBuilder:: IndexedRootVolumeFinderBuilder(std::vector binning) : m_casts(std::move(binning)) { - if (m_casts != std::vector{Acts::binZ, Acts::binR}) { + if (m_casts != std::vector{Acts::BinningValue::binZ, + Acts::BinningValue::binR}) { throw std::invalid_argument("Online (z,r) binning is currently supported."); } } diff --git a/Core/src/Detector/LayerStructureBuilder.cpp b/Core/src/Detector/LayerStructureBuilder.cpp index 1e1e311e384..6a421671cf1 100644 --- a/Core/src/Detector/LayerStructureBuilder.cpp +++ b/Core/src/Detector/LayerStructureBuilder.cpp @@ -240,13 +240,13 @@ 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 : s_binningValues) { + for (const auto& bv : allBinningValues()) { if (support.volumeExtent.constrains(bv) && std::find(support.internalConstraints.begin(), support.internalConstraints.end(), bv) == support.internalConstraints.end()) { ACTS_VERBOSE(" Support surface is constrained by volume extent in " - << binningValueNames()[bv]); + << binningValueName(bv)); supportExtent.set(bv, support.volumeExtent.min(bv), support.volumeExtent.max(bv)); } @@ -265,26 +265,27 @@ Acts::Experimental::LayerStructureBuilder::construct( // Add cylindrical support if (support.type == Surface::SurfaceType::Cylinder) { detail::SupportSurfacesHelper::CylindricalSupport cSupport{ - support.offset, support.volumeClearance[binZ], - support.volumeClearance[binPhi]}; + support.offset, support.volumeClearance[BinningValue::binZ], + support.volumeClearance[BinningValue::binPhi]}; 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[binR], - support.volumeClearance[binPhi]}; + support.offset, support.volumeClearance[BinningValue::binR], + support.volumeClearance[BinningValue::binPhi]}; 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 = {binX, binY}; - if (support.pPlacement == binX) { - locals = {binY, binZ}; - } else if (support.pPlacement == binY) { - locals = {binZ, binX}; + 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}; } // Add rectangular support detail::SupportSurfacesHelper::RectangularSupport rSupport{ diff --git a/Core/src/Detector/ProtoDetector.cpp b/Core/src/Detector/ProtoDetector.cpp index eba45c1f6c5..20db1689882 100644 --- a/Core/src/Detector/ProtoDetector.cpp +++ b/Core/src/Detector/ProtoDetector.cpp @@ -82,7 +82,7 @@ void Acts::ProtoVolume::harmonize(bool legacy) { std::vector borders = {}; // The volumes should be harmonized in all other constraining values - for (auto obValue : s_binningValues) { + for (auto obValue : allBinningValues()) { if (obValue != binValue && extent.constrains(obValue)) { otherConstrains.push_back(obValue); } diff --git a/Core/src/Detector/VolumeStructureBuilder.cpp b/Core/src/Detector/VolumeStructureBuilder.cpp index 9a149e978af..49dba260a52 100644 --- a/Core/src/Detector/VolumeStructureBuilder.cpp +++ b/Core/src/Detector/VolumeStructureBuilder.cpp @@ -72,14 +72,15 @@ 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(binX) && vExtent.constrains(binY) && - vExtent.constrains(binZ)) { - eTransform.pretranslate(Vector3(vExtent.medium(binX), - vExtent.medium(binY), - vExtent.medium(binZ))); - boundValues = {0.5 * vExtent.interval(binX), - 0.5 * vExtent.interval(binY), - 0.5 * vExtent.interval(binZ)}; + 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)}; } else { throw std::runtime_error( @@ -116,13 +117,16 @@ 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(binR) && vExtent.constrains(binZ)) { - eTransform.pretranslate(Vector3(0., 0., vExtent.medium(binZ))); - boundValues = {vExtent.min(binR), vExtent.max(binR), - 0.5 * vExtent.interval(binZ)}; - if (vExtent.constrains(binPhi)) { - boundValues.push_back(0.5 * vExtent.interval(binPhi)); - boundValues.push_back(vExtent.medium(binPhi)); + if (vExtent.constrains(BinningValue::binR) && + vExtent.constrains(BinningValue::binZ)) { + 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)); } } else { throw std::runtime_error( diff --git a/Core/src/Detector/detail/BlueprintHelper.cpp b/Core/src/Detector/detail/BlueprintHelper.cpp index 485bc8e129c..353036feeff 100644 --- a/Core/src/Detector/detail/BlueprintHelper.cpp +++ b/Core/src/Detector/detail/BlueprintHelper.cpp @@ -20,13 +20,13 @@ std::array endPointsXYZ( const Acts::Experimental::Blueprint::Node& node, Acts::BinningValue bVal) { unsigned int bIdx = 0; switch (bVal) { - case Acts::binX: + case Acts::BinningValue::binX: bIdx = 0; break; - case Acts::binY: + case Acts::BinningValue::binY: bIdx = 1; break; - case Acts::binZ: + case Acts::BinningValue::binZ: bIdx = 2; break; default: @@ -51,16 +51,18 @@ 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 == binX || bVal == binY || bVal == binZ) { + if (bVal == BinningValue::binX || bVal == BinningValue::binY || + bVal == BinningValue::binZ) { Vector3 nodeCenter = node.transform.translation(); - Vector3 nodeSortAxis = node.transform.rotation().col(bVal); + Vector3 nodeSortAxis = node.transform.rotation().col(toUnderlying(bVal)); std::sort( node.children.begin(), node.children.end(), [&](const auto& a, const auto& b) { return (a->transform.translation() - nodeCenter).dot(nodeSortAxis) < (b->transform.translation() - nodeCenter).dot(nodeSortAxis); }); - } else if (bVal == binR && node.boundsType == VolumeBounds::eCylinder) { + } else if (bVal == BinningValue::binR && + node.boundsType == VolumeBounds::eCylinder) { std::sort(node.children.begin(), node.children.end(), [](const auto& a, const auto& b) { return 0.5 * (a->boundaryValues[0] + a->boundaryValues[1]) < @@ -111,7 +113,7 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCylindrical( std::vector> gaps; // Only 1D binning implemented for the moment auto bVal = node.binning.front(); - if (bVal == binZ) { + if (bVal == BinningValue::binZ) { // adjust inner/outer radius if (adjustToParent) { std::for_each(node.children.begin(), node.children.end(), @@ -155,7 +157,7 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCylindrical( gaps.push_back(std::move(gap)); } - } else if (bVal == binR) { + } else if (bVal == BinningValue::binR) { // We have binning in R present if (adjustToParent) { std::for_each(node.children.begin(), node.children.end(), @@ -213,7 +215,8 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCuboidal( sort(node, false); // Cuboidal detector binnings - std::array allowedBinVals = {binX, binY, binZ}; + std::array allowedBinVals = { + BinningValue::binX, BinningValue::binY, BinningValue::binZ}; std::vector> gaps; auto binVal = node.binning.front(); @@ -225,8 +228,10 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCuboidal( if (bv != binVal) { // Both boundary values and translation // have to be adjusted - child->boundaryValues[bv] = node.boundaryValues[bv]; - child->transform.translation()[bv] = node.transform.translation()[bv]; + child->boundaryValues[toUnderlying(bv)] = + node.boundaryValues[toUnderlying(bv)]; + child->transform.translation()[toUnderlying(bv)] = + node.transform.translation()[toUnderlying(bv)]; } } }); @@ -245,10 +250,10 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCuboidal( gapTransform.rotate(node.transform.rotation()); gapTransform.pretranslate(0.5 * (neg + negC)); std::vector gapBounds{0, 0, 0}; - gapBounds[binVal] = 0.5 * gapSpan; + gapBounds[toUnderlying(binVal)] = 0.5 * gapSpan; for (auto bv : allowedBinVals) { if (bv != binVal) { - gapBounds[bv] = node.boundaryValues[bv]; + gapBounds[toUnderlying(bv)] = node.boundaryValues[toUnderlying(bv)]; } } auto gap = std::make_unique( @@ -268,10 +273,10 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCuboidal( gapTransform.rotate(node.transform.rotation()); gapTransform.pretranslate(0.5 * (negC + posC)); std::vector gapBounds{0, 0, 0}; - gapBounds[binVal] = 0.5 * gapSpan; + gapBounds[toUnderlying(binVal)] = 0.5 * gapSpan; for (auto bv : allowedBinVals) { if (bv != binVal) { - gapBounds[bv] = node.boundaryValues[bv]; + gapBounds[toUnderlying(bv)] = node.boundaryValues[toUnderlying(bv)]; } } auto gap = std::make_unique( diff --git a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp index 137654223be..d6cd6c35128 100644 --- a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp @@ -32,14 +32,15 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( ACTS_LOCAL_LOGGER(getDefaultLogger("CuboidalDetectorHelper", logLevel)); ACTS_DEBUG("Connect " << volumes.size() << " detector volumes in " - << binningValueNames()[bValue] << "."); + << binningValueName(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 = {binX, binY, binZ}; + 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) @@ -48,7 +49,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( {PortalSet{2, 3}, PortalSet{4, 5}, PortalSet{0, 1}}}; // This is the picked set for fusing - auto [sIndex, fIndex] = portalSets[bValue]; + auto [sIndex, fIndex] = portalSets[toUnderlying(bValue)]; // Log the merge splits, i.e. the boundaries of the volumes std::array, 3u> mergeSplits; @@ -77,21 +78,22 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( // Values const auto firstBoundValues = firstVolume->volumeBounds().values(); const auto lastBoundValues = lastVolume->volumeBounds().values(); - Vector3 stepDirection = firstVolume->transform(gctx).rotation().col(bValue); + Vector3 stepDirection = + firstVolume->transform(gctx).rotation().col(toUnderlying(bValue)); for (auto [im, mergeValue] : enumerate(possibleValues)) { // Skip the bin value itself, fusing will took care of that if (mergeValue == bValue) { continue; } - for (auto [is, index] : enumerate(portalSets[mergeValue])) { + for (auto [is, index] : enumerate(portalSets[toUnderlying(mergeValue)])) { // Take rotation from first volume auto rotation = firstVolume->portalPtrs()[index] ->surface() .transform(gctx) .rotation(); - ActsScalar stepDown = firstBoundValues[bValue]; - ActsScalar stepUp = lastBoundValues[bValue]; + ActsScalar stepDown = firstBoundValues[toUnderlying(bValue)]; + ActsScalar stepUp = lastBoundValues[toUnderlying(bValue)]; // Take translation from first and last volume auto translationF = firstVolume->portalPtrs()[index] ->surface() @@ -110,7 +112,8 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( portalTransform.prerotate(rotation); portalTransform.pretranslate(translation); // The half length to be kept - ActsScalar keepHalfLength = firstBoundValues[counterPart(mergeValue)]; + ActsScalar keepHalfLength = + firstBoundValues[toUnderlying(counterPart(mergeValue))]; mergeParameters[index] = MergeParameters(keepHalfLength, portalTransform); } } @@ -147,8 +150,8 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( continue; } // Record the merge splits - mergeSplits[im].push_back(2 * boundValues[bValue]); - mergeHalfLengths[im] += boundValues[bValue]; + mergeSplits[im].push_back(2 * boundValues[toUnderlying(bValue)]); + mergeHalfLengths[im] += boundValues[toUnderlying(bValue)]; } } @@ -165,14 +168,14 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( // - this is an anticyclic swap bool mergedInX = true; switch (bValue) { - case binZ: { - mergedInX = (mergeValue == binY); + case BinningValue::binZ: { + mergedInX = (mergeValue == BinningValue::binY); } break; - case binY: { - mergedInX = (mergeValue == binX); + case BinningValue::binY: { + mergedInX = (mergeValue == BinningValue::binX); } break; - case binX: { - mergedInX = (mergeValue == binZ); + case BinningValue::binX: { + mergedInX = (mergeValue == BinningValue::binZ); } break; default: break; @@ -185,7 +188,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( stitchBoundaries.push_back(stitchBoundaries.back() + step); } - for (auto [is, index] : enumerate(portalSets[mergeValue])) { + for (auto [is, index] : enumerate(portalSets[toUnderlying(mergeValue)])) { // Check if you need to skip due to selections if (!selectedOnly.empty() && std::find(selectedOnly.begin(), selectedOnly.end(), index) == @@ -210,7 +213,8 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( // Make the stitch boundaries pReplacements.push_back(PortalReplacement( - portal, index, dir, stitchBoundaries, (mergedInX ? binX : binY))); + portal, index, dir, stitchBoundaries, + (mergedInX ? BinningValue::binX : BinningValue::binY))); } } @@ -246,20 +250,21 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( ACTS_LOCAL_LOGGER(getDefaultLogger("CuboidalDetectorHelper", logLevel)); ACTS_DEBUG("Connect " << containers.size() << " containers in " - << binningValueNames()[bValue] << "."); + << binningValueName(bValue) << "."); // Return the new container DetectorComponent::PortalContainer dShell; // The possible bin values - std::array possibleValues = {binX, binY, binZ}; + std::array possibleValues = { + BinningValue::binX, BinningValue::binY, BinningValue::binZ}; // And their associated portal sets, see above using PortalSet = std::array; std::vector portalSets = { {PortalSet{2, 3}, PortalSet{4, 5}, PortalSet{0, 1}}}; // This is the picked set for refubishing - auto [endIndex, startIndex] = portalSets[bValue]; + auto [endIndex, startIndex] = portalSets[toUnderlying(bValue)]; // Fusing along the connection direction (bValue) for (std::size_t ic = 1; ic < containers.size(); ++ic) { @@ -307,8 +312,8 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( std::vector sidePortals = {}; for (auto sVals : possibleValues) { if (sVals != bValue) { - sidePortals.push_back(portalSets[sVals][0]); - sidePortals.push_back(portalSets[sVals][1]); + sidePortals.push_back(portalSets[toUnderlying(sVals)][0]); + sidePortals.push_back(portalSets[toUnderlying(sVals)][1]); } } diff --git a/Core/src/Detector/detail/CylindricalDetectorHelper.cpp b/Core/src/Detector/detail/CylindricalDetectorHelper.cpp index 41442140a41..ae5b35da9e7 100644 --- a/Core/src/Detector/detail/CylindricalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CylindricalDetectorHelper.cpp @@ -84,8 +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::binR : Acts::binPhi; + Acts::BinningValue stitchValue = phiBoundaries.size() == 2u + ? Acts::BinningValue::binR + : Acts::BinningValue::binPhi; // Estimate ranges auto [minR, maxR] = Acts::min_max(rBoundaries); auto [sectorPhi, avgPhi] = Acts::range_medium(phiBoundaries); @@ -98,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::binR) ? rBoundaries : phiBoundaries; + (stitchValue == Acts::BinningValue::binR) ? rBoundaries : phiBoundaries; return Acts::Experimental::PortalReplacement( std::make_shared(surface), index, dir, stitchBoundaries, stitchValue); @@ -120,8 +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::binZ : Acts::binPhi; + Acts::BinningValue stitchValue = phiBoundaries.size() == 2u + ? Acts::BinningValue::binZ + : Acts::BinningValue::binPhi; auto [lengthZ, medZ] = Acts::range_medium(zBoundaries); auto [sectorPhi, avgPhi] = Acts::range_medium(phiBoundaries); @@ -134,7 +136,7 @@ Acts::Experimental::PortalReplacement createCylinderReplacement( // A make a portal and indicate the new link direction const auto& stitchBoundaries = - (stitchValue == Acts::binZ) ? zBoundaries : phiBoundaries; + (stitchValue == Acts::BinningValue::binZ) ? zBoundaries : phiBoundaries; return Acts::Experimental::PortalReplacement( std::make_shared(surface), index, dir, stitchBoundaries, stitchValue); @@ -164,7 +166,7 @@ Acts::Experimental::PortalReplacement createSectorReplacement( // Create a new transform Acts::Transform3 transform = Acts::Transform3::Identity(); - if (binning == Acts::binR) { + if (binning == Acts::BinningValue::binR) { // Range and center-r calculation auto [range, medium] = Acts::range_medium(boundaries); // New joint center: @@ -178,7 +180,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::binZ) { + } else if (binning == Acts::BinningValue::binZ) { // Range and medium z alculation auto [range, medium] = Acts::range_medium(boundaries); // Center R calculation, using projection onto vector @@ -401,8 +403,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::binR, iu + 4u, idir)); + pReplacements.push_back( + createSectorReplacement(gctx, vCenter, refSurface, rBoundaries, + Acts::BinningValue::binR, iu + 4u, idir)); } } } else { @@ -605,9 +608,9 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInZ( selectedOnly.end()) { const Surface& refSurface = volumes[0u]->portals()[iu + iSecOffset]->surface(); - pReplacements.push_back( - createSectorReplacement(gctx, combinedCenter, refSurface, - zBoundaries, Acts::binZ, iu + 4u, idir)); + pReplacements.push_back(createSectorReplacement( + gctx, combinedCenter, refSurface, zBoundaries, + Acts::BinningValue::binZ, iu + 4u, idir)); } } } else { diff --git a/Core/src/Detector/detail/DetectorVolumeConsistency.cpp b/Core/src/Detector/detail/DetectorVolumeConsistency.cpp index 3e1c54aaa87..0f9487c7953 100644 --- a/Core/src/Detector/detail/DetectorVolumeConsistency.cpp +++ b/Core/src/Detector/detail/DetectorVolumeConsistency.cpp @@ -45,7 +45,8 @@ Acts::Experimental::detail::DetectorVolumeConsistency::checkCenterAlignment( checkRotationAlignment(gctx, volumes); // Get the reference axis - Vector3 refAxis = volumes[0u]->transform(gctx).rotation().col(axisValue); + Vector3 refAxis = + volumes[0u]->transform(gctx).rotation().col(toUnderlying(axisValue)); for (auto [iv, v] : enumerate(volumes)) { if (iv > 0) { diff --git a/Core/src/Detector/detail/SupportSurfacesHelper.cpp b/Core/src/Detector/detail/SupportSurfacesHelper.cpp index 5c5ce8583d3..32c12a6499d 100644 --- a/Core/src/Detector/detail/SupportSurfacesHelper.cpp +++ b/Core/src/Detector/detail/SupportSurfacesHelper.cpp @@ -27,23 +27,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(binZ) || !lExtent.constrains(binR)) { + if (!lExtent.constrains(BinningValue::binZ) || + !lExtent.constrains(BinningValue::binR)) { throw std::invalid_argument( "SupportSurfacesHelper::CylindricalSupport::operator() - z or " "r are not constrained."); } // Min / Max z with clearances adapted - ActsScalar minZ = lExtent.min(binZ) + std::abs(zClearance[0u]); - ActsScalar maxZ = lExtent.max(binZ) - std::abs(zClearance[1u]); + ActsScalar minZ = lExtent.min(BinningValue::binZ) + std::abs(zClearance[0u]); + ActsScalar maxZ = lExtent.max(BinningValue::binZ) - std::abs(zClearance[1u]); // Phi sector ActsScalar hPhiSector = M_PI; ActsScalar avgPhi = 0.; - if (lExtent.constrains(binPhi)) { + if (lExtent.constrains(BinningValue::binPhi)) { // Min / Max phi with clearances adapted - ActsScalar minPhi = lExtent.min(binPhi) + std::abs(phiClearance[0u]); - ActsScalar maxPhi = lExtent.max(binPhi) - std::abs(phiClearance[1u]); + ActsScalar minPhi = + lExtent.min(BinningValue::binPhi) + std::abs(phiClearance[0u]); + ActsScalar maxPhi = + lExtent.max(BinningValue::binPhi) - std::abs(phiClearance[1u]); hPhiSector = 0.5 * (maxPhi - minPhi); avgPhi = 0.5 * (minPhi + maxPhi); } @@ -54,10 +57,10 @@ operator()(const Extent& lExtent) const { } // The Radius estimation - ActsScalar r = - rOffset < 0 ? lExtent.min(binR) + rOffset : lExtent.max(binR) + rOffset; + ActsScalar r = rOffset < 0 ? lExtent.min(BinningValue::binR) + rOffset + : lExtent.max(BinningValue::binR) + rOffset; if (rOffset == 0.) { - r = lExtent.medium(binR); + r = lExtent.medium(BinningValue::binR); } // Components are resolved and returned as a tuple return { @@ -68,32 +71,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(binZ) || !lExtent.constrains(binR)) { + if (!lExtent.constrains(BinningValue::binZ) || + !lExtent.constrains(BinningValue::binR)) { throw std::invalid_argument( "SupportSurfacesHelper::DiscSupport::operator() - z or " "r are not constrained."); } // Min / Max r with clearances adapted - ActsScalar minR = lExtent.min(binR) + std::abs(rClearance[0u]); - ActsScalar maxR = lExtent.max(binR) - std::abs(rClearance[1u]); + ActsScalar minR = lExtent.min(BinningValue::binR) + std::abs(rClearance[0u]); + ActsScalar maxR = lExtent.max(BinningValue::binR) - std::abs(rClearance[1u]); // Phi sector ActsScalar hPhiSector = M_PI; ActsScalar avgPhi = 0.; - if (lExtent.constrains(binPhi)) { + if (lExtent.constrains(BinningValue::binPhi)) { // Min / Max phi with clearances adapted - ActsScalar minPhi = lExtent.min(binPhi) + std::abs(phiClearance[0u]); - ActsScalar maxPhi = lExtent.max(binPhi) - std::abs(phiClearance[1u]); + ActsScalar minPhi = + lExtent.min(BinningValue::binPhi) + std::abs(phiClearance[0u]); + ActsScalar maxPhi = + lExtent.max(BinningValue::binPhi) - std::abs(phiClearance[1u]); hPhiSector = 0.5 * (maxPhi - minPhi); avgPhi = 0.5 * (minPhi + maxPhi); } // The z position estimate - ActsScalar z = - zOffset < 0 ? lExtent.min(binZ) + zOffset : lExtent.max(binZ) + zOffset; + ActsScalar z = zOffset < 0 ? lExtent.min(BinningValue::binZ) + zOffset + : lExtent.max(BinningValue::binZ) + zOffset; if (zOffset == 0.) { - z = lExtent.medium(binZ); + z = lExtent.medium(BinningValue::binZ); } Transform3 transform = Transform3::Identity(); @@ -107,19 +113,20 @@ 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(binX) && lExtent.constrains(binY) && - lExtent.constrains(binZ))) { + if (!(lExtent.constrains(BinningValue::binX) && + lExtent.constrains(BinningValue::binY) && + lExtent.constrains(BinningValue::binZ))) { throw std::invalid_argument( "SupportSurfacesHelper::RectangularSupport::operator() - x, y or " "z are not constrained."); } // Set the local coordinates - cyclic permutation - std::array locals = {binX, binY}; - if (pPlacement == binX) { - locals = {binY, binZ}; - } else if (pPlacement == binY) { - locals = {binZ, binX}; + 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}; } // Make the rectangular shape @@ -130,7 +137,7 @@ operator()(const Extent& lExtent) const { ActsScalar gPlacement = lExtent.medium(pPlacement) + pOffset; Vector3 placement = Vector3::Zero(); - placement[pPlacement] = gPlacement; + placement[toUnderlying(pPlacement)] = gPlacement; Transform3 transform = Transform3::Identity(); transform.pretranslate(placement); diff --git a/Core/src/Geometry/CuboidVolumeBounds.cpp b/Core/src/Geometry/CuboidVolumeBounds.cpp index 2f4c122cb0f..e88507860f6 100644 --- a/Core/src/Geometry/CuboidVolumeBounds.cpp +++ b/Core/src/Geometry/CuboidVolumeBounds.cpp @@ -103,12 +103,14 @@ void CuboidVolumeBounds::buildSurfaceBounds() { } ActsScalar CuboidVolumeBounds::binningBorder(BinningValue bValue) const { - if (bValue <= binZ) { - return m_values[bValue]; + if (bValue <= BinningValue::binZ) { + return m_values[toUnderlying(bValue)]; } - if (bValue == binR) { - return std::sqrt(m_values[binX] * m_values[binX] + - m_values[binY] * m_values[binY]); + 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)]); } return 0.0; } diff --git a/Core/src/Geometry/CuboidVolumeBuilder.cpp b/Core/src/Geometry/CuboidVolumeBuilder.cpp index 7f5385fcd9b..4d01bd78227 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[binX] = cfg.envelopeX; - pl.envelope[binY] = cfg.envelopeY; - pl.envelope[binZ] = cfg.envelopeZ; + pl.envelope[BinningValue::binX] = cfg.envelopeX; + pl.envelope[BinningValue::binY] = cfg.envelopeY; + pl.envelope[BinningValue::binZ] = cfg.envelopeZ; return layerCreator.planeLayer(gctx, cfg.surfaces, cfg.binsY, cfg.binsZ, BinningValue::binX, pl, trafo); } @@ -121,10 +121,10 @@ std::pair Acts::CuboidVolumeBuilder::binningRange( for (const auto& layercfg : cfg.layerCfg) { // recreating the protolayer for each layer => slow, but only few sensors ProtoLayer pl{gctx, layercfg.surfaces}; - pl.envelope[binX] = layercfg.envelopeX; + pl.envelope[BinningValue::binX] = layercfg.envelopeX; - double surfacePosMin = pl.min(binX); - double surfacePosMax = pl.max(binX); + double surfacePosMin = pl.min(BinningValue::binX); + double surfacePosMax = pl.max(BinningValue::binX); // Test if new extreme is found and set it if (surfacePosMin < minMax.first) { @@ -136,8 +136,10 @@ std::pair Acts::CuboidVolumeBuilder::binningRange( } // Use the volume boundaries as limits for the binning - minMax.first = std::min(minMax.first, minVolumeBoundaries(binX)); - minMax.second = std::max(minMax.second, maxVolumeBoundaries(binX)); + minMax.first = std::min( + minMax.first, minVolumeBoundaries(toUnderlying(BinningValue::binX))); + minMax.second = std::max( + minMax.second, maxVolumeBoundaries(toUnderlying(BinningValue::binX))); return minMax; } diff --git a/Core/src/Geometry/CylinderVolumeBounds.cpp b/Core/src/Geometry/CylinderVolumeBounds.cpp index 21f6dd667da..325345e2465 100644 --- a/Core/src/Geometry/CylinderVolumeBounds.cpp +++ b/Core/src/Geometry/CylinderVolumeBounds.cpp @@ -233,17 +233,18 @@ bool CylinderVolumeBounds::inside(const Vector3& pos, ActsScalar tol) const { Vector3 CylinderVolumeBounds::binningOffset(BinningValue bValue) const { // the medium radius is taken for r-type binning - if (bValue == Acts::binR || bValue == Acts::binRPhi) { + if (bValue == Acts::BinningValue::binR || + bValue == Acts::BinningValue::binRPhi) { return Vector3(0.5 * (get(eMinR) + get(eMaxR)), 0., 0.); } return VolumeBounds::binningOffset(bValue); } ActsScalar CylinderVolumeBounds::binningBorder(BinningValue bValue) const { - if (bValue == Acts::binR) { + if (bValue == Acts::BinningValue::binR) { return 0.5 * (get(eMaxR) - get(eMinR)); } - if (bValue == Acts::binZ) { + if (bValue == Acts::BinningValue::binZ) { return get(eHalfLengthZ); } return VolumeBounds::binningBorder(bValue); diff --git a/Core/src/Geometry/CylinderVolumeBuilder.cpp b/Core/src/Geometry/CylinderVolumeBuilder.cpp index d6e5786de58..195eaefffe6 100644 --- a/Core/src/Geometry/CylinderVolumeBuilder.cpp +++ b/Core/src/Geometry/CylinderVolumeBuilder.cpp @@ -353,8 +353,8 @@ Acts::CylinderVolumeBuilder::trackingVolume( // Filling loop for (const auto& elay : endcapConfig.layers) { // Getting the reference radius - double test = - elay->surfaceRepresentation().binningPositionValue(gctx, binR); + double test = elay->surfaceRepresentation().binningPositionValue( + gctx, BinningValue::binR); // Find the right bin auto ringVolume = std::find_if( volumeRminRmax.begin(), volumeRminRmax.end(), diff --git a/Core/src/Geometry/CylinderVolumeHelper.cpp b/Core/src/Geometry/CylinderVolumeHelper.cpp index e83ed62eae5..79d73b40505 100644 --- a/Core/src/Geometry/CylinderVolumeHelper.cpp +++ b/Core/src/Geometry/CylinderVolumeHelper.cpp @@ -101,7 +101,7 @@ Acts::CylinderVolumeHelper::createTrackingVolume( double zMinRaw = 0.; double zMaxRaw = 0.; - BinningValue bValue = binR; + BinningValue bValue = BinningValue::binR; // check the dimension and fill raw data if (!estimateAndCheckDimension(gctx, layers, cylinderBounds, transform, @@ -138,7 +138,7 @@ Acts::CylinderVolumeHelper::createTrackingVolume( << bValue); // create the Layer Array - layerArray = (bValue == binR) + layerArray = (bValue == BinningValue::binR) ? m_cfg.layerArrayCreator->layerArray(gctx, layers, rMin, rMax, bType, bValue) : m_cfg.layerArrayCreator->layerArray(gctx, layers, zMin, @@ -378,9 +378,9 @@ Acts::CylinderVolumeHelper::createContainerTrackingVolume( // create the volume array with the ITrackingVolumeArrayCreator std::shared_ptr volumeArray = (rCase) ? m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, volumes, binR) + gctx, volumes, BinningValue::binR) : m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, volumes, binZ); + gctx, volumes, BinningValue::binZ); if (volumeArray == nullptr) { ACTS_WARNING( "Creation of TrackingVolume array did not succeed - returning 0 "); @@ -485,7 +485,7 @@ bool Acts::CylinderVolumeHelper::estimateAndCheckDimension( } // set the binning value - bValue = radial ? binR : binZ; + bValue = radial ? BinningValue::binR : BinningValue::binZ; ACTS_VERBOSE( "Estimate/check CylinderVolumeBounds from/w.r.t. enclosed " @@ -676,7 +676,7 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr glueVolumesNegativeFaceArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, glueVolumesNegativeFace, binR); + gctx, glueVolumesNegativeFace, BinningValue::binR); // register the glue voluems glueDescr.registerGlueVolumes(negativeFaceXY, glueVolumesNegativeFaceArray); @@ -685,7 +685,7 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr glueVolumesPositiveFaceArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, glueVolumesPositiveFace, binR); + gctx, glueVolumesPositiveFace, BinningValue::binR); // register the glue voluems glueDescr.registerGlueVolumes(positiveFaceXY, glueVolumesPositiveFaceArray); @@ -694,7 +694,7 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr glueVolumesInnerTubeArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, glueVolumesInnerTube, binZ); + gctx, glueVolumesInnerTube, BinningValue::binZ); // register the glue voluems glueDescr.registerGlueVolumes(tubeInnerCover, glueVolumesInnerTubeArray); } @@ -702,7 +702,7 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr glueVolumesOuterTubeArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - gctx, glueVolumesOuterTube, binZ); + gctx, glueVolumesOuterTube, BinningValue::binZ); // register the glue voluems glueDescr.registerGlueVolumes(tubeOuterCover, glueVolumesOuterTubeArray); } @@ -956,7 +956,7 @@ Acts::CylinderVolumeHelper::createCylinderLayer(double z, double r, // z-binning BinUtility layerBinUtility(binsZ, z - halflengthZ, z + halflengthZ, open, - binZ); + BinningValue::binZ); if (binsPhi == 1) { // the BinUtility for the material // ---------------------> create material for the layer surface @@ -966,7 +966,7 @@ Acts::CylinderVolumeHelper::createCylinderLayer(double z, double r, } else { // break the phi symmetry // update the BinUtility: local position on Cylinder is rPhi, z BinUtility layerBinUtilityPhiZ(binsPhi, -r * M_PI, +r * M_PI, closed, - binPhi); + BinningValue::binPhi); layerBinUtilityPhiZ += layerBinUtility; // ---------------------> create material for the layer surface ACTS_VERBOSE(" -> Preparing the binned material with " @@ -991,13 +991,14 @@ 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, binR); + BinUtility materialBinUtility(binsR, rMin, rMax, open, BinningValue::binR); if (binsPhi == 1) { ACTS_VERBOSE(" -> Preparing the binned material with " << binsR << " bins in R. "); } else { // also binning in phi chosen - materialBinUtility += BinUtility(binsPhi, -M_PI, M_PI, closed, binPhi); + materialBinUtility += + BinUtility(binsPhi, -M_PI, M_PI, closed, BinningValue::binPhi); 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 0a25937bee8..b6c75afb54f 100644 --- a/Core/src/Geometry/CylinderVolumeStack.cpp +++ b/Core/src/Geometry/CylinderVolumeStack.cpp @@ -108,14 +108,15 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, const Logger& logger) { ACTS_DEBUG("Creating CylinderVolumeStack from " << m_volumes.size() << " volumes in direction " - << binningValueNames()[direction]); + << binningValueName(direction)); if (m_volumes.empty()) { throw std::invalid_argument( "CylinderVolumeStack requires at least one volume"); } - if (direction != Acts::binZ && direction != Acts::binR) { - throw std::invalid_argument(binningValueNames()[direction] + + if (direction != Acts::BinningValue::binZ && + direction != Acts::BinningValue::binR) { + throw std::invalid_argument(binningValueName(direction) + " is not supported "); } @@ -156,7 +157,7 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, ACTS_VERBOSE("Checking volume alignment"); checkVolumeAlignment(volumeTuples, logger); - if (direction == Acts::binZ) { + if (direction == Acts::BinningValue::binZ) { ACTS_VERBOSE("Sorting by volume z position"); std::sort(volumeTuples.begin(), volumeTuples.end(), [](const auto& a, const auto& b) { @@ -219,7 +220,7 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, // @TODO: We probably can reuse m_transform m_groupTransform = m_transform; - } else if (direction == Acts::binR) { + } else if (direction == Acts::BinningValue::binR) { ACTS_VERBOSE("Sorting by volume r middle point"); std::sort(volumeTuples.begin(), volumeTuples.end(), [](const auto& a, const auto& b) { return a.midR() < b.midR(); }); @@ -278,9 +279,9 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, m_groupTransform = m_transform; } else { - ACTS_ERROR("Binning in " << binningValueNames()[direction] + ACTS_ERROR("Binning in " << binningValueName(direction) << " is not supported"); - throw std::invalid_argument(binningValueNames()[direction] + + throw std::invalid_argument(binningValueName(direction) + " is not supported "); } } diff --git a/Core/src/Geometry/Extent.cpp b/Core/src/Geometry/Extent.cpp index 334e8813e46..e8a4467a6a6 100644 --- a/Core/src/Geometry/Extent.cpp +++ b/Core/src/Geometry/Extent.cpp @@ -16,15 +16,15 @@ #include #include -Acts::Extent::Extent( - const std::array, binValues>& envelope) +Acts::Extent::Extent(const ExtentEnvelope& envelope) : m_constrains(0), m_envelope(envelope) { - m_range[binR] = + m_range[toUnderlying(BinningValue::binR)] = Range1D(0., std::numeric_limits::max()); - m_range[binPhi] = Range1D(-M_PI, M_PI); - m_range[binRPhi] = + m_range[toUnderlying(BinningValue::binPhi)] = + Range1D(-M_PI, M_PI); + m_range[toUnderlying(BinningValue::binRPhi)] = Range1D(0., std::numeric_limits::max()); - m_range[binMag] = + m_range[toUnderlying(BinningValue::binMag)] = Range1D(0., std::numeric_limits::max()); } @@ -35,22 +35,22 @@ void Acts::Extent::extend(const Vector3& vtx, // Get the casted value given the binning value description ActsScalar cValue = VectorHelpers::cast(vtx, bValue); if (fillHistograms) { - m_valueHistograms[bValue].push_back(cValue); + m_valueHistograms[toUnderlying(bValue)].push_back(cValue); } // Apply envelope as suggested ActsScalar lEnv = applyEnv ? m_envelope[bValue][0] : 0.; ActsScalar hEnv = applyEnv ? m_envelope[bValue][1] : 0.; ActsScalar mValue = cValue - lEnv; // Special protection for radial value - if (bValue == binR && mValue < 0.) { + if (bValue == BinningValue::binR && mValue < 0.) { mValue = std::max(mValue, 0.); } if (constrains(bValue)) { - m_range[bValue].expand(mValue, cValue + hEnv); + m_range[toUnderlying(bValue)].expand(mValue, cValue + hEnv); } else { - m_range[bValue].shrink(mValue, cValue + hEnv); + m_range[toUnderlying(bValue)].shrink(mValue, cValue + hEnv); } - m_constrains.set(bValue); + m_constrains.set(toUnderlying(bValue)); } } @@ -63,55 +63,58 @@ void Acts::Extent::extend(const Extent& rhs, ActsScalar lEnv = applyEnv ? m_envelope[bValue][0] : 0.; ActsScalar hEnv = applyEnv ? m_envelope[bValue][1] : 0.; if (constrains(bValue)) { - m_range[bValue].expand(rhs.range()[bValue].min() - lEnv, - rhs.range()[bValue].max() + hEnv); + m_range[toUnderlying(bValue)].expand( + rhs.range()[toUnderlying(bValue)].min() - lEnv, + rhs.range()[toUnderlying(bValue)].max() + hEnv); } else { - m_range[bValue].shrink(rhs.range()[bValue].min() - lEnv, - rhs.range()[bValue].max() + hEnv); + m_range[toUnderlying(bValue)].shrink( + rhs.range()[toUnderlying(bValue)].min() - lEnv, + rhs.range()[toUnderlying(bValue)].max() + hEnv); } - m_constrains.set(bValue); + m_constrains.set(toUnderlying(bValue)); } else if (rhs.envelope()[bValue] != zeroEnvelope) { // Only an envelope given, but value is not constraint -> apply envelope - m_range[bValue].expand(m_range[bValue].min() - rhs.envelope()[bValue][0], - m_range[bValue].max() + rhs.envelope()[bValue][1]); - m_constrains.set(bValue); + 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)); } } } void Acts::Extent::addConstrain(const Acts::Extent& rhs, const ExtentEnvelope& envelope) { - for (const auto& bValue : s_binningValues) { + for (const auto& bValue : allBinningValues()) { if (rhs.constrains(bValue) && !constrains(bValue)) { const auto& cRange = rhs.range(bValue); - m_range[bValue].setMin(cRange.min() - envelope[bValue][0u]); - m_range[bValue].setMax(cRange.max() + envelope[bValue][1u]); - m_constrains.set(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)); } } } void Acts::Extent::set(BinningValue bValue, ActsScalar min, ActsScalar max) { ActsScalar minval = min; - if (bValue == binR && minval < 0.) { + if (bValue == BinningValue::binR && minval < 0.) { minval = 0.; } - m_range[bValue] = Range1D{minval, max}; - m_constrains.set(bValue); + m_range[toUnderlying(bValue)] = Range1D{minval, max}; + m_constrains.set(toUnderlying(bValue)); } void Acts::Extent::setMin(BinningValue bValue, ActsScalar min) { ActsScalar minval = min; - if (bValue == binR && minval < 0.) { + if (bValue == BinningValue::binR && minval < 0.) { minval = 0.; } - m_range[bValue].setMin(0u, minval); - m_constrains.set(bValue); + m_range[toUnderlying(bValue)].setMin(0u, minval); + m_constrains.set(toUnderlying(bValue)); } void Acts::Extent::setMax(BinningValue bValue, ActsScalar max) { - m_range[bValue].setMax(0u, max); - m_constrains.set(bValue); + m_range[toUnderlying(bValue)].setMax(0u, max); + m_constrains.set(toUnderlying(bValue)); } void Acts::Extent::setEnvelope(const ExtentEnvelope& envelope) { @@ -120,7 +123,7 @@ void Acts::Extent::setEnvelope(const ExtentEnvelope& envelope) { bool Acts::Extent::contains(const Vector3& vtx) const { Extent checkExtent; - for (const auto& bv : s_binningValues) { + for (const auto& bv : allBinningValues()) { if (constrains(bv)) { ActsScalar vtxVal = VectorHelpers::cast(vtx, bv); checkExtent.set(bv, vtxVal, vtxVal); @@ -129,57 +132,52 @@ bool Acts::Extent::contains(const Vector3& vtx) const { return contains(checkExtent); } -bool Acts::Extent::contains(const Extent& rhs, BinningValue bValue) const { +bool Acts::Extent::contains(const Extent& rhs, + std::optional bValue) const { // Helper to check including a constraint bit set check auto checkContainment = [&](BinningValue bvc) -> bool { if (!constrains(bvc)) { return true; } - return (rhs.range()[bvc] <= m_range[bvc]); + return (rhs.range()[toUnderlying(bvc)] <= m_range[toUnderlying(bvc)]); }; // Check all - if (bValue == binValues) { - for (const auto& bv : s_binningValues) { - if (!checkContainment(bv)) { - return false; - } - } - return true; + if (!bValue.has_value()) { + return std::all_of(allBinningValues().begin(), allBinningValues().end(), + checkContainment); } // Check specific - return checkContainment(bValue); + return checkContainment(bValue.value()); } -bool Acts::Extent::intersects(const Extent& rhs, BinningValue bValue) const { +bool Acts::Extent::intersects(const Extent& rhs, + std::optional bValue) const { // Helper to check including a constraint bit set check auto checkIntersect = [&](BinningValue bvc) -> bool { if (!constrains(bvc) || !rhs.constrains(bvc)) { return false; } - return (m_range[bvc] && rhs.range()[bvc]); + return (m_range[toUnderlying(bvc)] && rhs.range()[toUnderlying(bvc)]); }; // Check all - if (bValue == binValues) { - for (const auto& bv : s_binningValues) { - if (checkIntersect(bv)) { - return true; - } - } - return false; + if (!bValue.has_value()) { + return std::any_of(allBinningValues().begin(), allBinningValues().end(), + checkIntersect); } // Check specific - return checkIntersect(bValue); + return checkIntersect(bValue.value()); } bool Acts::Extent::constrains(BinningValue bValue) const { - if (bValue == binValues) { - return (m_constrains.count() > 0); - } return m_constrains.test(static_cast(bValue)); } +bool Acts::Extent::constrains() const { + return m_constrains.count() > 0; +} + bool Acts::Extent::operator==(const Extent& e) const { if (m_constrains != e.m_constrains) { return false; @@ -199,11 +197,11 @@ 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 : s_binningValues) { + for (const auto& bv : allBinningValues()) { if (constrains(bv)) { - sl << indent << " - value :" << std::setw(10) << binningValueNames()[bv] - << " | range = [" << m_range[bv].min() << ", " << m_range[bv].max() - << "]" << std::endl; + sl << indent << " - value :" << std::setw(10) << binningValueName(bv) + << " | range = [" << m_range[toUnderlying(bv)].min() << ", " + << m_range[toUnderlying(bv)].max() << "]" << std::endl; } } return sl.str(); diff --git a/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp b/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp index 3da1043d7bd..315c06de01c 100644 --- a/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp +++ b/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp @@ -52,7 +52,9 @@ Acts::KDTreeTrackingGeometryBuilder::trackingGeometry( for (auto& s : m_cfg.surfaces) { auto ext = s->polyhedronRepresentation(gctx, 1u).extent(); surfacesMeasured.push_back(MeasuredSurface{ - std::array{ext.medium(binZ), ext.medium(binR)}, s}); + std::array{ext.medium(BinningValue::binZ), + ext.medium(BinningValue::binR)}, + s}); } // Create the KDTree @@ -82,8 +84,8 @@ Acts::KDTreeTrackingGeometryBuilder::translateVolume( std::vector> translatedVolumes = {}; // Volume extent - auto rangeR = ptVolume.extent.range(Acts::binR); - auto rangeZ = ptVolume.extent.range(Acts::binZ); + auto rangeR = ptVolume.extent.range(Acts::BinningValue::binR); + auto rangeZ = ptVolume.extent.range(Acts::BinningValue::binZ); // Simple gap volume if (!ptVolume.container.has_value()) { @@ -156,8 +158,8 @@ Acts::KDTreeTrackingGeometryBuilder::translateLayer( // Try to pull from the kd tree RangeXD<2u, ActsScalar> zrRange; - zrRange[0u] = plVolume.extent.range(Acts::binZ); - zrRange[1u] = plVolume.extent.range(Acts::binR); + zrRange[0u] = plVolume.extent.range(Acts::BinningValue::binZ); + zrRange[1u] = plVolume.extent.range(Acts::BinningValue::binR); 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 cfc49623eb0..baca1a8c13d 100644 --- a/Core/src/Geometry/LayerArrayCreator.cpp +++ b/Core/src/Geometry/LayerArrayCreator.cpp @@ -179,19 +179,19 @@ std::shared_ptr Acts::LayerArrayCreator::createNavigationSurface( // switching he binnig values switch (bValue) { // case x - case binX: { + case BinningValue::binX: { translation = Vector3(offset, 0., 0.); } break; // case y - case binY: { + case BinningValue::binY: { translation = Vector3(0., offset, 0.); } break; // case z - case binZ: { + case BinningValue::binZ: { translation = Vector3(0., 0., offset); } break; // case R - case binR: { + case BinningValue::binR: { // binning in R and cylinder surface means something different if (layerSurface.type() == Surface::Cylinder) { break; diff --git a/Core/src/Geometry/LayerCreator.cpp b/Core/src/Geometry/LayerCreator.cpp index 174d0578773..a5c194b0323 100644 --- a/Core/src/Geometry/LayerCreator.cpp +++ b/Core/src/Geometry/LayerCreator.cpp @@ -59,25 +59,26 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); // Remaining layer parameters - they include the envelopes - double layerR = protoLayer.medium(binR); - double layerZ = protoLayer.medium(binZ); - double layerHalfZ = 0.5 * protoLayer.range(binZ); - double layerThickness = protoLayer.range(binR); + 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); ACTS_VERBOSE("Creating a cylindrical Layer:"); ACTS_VERBOSE(" - with layer R = " << layerR); - ACTS_VERBOSE(" - from R min/max = " << protoLayer.min(binR, false) << " / " - << protoLayer.max(binR, false)); + ACTS_VERBOSE(" - from R min/max = " + << protoLayer.min(BinningValue::binR, false) << " / " + << protoLayer.max(BinningValue::binR, false)); ACTS_VERBOSE(" - with R thickness = " << layerThickness); - ACTS_VERBOSE(" - incl envelope = " << protoLayer.envelope[binR][0u] - << " / " - << protoLayer.envelope[binR][1u]); + ACTS_VERBOSE(" - incl envelope = " + << protoLayer.envelope[BinningValue::binR][0u] << " / " + << protoLayer.envelope[BinningValue::binR][1u]); ACTS_VERBOSE(" - with z min/max = " - << protoLayer.min(binZ, false) << " (-" - << protoLayer.envelope[binZ][0u] << ") / " - << protoLayer.max(binZ, false) << " (+" - << protoLayer.envelope[binZ][1u] << ")"); + << protoLayer.min(BinningValue::binZ, false) << " (-" + << protoLayer.envelope[BinningValue::binZ][0u] << ") / " + << protoLayer.max(BinningValue::binZ, false) << " (+" + << protoLayer.envelope[BinningValue::binZ][1u] << ")"); ACTS_VERBOSE(" - z center = " << layerZ); ACTS_VERBOSE(" - halflength z = " << layerHalfZ); @@ -91,9 +92,9 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( ACTS_VERBOSE(" - layer z shift = " << -layerZ); } - ACTS_VERBOSE(" - with phi min/max = " << protoLayer.min(binPhi, false) - << " / " - << protoLayer.max(binPhi, false)); + ACTS_VERBOSE(" - with phi min/max = " + << protoLayer.min(BinningValue::binPhi, false) << " / " + << protoLayer.max(BinningValue::binPhi, false)); ACTS_VERBOSE(" - # of modules = " << surfaces.size() << " ordered in ( " << binsPhi << " x " << binsZ << ")"); std::unique_ptr sArray; @@ -131,25 +132,26 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); // remaining layer parameters - double layerR = protoLayer.medium(binR); - double layerZ = protoLayer.medium(binZ); - double layerHalfZ = 0.5 * protoLayer.range(binZ); - double layerThickness = protoLayer.range(binR); + 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); // adjust the layer radius ACTS_VERBOSE("Creating a cylindrical Layer:"); ACTS_VERBOSE(" - with layer R = " << layerR); - ACTS_VERBOSE(" - from R min/max = " << protoLayer.min(binR, false) << " / " - << protoLayer.max(binR, false)); + ACTS_VERBOSE(" - from R min/max = " + << protoLayer.min(BinningValue::binR, false) << " / " + << protoLayer.max(BinningValue::binR, false)); ACTS_VERBOSE(" - with R thickness = " << layerThickness); - ACTS_VERBOSE(" - incl envelope = " << protoLayer.envelope[binR][0u] - << " / " - << protoLayer.envelope[binR][1u]); + ACTS_VERBOSE(" - incl envelope = " + << protoLayer.envelope[BinningValue::binR][0u] << " / " + << protoLayer.envelope[BinningValue::binR][1u]); ACTS_VERBOSE(" - with z min/max = " - << protoLayer.min(binZ, false) << " (-" - << protoLayer.envelope[binZ][0u] << ") / " - << protoLayer.max(binZ, false) << " (+" - << protoLayer.envelope[binZ][1u] << ")"); + << protoLayer.min(BinningValue::binZ, false) << " (-" + << protoLayer.envelope[BinningValue::binZ][0u] << ") / " + << protoLayer.max(BinningValue::binZ, false) << " (+" + << protoLayer.envelope[BinningValue::binZ][1u] << ")"); ACTS_VERBOSE(" - z center = " << layerZ); ACTS_VERBOSE(" - halflength z = " << layerHalfZ); @@ -163,9 +165,9 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( ACTS_VERBOSE(" - layer z shift = " << -layerZ); } - ACTS_VERBOSE(" - with phi min/max = " << protoLayer.min(binPhi, false) - << " / " - << protoLayer.max(binPhi, false)); + ACTS_VERBOSE(" - with phi min/max = " + << protoLayer.min(BinningValue::binPhi, false) << " / " + << protoLayer.max(BinningValue::binPhi, false)); ACTS_VERBOSE(" - # of modules = " << surfaces.size() << ""); // create the surface array @@ -203,26 +205,27 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( ProtoLayer protoLayer = _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); - double layerZ = protoLayer.medium(binZ); - double layerThickness = protoLayer.range(binZ); + double layerZ = protoLayer.medium(BinningValue::binZ); + double layerThickness = protoLayer.range(BinningValue::binZ); // adjust the layer radius ACTS_VERBOSE("Creating a disk Layer:"); ACTS_VERBOSE(" - at Z position = " << layerZ); - ACTS_VERBOSE(" - from Z min/max = " << protoLayer.min(binZ, false) << " / " - << protoLayer.max(binZ, false)); + ACTS_VERBOSE(" - from Z min/max = " + << protoLayer.min(BinningValue::binZ, false) << " / " + << protoLayer.max(BinningValue::binZ, false)); ACTS_VERBOSE(" - with Z thickness = " << layerThickness); - ACTS_VERBOSE(" - incl envelope = " << protoLayer.envelope[binZ][0u] - << " / " - << protoLayer.envelope[binZ][1u]); + ACTS_VERBOSE(" - incl envelope = " + << protoLayer.envelope[BinningValue::binZ][0u] << " / " + << protoLayer.envelope[BinningValue::binZ][1u]); ACTS_VERBOSE(" - with R min/max = " - << protoLayer.min(binR, false) << " (-" - << protoLayer.envelope[binR][0u] << ") / " - << protoLayer.max(binR, false) << " (+" - << protoLayer.envelope[binR][1u] << ")"); - ACTS_VERBOSE(" - with phi min/max = " << protoLayer.min(binPhi, false) - << " / " - << protoLayer.max(binPhi, false)); + << protoLayer.min(BinningValue::binR, false) << " (-" + << protoLayer.envelope[BinningValue::binR][0u] << ") / " + << protoLayer.max(BinningValue::binR, false) << " (+" + << protoLayer.envelope[BinningValue::binR][1u] << ")"); + ACTS_VERBOSE(" - with phi min/max = " + << protoLayer.min(BinningValue::binPhi, false) << " / " + << protoLayer.max(BinningValue::binPhi, false)); ACTS_VERBOSE(" - # of modules = " << surfaces.size() << " ordered in ( " << binsR << " x " << binsPhi << ")"); @@ -241,8 +244,8 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( } // create the share disc bounds - auto dBounds = std::make_shared(protoLayer.min(binR), - protoLayer.max(binR)); + auto dBounds = std::make_shared( + protoLayer.min(BinningValue::binR), protoLayer.max(BinningValue::binR)); // create the layers // we use the same transform here as for the layer itself @@ -267,26 +270,27 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( ProtoLayer protoLayer = _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); - double layerZ = protoLayer.medium(binZ); - double layerThickness = protoLayer.range(binZ); + double layerZ = protoLayer.medium(BinningValue::binZ); + double layerThickness = protoLayer.range(BinningValue::binZ); // adjust the layer radius ACTS_VERBOSE("Creating a disk Layer:"); ACTS_VERBOSE(" - at Z position = " << layerZ); - ACTS_VERBOSE(" - from Z min/max = " << protoLayer.min(binZ, false) << " / " - << protoLayer.max(binZ, false)); + ACTS_VERBOSE(" - from Z min/max = " + << protoLayer.min(BinningValue::binZ, false) << " / " + << protoLayer.max(BinningValue::binZ, false)); ACTS_VERBOSE(" - with Z thickness = " << layerThickness); - ACTS_VERBOSE(" - incl envelope = " << protoLayer.envelope[binZ][0u] - << " / " - << protoLayer.envelope[binZ][1u]); + ACTS_VERBOSE(" - incl envelope = " + << protoLayer.envelope[BinningValue::binZ][0u] << " / " + << protoLayer.envelope[BinningValue::binZ][1u]); ACTS_VERBOSE(" - with R min/max = " - << protoLayer.min(binR, false) << " (-" - << protoLayer.envelope[binR][0u] << ") / " - << protoLayer.max(binR, false) << " (+" - << protoLayer.envelope[binR][1u] << ")"); - ACTS_VERBOSE(" - with phi min/max = " << protoLayer.min(binPhi, false) - << " / " - << protoLayer.max(binPhi, false)); + << protoLayer.min(BinningValue::binR, false) << " (-" + << protoLayer.envelope[BinningValue::binR][0u] << ") / " + << protoLayer.max(BinningValue::binR, false) << " (+" + << protoLayer.envelope[BinningValue::binR][1u] << ")"); + ACTS_VERBOSE(" - with phi min/max = " + << protoLayer.min(BinningValue::binPhi, false) << " / " + << protoLayer.max(BinningValue::binPhi, false)); ACTS_VERBOSE(" - # of modules = " << surfaces.size()); // create the layer transforms if not given @@ -305,8 +309,8 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( } // create the shared disc bounds - auto dBounds = std::make_shared(protoLayer.min(binR), - protoLayer.max(binR)); + auto dBounds = std::make_shared( + protoLayer.min(BinningValue::binR), protoLayer.max(BinningValue::binR)); // create the layers MutableLayerPtr dLayer = @@ -333,38 +337,52 @@ Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( double layerHalf1 = 0, layerHalf2 = 0, layerThickness = 0; switch (bValue) { case BinningValue::binX: { - layerHalf1 = 0.5 * (protoLayer.max(binY) - protoLayer.min(binY)); - layerHalf2 = 0.5 * (protoLayer.max(binZ) - protoLayer.min(binZ)); - layerThickness = (protoLayer.max(binX) - protoLayer.min(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)); break; } case BinningValue::binY: { - layerHalf1 = 0.5 * (protoLayer.max(binX) - protoLayer.min(binX)); - layerHalf2 = 0.5 * (protoLayer.max(binZ) - protoLayer.min(binZ)); - layerThickness = (protoLayer.max(binY) - protoLayer.min(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)); break; } case BinningValue::binZ: { - layerHalf1 = 0.5 * (protoLayer.max(binX) - protoLayer.min(binX)); - layerHalf2 = 0.5 * (protoLayer.max(binY) - protoLayer.min(binY)); - layerThickness = (protoLayer.max(binZ) - protoLayer.min(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)); break; } default: throw std::invalid_argument("Invalid binning value"); } - double centerX = 0.5 * (protoLayer.max(binX) + protoLayer.min(binX)); - double centerY = 0.5 * (protoLayer.max(binY) + protoLayer.min(binY)); - double centerZ = 0.5 * (protoLayer.max(binZ) + protoLayer.min(binZ)); + 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)); ACTS_VERBOSE("Creating a plane Layer:"); ACTS_VERBOSE(" - with layer center = " << "(" << centerX << ", " << centerY << ", " << centerZ << ")"); - ACTS_VERBOSE(" - from X min/max = " << protoLayer.min(binX) << " / " - << protoLayer.max(binX)); - ACTS_VERBOSE(" - from Y min/max = " << protoLayer.min(binY) << " / " - << protoLayer.max(binY)); + 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(" - with Z thickness = " << layerThickness); ACTS_VERBOSE(" - incl envelope = " << protoLayer.envelope[bValue][0u] << " / " @@ -473,7 +491,7 @@ bool Acts::LayerCreator::checkBinning(const GeometryContext& gctx, ACTS_ERROR(" -- Inaccessible surfaces: "); for (const auto& srf : diff) { // have to choose BinningValue here - Vector3 ctr = srf->binningPosition(gctx, binR); + Vector3 ctr = srf->binningPosition(gctx, BinningValue::binR); ACTS_ERROR(" Surface(x=" << ctr.x() << ", y=" << ctr.y() << ", z=" << ctr.z() << ", r=" << perp(ctr) << ", phi=" << phi(ctr) << ")"); diff --git a/Core/src/Geometry/Polyhedron.cpp b/Core/src/Geometry/Polyhedron.cpp index c2af9153349..6663a49705a 100644 --- a/Core/src/Geometry/Polyhedron.cpp +++ b/Core/src/Geometry/Polyhedron.cpp @@ -48,10 +48,11 @@ Acts::Extent Acts::Polyhedron::extent(const Transform3& transform) const { return (vt); }); - // Special checks of binR for hyper plane surfaces + // Special checks of BinningValue::binR 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(binZ)); + Vector3 origin = + transform * Vector3(0., 0., extent.medium(BinningValue::binZ)); for (const auto& face : faces) { std::vector tface; tface.reserve(face.size()); @@ -59,8 +60,8 @@ Acts::Extent Acts::Polyhedron::extent(const Transform3& transform) const { tface.push_back(vtxs[f]); } if (detail::VerticesHelper::isInsidePolygon(origin, tface)) { - extent.range(binR).setMin(0.); - extent.range(binPhi).set(-M_PI, M_PI); + extent.range(BinningValue::binR).setMin(0.); + extent.range(BinningValue::binPhi).set(-M_PI, M_PI); break; } } @@ -89,7 +90,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(binR).expandMin(testR); + extent.range(BinningValue::binR).expandMin(testR); } } } diff --git a/Core/src/Geometry/ProtoLayerHelper.cpp b/Core/src/Geometry/ProtoLayerHelper.cpp index 2e3e64f8476..9d00aea6369 100644 --- a/Core/src/Geometry/ProtoLayerHelper.cpp +++ b/Core/src/Geometry/ProtoLayerHelper.cpp @@ -66,7 +66,7 @@ std::vector Acts::ProtoLayerHelper::protoLayers( std::vector> sortSurfaces = {surfaces}; for (const auto& sorting : sortings) { ACTS_VERBOSE("-> Sorting a set of " << sortSurfaces.size() << " in " - << binningValueNames()[sorting.first]); + << binningValueName(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 80e223fa895..c01a4473b4f 100644 --- a/Core/src/Geometry/SurfaceArrayCreator.cpp +++ b/Core/src/Geometry/SurfaceArrayCreator.cpp @@ -43,12 +43,12 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( << binsPhi * binsZ << " bins."); Transform3 ftransform = transform; - ProtoAxis pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, binPhi, - protoLayer, ftransform, binsPhi); - ProtoAxis pAxisZ = createEquidistantAxis(gctx, surfacesRaw, binZ, protoLayer, - ftransform, binsZ); + ProtoAxis pAxisPhi = createEquidistantAxis( + gctx, surfacesRaw, BinningValue::binPhi, protoLayer, ftransform, binsPhi); + ProtoAxis pAxisZ = createEquidistantAxis( + gctx, surfacesRaw, BinningValue::binZ, protoLayer, ftransform, binsZ); - double R = protoLayer.medium(binR, true); + double R = protoLayer.medium(BinningValue::binR, true); Transform3 itransform = ftransform.inverse(); // Transform lambda captures the transform matrix @@ -84,7 +84,7 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( ProtoLayer protoLayer = protoLayerOpt ? *protoLayerOpt : ProtoLayer(gctx, surfacesRaw); - double R = protoLayer.medium(binR, true); + double R = protoLayer.medium(BinningValue::binR, true); ProtoAxis pAxisPhi; ProtoAxis pAxisZ; @@ -92,19 +92,19 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( Transform3 ftransform = transform; if (bTypePhi == equidistant) { - pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, binPhi, protoLayer, - ftransform, 0); + pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, BinningValue::binPhi, + protoLayer, ftransform, 0); } else { - pAxisPhi = - createVariableAxis(gctx, surfacesRaw, binPhi, protoLayer, ftransform); + pAxisPhi = createVariableAxis(gctx, surfacesRaw, BinningValue::binPhi, + protoLayer, ftransform); } if (bTypeZ == equidistant) { - pAxisZ = - createEquidistantAxis(gctx, surfacesRaw, binZ, protoLayer, ftransform); + pAxisZ = createEquidistantAxis(gctx, surfacesRaw, BinningValue::binZ, + protoLayer, ftransform); } else { - pAxisZ = - createVariableAxis(gctx, surfacesRaw, binZ, protoLayer, ftransform); + pAxisZ = createVariableAxis(gctx, surfacesRaw, BinningValue::binZ, + protoLayer, ftransform); } Transform3 itransform = ftransform.inverse(); @@ -153,12 +153,12 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( ACTS_VERBOSE("Creating a SurfaceArray on a disc"); Transform3 ftransform = transform; - ProtoAxis pAxisR = createEquidistantAxis(gctx, surfacesRaw, binR, protoLayer, - ftransform, binsR); - ProtoAxis pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, binPhi, - protoLayer, ftransform, binsPhi); + ProtoAxis pAxisR = createEquidistantAxis( + gctx, surfacesRaw, BinningValue::binR, protoLayer, ftransform, binsR); + ProtoAxis pAxisPhi = createEquidistantAxis( + gctx, surfacesRaw, BinningValue::binPhi, protoLayer, ftransform, binsPhi); - double Z = protoLayer.medium(binZ, true); + double Z = protoLayer.medium(BinningValue::binZ, true); ACTS_VERBOSE("- z-position of disk estimated as " << Z); Transform3 itransform = transform.inverse(); @@ -211,11 +211,11 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( Transform3 ftransform = transform; if (bTypeR == equidistant) { - pAxisR = - createEquidistantAxis(gctx, surfacesRaw, binR, protoLayer, ftransform); + pAxisR = createEquidistantAxis(gctx, surfacesRaw, BinningValue::binR, + protoLayer, ftransform); } else { - pAxisR = - createVariableAxis(gctx, surfacesRaw, binR, protoLayer, ftransform); + pAxisR = createVariableAxis(gctx, surfacesRaw, BinningValue::binR, + protoLayer, ftransform); } // if we have more than one R ring, we need to figure out @@ -225,7 +225,7 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( // this FORCES equidistant binning std::vector> phiModules(pAxisR.nBins); for (const auto& srf : surfacesRaw) { - Vector3 bpos = srf->binningPosition(gctx, binR); + Vector3 bpos = srf->binningPosition(gctx, BinningValue::binR); std::size_t bin = pAxisR.getBin(perp(bpos)); phiModules.at(bin).push_back(srf); } @@ -233,7 +233,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, binPhi, a, b); + return matcher(gctx, BinningValue::binPhi, a, b); }; std::transform( @@ -251,21 +251,21 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( // @TODO: check in extrapolation std::size_t nBinsPhi = (*std::min_element(nPhiModules.begin(), nPhiModules.end())); - pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, binPhi, protoLayer, - ftransform, nBinsPhi); + pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, BinningValue::binPhi, + protoLayer, ftransform, nBinsPhi); } else { // use regular determination if (bTypePhi == equidistant) { - pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, binPhi, protoLayer, - ftransform, 0); + pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, BinningValue::binPhi, + protoLayer, ftransform, 0); } else { - pAxisPhi = - createVariableAxis(gctx, surfacesRaw, binPhi, protoLayer, ftransform); + pAxisPhi = createVariableAxis(gctx, surfacesRaw, BinningValue::binPhi, + protoLayer, ftransform); } } - double Z = protoLayer.medium(binZ, true); + double Z = protoLayer.medium(BinningValue::binZ, true); ACTS_VERBOSE("- z-position of disk estimated as " << Z); Transform3 itransform = ftransform.inverse(); @@ -333,30 +333,30 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( // Axis along the binning switch (bValue) { case BinningValue::binX: { - ProtoAxis pAxis1 = createEquidistantAxis(gctx, surfacesRaw, binY, - protoLayer, ftransform, bins1); - ProtoAxis pAxis2 = createEquidistantAxis(gctx, surfacesRaw, binZ, - protoLayer, ftransform, bins2); + ProtoAxis pAxis1 = createEquidistantAxis( + gctx, surfacesRaw, BinningValue::binY, protoLayer, ftransform, bins1); + ProtoAxis pAxis2 = createEquidistantAxis( + gctx, surfacesRaw, BinningValue::binZ, protoLayer, ftransform, bins2); sl = makeSurfaceGridLookup2D( globalToLocal, localToGlobal, pAxis1, pAxis2); break; } case BinningValue::binY: { - ProtoAxis pAxis1 = createEquidistantAxis(gctx, surfacesRaw, binX, - protoLayer, ftransform, bins1); - ProtoAxis pAxis2 = createEquidistantAxis(gctx, surfacesRaw, binZ, - protoLayer, ftransform, bins2); + ProtoAxis pAxis1 = createEquidistantAxis( + gctx, surfacesRaw, BinningValue::binX, protoLayer, ftransform, bins1); + ProtoAxis pAxis2 = createEquidistantAxis( + gctx, surfacesRaw, BinningValue::binZ, protoLayer, ftransform, bins2); sl = makeSurfaceGridLookup2D( globalToLocal, localToGlobal, pAxis1, pAxis2); break; } case BinningValue::binZ: { - ProtoAxis pAxis1 = createEquidistantAxis(gctx, surfacesRaw, binX, - protoLayer, ftransform, bins1); - ProtoAxis pAxis2 = createEquidistantAxis(gctx, surfacesRaw, binY, - protoLayer, ftransform, bins2); + ProtoAxis pAxis1 = createEquidistantAxis( + gctx, surfacesRaw, BinningValue::binX, protoLayer, ftransform, bins1); + ProtoAxis pAxis2 = createEquidistantAxis( + gctx, surfacesRaw, BinningValue::binY, protoLayer, ftransform, bins2); sl = makeSurfaceGridLookup2D( globalToLocal, localToGlobal, pAxis1, pAxis2); @@ -431,15 +431,17 @@ Acts::SurfaceArrayCreator::createVariableAxis( std::vector keys = findKeySurfaces(surfaces, equal); std::vector bValues; - if (bValue == Acts::binPhi) { - std::stable_sort(keys.begin(), keys.end(), - [&gctx](const Acts::Surface* a, const Acts::Surface* b) { - return (phi(a->binningPosition(gctx, binPhi)) < - phi(b->binningPosition(gctx, binPhi))); - }); + if (bValue == Acts::BinningValue::binPhi) { + 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))); + }); - AxisScalar maxPhi = 0.5 * (phi(keys.at(0)->binningPosition(gctx, binPhi)) + - phi(keys.at(1)->binningPosition(gctx, binPhi))); + AxisScalar maxPhi = + 0.5 * (phi(keys.at(0)->binningPosition(gctx, BinningValue::binPhi)) + + phi(keys.at(1)->binningPosition(gctx, BinningValue::binPhi))); // create rotation, so that maxPhi is +pi AxisScalar angle = -(M_PI + maxPhi); @@ -448,18 +450,19 @@ Acts::SurfaceArrayCreator::createVariableAxis( // iterate over all key surfaces, and use their mean position as bValues, // but // rotate using transform from before - AxisScalar previous = phi(keys.at(0)->binningPosition(gctx, binPhi)); + AxisScalar previous = + phi(keys.at(0)->binningPosition(gctx, BinningValue::binPhi)); // 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, binPhi))) + - angle; + AxisScalar edge = 0.5 * (previous + phi(surface->binningPosition( + gctx, BinningValue::binPhi))) + + angle; bValues.push_back(edge); - previous = phi(surface->binningPosition(gctx, binPhi)); + previous = phi(surface->binningPosition(gctx, BinningValue::binPhi)); } // segments @@ -487,56 +490,58 @@ Acts::SurfaceArrayCreator::createVariableAxis( bValues.push_back(M_PI); - } else if (bValue == Acts::binZ) { - std::stable_sort(keys.begin(), keys.end(), - [&gctx](const Acts::Surface* a, const Acts::Surface* b) { - return (a->binningPosition(gctx, binZ).z() < - b->binningPosition(gctx, binZ).z()); - }); + } else if (bValue == Acts::BinningValue::binZ) { + 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()); + }); - bValues.push_back(protoLayer.min(binZ)); - bValues.push_back(protoLayer.max(binZ)); + bValues.push_back(protoLayer.min(BinningValue::binZ)); + bValues.push_back(protoLayer.max(BinningValue::binZ)); // the z-center position of the previous surface - AxisScalar previous = keys.front()->binningPosition(gctx, binZ).z(); + AxisScalar previous = + keys.front()->binningPosition(gctx, BinningValue::binZ).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, binZ).z())); - previous = (*surface)->binningPosition(gctx, binZ).z(); + 0.5 * (previous + + (*surface)->binningPosition(gctx, BinningValue::binZ).z())); + previous = (*surface)->binningPosition(gctx, BinningValue::binZ).z(); } - } else { // binR - std::stable_sort(keys.begin(), keys.end(), - [&gctx](const Acts::Surface* a, const Acts::Surface* b) { - return (perp(a->binningPosition(gctx, binR)) < - perp(b->binningPosition(gctx, binR))); - }); + } else { // BinningValue::binR + 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))); + }); - bValues.push_back(protoLayer.min(binR)); - bValues.push_back(protoLayer.max(binR)); + bValues.push_back(protoLayer.min(BinningValue::binR)); + bValues.push_back(protoLayer.max(BinningValue::binR)); // the r-center position of the previous surface - AxisScalar previous = perp(keys.front()->binningPosition(gctx, binR)); + AxisScalar previous = + perp(keys.front()->binningPosition(gctx, BinningValue::binR)); // 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, binR)))); - previous = perp((*surface)->binningPosition(gctx, binR)); + bValues.push_back(0.5 * (previous + perp((*surface)->binningPosition( + gctx, BinningValue::binR)))); + previous = perp((*surface)->binningPosition(gctx, BinningValue::binR)); } } std::sort(bValues.begin(), bValues.end()); ACTS_VERBOSE("Create variable binning Axis for binned SurfaceArray"); ACTS_VERBOSE(" BinningValue: " << bValue); - ACTS_VERBOSE( - " (binX = 0, binY = 1, binZ = 2, binR = 3, binPhi = 4, " - "binRPhi = 5, binH = 6, binEta = 7)"); ACTS_VERBOSE(" Number of bins: " << (bValues.size() - 1)); ACTS_VERBOSE(" (Min/Max) = (" << bValues.front() << "/" << bValues.back() << ")"); @@ -584,7 +589,7 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( auto matcher = m_cfg.surfaceMatcher; // now check the binning value - if (bValue == binPhi) { + if (bValue == BinningValue::binPhi) { if (m_cfg.doPhiBinningOptimization) { // Phi binning // set the binning option for phi @@ -592,8 +597,8 @@ 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, binR)) < - phi(b->binningPosition(gctx, binR)); + return phi(a->binningPosition(gctx, BinningValue::binR)) < + phi(b->binningPosition(gctx, BinningValue::binR)); }); // get the key surfaces at the different phi positions @@ -615,15 +620,15 @@ 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, binR)); + double max = phi(maxElem->binningPosition(gctx, BinningValue::binR)); double angle = M_PI - (max + 0.5 * step); // replace given transform ref transform = (transform)*AngleAxis3(angle, Vector3::UnitZ()); } else { - minimum = protoLayer.min(binPhi, true); - maximum = protoLayer.max(binPhi, true); + minimum = protoLayer.min(BinningValue::binPhi, true); + maximum = protoLayer.max(BinningValue::binPhi, true); // we do not need a transform in this case } } else { @@ -638,9 +643,6 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( // assign the bin size ACTS_VERBOSE("Create equidistant binning Axis for binned SurfaceArray"); ACTS_VERBOSE(" BinningValue: " << bValue); - ACTS_VERBOSE( - " (binX = 0, binY = 1, binZ = 2, binR = 3, binPhi = 4, " - "binRPhi = 5, binH = 6, binEta = 7)"); ACTS_VERBOSE(" Number of bins: " << binNumber); ACTS_VERBOSE(" (Min/Max) = (" << minimum << "/" << maximum << ")"); diff --git a/Core/src/Geometry/TrackingVolume.cpp b/Core/src/Geometry/TrackingVolume.cpp index 5065034185b..1c2fd682e9e 100644 --- a/Core/src/Geometry/TrackingVolume.cpp +++ b/Core/src/Geometry/TrackingVolume.cpp @@ -153,10 +153,11 @@ void TrackingVolume::glueTrackingVolume(const GeometryContext& gctx, BoundarySurfaceFace bsfMine, TrackingVolume* neighbor, BoundarySurfaceFace bsfNeighbor) { - // Find the connection of the two tracking volumes: binR returns the center - // except for cylindrical volumes - Vector3 bPosition(binningPosition(gctx, binR)); - Vector3 distance = Vector3(neighbor->binningPosition(gctx, binR) - bPosition); + // 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); // glue to the face std::shared_ptr> bSurfaceMine = boundarySurfaces().at(bsfMine); @@ -196,14 +197,14 @@ void TrackingVolume::glueTrackingVolumes( const GeometryContext& gctx, BoundarySurfaceFace bsfMine, const std::shared_ptr& neighbors, BoundarySurfaceFace bsfNeighbor) { - // find the connection of the two tracking volumes : binR returns the center - // except for cylindrical volumes + // find the connection of the two tracking volumes : BinningValue::binR + // returns the center except for cylindrical volumes std::shared_ptr nRefVolume = neighbors->arrayObjects().at(0); // get the distance - Vector3 bPosition(binningPosition(gctx, binR)); - Vector3 distance = - Vector3(nRefVolume->binningPosition(gctx, binR) - bPosition); + Vector3 bPosition(binningPosition(gctx, BinningValue::binR)); + Vector3 distance = Vector3( + nRefVolume->binningPosition(gctx, BinningValue::binR) - bPosition); // take the normal at the binning positio std::shared_ptr> bSurfaceMine = boundarySurfaces().at(bsfMine); diff --git a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp index 6de559c88c1..15ca130289a 100644 --- a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp +++ b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp @@ -23,7 +23,7 @@ Acts::TrackingVolumeArrayCreator::trackingVolumeArray( const GeometryContext& gctx, const TrackingVolumeVector& tVolumes, BinningValue bValue) const { // MSG_VERBOSE("Create VolumeArray of "<< tVolumes.size() << " TrackingVolumes - // with binning in : " << binningValueNames()[bValue] ); + // with binning in : " << binningValueName(bValue) ); // let's copy and sort TrackingVolumeVector volumes(tVolumes); // sort it accordingly to the binning value diff --git a/Core/src/Geometry/Volume.cpp b/Core/src/Geometry/Volume.cpp index a69154624b5..79dcf5598dc 100644 --- a/Core/src/Geometry/Volume.cpp +++ b/Core/src/Geometry/Volume.cpp @@ -37,7 +37,7 @@ Vector3 Volume::binningPosition(const GeometryContext& /*gctx*/, BinningValue bValue) const { // for most of the binning types it is actually the center, // just for R-binning types the - if (bValue == binR || bValue == binRPhi) { + if (bValue == BinningValue::binR || bValue == BinningValue::binRPhi) { // the binning Position for R-type may have an offset return (center() + m_volumeBounds->binningOffset(bValue)); } diff --git a/Core/src/Material/MaterialGridHelper.cpp b/Core/src/Material/MaterialGridHelper.cpp index a348169bda6..23792f3bd7f 100644 --- a/Core/src/Material/MaterialGridHelper.cpp +++ b/Core/src/Material/MaterialGridHelper.cpp @@ -88,41 +88,40 @@ std::function Acts::globalToLocalFromBin( std::function transfoGlobalToLocal; switch (type) { - case Acts::binX: + case Acts::BinningValue::binX: transfoGlobalToLocal = [](const Acts::Vector3& pos) -> double { return (pos.x()); }; break; - case Acts::binY: + case Acts::BinningValue::binY: transfoGlobalToLocal = [](const Acts::Vector3& pos) -> double { return (pos.y()); }; break; - case Acts::binR: + case Acts::BinningValue::binR: transfoGlobalToLocal = [](const Acts::Vector3& pos) -> double { return (Acts::VectorHelpers::perp(pos)); }; break; - case Acts::binPhi: + case Acts::BinningValue::binPhi: transfoGlobalToLocal = [](const Acts::Vector3& pos) -> double { return (Acts::VectorHelpers::phi(pos)); }; break; - case Acts::binZ: + case Acts::BinningValue::binZ: transfoGlobalToLocal = [](const Acts::Vector3& pos) -> double { return (pos.z()); }; break; - // case Acts::binRPhi: - // case Acts::binEta: - // case Acts::binH: - // case Acts::binMag: - // case Acts::binValues: + // case Acts::BinningValue::binRPhi: + // case Acts::BinningValue::binEta: + // case Acts::BinningValue::binH: + // case Acts::BinningValue::binMag: default: throw std::invalid_argument("Incorrect bin, should be x,y,z,r,phi"); } @@ -138,10 +137,12 @@ Acts::Grid2D Acts::createGrid2D( bool isCylindrical = false; for (std::size_t b = 0; b < bu.size(); b++) { - if (bu[b].binvalue == Acts::binX || bu[b].binvalue == Acts::binY) { + if (bu[b].binvalue == Acts::BinningValue::binX || + bu[b].binvalue == Acts::BinningValue::binY) { isCartesian = true; } - if (bu[b].binvalue == Acts::binR || bu[b].binvalue == Acts::binPhi) { + if (bu[b].binvalue == Acts::BinningValue::binR || + bu[b].binvalue == Acts::BinningValue::binPhi) { isCylindrical = true; } } @@ -176,10 +177,12 @@ Acts::Grid3D Acts::createGrid3D( bool isCylindrical = false; for (std::size_t b = 0; b < bu.size(); b++) { - if (bu[b].binvalue == Acts::binX || bu[b].binvalue == Acts::binY) { + if (bu[b].binvalue == Acts::BinningValue::binX || + bu[b].binvalue == Acts::BinningValue::binY) { isCartesian = true; } - if (bu[b].binvalue == Acts::binR || bu[b].binvalue == Acts::binPhi) { + if (bu[b].binvalue == Acts::BinningValue::binR || + bu[b].binvalue == Acts::BinningValue::binPhi) { isCylindrical = true; } } diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index 71a94aff0eb..3ee3feeb58e 100644 --- a/Core/src/Surfaces/ConeSurface.cpp +++ b/Core/src/Surfaces/ConeSurface.cpp @@ -64,12 +64,15 @@ Acts::Vector3 Acts::ConeSurface::binningPosition( const Vector3& sfCenter = center(gctx); // special binning type for R-type methods - if (bValue == Acts::binR || bValue == Acts::binRPhi) { + if (bValue == Acts::BinningValue::binR || + bValue == Acts::BinningValue::binRPhi) { return Vector3(sfCenter.x() + bounds().r(sfCenter.z()), sfCenter.y(), sfCenter.z()); } // give the center as default for all of these binning types - // binX, binY, binZ, binR, binPhi, binRPhi, binH, binEta + // BinningValue::binX, BinningValue::binY, BinningValue::binZ, + // BinningValue::binR, BinningValue::binPhi, BinningValue::binRPhi, + // BinningValue::binH, BinningValue::binEta return sfCenter; } diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index b044fb9bec1..b04bb2fca58 100644 --- a/Core/src/Surfaces/CylinderSurface.cpp +++ b/Core/src/Surfaces/CylinderSurface.cpp @@ -85,13 +85,16 @@ Acts::CylinderSurface& Acts::CylinderSurface::operator=( Acts::Vector3 Acts::CylinderSurface::binningPosition( const GeometryContext& gctx, BinningValue bValue) const { // special binning type for R-type methods - if (bValue == Acts::binR || bValue == Acts::binRPhi) { + if (bValue == Acts::BinningValue::binR || + bValue == Acts::BinningValue::binRPhi) { 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 - // binX, binY, binZ, binR, binPhi, binRPhi, binH, binEta + // BinningValue::binX, BinningValue::binY, BinningValue::binZ, + // BinningValue::binR, BinningValue::binPhi, BinningValue::binRPhi, + // BinningValue::binH, BinningValue::binEta return center(gctx); } @@ -370,7 +373,7 @@ std::shared_ptr Acts::CylinderSurface::mergedWith( BinningValue direction, const Logger& logger) const { using namespace Acts::UnitLiterals; - ACTS_DEBUG("Merging cylinder surfaces in " << binningValueNames()[direction] + ACTS_DEBUG("Merging cylinder surfaces in " << binningValueName(direction) << " direction"); Transform3 otherLocal = transform(gctx).inverse() * other.transform(gctx); @@ -433,7 +436,7 @@ std::shared_ptr Acts::CylinderSurface::mergedWith( "CylinderSurface::merge: surfaces have relative translation in x/y"); } - if (direction == Acts::binZ) { + if (direction == Acts::BinningValue::binZ) { // z shift must match the bounds ActsScalar hlZ = bounds().get(CylinderBounds::eHalfLengthZ); @@ -475,7 +478,7 @@ std::shared_ptr Acts::CylinderSurface::mergedWith( return Surface::makeShared(newTransform, newBounds); - } else if (direction == Acts::binRPhi) { + } else if (direction == Acts::BinningValue::binRPhi) { // no z shift is allowed if (std::abs(translation[2]) > tolerance) { ACTS_ERROR( @@ -508,6 +511,6 @@ std::shared_ptr Acts::CylinderSurface::mergedWith( } else { throw SurfaceMergingException(getSharedPtr(), other.getSharedPtr(), "CylinderSurface::merge: invalid direction " + - binningValueNames()[direction]); + binningValueName(direction)); } } diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index bc0543887f0..384d1cf5e08 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -351,7 +351,7 @@ Acts::Vector3 Acts::DiscSurface::normal(const GeometryContext& gctx) const { Acts::Vector3 Acts::DiscSurface::binningPosition(const GeometryContext& gctx, BinningValue bValue) const { - if (bValue == binR || bValue == binPhi) { + if (bValue == BinningValue::binR || bValue == BinningValue::binPhi) { double r = m_bounds->binningValueR(); double phi = m_bounds->binningValuePhi(); return localToGlobal(gctx, Vector2{r, phi}, Vector3{}); @@ -361,10 +361,10 @@ Acts::Vector3 Acts::DiscSurface::binningPosition(const GeometryContext& gctx, double Acts::DiscSurface::binningPositionValue(const GeometryContext& gctx, BinningValue bValue) const { - if (bValue == binR) { + if (bValue == BinningValue::binR) { return VectorHelpers::perp(binningPosition(gctx, bValue)); } - if (bValue == binPhi) { + if (bValue == BinningValue::binPhi) { return VectorHelpers::phi(binningPosition(gctx, bValue)); } @@ -383,7 +383,7 @@ std::shared_ptr Acts::DiscSurface::mergedWith( BinningValue direction, const Logger& logger) const { using namespace Acts::UnitLiterals; - ACTS_DEBUG("Merging disc surfaces in " << binningValueNames()[direction] + ACTS_DEBUG("Merging disc surfaces in " << binningValueName(direction) << " direction"); Transform3 otherLocal = transform(gctx).inverse() * other.transform(gctx); @@ -447,7 +447,7 @@ std::shared_ptr Acts::DiscSurface::mergedWith( << otherAvgPhi / 1_degree << " +- " << otherHlPhi / 1_degree); - if (direction == Acts::binR) { + if (direction == Acts::BinningValue::binR) { if (std::abs(minR - otherMaxR) > tolerance && std::abs(maxR - otherMinR) > tolerance) { ACTS_ERROR("DiscSurface::merge: surfaces are not touching r"); @@ -479,7 +479,7 @@ std::shared_ptr Acts::DiscSurface::mergedWith( return Surface::makeShared(transform(gctx), newBounds); - } else if (direction == Acts::binPhi) { + } else if (direction == Acts::BinningValue::binPhi) { if (std::abs(maxR - otherMaxR) > tolerance || std::abs(minR - otherMinR) > tolerance) { ACTS_ERROR("DiscSurface::merge: surfaces don't have same r bounds"); @@ -503,10 +503,9 @@ std::shared_ptr Acts::DiscSurface::mergedWith( } else { ACTS_ERROR("DiscSurface::merge: invalid direction " - << binningValueNames()[direction]); - - throw SurfaceMergingException(getSharedPtr(), other.getSharedPtr(), - "DiscSurface::merge: invalid direction " + - binningValueNames()[direction]); + << binningValueName(direction)); + throw SurfaceMergingException( + getSharedPtr(), other.getSharedPtr(), + "DiscSurface::merge: invalid direction " + binningValueName(direction)); } } diff --git a/Core/src/Utilities/BinningType.cpp b/Core/src/Utilities/BinningType.cpp new file mode 100644 index 00000000000..dd0295881a9 --- /dev/null +++ b/Core/src/Utilities/BinningType.cpp @@ -0,0 +1,53 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2016-2024 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 http://mozilla.org/MPL/2.0/. + +#include "Acts/Utilities/BinningType.hpp" + +#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::find(s_binningValueNames.begin(), s_binningValueNames.end(), 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 53a23bfd83d..64ede8dcd89 100644 --- a/Core/src/Utilities/CMakeLists.txt +++ b/Core/src/Utilities/CMakeLists.txt @@ -6,4 +6,5 @@ target_sources( Logger.cpp SpacePointUtility.cpp TrackHelpers.cpp + BinningType.cpp ) diff --git a/Core/src/Visualization/GeometryView3D.cpp b/Core/src/Visualization/GeometryView3D.cpp index 960182a4431..33822f9ac7d 100644 --- a/Core/src/Visualization/GeometryView3D.cpp +++ b/Core/src/Visualization/GeometryView3D.cpp @@ -127,8 +127,9 @@ void Acts::GeometryView3D::drawSurfaceArray( auto axes = surfaceArray.getAxes(); if (!binning.empty() && binning.size() == 2 && axes.size() == 2) { // Cylinder surface array - if (binning[0] == binPhi && binning[1] == binZ) { - double R = arrayExtent.medium(binR) + gridConfig.offset; + if (binning[0] == BinningValue::binPhi && + binning[1] == BinningValue::binZ) { + double R = arrayExtent.medium(BinningValue::binR) + gridConfig.offset; auto phiValues = axes[0]->getBinEdges(); auto zValues = axes[1]->getBinEdges(); ViewConfig gridRadConfig = gridConfig; @@ -151,8 +152,9 @@ void Acts::GeometryView3D::drawSurfaceArray( } } - } else if (binning[0] == binR && binning[1] == binPhi) { - double z = arrayExtent.medium(binZ) + gridConfig.offset; + } else if (binning[0] == BinningValue::binR && + binning[1] == BinningValue::binPhi) { + double z = arrayExtent.medium(BinningValue::binZ) + 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 94023637068..1305ea657b8 100644 --- a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/Smearers.hpp +++ b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/Smearers.hpp @@ -138,7 +138,7 @@ struct Uniform { /// Construct with a @param pitch standard deviation and @param range Uniform(double pitch, const std::pair& range_) : binningData( - Acts::open, Acts::binX, + Acts::open, Acts::BinningValue::binX, static_cast((range_.second - range_.first) / pitch), range_.first, range_.second) {} @@ -176,7 +176,7 @@ struct Digital { /// Construct with a @param pitch standard deviation and @param range Digital(double pitch, const std::pair& range_) : binningData( - Acts::open, Acts::binX, + Acts::open, Acts::BinningValue::binX, 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 3554c239535..504f364f4c0 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::binX, + 0, # Acts::BinningValue::binX, (high - low) / pitch, low, high, diff --git a/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp b/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp index 7e12064df20..6e363809ca2 100644 --- a/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp +++ b/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp @@ -80,15 +80,17 @@ void ActsExamples::DigitizationConfigurator::operator()( switch (sBounds.type()) { // The module is a rectangle module case Acts::SurfaceBounds::eRectangle: { - if (inputSegmentation.binningData()[0].binvalue == Acts::binX) { + if (inputSegmentation.binningData()[0].binvalue == + Acts::BinningValue::binX) { Acts::ActsScalar minX = boundValues[Acts::RectangleBounds::eMinX]; Acts::ActsScalar maxX = boundValues[Acts::RectangleBounds::eMaxX]; unsigned int nBins = static_cast(std::round( (maxX - minX) / inputSegmentation.binningData()[0].step)); - outputSegmentation += - Acts::BinUtility(nBins, minX, maxX, Acts::open, Acts::binX); + outputSegmentation += Acts::BinUtility( + nBins, minX, maxX, Acts::open, Acts::BinningValue::binX); } - if (inputSegmentation.binningData()[0].binvalue == Acts::binY || + if (inputSegmentation.binningData()[0].binvalue == + Acts::BinningValue::binY || inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; @@ -97,23 +99,25 @@ void ActsExamples::DigitizationConfigurator::operator()( unsigned int nBins = static_cast( std::round((maxY - minY) / inputSegmentation.binningData()[accessBin].step)); - outputSegmentation += - Acts::BinUtility(nBins, minY, maxY, Acts::open, Acts::binY); + outputSegmentation += Acts::BinUtility( + nBins, minY, maxY, Acts::open, Acts::BinningValue::binY); } } break; // The module is a trapezoid module case Acts::SurfaceBounds::eTrapezoid: { - if (inputSegmentation.binningData()[0].binvalue == Acts::binX) { + if (inputSegmentation.binningData()[0].binvalue == + Acts::BinningValue::binX) { Acts::ActsScalar maxX = std::max( boundValues[Acts::TrapezoidBounds::eHalfLengthXnegY], boundValues[Acts::TrapezoidBounds::eHalfLengthXposY]); unsigned int nBins = static_cast(std::round( 2 * maxX / inputSegmentation.binningData()[0].step)); - outputSegmentation += - Acts::BinUtility(nBins, -maxX, maxX, Acts::open, Acts::binX); + outputSegmentation += Acts::BinUtility( + nBins, -maxX, maxX, Acts::open, Acts::BinningValue::binX); } - if (inputSegmentation.binningData()[0].binvalue == Acts::binY || + if (inputSegmentation.binningData()[0].binvalue == + Acts::BinningValue::binY || inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; @@ -122,22 +126,24 @@ void ActsExamples::DigitizationConfigurator::operator()( unsigned int nBins = static_cast( std::round((2 * maxY) / inputSegmentation.binningData()[accessBin].step)); - outputSegmentation += - Acts::BinUtility(nBins, -maxY, maxY, Acts::open, Acts::binY); + outputSegmentation += Acts::BinUtility( + nBins, -maxY, maxY, Acts::open, Acts::BinningValue::binY); } } break; // The module is an annulus module case Acts::SurfaceBounds::eAnnulus: { - if (inputSegmentation.binningData()[0].binvalue == Acts::binR) { + if (inputSegmentation.binningData()[0].binvalue == + Acts::BinningValue::binR) { Acts::ActsScalar minR = boundValues[Acts::AnnulusBounds::eMinR]; Acts::ActsScalar maxR = boundValues[Acts::AnnulusBounds::eMaxR]; unsigned int nBins = static_cast(std::round( (maxR - minR) / inputSegmentation.binningData()[0].step)); - outputSegmentation += - Acts::BinUtility(nBins, minR, maxR, Acts::open, Acts::binR); + outputSegmentation += Acts::BinUtility( + nBins, minR, maxR, Acts::open, Acts::BinningValue::binR); } - if (inputSegmentation.binningData()[0].binvalue == Acts::binPhi || + if (inputSegmentation.binningData()[0].binvalue == + Acts::BinningValue::binPhi || inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; @@ -150,8 +156,9 @@ void ActsExamples::DigitizationConfigurator::operator()( unsigned int nBins = static_cast( std::round((maxPhi - minPhi) / inputSegmentation.binningData()[accessBin].step)); - outputSegmentation += Acts::BinUtility(nBins, minPhi, maxPhi, - Acts::open, Acts::binPhi); + outputSegmentation += + Acts::BinUtility(nBins, minPhi, maxPhi, Acts::open, + Acts::BinningValue::binPhi); } } break; @@ -163,13 +170,15 @@ void ActsExamples::DigitizationConfigurator::operator()( Acts::ActsScalar maxR = boundValues[Acts::DiscTrapezoidBounds::eMaxR]; - if (inputSegmentation.binningData()[0].binvalue == Acts::binR) { + if (inputSegmentation.binningData()[0].binvalue == + Acts::BinningValue::binR) { unsigned int nBins = static_cast(std::round( (maxR - minR) / inputSegmentation.binningData()[0].step)); - outputSegmentation += - Acts::BinUtility(nBins, minR, maxR, Acts::open, Acts::binR); + outputSegmentation += Acts::BinUtility( + nBins, minR, maxR, Acts::open, Acts::BinningValue::binR); } - if (inputSegmentation.binningData()[0].binvalue == Acts::binPhi || + if (inputSegmentation.binningData()[0].binvalue == + Acts::BinningValue::binPhi || inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; @@ -185,23 +194,25 @@ void ActsExamples::DigitizationConfigurator::operator()( Acts::ActsScalar alpha = std::max(alphaMinR, alphaMaxR); unsigned int nBins = static_cast(std::round( 2 * alpha / inputSegmentation.binningData()[accessBin].step)); - outputSegmentation += Acts::BinUtility(nBins, averagePhi - alpha, - averagePhi + alpha, - Acts::open, Acts::binPhi); + outputSegmentation += Acts::BinUtility( + nBins, averagePhi - alpha, averagePhi + alpha, Acts::open, + Acts::BinningValue::binPhi); } } break; case Acts::SurfaceBounds::eDisc: { - if (inputSegmentation.binningData()[0].binvalue == Acts::binR) { + if (inputSegmentation.binningData()[0].binvalue == + Acts::BinningValue::binR) { Acts::ActsScalar minR = boundValues[Acts::RadialBounds::eMinR]; Acts::ActsScalar maxR = boundValues[Acts::RadialBounds::eMaxR]; unsigned int nBins = static_cast(std::round( (maxR - minR) / inputSegmentation.binningData()[0].step)); - outputSegmentation += - Acts::BinUtility(nBins, minR, maxR, Acts::open, Acts::binR); + outputSegmentation += Acts::BinUtility( + nBins, minR, maxR, Acts::open, Acts::BinningValue::binR); } - if (inputSegmentation.binningData()[0].binvalue == Acts::binPhi || + if (inputSegmentation.binningData()[0].binvalue == + Acts::BinningValue::binPhi || inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; @@ -216,8 +227,9 @@ void ActsExamples::DigitizationConfigurator::operator()( unsigned int nBins = static_cast( std::round((maxPhi - minPhi) / inputSegmentation.binningData()[accessBin].step)); - outputSegmentation += Acts::BinUtility(nBins, minPhi, maxPhi, - Acts::open, Acts::binPhi); + outputSegmentation += + Acts::BinUtility(nBins, minPhi, maxPhi, Acts::open, + Acts::BinningValue::binPhi); } } break; diff --git a/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp b/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp index 9fbda5c4c93..dfc837889b4 100644 --- a/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp +++ b/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp @@ -72,8 +72,8 @@ ActsExamples::Telescope::TelescopeG4DetectorConstruction::Construct() { new G4Material("Silicon", 14, 28.0855 * g / mole, 2.329 * g / cm3); // Construct the rotation - // This assumes the binValue is binX, binY or binZ. No reset is necessary in - // case of binZ + // This assumes the binValue is BinningValue::binX, BinningValue::binY or + // BinningValue::binZ. No reset is necessary in case of BinningValue::binZ G4RotationMatrix* rotation = nullptr; if (static_cast(m_cfg.binValue) == Acts::BinningValue::binX) { diff --git a/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MappingMaterialDecorator.hpp b/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MappingMaterialDecorator.hpp index 1a9fce3fcca..e2217692e7b 100644 --- a/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MappingMaterialDecorator.hpp +++ b/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MappingMaterialDecorator.hpp @@ -204,10 +204,10 @@ class MappingMaterialDecorator : public IMaterialDecorator { Acts::s_epsilon ? Acts::closed : Acts::open, - Acts::binPhi); - bUtility += - Acts::BinUtility(binning.second, radialBounds->rMin(), - radialBounds->rMax(), Acts::open, Acts::binR); + Acts::BinningValue::binPhi); + bUtility += Acts::BinUtility(binning.second, radialBounds->rMin(), + radialBounds->rMax(), Acts::open, + Acts::BinningValue::binR); } if (cylinderBounds != nullptr) { bUtility += Acts::BinUtility( @@ -220,43 +220,44 @@ class MappingMaterialDecorator : public IMaterialDecorator { Acts::s_epsilon ? Acts::closed : Acts::open, - Acts::binPhi); + Acts::BinningValue::binPhi); bUtility += Acts::BinUtility( binning.second, -1 * cylinderBounds->get(Acts::CylinderBounds::eHalfLengthZ), cylinderBounds->get(Acts::CylinderBounds::eHalfLengthZ), Acts::open, - Acts::binZ); + Acts::BinningValue::binZ); } if (annulusBounds != nullptr) { bUtility += Acts::BinUtility( binning.first, annulusBounds->get(Acts::AnnulusBounds::eMinPhiRel), annulusBounds->get(Acts::AnnulusBounds::eMaxPhiRel), Acts::open, - Acts::binPhi); - bUtility += - Acts::BinUtility(binning.second, annulusBounds->rMin(), - annulusBounds->rMax(), Acts::open, Acts::binR); + Acts::BinningValue::binPhi); + bUtility += Acts::BinUtility(binning.second, annulusBounds->rMin(), + annulusBounds->rMax(), Acts::open, + Acts::BinningValue::binR); } if (rectangleBounds != nullptr) { bUtility += Acts::BinUtility( binning.first, rectangleBounds->get(Acts::RectangleBounds::eMinX), rectangleBounds->get(Acts::RectangleBounds::eMaxX), Acts::open, - Acts::binX); + Acts::BinningValue::binX); bUtility += Acts::BinUtility( binning.second, rectangleBounds->get(Acts::RectangleBounds::eMinY), rectangleBounds->get(Acts::RectangleBounds::eMaxY), Acts::open, - Acts::binY); + Acts::BinningValue::binY); } if (trapezoidBounds != nullptr) { double halfLengthX = std::max( trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthXnegY), trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthXposY)); - bUtility += Acts::BinUtility(binning.first, -1 * halfLengthX, - halfLengthX, Acts::open, Acts::binX); + bUtility += + Acts::BinUtility(binning.first, -1 * halfLengthX, halfLengthX, + Acts::open, Acts::BinningValue::binX); bUtility += Acts::BinUtility( binning.second, -1 * trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthY), trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthY), - Acts::open, Acts::binY); + Acts::open, Acts::BinningValue::binY); } } return std::make_shared(bUtility); diff --git a/Examples/Algorithms/TrackFinding/src/SeedingAlgorithm.cpp b/Examples/Algorithms/TrackFinding/src/SeedingAlgorithm.cpp index 023a6e386ca..efaa4c1891a 100644 --- a/Examples/Algorithms/TrackFinding/src/SeedingAlgorithm.cpp +++ b/Examples/Algorithms/TrackFinding/src/SeedingAlgorithm.cpp @@ -266,11 +266,11 @@ ActsExamples::ProcessCode ActsExamples::SeedingAlgorithm::execute( // safely clamp double to float float up = Acts::clampValue( - std::floor(rRangeSPExtent.max(Acts::binR) / 2) * 2); + std::floor(rRangeSPExtent.max(Acts::BinningValue::binR) / 2) * 2); /// variable middle SP radial region of interest const Acts::Range1D rMiddleSPRange( - std::floor(rRangeSPExtent.min(Acts::binR) / 2) * 2 + + std::floor(rRangeSPExtent.min(Acts::BinningValue::binR) / 2) * 2 + m_cfg.seedFinderConfig.deltaRMiddleMinSPRange, up - m_cfg.seedFinderConfig.deltaRMiddleMaxSPRange); diff --git a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp index 265cfe34408..9d42ad9441c 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp @@ -159,17 +159,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::binPhi); - pCylinderUtility += Acts::BinUtility(10, -1, 1, Acts::open, Acts::binZ); + Acts::BinUtility pCylinderUtility(10, -1, 1, Acts::closed, + Acts::BinningValue::binPhi); + pCylinderUtility += + Acts::BinUtility(10, -1, 1, Acts::open, Acts::BinningValue::binZ); auto pCylinderMaterial = std::make_shared(pCylinderUtility); // - disc - Acts::BinUtility pDiscUtility(10, 0, 1, Acts::open, Acts::binR); - pDiscUtility += Acts::BinUtility(10, -1, 1, Acts::closed, Acts::binPhi); + Acts::BinUtility pDiscUtility(10, 0, 1, Acts::open, Acts::BinningValue::binR); + pDiscUtility += + Acts::BinUtility(10, -1, 1, Acts::closed, Acts::BinningValue::binPhi); auto pDiscMaterial = std::make_shared(pDiscUtility); // - plane - Acts::BinUtility pPlaneUtility(1, -1, 1, Acts::open, Acts::binX); + Acts::BinUtility pPlaneUtility(1, -1, 1, Acts::open, + Acts::BinningValue::binX); 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 651fc643ae3..8eef808dbb9 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp @@ -329,9 +329,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::binR] = {m_cfg.approachSurfaceEnvelope, - m_cfg.approachSurfaceEnvelope}; - pl.envelope[Acts::binZ] = {layerEnvelopeCoverZ, layerEnvelopeCoverZ}; + pl.envelope[Acts::BinningValue::binR] = {m_cfg.approachSurfaceEnvelope, + m_cfg.approachSurfaceEnvelope}; + pl.envelope[Acts::BinningValue::binZ] = {layerEnvelopeCoverZ, + layerEnvelopeCoverZ}; // Record the proto layer and the surfaces for the later layer building ProtoLayerSurfaces pls{std::move(pl), sVector, phiBins, zBins}; @@ -515,9 +516,9 @@ ProtoLayerCreatorT::createProtoLayers( } // create the layers with the surface arrays Acts::ProtoLayer ple(gctx, esVector); - ple.envelope[Acts::binR] = {layerEnvelopeR, layerEnvelopeR}; - ple.envelope[Acts::binZ] = {m_cfg.approachSurfaceEnvelope, - m_cfg.approachSurfaceEnvelope}; + ple.envelope[Acts::BinningValue::binR] = {layerEnvelopeR, layerEnvelopeR}; + ple.envelope[Acts::BinningValue::binZ] = {m_cfg.approachSurfaceEnvelope, + m_cfg.approachSurfaceEnvelope}; // push it into the layer vector ProtoLayerSurfaces ples{std::move(ple), esVector, layerBinsR, diff --git a/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp b/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp index f60af5f7afe..77edfa78e1a 100644 --- a/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp +++ b/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp @@ -66,13 +66,16 @@ std::vector makeLayerBuilderConfigs( // configure surface autobinning std::vector> binTolerances( - static_cast(Acts::binValues), {0., 0.}); - binTolerances[Acts::binR] = {volume.binToleranceR.lower.value_or(0.), - volume.binToleranceR.upper.value_or(0.)}; - binTolerances[Acts::binZ] = {volume.binToleranceZ.lower.value_or(0.), - volume.binToleranceZ.upper.value_or(0.)}; - binTolerances[Acts::binPhi] = {volume.binTolerancePhi.lower.value_or(0.), - volume.binTolerancePhi.upper.value_or(0.)}; + Acts::numBinningValues(), {0., 0.}); + binTolerances[toUnderlying(Acts::BinningValue::binR)] = { + volume.binToleranceR.lower.value_or(0.), + volume.binToleranceR.upper.value_or(0.)}; + binTolerances[toUnderlying(Acts::BinningValue::binZ)] = { + volume.binToleranceZ.lower.value_or(0.), + volume.binToleranceZ.upper.value_or(0.)}; + binTolerances[toUnderlying(Acts::BinningValue::binPhi)] = { + volume.binTolerancePhi.lower.value_or(0.), + volume.binTolerancePhi.upper.value_or(0.)}; layerBuilderConfig.autoSurfaceBinning = true; layerBuilderConfig.surfaceBinMatcher = @@ -101,18 +104,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::binR, {rMin, rMax}}, - {Acts::binZ, {zMin, zMax}}, + {Acts::BinningValue::binR, {rMin, rMax}}, + {Acts::BinningValue::binZ, {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::binR, str); + lConfig.splitConfigs.emplace_back(Acts::BinningValue::binR, str); } if (0 < stz) { - lConfig.splitConfigs.emplace_back(Acts::binZ, stz); + lConfig.splitConfigs.emplace_back(Acts::BinningValue::binZ, stz); } lConfig.binning0 = volume.binning0.at(ncp); lConfig.binning1 = volume.binning1.at(ncp); @@ -284,7 +287,7 @@ std::shared_ptr buildTGeoDetector( -> void { for (const auto& lcfg : lConfigs) { for (const auto& scfg : lcfg.splitConfigs) { - if (scfg.first == Acts::binR && scfg.second > 0.) { + if (scfg.first == Acts::BinningValue::binR && scfg.second > 0.) { volumeConfig.ringTolerance = std::max(volumeConfig.ringTolerance, scfg.second); volumeConfig.checkRingLayout = true; diff --git a/Fatras/src/Digitization/Segmentizer.cpp b/Fatras/src/Digitization/Segmentizer.cpp index 76467ebd220..9c2bb72c972 100644 --- a/Fatras/src/Digitization/Segmentizer.cpp +++ b/Fatras/src/Digitization/Segmentizer.cpp @@ -116,7 +116,8 @@ ActsFatras::Segmentizer::segments(const Acts::GeometryContext& geoCtx, } // The phi boundaries if (bstart[1] != bend[1]) { - double referenceR = surface.binningPositionValue(geoCtx, Acts::binR); + double referenceR = + surface.binningPositionValue(geoCtx, Acts::BinningValue::binR); 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 1b11badec5c..96076d50377 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/GridSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/GridSvgConverter.hpp @@ -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] == binPhi && + if (bValues[0u] == BinningValue::binPhi && 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 == binR) { + if (boundValue == BinningValue::binR) { // good - no swap needed edges0 = {boundRange[0u], boundRange[1u]}; } @@ -89,21 +89,26 @@ ProtoGrid convert(const grid_type& grid, // Assign edges0 = axes[0]->getBinEdges(); edges1 = axes[1]->getBinEdges(); - if (bValues[0] == binPhi && bValues[1] == binZ) { + if (bValues[0] == BinningValue::binPhi && + bValues[1] == BinningValue::binZ) { // swap needed std::swap(edges0, edges1); pGrid._type = actsvg::proto::grid::e_z_phi; - } else if (bValues[0] == binPhi && bValues[1] == binR) { + } else if (bValues[0] == BinningValue::binPhi && + bValues[1] == BinningValue::binR) { // swap needed std::swap(edges0, edges1); pGrid._type = actsvg::proto::grid::e_r_phi; - } else if (bValues[0] == binZ && bValues[1] == binPhi) { + } else if (bValues[0] == BinningValue::binZ && + bValues[1] == BinningValue::binPhi) { // good - no swap needed pGrid._type = actsvg::proto::grid::e_z_phi; - } else if (bValues[0] == binR && bValues[1] == binPhi) { + } else if (bValues[0] == BinningValue::binR && + bValues[1] == BinningValue::binPhi) { // good - no swap needed pGrid._type = actsvg::proto::grid::e_r_phi; - } else if (bValues[0] == binX && bValues[1] == binY) { + } else if (bValues[0] == BinningValue::binX && + bValues[1] == BinningValue::binY) { // 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 4596067a828..ceb12c5acb0 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp @@ -73,10 +73,11 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, // Estimate the radial extension // - for 1D phi // - for 2D z-phi or phi-z - bool estimateR = - (index_grid::grid_type::DIM == 1 && indexGrid.casts[0u] == binPhi) || - (index_grid::grid_type::DIM == 2 && - (indexGrid.casts[0u] == binPhi || indexGrid.casts[1u] == binPhi)); + bool estimateR = (index_grid::grid_type::DIM == 1 && + indexGrid.casts[0u] == BinningValue::binPhi) || + (index_grid::grid_type::DIM == 2 && + (indexGrid.casts[0u] == BinningValue::binPhi || + indexGrid.casts[1u] == BinningValue::binPhi)); for (auto [is, s] : enumerate(surfaces)) { // Create the surface converter options @@ -91,9 +92,9 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, if (estimateR) { auto sExtent = s->polyhedronRepresentation(gctx, 4u).extent(); if constexpr (index_grid::grid_type::DIM == 2u) { - pSurface._radii[0u] = sExtent.medium(binR); + pSurface._radii[0u] = sExtent.medium(BinningValue::binR); } - constrain.extend(sExtent, {binR}); + constrain.extend(sExtent, {BinningValue::binR}); } // Add center info std::string centerInfo = " - center = ("; @@ -113,10 +114,10 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, // Adjust the grid options if constexpr (index_grid::grid_type::DIM == 1u) { - if (indexGrid.casts[0u] == binPhi) { - auto estRangeR = constrain.range(binR); + if (indexGrid.casts[0u] == BinningValue::binPhi) { + auto estRangeR = constrain.range(BinningValue::binR); std::array rRange = {estRangeR.min(), estRangeR.max()}; - gridOptions.optionalBound = {rRange, binR}; + gridOptions.optionalBound = {rRange, BinningValue::binR}; } } @@ -164,7 +165,7 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, std::to_string(binCenter1) + ")"; pGrid._bin_ids.push_back(binInfo); if (estimateR) { - pGrid._reference_r = constrain.medium(binR); + pGrid._reference_r = constrain.medium(BinningValue::binR); } } } diff --git a/Plugins/ActSVG/src/LayerSvgConverter.cpp b/Plugins/ActSVG/src/LayerSvgConverter.cpp index f9ccb81b498..11cabd0e0e7 100644 --- a/Plugins/ActSVG/src/LayerSvgConverter.cpp +++ b/Plugins/ActSVG/src/LayerSvgConverter.cpp @@ -85,7 +85,8 @@ std::vector Acts::Svg::LayerConverter::convert( for (const auto& sf : layer.surfaceArray()->surfaces()) { // Surface center - const Acts::Vector3 rCenter = sf->binningPosition(gctx, Acts::binR); + const Acts::Vector3 rCenter = + sf->binningPosition(gctx, Acts::BinningValue::binR); const Acts::Vector3 sfCenter = sf->center(gctx); Acts::ActsScalar radius = Acts::VectorHelpers::perp(rCenter); Acts::ActsScalar phi = Acts::VectorHelpers::phi(rCenter); diff --git a/Plugins/ActSVG/src/PortalSvgConverter.cpp b/Plugins/ActSVG/src/PortalSvgConverter.cpp index 0d59a08c780..47ca4a12c1a 100644 --- a/Plugins/ActSVG/src/PortalSvgConverter.cpp +++ b/Plugins/ActSVG/src/PortalSvgConverter.cpp @@ -75,15 +75,15 @@ std::vector convertMultiLink( Acts::ActsScalar refC = 0.5 * (boundaries[il + 1u] + boundaries[il]); - if (bValue == Acts::binR) { + if (bValue == Acts::BinningValue::binR) { Acts::ActsScalar phi = Acts::VectorHelpers::phi(refPosition); position = Acts::Vector3(refC * std::cos(phi), refC * std::sin(phi), refPosition.z()); - } else if (bValue == Acts::binZ) { + } else if (bValue == Acts::BinningValue::binZ) { // correct to global refC += surface.transform(gctx).translation().z(); position[2] = refC; - } else if (bValue == Acts::binPhi) { + } else if (bValue == Acts::BinningValue::binPhi) { Acts::ActsScalar 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 976d1b6fd40..990cfdc75bb 100644 --- a/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp +++ b/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp @@ -48,25 +48,29 @@ Acts::Svg::SurfaceArrayConverter::convert( }; // Walk through the binning and translate - if (binning[0] == binPhi && binning[1] == binZ) { + if (binning[0] == BinningValue::binPhi && + binning[1] == BinningValue::binZ) { 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] == binPhi && binning[1] == binR) { + } else if (binning[0] == BinningValue::binPhi && + binning[1] == BinningValue::binR) { 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] == binZ && binning[1] == binPhi) { + } else if (binning[0] == BinningValue::binZ && + binning[1] == BinningValue::binPhi) { // good vType = cylinder; edges0 = axes[0]->getBinEdges(); edges1 = axes[1]->getBinEdges(); pGrid._type = actsvg::proto::grid::e_z_phi; - } else if (binning[0] == binR && binning[1] == binPhi) { + } else if (binning[0] == BinningValue::binR && + binning[1] == BinningValue::binPhi) { // good vType = polar; edges0 = axes[0]->getBinEdges(); diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp index 10e2a0bcfa2..aa5ddabef2a 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp @@ -26,7 +26,11 @@ namespace Acts { static std::vector> allowedBinnings = { - {"x", binX}, {"y", binY}, {"z", binZ}, {"phi", binPhi}, {"r", binR}}; + {"x", BinningValue::binX}, + {"y", BinningValue::binY}, + {"z", BinningValue::binZ}, + {"phi", BinningValue::binPhi}, + {"r", BinningValue::binR}}; /// Helper method to convert the string to binning value /// @@ -35,15 +39,15 @@ static std::vector> allowedBinnings = { /// @return a binningValue inline BinningValue stringToBinningValue(const std::string &binningString) { if (binningString == "x") { - return binX; + return BinningValue::binX; } else if (binningString == "y") { - return binY; + return BinningValue::binY; } else if (binningString == "z") { - return binZ; + return BinningValue::binZ; } else if (binningString == "phi") { - return binPhi; + return BinningValue::binPhi; } else if (binningString == "r") { - return binR; + return BinningValue::binR; } else { throw std::invalid_argument("DD4hepBinningHelpers: Binning value " + binningString + " not allowed."); diff --git a/Plugins/DD4hep/src/DD4hepBinningHelpers.cpp b/Plugins/DD4hep/src/DD4hepBinningHelpers.cpp index 73a9794eed8..2b37ebc040f 100644 --- a/Plugins/DD4hep/src/DD4hepBinningHelpers.cpp +++ b/Plugins/DD4hep/src/DD4hepBinningHelpers.cpp @@ -36,14 +36,14 @@ Acts::DD4hepBinningHelpers::convertBinning( Experimental::ProtoBinning(bVal, bType, nBins, nExpansion)); } else { // Equidistant binning - ActsScalar minDefault = bVal == binPhi ? -M_PI : 0.; - ActsScalar maxDefault = bVal == binPhi ? M_PI : 0.; + ActsScalar minDefault = bVal == BinningValue::binPhi ? -M_PI : 0.; + ActsScalar maxDefault = bVal == BinningValue::binPhi ? M_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 == binPhi && (max - min) > 1.9 * M_PI) { + if (bVal == BinningValue::binPhi && (max - min) > 1.9 * M_PI) { bType = Acts::AxisBoundaryType::Closed; } protoBinnings.push_back(Experimental::ProtoBinning( @@ -57,7 +57,8 @@ Acts::DD4hepBinningHelpers::convertBinning( bname + "_" + ab + "_b" + std::to_string(ib), dd4hepElement, 0.)); } // Check for closed phi binning - if (bVal == binPhi && (edges.back() - edges.front()) > 1.9 * M_PI) { + if (bVal == BinningValue::binPhi && + (edges.back() - edges.front()) > 1.9 * M_PI) { bType = Acts::AxisBoundaryType::Closed; } protoBinnings.push_back( diff --git a/Plugins/DD4hep/src/DD4hepBlueprintFactory.cpp b/Plugins/DD4hep/src/DD4hepBlueprintFactory.cpp index dfc07bf71c3..351b5312af3 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::binR}; + std::vector binning = {Acts::BinningValue::binR}; auto root = std::make_unique( dd4hepElement.name(), Acts::Transform3::Identity(), Acts::VolumeBounds::eCylinder, bValues, binning); @@ -173,17 +173,17 @@ Acts::Experimental::DD4hepBlueprintFactory::extractExternals( // Set as defaults bValues = {0., 0., 0.}; auto parsedExtent = extOpt.value(); - if (parsedExtent.constrains(binR)) { - bValues[0u] = std::floor(parsedExtent.min(binR)); - bValues[1u] = std::ceil(parsedExtent.max(binR)); + if (parsedExtent.constrains(BinningValue::binR)) { + bValues[0u] = std::floor(parsedExtent.min(BinningValue::binR)); + bValues[1u] = std::ceil(parsedExtent.max(BinningValue::binR)); } - if (parsedExtent.constrains(binZ)) { - ActsScalar minZ = parsedExtent.min(binZ) > 0. - ? std::floor(parsedExtent.min(binZ)) - : std::ceil(parsedExtent.min(binZ)); - ActsScalar maxZ = parsedExtent.max(binZ) > 0. - ? std::floor(parsedExtent.max(binZ)) - : std::ceil(parsedExtent.max(binZ)); + if (parsedExtent.constrains(BinningValue::binZ)) { + ActsScalar minZ = parsedExtent.min(BinningValue::binZ) > 0. + ? std::floor(parsedExtent.min(BinningValue::binZ)) + : std::ceil(parsedExtent.min(BinningValue::binZ)); + ActsScalar maxZ = parsedExtent.max(BinningValue::binZ) > 0. + ? std::floor(parsedExtent.max(BinningValue::binZ)) + : std::ceil(parsedExtent.max(BinningValue::binZ)); bValues[2u] = 0.5 * (maxZ - minZ); transform.translation().z() = 0.5 * (maxZ + minZ); } @@ -258,10 +258,9 @@ Acts::Experimental::DD4hepBlueprintFactory::extractInternals( if (!internalBinningValues.empty()) { ACTS_VERBOSE(" - internals extent measurement requested"); Extent internalsExtent; - ExtentEnvelope clearance = zeroEnvelopes; + ExtentEnvelope clearance = ExtentEnvelope::Zero(); for (const auto& bv : internalBinningValues) { - ACTS_VERBOSE(" -> measuring extent for " - << binningValueNames()[bv]); + ACTS_VERBOSE(" -> measuring extent for " << binningValueName(bv)); ACTS_VERBOSE(" -> with clearance :" << internalsClearance); clearance[bv] = {internalsClearance, internalsClearance}; } @@ -286,7 +285,8 @@ Acts::Experimental::DD4hepBlueprintFactory::extractInternals( baseName + "_root_volume_finder", dd4hepElement, ""); if (rootFinder == "indexed") { aux[1u] = "root finder : indexed"; - std::vector binning = {binZ, binR}; + std::vector binning = {BinningValue::binZ, + BinningValue::binR}; rootsFinderBuilder = std::make_shared( binning); diff --git a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp index 896d0c3854b..2fb52291a04 100644 --- a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp @@ -118,10 +118,12 @@ 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::binR] = {params.get("envelope_r_min"), - params.get("envelope_r_max")}; - pl.envelope[Acts::binZ] = {params.get("envelope_z_min"), - params.get("envelope_z_max")}; + pl.envelope[Acts::BinningValue::binR] = { + params.get("envelope_r_min"), + params.get("envelope_r_max")}; + pl.envelope[Acts::BinningValue::binZ] = { + params.get("envelope_z_min"), + params.get("envelope_z_max")}; } else if (geoShape != nullptr) { TGeoTubeSeg* tube = dynamic_cast(geoShape); if (tube == nullptr) { @@ -151,20 +153,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::binZ).set(eiz, eoz); - pl.extent.range(Acts::binR).set(rMin, rMax); - pl.envelope[Acts::binR] = {0., 0.}; - pl.envelope[Acts::binZ] = {0., 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.}; } 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::binZ] = {std::abs(zMin - pl.min(Acts::binZ)), - std::abs(zMax - pl.max(Acts::binZ))}; - pl.envelope[Acts::binR] = {std::abs(rMin - pl.min(Acts::binR)), - std::abs(rMax - pl.max(Acts::binR))}; - pl.extent.range(Acts::binR).set(rMin, rMax); + 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); } } else { throw std::logic_error( @@ -200,9 +204,10 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::endcapLayers( auto sArray = std::make_unique(sensitiveSurf); // create the share disc bounds - auto dBounds = std::make_shared(pl.min(Acts::binR), - pl.max(Acts::binR)); - double thickness = std::fabs(pl.max(Acts::binZ) - pl.min(Acts::binZ)); + auto dBounds = std::make_shared( + pl.min(Acts::BinningValue::binR), pl.max(Acts::BinningValue::binR)); + double thickness = std::fabs(pl.max(Acts::BinningValue::binZ) - + pl.min(Acts::BinningValue::binZ)); // Create the layer containing the sensitive surface endcapLayer = DiscLayer::create(transform, dBounds, std::move(sArray), thickness, nullptr, Acts::active); @@ -283,10 +288,12 @@ 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::binR] = {params.get("envelope_r_min"), - params.get("envelope_r_max")}; - pl.envelope[Acts::binZ] = {params.get("envelope_z_min"), - params.get("envelope_z_max")}; + pl.envelope[Acts::BinningValue::binR] = { + params.get("envelope_r_min"), + params.get("envelope_r_max")}; + pl.envelope[Acts::BinningValue::binZ] = { + params.get("envelope_z_min"), + params.get("envelope_z_max")}; } else if (geoShape != nullptr) { TGeoTubeSeg* tube = dynamic_cast(geoShape); if (tube == nullptr) { @@ -307,17 +314,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::binR).set(eir, eor); - pl.extent.range(Acts::binZ).set(-dz, dz); - pl.envelope[Acts::binR] = {0., 0.}; - pl.envelope[Acts::binZ] = {0., 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.}; } else { // set the values of the proto layer in case dimensions are given by // geometry - pl.envelope[Acts::binZ] = {std::abs(-dz - pl.min(Acts::binZ)), - std::abs(dz - pl.max(Acts::binZ))}; - pl.envelope[Acts::binR] = {std::abs(rMin - pl.min(Acts::binR)), - std::abs(rMax - pl.max(Acts::binR))}; + 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))}; } } else { throw std::logic_error( @@ -327,7 +336,9 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( "constructor!")); } - double halfZ = (pl.min(Acts::binZ) - pl.max(Acts::binZ)) * 0.5; + double halfZ = (pl.min(Acts::BinningValue::binZ) - + pl.max(Acts::BinningValue::binZ)) * + 0.5; std::shared_ptr centralLayer = nullptr; // In case the layer is sensitive @@ -339,8 +350,11 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( std::make_unique(sensitiveSurf); // create the layer - double layerR = (pl.min(Acts::binR) + pl.max(Acts::binR)) * 0.5; - double thickness = std::fabs(pl.max(Acts::binR) - pl.min(Acts::binR)); + double layerR = (pl.min(Acts::BinningValue::binR) + + pl.max(Acts::BinningValue::binR)) * + 0.5; + double thickness = std::fabs(pl.max(Acts::BinningValue::binR) - + pl.min(Acts::BinningValue::binR)); 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 558132a4605..9135fd6608a 100644 --- a/Plugins/DD4hep/src/DD4hepLayerStructure.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerStructure.cpp @@ -69,7 +69,7 @@ Acts::Experimental::DD4hepLayerStructure::builder( ACTS_VERBOSE("Checking if surface binning ranges can be patched."); for (auto& b : fCache.binnings) { if (extent.constrains(b.binValue)) { - ACTS_VERBOSE("Binning '" << binningValueNames()[b.binValue] + ACTS_VERBOSE("Binning '" << binningValueName(b.binValue) << "' is patched."); ACTS_VERBOSE(" <- from : [" << b.edges.front() << ", " << b.edges.back() << "]"); diff --git a/Plugins/DD4hep/src/DD4hepMaterialHelpers.cpp b/Plugins/DD4hep/src/DD4hepMaterialHelpers.cpp index 6667da5b912..02fb1fa4947 100644 --- a/Plugins/DD4hep/src/DD4hepMaterialHelpers.cpp +++ b/Plugins/DD4hep/src/DD4hepMaterialHelpers.cpp @@ -13,6 +13,7 @@ #include "Acts/Plugins/DD4hep/DD4hepConversionHelpers.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/BinUtility.hpp" +#include "Acts/Utilities/BinningType.hpp" #include #include @@ -34,11 +35,7 @@ std::shared_ptr Acts::createProtoMaterial( Acts::BinUtility bu; // Loop over the bins for (auto& bin : binning) { - // finding the iterator position to determine the binning value - auto bit = std::find(Acts::binningValueNames().begin(), - Acts::binningValueNames().end(), bin.first); - const int indx = std::distance(Acts::binningValueNames().begin(), bit); - Acts::BinningValue bval = Acts::BinningValue{indx}; + BinningValue bval = binningValueFromName(bin.first); Acts::BinningOption bopt = bin.second; double min = 0.; double max = 0.; diff --git a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelBinningHelper.hpp b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelBinningHelper.hpp index c00bbb80d94..bbd0e55c83b 100644 --- a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelBinningHelper.hpp +++ b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/detail/GeoModelBinningHelper.hpp @@ -39,7 +39,7 @@ inline BinningValue toBinningValue(const std::string& binning, throw std::invalid_argument( "GeoModelBinningHelper: Unknown binning value '" + binning + "'"); } - return BinningValue::binValues; + return BinningValue::numBinningValues(); } /// @brief Convert a binning string into a ProtoiBinning description diff --git a/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp b/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp index 78265c3dd93..3f12c01037d 100644 --- a/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp +++ b/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp @@ -49,7 +49,8 @@ Acts::GeoModelBlueprintCreater::create(const GeometryContext& gctx, // Prepare the KdtSurfaces if configured to do so // if (!m_cfg.detectorSurfaces.empty()) { - std::array kdtBinning = {binX, binY, binZ}; + std::array kdtBinning = { + BinningValue::binX, BinningValue::binY, BinningValue::binZ}; if (m_cfg.kdtBinning.empty()) { throw std::invalid_argument( "GeoModelBlueprintCreater: At least one binning value for KDTree " @@ -155,7 +156,7 @@ Acts::GeoModelBlueprintCreater::createNode( ACTS_VERBOSE("Found " << internalConstraints.size() << " internal constraints to check for: "); for (const auto& ic : internalConstraints) { - ACTS_VERBOSE("- " << binningValueNames()[ic]); + ACTS_VERBOSE("- " << binningValueName(ic)); } } @@ -411,9 +412,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(binZ)); - boundValues = {extent.min(binR), extent.max(binR), - 0.5 * extent.interval(binZ)}; + translation = Acts::Vector3(0., 0., extent.medium(BinningValue::binZ)); + boundValues = {extent.min(BinningValue::binR), + extent.max(BinningValue::binR), + 0.5 * extent.interval(BinningValue::binZ)}; } else { throw std::invalid_argument( "GeoModelBlueprintCreater: Unknown bounds type, only 'cyl' is " diff --git a/Plugins/GeoModel/src/detail/GeoModelExtentHelper.cpp b/Plugins/GeoModel/src/detail/GeoModelExtentHelper.cpp index 75339964300..56156e5bb6d 100644 --- a/Plugins/GeoModel/src/detail/GeoModelExtentHelper.cpp +++ b/Plugins/GeoModel/src/detail/GeoModelExtentHelper.cpp @@ -36,8 +36,9 @@ Acts::detail::GeoModelExentHelper::readBoundsConstaints( "least 4 entries (rmin, rmax, zmin, zmax)"); } // Raw database values to extent entries - constexpr std::array bvCyl = {binR, binR, binZ, - binZ, binPhi, binPhi}; + constexpr std::array bvCyl = { + BinningValue::binR, BinningValue::binR, BinningValue::binZ, + BinningValue::binZ, BinningValue::binPhi, BinningValue::binPhi}; for (auto [iv, value] : enumerate(valuesEntry)) { if (value == ctype || value[0u] == ctype[0u]) { @@ -61,7 +62,7 @@ Acts::detail::GeoModelExentHelper::readBinningConstraints( boost::split(sbTokens, sbe, boost::is_any_of(",")); BinningValue bv = Acts::detail::GeoModelBinningHelper::toBinningValue(sbTokens[0], false); - if (bv != binValues && sbTokens.size() > 1u) { + if (bv != numBinningValues() && sbTokens.size() > 1u) { std::vector valueTokens = {sbTokens.begin() + 1, sbTokens.end()}; if (!valueTokens.empty() && valueTokens[0] == "bound") { @@ -102,8 +103,9 @@ Acts::detail::GeoModelExentHelper::extentFromTable( "least 4 entries (rmin, rmax, zmin, zmax)"); } // Raw database values to extent entries - constexpr std::array bvCyl = {binR, binR, binZ, - binZ, binPhi, binPhi}; + constexpr std::array bvCyl = { + BinningValue::binR, BinningValue::binR, BinningValue::binZ, + BinningValue::binZ, BinningValue::binPhi, BinningValue::binPhi}; for (auto [iv, value] : enumerate(valuesEntry)) { // Get the binning value BinningValue bValue = bvCyl.at(iv); @@ -147,7 +149,7 @@ Acts::detail::GeoModelExentHelper::extentFromTable( } // Round up / down if configured if (roundInternalExtent) { - for (const auto& bv : s_binningValues) { + for (const auto& bv : allBinningValues()) { 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/DetrayJsonHelper.hpp b/Plugins/Json/include/Acts/Plugins/Json/DetrayJsonHelper.hpp index 84519166324..fe00fbc0aee 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/DetrayJsonHelper.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/DetrayJsonHelper.hpp @@ -109,19 +109,25 @@ inline static std::size_t accelerationLink(const binning_values_t& casts) { // Default is `brute_force` std::size_t accLink = 0u; if (casts.size() == 2u) { - if (casts[0u] == binX && casts[1u] == binY) { + if (casts[0u] == BinningValue::binX && casts[1u] == BinningValue::binY) { accLink = 1u; - } else if (casts[0u] == binR && casts[1u] == binPhi) { + } else if (casts[0u] == BinningValue::binR && + casts[1u] == BinningValue::binPhi) { accLink = 3u; - } else if (casts[0u] == binZ && casts[1u] == binPhi) { + } else if (casts[0u] == BinningValue::binZ && + casts[1u] == BinningValue::binPhi) { accLink = 4u; - } else if (casts[0u] == binZ && casts[1u] == binR) { + } else if (casts[0u] == BinningValue::binZ && + casts[1u] == BinningValue::binR) { accLink = 5u; } } else if (casts.size() == 3u) { - if (casts[0u] == binX && casts[1u] == binY && casts[2u] == binZ) { + if (casts[0u] == BinningValue::binX && casts[1u] == BinningValue::binY && + casts[2u] == BinningValue::binZ) { accLink = 2u; - } else if (casts[0u] == binZ && casts[1u] == binPhi && casts[2u] == binR) { + } else if (casts[0u] == BinningValue::binZ && + casts[1u] == BinningValue::binPhi && + casts[2u] == BinningValue::binR) { accLink = 5u; } } diff --git a/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp b/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp index cd3d96c46bf..27f8c60fa59 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.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] == binZ && indexGrid.casts[1u] == binPhi); + swapAxes = checkSwap && (indexGrid.casts[0u] == BinningValue::binZ && + indexGrid.casts[1u] == BinningValue::binPhi); } jIndexedGrid["casts"] = jCasts; jIndexedGrid["transform"] = diff --git a/Plugins/Json/src/ExtentJsonConverter.cpp b/Plugins/Json/src/ExtentJsonConverter.cpp index 8f644ce765e..5e509d74e97 100644 --- a/Plugins/Json/src/ExtentJsonConverter.cpp +++ b/Plugins/Json/src/ExtentJsonConverter.cpp @@ -19,14 +19,12 @@ #include void Acts::to_json(nlohmann::json& j, const Acts::Extent& e) { - const auto& bValueNames = binningValueNames(); - { nlohmann::json jrange; const auto& xrange = e.range(); - for (auto [ib, ibv] : enumerate(s_binningValues)) { + for (auto ibv : allBinningValues()) { if (e.constrains(ibv)) { - jrange[bValueNames[ib]] = xrange[ib]; + jrange[binningValueName(ibv)] = xrange[toUnderlying(ibv)]; } } j["range"] = jrange; @@ -35,10 +33,10 @@ void Acts::to_json(nlohmann::json& j, const Acts::Extent& e) { { nlohmann::json jenvelope; const auto& envelope = e.envelope(); - for (auto [ib, ibv] : enumerate(s_binningValues)) { + for (auto ibv : allBinningValues()) { if (envelope[ibv] != zeroEnvelope) { - jenvelope[bValueNames[ib]] = - Range1D(envelope[ib][0], envelope[ib][1]); + jenvelope[binningValueName(ibv)] = + Range1D(envelope[ibv][0], envelope[ibv][1]); } } if (!jenvelope.empty()) { @@ -48,26 +46,22 @@ void Acts::to_json(nlohmann::json& j, const Acts::Extent& e) { } void Acts::from_json(const nlohmann::json& j, Acts::Extent& e) { - const auto& bValueNames = binningValueNames(); + const auto& jrange = j["range"]; - { - const auto& jrange = j["range"]; - for (auto [ib, bvn] : enumerate(bValueNames)) { - if (jrange.contains(bvn)) { - e.set(static_cast(ib), jrange[bvn]["min"], - jrange[bvn]["max"]); - } - } + for (const auto& [key, value] : jrange.items()) { + BinningValue bval = binningValueFromName(key); + e.set(bval, value["min"], value["max"]); } if (j.contains("envelope")) { const auto& jenvelope = j["envelope"]; ExtentEnvelope envelope; - for (auto [ib, bvn] : enumerate(bValueNames)) { - if (jenvelope.find(bvn) != jenvelope.end()) { - envelope[ib] = {jenvelope[bvn]["min"], jenvelope[bvn]["max"]}; - } + + for (const auto& [key, value] : jenvelope.items()) { + BinningValue bval = binningValueFromName(key); + envelope[bval] = {value["min"], value["max"]}; } + e.setEnvelope(envelope); } } diff --git a/Plugins/Json/src/GridJsonConverter.cpp b/Plugins/Json/src/GridJsonConverter.cpp index 4dddd4b7619..8d9a805b685 100644 --- a/Plugins/Json/src/GridJsonConverter.cpp +++ b/Plugins/Json/src/GridJsonConverter.cpp @@ -197,10 +197,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, GridAccess::GlobalSubspace> + const std::tuple, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace, + GridAccess::GlobalSubspace> oneDimSubspaces = {}; for (bool transform : transformOptions) { @@ -212,16 +214,17 @@ 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> + const std::tuple< + 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) { @@ -246,23 +249,29 @@ Acts::GridAccessJsonConverter::globalToGridLocalFromJson( // Switch and fill for 1D if (accessors.size() == 1u) { switch (accessors[0]) { - case binX: - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); + case BinningValue::binX: + globalToGridLocal = + decodeGeneralSubspace(jGlobalToGridLocal); break; - case binY: - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); + case BinningValue::binY: + globalToGridLocal = + decodeGeneralSubspace(jGlobalToGridLocal); break; - case binZ: - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); + case BinningValue::binZ: + globalToGridLocal = + decodeGeneralSubspace(jGlobalToGridLocal); break; - case binR: - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); + case BinningValue::binR: + globalToGridLocal = + decodeGeneralSubspace(jGlobalToGridLocal); break; - case binPhi: - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); + case BinningValue::binPhi: + globalToGridLocal = + decodeGeneralSubspace(jGlobalToGridLocal); break; - case binEta: - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); + case BinningValue::binEta: + globalToGridLocal = + decodeGeneralSubspace(jGlobalToGridLocal); break; default: // globalToGridLocal = nullptr; @@ -272,30 +281,56 @@ Acts::GridAccessJsonConverter::globalToGridLocalFromJson( // Switch and fill for 2D if (accessors.size() == 2u) { - if (accessors == std::vector{binX, binY}) { - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); - } else if (accessors == std::vector{binY, binX}) { - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); - } else if (accessors == std::vector{binX, binZ}) { - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); - } else if (accessors == std::vector{binZ, binX}) { - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); - } else if (accessors == std::vector{binY, binZ}) { - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); - } else if (accessors == std::vector{binZ, binY}) { - globalToGridLocal = decodeGeneralSubspace(jGlobalToGridLocal); - } else if (accessors == std::vector{binR, binPhi}) { + if (accessors == + std::vector{BinningValue::binX, BinningValue::binY}) { + globalToGridLocal = + decodeGeneralSubspace( + jGlobalToGridLocal); + } else if (accessors == std::vector{BinningValue::binY, + BinningValue::binX}) { + globalToGridLocal = + decodeGeneralSubspace( + jGlobalToGridLocal); + } else if (accessors == std::vector{BinningValue::binX, + BinningValue::binZ}) { + globalToGridLocal = + decodeGeneralSubspace( + jGlobalToGridLocal); + } else if (accessors == std::vector{BinningValue::binZ, + BinningValue::binX}) { + globalToGridLocal = + decodeGeneralSubspace( + jGlobalToGridLocal); + } else if (accessors == std::vector{BinningValue::binY, + BinningValue::binZ}) { + globalToGridLocal = + decodeGeneralSubspace( + jGlobalToGridLocal); + } else if (accessors == std::vector{BinningValue::binZ, + BinningValue::binY}) { globalToGridLocal = - decodeGeneralSubspace(jGlobalToGridLocal); - } else if (accessors == std::vector{binPhi, binR}) { + decodeGeneralSubspace( + jGlobalToGridLocal); + } else if (accessors == std::vector{BinningValue::binR, + BinningValue::binPhi}) { globalToGridLocal = - decodeGeneralSubspace(jGlobalToGridLocal); - } else if (accessors == std::vector{binZ, binPhi}) { + decodeGeneralSubspace( + jGlobalToGridLocal); + } else if (accessors == std::vector{BinningValue::binPhi, + BinningValue::binR}) { globalToGridLocal = - decodeGeneralSubspace(jGlobalToGridLocal); - } else if (accessors == std::vector{binPhi, binZ}) { + decodeGeneralSubspace( + jGlobalToGridLocal); + } else if (accessors == std::vector{BinningValue::binZ, + BinningValue::binPhi}) { globalToGridLocal = - decodeGeneralSubspace(jGlobalToGridLocal); + decodeGeneralSubspace( + jGlobalToGridLocal); + } else if (accessors == std::vector{BinningValue::binPhi, + BinningValue::binZ}) { + globalToGridLocal = + decodeGeneralSubspace( + jGlobalToGridLocal); } // else globalToGridLocal = nullptr; } @@ -312,7 +347,9 @@ Acts::GridAccessJsonConverter::globalToGridLocal1DimDelegateFromJson( } // Unroll the decoration Acts::GridAccess::GlobalToGridLocal1DimDelegate delegate; - decorateGlobal1DimDelegate( + decorateGlobal1DimDelegate( delegate, jGlobalToGridLocal); return delegate; } @@ -329,26 +366,36 @@ Acts::GridAccessJsonConverter::globalToGridLocal2DimDelegateFromJson( Acts::GridAccess::GlobalToGridLocal2DimDelegate delegate; // Only the matching one will be applied, matching condition is checked inside // the call - may unroll this es well - decorateGlobalDelegate(delegate, jGlobalToGridLocal); - decorateGlobalDelegate(delegate, jGlobalToGridLocal); - decorateGlobalDelegate(delegate, jGlobalToGridLocal); - decorateGlobalDelegate(delegate, jGlobalToGridLocal); - decorateGlobalDelegate(delegate, jGlobalToGridLocal); - decorateGlobalDelegate(delegate, jGlobalToGridLocal); - decorateGlobalDelegate(delegate, jGlobalToGridLocal); decorateGlobalDelegate(delegate, jGlobalToGridLocal); - decorateGlobalDelegate(delegate, jGlobalToGridLocal); + BinningValue::binX, BinningValue::binY>( + delegate, jGlobalToGridLocal); + decorateGlobalDelegate( + delegate, jGlobalToGridLocal); + decorateGlobalDelegate( + delegate, jGlobalToGridLocal); + decorateGlobalDelegate( + delegate, jGlobalToGridLocal); + decorateGlobalDelegate( + delegate, jGlobalToGridLocal); decorateGlobalDelegate(delegate, jGlobalToGridLocal); + BinningValue::binZ, BinningValue::binY>( + delegate, jGlobalToGridLocal); + decorateGlobalDelegate( + delegate, jGlobalToGridLocal); + decorateGlobalDelegate( + delegate, jGlobalToGridLocal); + decorateGlobalDelegate( + delegate, jGlobalToGridLocal); + decorateGlobalDelegate( + delegate, jGlobalToGridLocal); return delegate; } diff --git a/Plugins/Json/src/MaterialJsonConverter.cpp b/Plugins/Json/src/MaterialJsonConverter.cpp index 316d0507acb..cb718f01ba4 100644 --- a/Plugins/Json/src/MaterialJsonConverter.cpp +++ b/Plugins/Json/src/MaterialJsonConverter.cpp @@ -685,12 +685,12 @@ 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 == binR) { + if (bUtility.binningData()[0u].binvalue == BinningValue::binR) { // Turn to R-Phi - bUtility += BinUtility(1u, -M_PI, M_PI, closed, binR); - } else if (bUtility.binningData()[0u].binvalue == binZ) { + bUtility += BinUtility(1u, -M_PI, M_PI, closed, BinningValue::binR); + } else if (bUtility.binningData()[0u].binvalue == BinningValue::binZ) { // Turn to Phi-Z - swap needed - BinUtility nbUtility(1u, -M_PI, M_PI, closed, binPhi); + BinUtility nbUtility(1u, -M_PI, M_PI, closed, BinningValue::binPhi); nbUtility += bUtility; bUtility = std::move(nbUtility); swapped = true; @@ -698,8 +698,8 @@ nlohmann::json Acts::MaterialJsonConverter::toJsonDetray( std::runtime_error("Unsupported binning for Detray"); } } else if (bUtility.dimensions() == 2u && - bUtility.binningData()[0u].binvalue == binZ && - bUtility.binningData()[1u].binvalue == binPhi) { + bUtility.binningData()[0u].binvalue == BinningValue::binZ && + bUtility.binningData()[1u].binvalue == BinningValue::binPhi) { BinUtility nbUtility(bUtility.binningData()[1u]); nbUtility += bUtility.binningData()[0u]; bUtility = std::move(nbUtility); @@ -711,11 +711,11 @@ nlohmann::json Acts::MaterialJsonConverter::toJsonDetray( // Translate into grid index type int gridIndexType = 0; - if (bVal0 == binR && bVal1 == binPhi) { + if (bVal0 == BinningValue::binR && bVal1 == BinningValue::binPhi) { gridIndexType = 0; - } else if (bVal0 == binPhi && bVal1 == binZ) { + } else if (bVal0 == BinningValue::binPhi && bVal1 == BinningValue::binZ) { gridIndexType = 3; - } else if (bVal0 == binX && bVal1 == binY) { + } else if (bVal0 == BinningValue::binX && bVal1 == BinningValue::binY) { gridIndexType = 2; } else { std::runtime_error("Unsupported binning for Detray"); @@ -798,7 +798,7 @@ nlohmann::json Acts::MaterialJsonConverter::toJsonDetray( jAxis["label"] = ib; jAxis["bins"] = bData.bins(); ActsScalar offset = 0; - if (bData.binvalue == binZ) { + if (bData.binvalue == BinningValue::binZ) { offset = surface.center(Acts::GeometryContext{}).z(); } jAxis["edges"] = diff --git a/Plugins/Json/src/MaterialMapJsonConverter.cpp b/Plugins/Json/src/MaterialMapJsonConverter.cpp index c3b126eca14..e13a4ab59e6 100644 --- a/Plugins/Json/src/MaterialMapJsonConverter.cpp +++ b/Plugins/Json/src/MaterialMapJsonConverter.cpp @@ -118,9 +118,9 @@ Acts::SurfaceAndMaterialWithContext defaultSurfaceMaterial( Acts::s_epsilon ? Acts::closed : Acts::open, - Acts::binPhi); + Acts::BinningValue::binPhi); bUtility += Acts::BinUtility(1, radialBounds->rMin(), radialBounds->rMax(), - Acts::open, Acts::binR); + Acts::open, Acts::BinningValue::binR); } if (cylinderBounds != nullptr) { bUtility += Acts::BinUtility( @@ -133,40 +133,41 @@ Acts::SurfaceAndMaterialWithContext defaultSurfaceMaterial( Acts::s_epsilon ? Acts::closed : Acts::open, - Acts::binPhi); + Acts::BinningValue::binPhi); bUtility += Acts::BinUtility( 1, -1 * cylinderBounds->get(Acts::CylinderBounds::eHalfLengthZ), cylinderBounds->get(Acts::CylinderBounds::eHalfLengthZ), Acts::open, - Acts::binZ); + Acts::BinningValue::binZ); } if (annulusBounds != nullptr) { bUtility += Acts::BinUtility(1, annulusBounds->get(Acts::AnnulusBounds::eMinPhiRel), annulusBounds->get(Acts::AnnulusBounds::eMaxPhiRel), - Acts::open, Acts::binPhi); - bUtility += Acts::BinUtility(1, annulusBounds->rMin(), - annulusBounds->rMax(), Acts::open, Acts::binR); + Acts::open, Acts::BinningValue::binPhi); + bUtility += + Acts::BinUtility(1, annulusBounds->rMin(), annulusBounds->rMax(), + Acts::open, Acts::BinningValue::binR); } if (rectangleBounds != nullptr) { bUtility += Acts::BinUtility(1, rectangleBounds->get(Acts::RectangleBounds::eMinX), rectangleBounds->get(Acts::RectangleBounds::eMaxX), - Acts::open, Acts::binX); + Acts::open, Acts::BinningValue::binX); bUtility += Acts::BinUtility(1, rectangleBounds->get(Acts::RectangleBounds::eMinY), rectangleBounds->get(Acts::RectangleBounds::eMaxY), - Acts::open, Acts::binY); + Acts::open, Acts::BinningValue::binY); } 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::binX); + Acts::BinningValue::binX); bUtility += Acts::BinUtility( 1, -1 * trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthY), trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthY), Acts::open, - Acts::binY); + Acts::BinningValue::binY); } return {surface, std::make_shared(bUtility), context}; @@ -190,7 +191,7 @@ Acts::TrackingVolumeAndMaterial defaultVolumeMaterial( bUtility += Acts::BinUtility(1, cyBounds->get(Acts::CylinderVolumeBounds::eMinR), cyBounds->get(Acts::CylinderVolumeBounds::eMaxR), - Acts::open, Acts::binR); + Acts::open, Acts::BinningValue::binR); bUtility += Acts::BinUtility( 1, -cyBounds->get(Acts::CylinderVolumeBounds::eHalfPhiSector), cyBounds->get(Acts::CylinderVolumeBounds::eHalfPhiSector), @@ -198,35 +199,36 @@ Acts::TrackingVolumeAndMaterial defaultVolumeMaterial( Acts::s_epsilon ? Acts::closed : Acts::open, - Acts::binPhi); + Acts::BinningValue::binPhi); bUtility += Acts::BinUtility( 1, -cyBounds->get(Acts::CylinderVolumeBounds::eHalfLengthZ), cyBounds->get(Acts::CylinderVolumeBounds::eHalfLengthZ), Acts::open, - Acts::binZ); + Acts::BinningValue::binZ); } if (cutcylBounds != nullptr) { bUtility += Acts::BinUtility( 1, cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eMinR), cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eMaxR), Acts::open, - Acts::binR); - bUtility += Acts::BinUtility(1, -M_PI, M_PI, Acts::closed, Acts::binPhi); + Acts::BinningValue::binR); + bUtility += Acts::BinUtility(1, -M_PI, M_PI, Acts::closed, + Acts::BinningValue::binPhi); bUtility += Acts::BinUtility( 1, -cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eHalfLengthZ), cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eHalfLengthZ), - Acts::open, Acts::binZ); + Acts::open, Acts::BinningValue::binZ); } else if (cuBounds != nullptr) { bUtility += Acts::BinUtility( 1, -cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthX), cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthX), Acts::open, - Acts::binX); + Acts::BinningValue::binX); bUtility += Acts::BinUtility( 1, -cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthY), cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthY), Acts::open, - Acts::binY); + Acts::BinningValue::binY); bUtility += Acts::BinUtility( 1, -cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthZ), cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthZ), Acts::open, - Acts::binZ); + Acts::BinningValue::binZ); } return {volume, std::make_shared(bUtility)}; } diff --git a/Plugins/Json/src/PortalJsonConverter.cpp b/Plugins/Json/src/PortalJsonConverter.cpp index 5a311b58f48..a394525a957 100644 --- a/Plugins/Json/src/PortalJsonConverter.cpp +++ b/Plugins/Json/src/PortalJsonConverter.cpp @@ -156,12 +156,14 @@ Acts::PortalJsonConverter::toJsonDetray( // Pick the surface dimension - via poly std::array clipRange = {0., 0.}; std::vector boundValues = surfaceAdjusted->bounds().values(); - if (surfaceType == Surface::SurfaceType::Cylinder && cast == binZ) { + if (surfaceType == Surface::SurfaceType::Cylinder && + cast == BinningValue::binZ) { ActsScalar zPosition = surfaceAdjusted->center(gctx).z(); clipRange = { zPosition - boundValues[CylinderBounds::BoundValues::eHalfLengthZ], zPosition + boundValues[CylinderBounds::BoundValues::eHalfLengthZ]}; - } else if (surfaceType == Surface::SurfaceType::Disc && cast == binR) { + } else if (surfaceType == Surface::SurfaceType::Disc && + cast == BinningValue::binR) { clipRange = {boundValues[RadialBounds::BoundValues::eMinR], boundValues[RadialBounds::BoundValues::eMaxR]}; } else { diff --git a/Plugins/TGeo/src/TGeoLayerBuilder.cpp b/Plugins/TGeo/src/TGeoLayerBuilder.cpp index fca4d96bc77..9476bca114a 100644 --- a/Plugins/TGeo/src/TGeoLayerBuilder.cpp +++ b/Plugins/TGeo/src/TGeoLayerBuilder.cpp @@ -149,10 +149,13 @@ void Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, if (type == 0) { ProtoLayer pl(gctx, lSurfaces); ACTS_DEBUG("- creating CylinderLayer with " - << lSurfaces.size() << " surfaces at r = " << pl.medium(binR)); + << lSurfaces.size() + << " surfaces at r = " << pl.medium(BinningValue::binR)); - pl.envelope[Acts::binR] = {lCfg.envelope.first, lCfg.envelope.second}; - pl.envelope[Acts::binZ] = {lCfg.envelope.second, lCfg.envelope.second}; + pl.envelope[Acts::BinningValue::binR] = {lCfg.envelope.first, + lCfg.envelope.second}; + pl.envelope[Acts::BinningValue::binZ] = {lCfg.envelope.second, + lCfg.envelope.second}; if (nb0 >= 0 && nb1 >= 0) { layers.push_back( m_cfg.layerCreator->cylinderLayer(gctx, lSurfaces, nb0, nb1, pl)); @@ -163,10 +166,13 @@ void Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, } else { ProtoLayer pl(gctx, lSurfaces); ACTS_DEBUG("- creating DiscLayer with " - << lSurfaces.size() << " surfaces at z = " << pl.medium(binZ)); + << lSurfaces.size() + << " surfaces at z = " << pl.medium(BinningValue::binZ)); - pl.envelope[Acts::binR] = {lCfg.envelope.first, lCfg.envelope.second}; - pl.envelope[Acts::binZ] = {lCfg.envelope.second, lCfg.envelope.second}; + pl.envelope[Acts::BinningValue::binR] = {lCfg.envelope.first, + lCfg.envelope.second}; + pl.envelope[Acts::BinningValue::binZ] = {lCfg.envelope.second, + lCfg.envelope.second}; if (nb0 >= 0 && nb1 >= 0) { layers.push_back( m_cfg.layerCreator->discLayer(gctx, lSurfaces, nb0, nb1, pl)); @@ -186,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 " - << binningValueNames()[pRange.first] << " to [" + << binningValueName(pRange.first) << " to [" << pRange.second.first << "/" << pRange.second.second << "]."); } @@ -194,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 " - << binningValueNames()[sConfig.first] << " with tolerance " + << binningValueName(sConfig.first) << " with tolerance " << sConfig.second << "."); } } @@ -234,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 " << binningValueNames()[prange.first] + ACTS_VERBOSE(" - range " << binningValueName(prange.first) << " within [ " << prange.second.first << ", " << prange.second.second << "]"); } diff --git a/Tests/Benchmarks/BinUtilityBenchmark.cpp b/Tests/Benchmarks/BinUtilityBenchmark.cpp index 463a4d7d70e..6c9abdf5e4d 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::binX); + Acts::BinUtility small(fewBins, Acts::open, Acts::BinningValue::binX); 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::binX); + Acts::BinUtility medium(mediumBins, Acts::open, Acts::BinningValue::binX); 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::binX); + Acts::BinUtility many(manyBins, Acts::open, Acts::BinningValue::binX); Acts::Vector3 low = Acts::Vector3(1.5, 0., 0.); Acts::Vector3 high = Acts::Vector3(4.5, 0., 0.); @@ -124,7 +124,8 @@ int main(int argc, char* argv[]) { ACTS_INFO("Execution stats many: " << bin_utility_benchmark_many); ACTS_INFO("Fraction is: " << st << " vs. " << gt); - Acts::BinUtility equidistant(100, 0., 6., Acts::open, Acts::binX); + Acts::BinUtility equidistant(100, 0., 6., Acts::open, + Acts::BinningValue::binX); st = 0; gt = 0; num_iters = 0; diff --git a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp index 0e569c2fc68..b13c4843baf 100644 --- a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp +++ b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp @@ -303,7 +303,7 @@ struct CylindricalTrackingGeometry { // create the layer and store it ProtoLayer protoLayer(geoContext, layerSurfaces); - protoLayer.envelope[binR] = {0.5, 0.5}; + protoLayer.envelope[BinningValue::binR] = {0.5, 0.5}; auto pLayer = layerCreator->cylinderLayer( geoContext, std::move(layerSurfacePtrs), pLayerBinning[ilp].first, pLayerBinning[ilp].second, protoLayer); @@ -317,8 +317,8 @@ struct CylindricalTrackingGeometry { } // loop over layers // layer array - auto pLayerArray = layerArrayCreator->layerArray(geoContext, pLayers, 25., - 300., arbitrary, binR); + auto pLayerArray = layerArrayCreator->layerArray( + geoContext, pLayers, 25., 300., arbitrary, BinningValue::binR); auto pVolumeBounds = std::make_shared(25., 300., 1100.); // create the Tracking volume diff --git a/Tests/UnitTests/Core/Detector/BlueprintHelperTests.cpp b/Tests/UnitTests/Core/Detector/BlueprintHelperTests.cpp index 0f704545e7b..a307d8cba8d 100644 --- a/Tests/UnitTests/Core/Detector/BlueprintHelperTests.cpp +++ b/Tests/UnitTests/Core/Detector/BlueprintHelperTests.cpp @@ -23,7 +23,7 @@ BOOST_AUTO_TEST_SUITE(Experimental) BOOST_AUTO_TEST_CASE(BlueprintHelperSorting) { // Create root node - std::vector detectorBinning = {Acts::binR}; + std::vector detectorBinning = {Acts::BinningValue::binR}; std::vector detectorBoundaries = {0., 50., 100.}; auto detector = std::make_unique( "detector", Acts::Transform3::Identity(), Acts::VolumeBounds::eCylinder, @@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(BlueprintHelperSorting) { BOOST_CHECK(detector->children.empty()); BOOST_CHECK_EQUAL(detector->name, "detector"); - std::vector pixelsBinning = {Acts::binZ}; + std::vector pixelsBinning = {Acts::BinningValue::binZ}; std::vector pixelsBoundaries = {20., 50., 100.}; auto pixels = std::make_unique( @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE(BlueprintCylindricalGapFilling) { std::make_shared(); // Create root node - std::vector detectorBinning = {Acts::binR}; + std::vector detectorBinning = {Acts::BinningValue::binR}; std::vector detectorBoundaries = {detectorIr, detectorOr, detectorHz}; @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(BlueprintCylindricalGapFilling) { // A pixel system std::vector pixelBoundaries = {pixelIr, pixelOr, detectorHz}; - std::vector pixelBinning = {Acts::binZ}; + std::vector pixelBinning = {Acts::BinningValue::binZ}; auto pixel = std::make_unique( "pixel", Acts::Transform3::Identity(), Acts::VolumeBounds::eCylinder, pixelBoundaries, pixelBinning); @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(BlueprintCylindricalGapFilling) { // Nec: Small differences to check if the adjustments are made std::vector pixelEcBoundaries = {pixelIr, pixelOr - 5., pixelEcHz}; - std::vector pixelEcBinning = {Acts::binZ}; + std::vector pixelEcBinning = {Acts::BinningValue::binZ}; auto pixelNec = std::make_unique( "pixelNec", @@ -155,7 +155,8 @@ BOOST_AUTO_TEST_CASE(BlueprintCylindricalGapFilling) { // Barrel std::vector pixelBarrelBoundaries = { pixelIr + 1, pixelOr - 1., detectorHz - 2 * pixelEcHz}; - std::vector pixelBarrelBinning = {Acts::binR}; + std::vector pixelBarrelBinning = { + Acts::BinningValue::binR}; auto pixelBarrel = std::make_unique( "pixelBarrel", Acts::Transform3::Identity(), @@ -265,7 +266,7 @@ BOOST_AUTO_TEST_CASE(BlueprintCylindricalGapException) { // The root node - detector std::vector detectorBoundaries = {0., 50., 100.}; - std::vector detectorBinning = {Acts::binX}; + std::vector detectorBinning = {Acts::BinningValue::binX}; 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 a8d2acfcaaa..323de9218a7 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::binR}; + std::vector binning = {Acts::BinningValue::binR}; 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 1d26fc7b0eb..70243622fe9 100644 --- a/Tests/UnitTests/Core/Detector/CuboidalContainerBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/CuboidalContainerBuilderTests.cpp @@ -125,14 +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::binR; + misCfg.binning = Acts::BinningValue::binR; BOOST_CHECK_THROW(auto b = CuboidalContainerBuilder(misCfg), std::invalid_argument); } BOOST_AUTO_TEST_CASE(CuboidalContainerBuildingXYZVolumes) { - std::array binningValues = {Acts::binX, Acts::binY, - Acts::binZ}; + std::array binningValues = {Acts::BinningValue::binX, + Acts::BinningValue::binY, + Acts::BinningValue::binZ}; for (auto bVal : binningValues) { // A perfect box shape auto box = Acts::CuboidVolumeBounds(10, 10, 10); @@ -141,7 +142,7 @@ BOOST_AUTO_TEST_CASE(CuboidalContainerBuildingXYZVolumes) { auto transformB = Acts::Transform3::Identity(); Acts::Vector3 translation = Acts::Vector3::Zero(); - translation[bVal] = 20; + translation[toUnderlying(bVal)] = 20; transformB.pretranslate(translation); auto builderA = std::make_shared( @@ -167,10 +168,14 @@ BOOST_AUTO_TEST_CASE(CuboidalContainerBuildingXYZVolumes) { BOOST_CHECK_EQUAL(roots.volumes.size(), 2u); BOOST_CHECK_EQUAL(roots.volumes.at(0)->geometryId().volume(), 1u); BOOST_CHECK_EQUAL(roots.volumes.at(1)->geometryId().volume(), 2u); - BOOST_CHECK_EQUAL( - roots.volumes.at(0)->transform(tContext).translation()[bVal], 0); - BOOST_CHECK_EQUAL( - roots.volumes.at(1)->transform(tContext).translation()[bVal], 20); + BOOST_CHECK_EQUAL(roots.volumes.at(0) + ->transform(tContext) + .translation()[toUnderlying(bVal)], + 0); + BOOST_CHECK_EQUAL(roots.volumes.at(1) + ->transform(tContext) + .translation()[toUnderlying(bVal)], + 20); for (auto& portal : portals) { if (portal.second->attachedDetectorVolumes().at(0).empty()) { diff --git a/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp b/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp index 0137d8ffcd9..3365afeedcb 100644 --- a/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp +++ b/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { Acts::ActsScalar pixelZ = 10; // Create root node - std::vector detectorBins = {Acts::binX}; + std::vector detectorBins = {Acts::BinningValue::binX}; std::vector detectorBounds = {detectorX, detectorY, detectorZ}; @@ -107,7 +107,7 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { std::vector leftArmBounds = {detectorX * 0.5, detectorY, detectorZ}; - std::vector leftArmBins = {Acts::binZ}; + std::vector leftArmBins = {Acts::BinningValue::binZ}; Acts::Transform3 leftArmTransform = Acts::Transform3::Identity() * @@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { std::vector rightArmBounds = {detectorX * 0.5, detectorY, detectorZ}; - std::vector rightArmBins = {Acts::binZ}; + std::vector rightArmBins = {Acts::BinningValue::binZ}; Acts::Transform3 rightArmTransform = Acts::Transform3::Identity() * Acts::Translation3(detectorX * 0.5, 0., 0); @@ -258,38 +258,78 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { // Volumes have to be contained within the // initial detector bounds double internalStretchLeftZ = - detector->volumes()[0]->volumeBounds().values()[Acts::binZ] + - detector->volumes()[1]->volumeBounds().values()[Acts::binZ] + - detector->volumes()[2]->volumeBounds().values()[Acts::binZ] + - detector->volumes()[3]->volumeBounds().values()[Acts::binZ] + - detector->volumes()[4]->volumeBounds().values()[Acts::binZ]; + detector->volumes()[0] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binZ)] + + detector->volumes()[1] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binZ)] + + detector->volumes()[2] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binZ)] + + detector->volumes()[3] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binZ)] + + detector->volumes()[4] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binZ)]; double internalStretchRightZ = - detector->volumes()[5]->volumeBounds().values()[Acts::binZ] + - detector->volumes()[6]->volumeBounds().values()[Acts::binZ] + - detector->volumes()[7]->volumeBounds().values()[Acts::binZ] + - detector->volumes()[8]->volumeBounds().values()[Acts::binZ] + - detector->volumes()[9]->volumeBounds().values()[Acts::binZ]; + detector->volumes()[5] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binZ)] + + detector->volumes()[6] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binZ)] + + detector->volumes()[7] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binZ)] + + detector->volumes()[8] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binZ)] + + detector->volumes()[9] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binZ)]; double internalStretchX1 = - detector->volumes()[0]->volumeBounds().values()[Acts::binX] + - detector->volumes()[5]->volumeBounds().values()[Acts::binX]; + detector->volumes()[0] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binX)] + + detector->volumes()[5] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binX)]; double internalStretchX2 = - detector->volumes()[1]->volumeBounds().values()[Acts::binX] + - detector->volumes()[6]->volumeBounds().values()[Acts::binX]; + detector->volumes()[1] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binX)] + + detector->volumes()[6] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binX)]; double internalStretchX3 = - detector->volumes()[2]->volumeBounds().values()[Acts::binX] + - detector->volumes()[7]->volumeBounds().values()[Acts::binX]; + detector->volumes()[2] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binX)] + + detector->volumes()[7] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binX)]; double internalStretchX4 = - detector->volumes()[3]->volumeBounds().values()[Acts::binX] + - detector->volumes()[8]->volumeBounds().values()[Acts::binX]; + detector->volumes()[3] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binX)] + + detector->volumes()[8] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binX)]; double internalStretchX5 = - detector->volumes()[4]->volumeBounds().values()[Acts::binX] + - detector->volumes()[9]->volumeBounds().values()[Acts::binX]; + detector->volumes()[4] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binX)] + + detector->volumes()[9] + ->volumeBounds() + .values()[toUnderlying(Acts::BinningValue::binX)]; BOOST_CHECK_EQUAL(internalStretchLeftZ, detectorZ); BOOST_CHECK_EQUAL(internalStretchRightZ, detectorZ); @@ -300,7 +340,9 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { BOOST_CHECK_EQUAL(internalStretchX5, detectorX); for (auto& volume : detector->volumes()) { - BOOST_CHECK_EQUAL(volume->volumeBounds().values()[Acts::binY], detectorY); + BOOST_CHECK_EQUAL( + volume->volumeBounds().values()[toUnderlying(Acts::BinningValue::binY)], + 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 dc02f2a894f..2159a62b763 100644 --- a/Tests/UnitTests/Core/Detector/CuboidalDetectorHelperTests.cpp +++ b/Tests/UnitTests/Core/Detector/CuboidalDetectorHelperTests.cpp @@ -49,15 +49,16 @@ BOOST_AUTO_TEST_CASE(CubicVolumeExceptions) { std::vector> volumes = { volumeA, volumeB}; - BOOST_CHECK_THROW( - Acts::Experimental::detail::CuboidalDetectorHelper::connect( - tContext, volumes, Acts::binX, {}, Acts::Logging::VERBOSE), - std::invalid_argument); + BOOST_CHECK_THROW(Acts::Experimental::detail::CuboidalDetectorHelper::connect( + tContext, volumes, Acts::BinningValue::binX, {}, + Acts::Logging::VERBOSE), + std::invalid_argument); } BOOST_AUTO_TEST_CASE(SimpleBoxConnection) { - std::array binningValues = {Acts::binX, Acts::binY, - Acts::binZ}; + std::array binningValues = {Acts::BinningValue::binX, + Acts::BinningValue::binY, + Acts::BinningValue::binZ}; for (auto bVal : binningValues) { // A perfect box shape auto box = std::make_shared(10, 10, 10); @@ -71,7 +72,7 @@ BOOST_AUTO_TEST_CASE(SimpleBoxConnection) { auto transformB = Acts::Transform3::Identity(); Acts::Vector3 translation = Acts::Vector3::Zero(); - translation[bVal] = 20; + translation[toUnderlying(bVal)] = 20; transformB.pretranslate(translation); // Create volume B auto volumeB = Acts::Experimental::DetectorVolumeFactory::construct( @@ -90,14 +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::binningValueNames()[bVal] + + obj.write("ConnectectBoxesRegular_" + Acts::binningValueName(bVal) + ".obj"); } } BOOST_AUTO_TEST_CASE(IrregularBoxConnectionInZ) { - std::vector binningValues = {Acts::binX, Acts::binY, - Acts::binZ}; + std::vector binningValues = {Acts::BinningValue::binX, + Acts::BinningValue::binY, + Acts::BinningValue::binZ}; using HlPos = std::array; using VolHlPos = std::array; @@ -121,7 +123,7 @@ BOOST_AUTO_TEST_CASE(IrregularBoxConnectionInZ) { auto rotation = t.rotation(); // Try for all binning values for (auto bVal : binningValues) { - auto [vsA, vsB, vsC] = volSetups[bVal]; + auto [vsA, vsB, vsC] = volSetups[toUnderlying(bVal)]; // Three box shares with different length in Z auto boxA = std::make_shared( @@ -168,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::binningValueNames()[bVal] + + obj.write("ConnectectBoxesIrregular_" + Acts::binningValueName(bVal) + trstr + ".obj"); } } @@ -188,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[Acts::binX] = 20; + translationB[toUnderlying(Acts::BinningValue::binX)] = 20; transformB.pretranslate(translationB); // Create volume B auto volumeB = Acts::Experimental::DetectorVolumeFactory::construct( @@ -199,13 +201,14 @@ BOOST_AUTO_TEST_CASE(ContainerConnection) { volumeA, volumeB}; auto containerAB = Acts::Experimental::detail::CuboidalDetectorHelper::connect( - tContext, volumes, Acts::binX, {}, Acts::Logging::VERBOSE); + tContext, volumes, Acts::BinningValue::binX, {}, + Acts::Logging::VERBOSE); // Create a CD container auto transformC = Acts::Transform3::Identity(); Acts::Vector3 translationC = Acts::Vector3::Zero(); - translationC[Acts::binY] = 20; + translationC[toUnderlying(Acts::BinningValue::binY)] = 20; transformC.pretranslate(translationC); auto volumeC = Acts::Experimental::DetectorVolumeFactory::construct( @@ -214,8 +217,8 @@ BOOST_AUTO_TEST_CASE(ContainerConnection) { auto transformD = Acts::Transform3::Identity(); Acts::Vector3 translationD = Acts::Vector3::Zero(); - translationD[Acts::binX] = 20; - translationD[Acts::binY] = 20; + translationD[toUnderlying(Acts::BinningValue::binX)] = 20; + translationD[toUnderlying(Acts::BinningValue::binY)] = 20; transformD.pretranslate(translationD); auto volumeD = Acts::Experimental::DetectorVolumeFactory::construct( @@ -225,11 +228,12 @@ BOOST_AUTO_TEST_CASE(ContainerConnection) { volumes = {volumeC, volumeD}; auto containerCD = Acts::Experimental::detail::CuboidalDetectorHelper::connect( - tContext, volumes, Acts::binX, {}, Acts::Logging::VERBOSE); + tContext, volumes, Acts::BinningValue::binX, {}, + Acts::Logging::VERBOSE); auto containerABCD = Acts::Experimental::detail::CuboidalDetectorHelper::connect( - tContext, {containerAB, containerCD}, Acts::binY, {}, + tContext, {containerAB, containerCD}, Acts::BinningValue::binY, {}, 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 98edad2f301..5fe880f57dd 100644 --- a/Tests/UnitTests/Core/Detector/CylindricalContainerBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/CylindricalContainerBuilderTests.cpp @@ -132,19 +132,19 @@ BOOST_AUTO_TEST_CASE(CylindricaContainerBuilder_Misconfiguration) { std::invalid_argument); // misconfiguration - 1D binning not in z, r, phi misCfg.builders = {nullptr}; - misCfg.binning = {Acts::binX}; + misCfg.binning = {Acts::BinningValue::binX}; BOOST_CHECK_THROW(auto b = CylindricalContainerBuilder(misCfg), std::invalid_argument); // misconfiguration - 2D binning not in z, r, misCfg.builders = {nullptr, nullptr}; - misCfg.binning = {Acts::binZ, Acts::binPhi}; + misCfg.binning = {Acts::BinningValue::binZ, Acts::BinningValue::binPhi}; 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::binZ, Acts::binR}; + misCfg.binning = {Acts::BinningValue::binZ, Acts::BinningValue::binR}; BOOST_CHECK_THROW(auto d = CylindricalContainerBuilder(misCfg), std::invalid_argument); } @@ -175,12 +175,13 @@ BOOST_AUTO_TEST_CASE(CylindricaContainerBuildingZ) { CylindricalContainerBuilder::Config tripleZCfg; tripleZCfg.auxiliary = "*** Test 0 - Build triple in Z ***"; tripleZCfg.builders = {negDisc, barrel, posDisc}; - tripleZCfg.binning = {binZ}; + tripleZCfg.binning = {BinningValue::binZ}; tripleZCfg.geoIdGenerator = std::make_shared(); // Create a materialBinning tripleZCfg.portalMaterialBinning[2u] = BinningDescription{ - {ProtoBinning(binZ, Acts::AxisBoundaryType::Bound, 50), - ProtoBinning(binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, 12)}}; + {ProtoBinning(BinningValue::binZ, Acts::AxisBoundaryType::Bound, 50), + ProtoBinning(BinningValue::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, + M_PI, 12)}}; // Let's test the reverse generation tripleZCfg.geoIdReverseGen = true; @@ -227,7 +228,7 @@ BOOST_AUTO_TEST_CASE(CylindricaContainerBuildingR) { CylindricalContainerBuilder::Config barrelRCfg; barrelRCfg.auxiliary = "*** Test 1 - Build multilayer barrel ***"; barrelRCfg.builders = {barrel0, barrel1, barrel2}; - barrelRCfg.binning = {binR}; + barrelRCfg.binning = {BinningValue::binR}; barrelRCfg.geoIdGenerator = std::make_shared(); auto barrelR = std::make_shared( @@ -246,7 +247,7 @@ BOOST_AUTO_TEST_CASE(CylindricaContainerBuildingPhi) { // Create the container builder CylindricalContainerBuilder::Config barrelPhiCfg; barrelPhiCfg.auxiliary = "*** Test 2 - Build segmented phi barrel ***"; - barrelPhiCfg.binning = {binPhi}; + barrelPhiCfg.binning = {BinningValue::binPhi}; unsigned int phiSectors = 5; Acts::ActsScalar phiHalfSector = M_PI / phiSectors; @@ -312,7 +313,7 @@ BOOST_AUTO_TEST_CASE(CylindricalContainerBuilderDetector) { // Create the barrel container builder CylindricalContainerBuilder::Config barrelRCfg; barrelRCfg.builders = {barrel0, barrel1, barrel2}; - barrelRCfg.binning = {binR}; + barrelRCfg.binning = {BinningValue::binR}; auto barrel = std::make_shared( barrelRCfg, getDefaultLogger("BarrelBuilderR", Logging::VERBOSE)); @@ -327,7 +328,7 @@ BOOST_AUTO_TEST_CASE(CylindricalContainerBuilderDetector) { // Create the barrel container builder CylindricalContainerBuilder::Config barrelEndcapCfg; barrelEndcapCfg.builders = {endcapN, barrel, endcapP}; - barrelEndcapCfg.binning = {binZ}; + barrelEndcapCfg.binning = {BinningValue::binZ}; auto barrelEndcap = std::make_shared( barrelEndcapCfg, @@ -336,7 +337,7 @@ BOOST_AUTO_TEST_CASE(CylindricalContainerBuilderDetector) { // Create the barrel container builder CylindricalContainerBuilder::Config detectorCfg; detectorCfg.builders = {beampipe, barrelEndcap}; - detectorCfg.binning = {binR}; + detectorCfg.binning = {BinningValue::binR}; 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 49d4ddfb100..427a1effa11 100644 --- a/Tests/UnitTests/Core/Detector/CylindricalDetectorFromBlueprintTests.cpp +++ b/Tests/UnitTests/Core/Detector/CylindricalDetectorFromBlueprintTests.cpp @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(CylindricalDetectorFromBlueprintTest) { Acts::ActsScalar pixelEcLayerHz = 10; // Create root node - std::vector detectorBinning = {Acts::binR}; + std::vector detectorBinning = {Acts::BinningValue::binR}; std::vector detectorBoundaries = {detectorIr, detectorOr, detectorHz}; @@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(CylindricalDetectorFromBlueprintTest) { // A pixel system std::vector pixelBoundaries = {pixelIr, pixelOr, detectorHz}; - std::vector pixelBinning = {Acts::binZ}; + std::vector pixelBinning = {Acts::BinningValue::binZ}; auto pixel = std::make_unique( "pixel", Acts::Transform3::Identity(), Acts::VolumeBounds::eCylinder, pixelBoundaries, pixelBinning); @@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE(CylindricalDetectorFromBlueprintTest) { // Nec: Small differences to check if the adjustments are made std::vector pixelEcBoundaries = {pixelIr, pixelOr - 5., pixelEcHz}; - std::vector pixelEcBinning = {Acts::binZ}; + std::vector pixelEcBinning = {Acts::BinningValue::binZ}; Acts::Transform3 pixelNecTransform = Acts::Transform3::Identity() * @@ -151,7 +151,8 @@ BOOST_AUTO_TEST_CASE(CylindricalDetectorFromBlueprintTest) { // Barrel std::vector pixelBarrelBoundaries = { pixelIr + 1, pixelOr - 1., detectorHz - 2 * pixelEcHz}; - std::vector pixelBarrelBinning = {Acts::binR}; + std::vector pixelBarrelBinning = { + Acts::BinningValue::binR}; auto pixelBarrel = std::make_unique( "pixel_barrel", Acts::Transform3::Identity(), @@ -210,7 +211,8 @@ BOOST_AUTO_TEST_CASE(CylindricalDetectorFromBlueprintTest) { detectorBpr->add(std::move(pixel)); // An Indexed volume finder will be attached - std::vector rootVolumeBinning = {Acts::binZ, Acts::binR}; + std::vector rootVolumeBinning = { + Acts::BinningValue::binZ, Acts::BinningValue::binR}; detectorBpr->rootVolumeFinderBuilder = std::make_shared( rootVolumeBinning); diff --git a/Tests/UnitTests/Core/Detector/DetectorVolumeBuilderTests.cpp b/Tests/UnitTests/Core/Detector/DetectorVolumeBuilderTests.cpp index 522878468ad..641226f0c43 100644 --- a/Tests/UnitTests/Core/Detector/DetectorVolumeBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/DetectorVolumeBuilderTests.cpp @@ -160,8 +160,9 @@ BOOST_AUTO_TEST_CASE(DetectorVolumeBuilder_EmptyVolume) { // Assign proto material to dvCfg.portalMaterialBinning[2u] = BinningDescription{ - {ProtoBinning(binZ, Acts::AxisBoundaryType::Bound, 50), - ProtoBinning(binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, 12)}}; + {ProtoBinning(BinningValue::binZ, Acts::AxisBoundaryType::Bound, 50), + ProtoBinning(BinningValue::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, + M_PI, 12)}}; auto dvBuilder = std::make_shared( dvCfg, getDefaultLogger("DetectorVolumeBuilder", Logging::VERBOSE)); diff --git a/Tests/UnitTests/Core/Detector/DetectorVolumeConsistencyTests.cpp b/Tests/UnitTests/Core/Detector/DetectorVolumeConsistencyTests.cpp index 26bca183611..0bbabbaf293 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[Acts::binX] = 20; - translationB[Acts::binY] = 5; + translationB[toUnderlying(Acts::BinningValue::binX)] = 20; + translationB[toUnderlying(Acts::BinningValue::binY)] = 5; transformB.pretranslate(translationB); // Create volume B auto volumeB = Acts::Experimental::DetectorVolumeFactory::construct( @@ -44,10 +44,10 @@ BOOST_AUTO_TEST_CASE(DetectorVolumeConsistencyFail) { std::vector> volumes = { volumeA, volumeB}; - BOOST_CHECK_THROW( - Acts::Experimental::detail::DetectorVolumeConsistency:: - checkCenterAlignment(tContext, {volumeA, volumeB}, Acts::binX), - std::invalid_argument); + BOOST_CHECK_THROW(Acts::Experimental::detail::DetectorVolumeConsistency:: + checkCenterAlignment(tContext, {volumeA, volumeB}, + Acts::BinningValue::binX), + std::invalid_argument); } BOOST_AUTO_TEST_CASE(DetectorVolumeConsistencyPass) { @@ -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[Acts::binX] = 20; + translationB[toUnderlying(Acts::BinningValue::binX)] = 20; transformB.pretranslate(translationB); // Create volume B auto volumeB = Acts::Experimental::DetectorVolumeFactory::construct( @@ -72,9 +72,9 @@ BOOST_AUTO_TEST_CASE(DetectorVolumeConsistencyPass) { std::vector> volumes = { volumeA, volumeB}; - BOOST_CHECK_NO_THROW( - Acts::Experimental::detail::DetectorVolumeConsistency:: - checkCenterAlignment(tContext, {volumeA, volumeB}, Acts::binX)); + BOOST_CHECK_NO_THROW(Acts::Experimental::detail::DetectorVolumeConsistency:: + checkCenterAlignment(tContext, {volumeA, volumeB}, + Acts::BinningValue::binX)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Core/Detector/DetectorVolumeTests.cpp b/Tests/UnitTests/Core/Detector/DetectorVolumeTests.cpp index 9b8d8a91203..9221bc0eed0 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::binR), 10., 10e-5); - CHECK_CLOSE_ABS(volumeExtent.max(Acts::binR), 100., 10e-5); - CHECK_CLOSE_ABS(volumeExtent.min(Acts::binZ), -200., 10e-5); - CHECK_CLOSE_ABS(volumeExtent.max(Acts::binZ), 200., 10e-5); + 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); } BOOST_AUTO_TEST_CASE(UpdatePortal) { diff --git a/Tests/UnitTests/Core/Detector/IndexedRootVolumeFinderBuilderTests.cpp b/Tests/UnitTests/Core/Detector/IndexedRootVolumeFinderBuilderTests.cpp index 50e6cb4f44a..956bb597047 100644 --- a/Tests/UnitTests/Core/Detector/IndexedRootVolumeFinderBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/IndexedRootVolumeFinderBuilderTests.cpp @@ -68,7 +68,8 @@ BOOST_AUTO_TEST_CASE(IndexedRootVolumeFinderBuilderCylindrical) { std::vector> rootVolumes = { innerV, middleLV, middleDV, middleUV, middleRV, outerV}; - IndexedRootVolumeFinderBuilder builder({Acts::binZ, Acts::binR}); + IndexedRootVolumeFinderBuilder builder( + {Acts::BinningValue::binZ, Acts::BinningValue::binR}); // 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 f7f30da2849..d67b6a8fbe5 100644 --- a/Tests/UnitTests/Core/Detector/IndexedSurfaceGridFillerTests.cpp +++ b/Tests/UnitTests/Core/Detector/IndexedSurfaceGridFillerTests.cpp @@ -126,8 +126,8 @@ BOOST_AUTO_TEST_CASE(IndexGridXYOneSurfaceCenter) { std::move(axisY)); // Indexed Surface grid - IndexedSurfacesNavigation indexedGridXY(std::move(gridXY), - {binX, binY}); + IndexedSurfacesNavigation indexedGridXY( + std::move(gridXY), {BinningValue::binX, BinningValue::binY}); // Create a single surface in the center auto rBounds = std::make_shared(4., 4.); @@ -162,8 +162,8 @@ BOOST_AUTO_TEST_CASE(IndexGridXYOneSurfaceBinValue) { std::move(axisY)); // Indexed Surface grid - IndexedSurfacesNavigation indexedGridXY(std::move(gridXY), - {binX, binY}); + IndexedSurfacesNavigation indexedGridXY( + std::move(gridXY), {BinningValue::binX, BinningValue::binY}); // 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; + BinningValueReferenceGenerator generator; std::vector> surfaces = {pSurface}; // Fill the surface @@ -199,8 +199,8 @@ BOOST_AUTO_TEST_CASE(IndexGridXYOneSurfacePolyhedron) { std::move(axisY)); // Indexed Surface grid - IndexedSurfacesNavigation indexedGridXY(std::move(gridXY), - {binX, binY}); + IndexedSurfacesNavigation indexedGridXY( + std::move(gridXY), {BinningValue::binX, BinningValue::binY}); // Create a single surface in the center auto rBounds = std::make_shared(4., 4.); @@ -236,8 +236,8 @@ BOOST_AUTO_TEST_CASE(IndexGridXYOneSurfacePolyhedronBinExpansion) { std::move(axisY)); // Indexed Surface grid - IndexedSurfacesNavigation indexedGridXY(std::move(gridXY), - {binX, binY}); + IndexedSurfacesNavigation indexedGridXY( + std::move(gridXY), {BinningValue::binX, BinningValue::binY}); // 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), {binZ, binPhi}); + std::move(gridZPhi), {BinningValue::binZ, BinningValue::binPhi}); auto cBounds = std::make_shared(10, 2., M_PI / 30, 0.); auto cSurface = Surface::makeShared(Transform3::Identity(), @@ -309,7 +309,7 @@ BOOST_AUTO_TEST_CASE(IndexGridZPhiYOneSurfaceMPIPolyhedronBinExpansion) { // Indexed Surface grid IndexedSurfacesNavigation indexedGridZPhi( - std::move(gridZPhi), {binZ, binPhi}); + std::move(gridZPhi), {BinningValue::binZ, BinningValue::binPhi}); auto cBounds = std::make_shared(10, 2., M_PI / 10, 0.); auto tf = AngleAxis3(M_PI, Vector3::UnitZ()) * Transform3::Identity(); diff --git a/Tests/UnitTests/Core/Detector/IndexedSurfacesGeneratorTests.cpp b/Tests/UnitTests/Core/Detector/IndexedSurfacesGeneratorTests.cpp index a95d52cf6ac..ab1212e4887 100644 --- a/Tests/UnitTests/Core/Detector/IndexedSurfacesGeneratorTests.cpp +++ b/Tests/UnitTests/Core/Detector/IndexedSurfacesGeneratorTests.cpp @@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(RingDisc1D) { 55., 0., 2., 22u); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {binPhi}}; + irSurfaces{rSurfaces, {}, {BinningValue::binPhi}}; GridAxisGenerators::EqClosed aGenerator{{-M_PI, M_PI}, 44u}; PolyhedronReferenceGenerator<1u, true> rGenerator; @@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(RingDisc1DWithSupport) { rSurfaces.push_back(dSurface.get()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {rSurfaces.size() - 1u}, {binPhi}}; + irSurfaces{rSurfaces, {rSurfaces.size() - 1u}, {BinningValue::binPhi}}; GridAxisGenerators::EqClosed aGenerator{{-M_PI, M_PI}, 44u}; PolyhedronReferenceGenerator<1u, true> rGenerator; @@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(RingDisc2D) { rSurfaces.insert(rSurfaces.end(), rSurfacesR1.begin(), rSurfacesR1.end()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {binR, binPhi}}; + irSurfaces{rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}}; GridAxisGenerators::VarBoundEqClosed aGenerator{ {24., 74., 110.}, {-M_PI, M_PI}, 44u}; @@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(RingDisc2DFine) { rSurfaces.insert(rSurfaces.end(), rSurfacesR2.begin(), rSurfacesR2.end()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {binR, binPhi}}; + irSurfaces{rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {24., 152}, 8u, {-M_PI, M_PI}, 88u}; @@ -238,7 +238,8 @@ BOOST_AUTO_TEST_CASE(RingDisc2DFineExpanded) { rSurfaces.insert(rSurfaces.end(), rSurfacesR2.begin(), rSurfacesR2.end()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {binR, binPhi}, {2u, 4u}}; + irSurfaces{ + rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}, {2u, 4u}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {24., 152}, 8u, {-M_PI, M_PI}, 88u}; @@ -272,7 +273,8 @@ BOOST_AUTO_TEST_CASE(Cylinder2D) { 116., 3., 2., {52, 14}); IndexedSurfacesGenerator - icSurfaces{surfaces, {}, {binZ, binPhi}, {1u, 1u}}; + icSurfaces{ + surfaces, {}, {BinningValue::binZ, BinningValue::binPhi}, {1u, 1u}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {-500., 500}, 28, {-M_PI, M_PI}, 52u}; diff --git a/Tests/UnitTests/Core/Detector/KdtSurfacesProviderTests.cpp b/Tests/UnitTests/Core/Detector/KdtSurfacesProviderTests.cpp index f02102c1892..16a5e9f772c 100644 --- a/Tests/UnitTests/Core/Detector/KdtSurfacesProviderTests.cpp +++ b/Tests/UnitTests/Core/Detector/KdtSurfacesProviderTests.cpp @@ -99,12 +99,13 @@ BOOST_AUTO_TEST_CASE(KdtSurfacesProvider) { BOOST_CHECK_EQUAL(pSurfaces.size(), refNumber); using KDTS = Acts::Experimental::KdtSurfaces<>; - auto skdt = std::make_shared(KDTS(tContext, pSurfaces, {binZ, binR})); + auto skdt = std::make_shared( + KDTS(tContext, pSurfaces, {BinningValue::binZ, BinningValue::binR})); // query: Negative disc 3, it should yield 22 surfaces Acts::Extent regionND3; - regionND3.set(binZ, -820, -780); - regionND3.set(binR, 0., 200.); + regionND3.set(BinningValue::binZ, -820, -780); + regionND3.set(BinningValue::binR, 0., 200.); Acts::Experimental::KdtSurfacesProvider<> end3(skdt, regionND3); auto nd3 = end3.surfaces(tContext); @@ -112,8 +113,8 @@ BOOST_AUTO_TEST_CASE(KdtSurfacesProvider) { // query: 2nd Pixel barrel Acts::Extent regionB1; - regionB1.set(binZ, -580, 580); - regionB1.set(binR, 60., 80.); + regionB1.set(BinningValue::binZ, -580, 580); + regionB1.set(BinningValue::binR, 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 35ec5a7c916..2e832a29f74 100644 --- a/Tests/UnitTests/Core/Detector/LayerStructureBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/LayerStructureBuilderTests.cpp @@ -66,8 +66,9 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationRing) { Acts::Experimental::LayerStructureBuilder::Config lsConfig; lsConfig.auxiliary = "*** Endcap with 22 surfaces ***"; lsConfig.surfacesProvider = endcapSurfaces; - lsConfig.binnings = {ProtoBinning( - Acts::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, 22u, 1u)}; + lsConfig.binnings = {ProtoBinning(Acts::BinningValue::binPhi, + Acts::AxisBoundaryType::Closed, -M_PI, M_PI, + 22u, 1u)}; auto endcapBuilder = Acts::Experimental::LayerStructureBuilder( lsConfig, Acts::getDefaultLogger("EndcapBuilder", Logging::VERBOSE)); @@ -87,7 +88,8 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationRing) { LayerSupport supportDisc; supportDisc.type = Acts::Surface::SurfaceType::Disc; supportDisc.offset = 15.; - supportDisc.internalConstraints = {Acts::binZ, Acts::binR}; + supportDisc.internalConstraints = {Acts::BinningValue::binZ, + Acts::BinningValue::binR}; lsConfig.auxiliary = "*** Endcap with 22 surfaces + 1 support disc, " @@ -115,9 +117,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::binZ}; - supportDisc.volumeExtent.set(Acts::binR, 10., 120.); - supportDisc.volumeClearance[Acts::binR] = {2., 1.}; + supportDisc.internalConstraints = {Acts::BinningValue::binZ}; + supportDisc.volumeExtent.set(Acts::BinningValue::binR, 10., 120.); + supportDisc.volumeClearance[Acts::BinningValue::binR] = {2., 1.}; lsConfig.supports = {supportDisc}; @@ -184,10 +186,12 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationCylinder) { lsConfig.auxiliary = "*** Barrel with 448 surfaces ***"; lsConfig.surfacesProvider = barrelSurfaces; lsConfig.binnings = { - Acts::Experimental::ProtoBinning{ - Acts::binZ, Acts::AxisBoundaryType::Bound, -480., 480., 14u, 1u}, - Acts::Experimental::ProtoBinning( - Acts::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, 32u, 1u)}; + Acts::Experimental::ProtoBinning{Acts::BinningValue::binZ, + Acts::AxisBoundaryType::Bound, -480., + 480., 14u, 1u}, + Acts::Experimental::ProtoBinning(Acts::BinningValue::binPhi, + Acts::AxisBoundaryType::Closed, -M_PI, + M_PI, 32u, 1u)}; auto barrelBuilder = Acts::Experimental::LayerStructureBuilder( lsConfig, Acts::getDefaultLogger("BarrelBuilder", Logging::VERBOSE)); @@ -206,7 +210,8 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationCylinder) { LayerSupport supportCylinder; supportCylinder.type = Acts::Surface::SurfaceType::Cylinder; supportCylinder.offset = 15.; - supportCylinder.internalConstraints = {Acts::binZ, Acts::binR}; + supportCylinder.internalConstraints = {Acts::BinningValue::binZ, + Acts::BinningValue::binR}; lsConfig.supports = {supportCylinder}; lsConfig.auxiliary = "*** Barrel with 448 surfaces + 1 support cylinder, r/z evaluated ***"; @@ -223,9 +228,9 @@ BOOST_AUTO_TEST_CASE(LayerStructureBuilder_creationCylinder) { BOOST_CHECK(volumeUpdater1.connected()); // Second test: z-range externally given - supportCylinder.internalConstraints = {Acts::binR}; - supportCylinder.volumeExtent.set(Acts::binZ, -600., 600.); - supportCylinder.volumeClearance[Acts::binZ] = {2., 2.}; + supportCylinder.internalConstraints = {Acts::BinningValue::binR}; + supportCylinder.volumeExtent.set(Acts::BinningValue::binZ, -600., 600.); + supportCylinder.volumeClearance[Acts::BinningValue::binZ] = {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 f14048389d2..7f54da797b7 100644 --- a/Tests/UnitTests/Core/Detector/MultiWireStructureBuilderTests.cpp +++ b/Tests/UnitTests/Core/Detector/MultiWireStructureBuilderTests.cpp @@ -70,10 +70,11 @@ BOOST_AUTO_TEST_CASE(Multi_Wire_Structure_Builder_StrawSurfacesCreation) { mlCfg.name = "Multi_Layer_With_Wires"; mlCfg.mlSurfaces = strawSurfaces; mlCfg.mlBounds = vBounds; - mlCfg.mlBinning = {ProtoBinning(Acts::binX, Acts::AxisBoundaryType::Bound, - -vBounds[0], vBounds[0], nSurfacesX, 1u), - ProtoBinning(Acts::binY, Acts::AxisBoundaryType::Bound, - -vBounds[1], vBounds[1], nSurfacesY, 0u)}; + mlCfg.mlBinning = { + ProtoBinning(Acts::BinningValue::binX, Acts::AxisBoundaryType::Bound, + -vBounds[0], vBounds[0], nSurfacesX, 1u), + ProtoBinning(Acts::BinningValue::binY, Acts::AxisBoundaryType::Bound, + -vBounds[1], vBounds[1], nSurfacesY, 0u)}; MultiWireStructureBuilder mlBuilder(mlCfg); auto [volumes, portals, roots] = mlBuilder.construct(tContext); diff --git a/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp b/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp index 77f1d7bce3a..05c4c5946a8 100644 --- a/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp +++ b/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp @@ -18,28 +18,29 @@ BOOST_AUTO_TEST_SUITE(Detector) BOOST_AUTO_TEST_CASE(ProtoBinningPlaceHolderEquidistant) { // A valid placeholder binning - auto peq = ProtoBinning(Acts::binX, Acts::AxisBoundaryType::Bound, 5u); + auto peq = + ProtoBinning(Acts::BinningValue::binX, 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::binX, Acts::AxisBoundaryType::Bound, 15., 20., 0), - std::invalid_argument); + BOOST_CHECK_THROW(ProtoBinning(Acts::BinningValue::binX, + Acts::AxisBoundaryType::Bound, 15., 20., 0), + std::invalid_argument); // Another invalid binning, min/max swapped - BOOST_CHECK_THROW( - ProtoBinning(Acts::binX, Acts::AxisBoundaryType::Bound, 150., 20., 10), - std::invalid_argument); + BOOST_CHECK_THROW(ProtoBinning(Acts::BinningValue::binX, + Acts::AxisBoundaryType::Bound, 150., 20., 10), + std::invalid_argument); // A valid binning - auto eq = - ProtoBinning(Acts::binX, Acts::AxisBoundaryType::Bound, 0., 10., 5u); + auto eq = ProtoBinning(Acts::BinningValue::binX, + 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::binX); + BOOST_CHECK_EQUAL(eq.binValue, Acts::BinningValue::binX); BOOST_CHECK(eq.axisType == Acts::AxisType::Equidistant); BOOST_CHECK(eq.boundaryType == Acts::AxisBoundaryType::Bound); BOOST_CHECK_EQUAL_COLLECTIONS(eq.edges.begin(), eq.edges.end(), @@ -49,16 +50,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::binX, Acts::AxisBoundaryType::Bound, iedges), - std::invalid_argument); + BOOST_CHECK_THROW(ProtoBinning(Acts::BinningValue::binX, + Acts::AxisBoundaryType::Bound, iedges), + std::invalid_argument); // A valid binning std::vector varEdges = {0., 12., 13., 15., 20.}; - auto var = ProtoBinning(Acts::binX, Acts::AxisBoundaryType::Bound, varEdges); + auto var = ProtoBinning(Acts::BinningValue::binX, + Acts::AxisBoundaryType::Bound, varEdges); BOOST_CHECK_EQUAL(var.bins(), 4u); - BOOST_CHECK_EQUAL(var.binValue, Acts::binX); + BOOST_CHECK_EQUAL(var.binValue, Acts::BinningValue::binX); BOOST_CHECK(var.axisType == Acts::AxisType::Variable); BOOST_CHECK(var.boundaryType == Acts::AxisBoundaryType::Bound); BOOST_CHECK_EQUAL_COLLECTIONS(var.edges.begin(), var.edges.end(), @@ -67,9 +69,9 @@ BOOST_AUTO_TEST_CASE(ProtoBinningVariable) { BOOST_AUTO_TEST_CASE(BinningDescriptionFromAndToBinUtility) { // A valid binning - Acts::BinUtility bUtility(5u, 0., 10., Acts::open, Acts::binR); + Acts::BinUtility bUtility(5u, 0., 10., Acts::open, Acts::BinningValue::binR); std::vector edges = {-M_PI, 0.1, M_PI}; - bUtility += Acts::BinUtility(edges, Acts::closed, Acts::binPhi); + bUtility += Acts::BinUtility(edges, Acts::closed, Acts::BinningValue::binPhi); auto bDescription = BinningDescription::fromBinUtility(bUtility); @@ -77,7 +79,7 @@ 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::binR); + BOOST_CHECK_EQUAL(bDescription.binning[0].binValue, Acts::BinningValue::binR); BOOST_CHECK(bDescription.binning[0].axisType == Acts::AxisType::Equidistant); BOOST_CHECK(bDescription.binning[0].boundaryType == Acts::AxisBoundaryType::Bound); @@ -85,7 +87,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::binPhi); + BOOST_CHECK_EQUAL(bDescription.binning[1].binValue, + Acts::BinningValue::binPhi); 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 0a973cbd995..114006c0351 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::binZ, -2000., 2000); + detectorVolume.extent.set(Acts::BinningValue::binZ, -2000., 2000); // Beam Pipe volume Acts::ProtoVolume beamPipe; beamPipe.name = "beam-pipe"; - beamPipe.extent.set(Acts::binR, 0., 30.); + beamPipe.extent.set(Acts::BinningValue::binR, 0., 30.); // Pixel section Acts::ProtoVolume pixelContainer; pixelContainer.name = "pixel-container"; - pixelContainer.extent.set(Acts::binR, 40., 200); + pixelContainer.extent.set(Acts::BinningValue::binR, 40., 200); // Pixel volume sub structure Acts::ProtoVolume pixelNec; pixelNec.name = "pixel-nec"; - pixelNec.extent.set(Acts::binZ, -1900., -600); + pixelNec.extent.set(Acts::BinningValue::binZ, -1900., -600); Acts::ProtoVolume pixelBarrel; pixelBarrel.name = "pixel-barrel"; - pixelBarrel.extent.set(Acts::binR, 41., 199.); - pixelBarrel.extent.set(Acts::binZ, -550., 550.); + pixelBarrel.extent.set(Acts::BinningValue::binR, 41., 199.); + pixelBarrel.extent.set(Acts::BinningValue::binZ, -550., 550.); Acts::ProtoVolume pixelBarrelL0; pixelBarrelL0.name = "pixel-barrel-l0"; - pixelBarrelL0.extent.set(Acts::binR, 45., 50.); + pixelBarrelL0.extent.set(Acts::BinningValue::binR, 45., 50.); pixelBarrelL0.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; Acts::ProtoVolume pixelBarrelL1; pixelBarrelL1.name = "pixel-barrel-l1"; - pixelBarrelL1.extent.set(Acts::binR, 70., 80.); + pixelBarrelL1.extent.set(Acts::BinningValue::binR, 70., 80.); pixelBarrelL1.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; pixelBarrel.container = Acts::ProtoVolume::ContainerStructure{ {pixelBarrelL0, pixelBarrelL1}, - {Acts::BinningData(Acts::open, Acts::binR, {0., 1.})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1.})}, true}; Acts::ProtoVolume pixelPec; pixelPec.name = "pixel-pec"; - pixelPec.extent.set(Acts::binZ, 600., 1900.); + pixelPec.extent.set(Acts::BinningValue::binZ, 600., 1900.); pixelContainer.container = Acts::ProtoVolume::ContainerStructure{ {pixelNec, pixelBarrel, pixelPec}, - {Acts::BinningData(Acts::open, Acts::binZ, {0., 1})}}; + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}}; detectorVolume.container = Acts::ProtoVolume::ContainerStructure{ {beamPipe, pixelContainer}, - {Acts::BinningData(Acts::open, Acts::binR, {0., 1})}}; + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {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::binR), 0, + CHECK_CLOSE_ABS(detectorVolume.extent.min(Acts::BinningValue::binR), 0, std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(detectorVolume.extent.max(Acts::binR), 200., + CHECK_CLOSE_ABS(detectorVolume.extent.max(Acts::BinningValue::binR), 200., std::numeric_limits::epsilon()); // The detector container should have binning in R @@ -122,7 +122,8 @@ 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::binR); + BOOST_CHECK_EQUAL(cts.constituentBinning[0].binvalue, + Acts::BinningValue::binR); const auto& binBoundaries = cts.constituentBinning[0].boundaries(); BOOST_CHECK_EQUAL(binBoundaries.size(), 3u); @@ -138,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::binZ), -2000., + CHECK_CLOSE_ABS(beamPipe.extent.min(Acts::BinningValue::binZ), -2000., std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(beamPipe.extent.max(Acts::binZ), 2000., + CHECK_CLOSE_ABS(beamPipe.extent.max(Acts::BinningValue::binZ), 2000., std::numeric_limits::epsilon()); // The new beam pipe radius should have been applied - CHECK_CLOSE_ABS(beamPipe.extent.max(Acts::binR), 35., + CHECK_CLOSE_ABS(beamPipe.extent.max(Acts::BinningValue::binR), 35., std::numeric_limits::epsilon()); // The second volume is the pixel detector @@ -153,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::binR), 35., + CHECK_CLOSE_ABS(pixelContainer.extent.min(Acts::BinningValue::binR), 35., std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(pixelContainer.extent.max(Acts::binR), 200., + CHECK_CLOSE_ABS(pixelContainer.extent.max(Acts::BinningValue::binR), 200., std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(pixelContainer.extent.min(Acts::binZ), -2000., + CHECK_CLOSE_ABS(pixelContainer.extent.min(Acts::BinningValue::binZ), -2000., std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(pixelContainer.extent.max(Acts::binZ), 2000., + CHECK_CLOSE_ABS(pixelContainer.extent.max(Acts::BinningValue::binZ), 2000., std::numeric_limits::epsilon()); // The Pixel container has constituents @@ -169,17 +170,18 @@ 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::binR), 35., + CHECK_CLOSE_ABS(pv.extent.min(Acts::BinningValue::binR), 35., std::numeric_limits::epsilon()); - CHECK_CLOSE_ABS(pv.extent.max(Acts::binR), 200., + CHECK_CLOSE_ABS(pv.extent.max(Acts::BinningValue::binR), 200., std::numeric_limits::epsilon()); } // The binning should have been estimated BOOST_CHECK_EQUAL(cts1.constituentBinning.size(), 1u); BOOST_CHECK_EQUAL(cts1.constituentBinning[0].type, Acts::arbitrary); - BOOST_CHECK_EQUAL(cts1.constituentBinning[0].binvalue, Acts::binZ); + BOOST_CHECK_EQUAL(cts1.constituentBinning[0].binvalue, + Acts::BinningValue::binZ); 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 af521326ce2..a0063e5d471 100644 --- a/Tests/UnitTests/Core/Detector/ReferenceGeneratorsTests.cpp +++ b/Tests/UnitTests/Core/Detector/ReferenceGeneratorsTests.cpp @@ -42,8 +42,8 @@ BOOST_AUTO_TEST_CASE(BinningPositionReference) { // Simply return binning position, we test only the behavior of the generator // not the output auto binningPosition = - BinningValueReferenceGenerator{}.references(tContext, - *pSurface); + BinningValueReferenceGenerator{}.references( + tContext, *pSurface); BOOST_CHECK_EQUAL(binningPosition.size(), 1u); } diff --git a/Tests/UnitTests/Core/Detector/SupportSurfacesHelperTests.cpp b/Tests/UnitTests/Core/Detector/SupportSurfacesHelperTests.cpp index d60950c9b8d..624e0987a40 100644 --- a/Tests/UnitTests/Core/Detector/SupportSurfacesHelperTests.cpp +++ b/Tests/UnitTests/Core/Detector/SupportSurfacesHelperTests.cpp @@ -42,8 +42,8 @@ BOOST_AUTO_TEST_CASE(CylindricalSupportCase) { // phi max = 2pi Acts::Extent lExtent; - lExtent.set(Acts::binR, 100., 110.); - lExtent.set(Acts::binZ, -400., 400.); + lExtent.set(Acts::BinningValue::binR, 100., 110.); + lExtent.set(Acts::BinningValue::binZ, -400., 400.); // Test creation of surface components CylindricalSupport csCreator{10., {1., 1.}}; @@ -100,8 +100,8 @@ BOOST_AUTO_TEST_CASE(DiscSupportCase) { /// phi min = 0 // phi max = 2pi Acts::Extent lExtent; - lExtent.set(Acts::binR, 100., 400.); - lExtent.set(Acts::binZ, -405., -395.); + lExtent.set(Acts::BinningValue::binR, 100., 400.); + lExtent.set(Acts::BinningValue::binZ, -405., -395.); // Test creation of surface components DiscSupport dsCreator{0., {1., 1.}}; @@ -161,13 +161,14 @@ BOOST_AUTO_TEST_CASE(RectangularSupportCase) { // dy = [-200,200] // dz = [-50, -60] Acts::Extent lExtent; - lExtent.set(Acts::binX, -100., 100.); - lExtent.set(Acts::binY, -200., 200.); - lExtent.set(Acts::binZ, -60., -50.); + lExtent.set(Acts::BinningValue::binX, -100., 100.); + lExtent.set(Acts::BinningValue::binY, -200., 200.); + lExtent.set(Acts::BinningValue::binZ, -60., -50.); // place in Z with offset 2_mm // Asymmetric clearances in x an y for testing - RectangularSupport rsCreator{Acts::binZ, 2., {1., 2.}, {3., 4.}}; + RectangularSupport rsCreator{ + Acts::BinningValue::binZ, 2., {1., 2.}, {3., 4.}}; auto rsComponents = rsCreator(lExtent); auto& [rsType, rsValues, rsTransform] = rsComponents; @@ -190,8 +191,8 @@ BOOST_AUTO_TEST_CASE(RectangularSupportCase) { // Invalid / runtime checks Acts::Extent invalid; - invalid.set(Acts::binX, -100., 100.); - invalid.set(Acts::binY, -200., 200.); + invalid.set(Acts::BinningValue::binX, -100., 100.); + invalid.set(Acts::BinningValue::binY, -200., 200.); BOOST_CHECK_THROW(rsCreator(invalid), std::invalid_argument); } @@ -207,8 +208,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::binR, 100., 110.); - lExtent.set(Acts::binZ, -400., 400.); + lExtent.set(Acts::BinningValue::binR, 100., 110.); + lExtent.set(Acts::BinningValue::binZ, -400., 400.); // Cylinder support CylindricalSupport csCreator{10., {1., 1.}}; @@ -247,8 +248,8 @@ BOOST_AUTO_TEST_CASE(addDiscSupportCase) { // The Extent Acts::Extent lExtent; - lExtent.set(Acts::binR, 100., 400.); - lExtent.set(Acts::binZ, -110., -100.); + lExtent.set(Acts::BinningValue::binR, 100., 400.); + lExtent.set(Acts::BinningValue::binZ, -110., -100.); // Disc support: this would set the disc at the center DiscSupport dsCreator{0., {1., 1.}}; @@ -289,13 +290,14 @@ BOOST_AUTO_TEST_CASE(addRectangularSupportCase) { // dy = [-200,200] // dz = [-50, -60] Acts::Extent lExtent; - lExtent.set(Acts::binX, -100., 100.); - lExtent.set(Acts::binY, -200., 200.); - lExtent.set(Acts::binZ, -60., -50.); + lExtent.set(Acts::BinningValue::binX, -100., 100.); + lExtent.set(Acts::BinningValue::binY, -200., 200.); + lExtent.set(Acts::BinningValue::binZ, -60., -50.); // place in Z with offset 2_mm // Asymmetric clearances in x an y for testing - RectangularSupport rsCreator{Acts::binZ, 2., {1., 2.}, {3., 4.}}; + RectangularSupport rsCreator{ + Acts::BinningValue::binZ, 2., {1., 2.}, {3., 4.}}; // Add a single disc as a support surface Acts::Experimental::detail::SupportSurfacesHelper::addSupport( @@ -334,8 +336,8 @@ BOOST_AUTO_TEST_CASE(addMisconfiguredSupportCase) { std::invalid_argument); // The Extent - lExtent.set(Acts::binR, 100., 400.); - lExtent.set(Acts::binZ, -110., -100.); + lExtent.set(Acts::BinningValue::binR, 100., 400.); + lExtent.set(Acts::BinningValue::binZ, -110., -100.); // Wrong surface type struct InvalidCreator { diff --git a/Tests/UnitTests/Core/Detector/VolumeStructureBuilderTests.cpp b/Tests/UnitTests/Core/Detector/VolumeStructureBuilderTests.cpp index a5f4b2b98da..6ff8c35a291 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(binX, -100, 100); - cuboidExtent.set(binY, -200, 200); - cuboidExtent.set(binZ, -300, 300); + cuboidExtent.set(BinningValue::binX, -100, 100); + cuboidExtent.set(BinningValue::binY, -200, 200); + cuboidExtent.set(BinningValue::binZ, -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(binR, 100., 200.); - cylinderExtent.set(binZ, -800., 0.); + cylinderExtent.set(BinningValue::binR, 100., 200.); + cylinderExtent.set(BinningValue::binZ, -800., 0.); VolumeStructureBuilder::Config cylExtentConfig; cylExtentConfig.extent = cylinderExtent; diff --git a/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp index df24dc264f1..dac15d46ba5 100644 --- a/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp @@ -104,11 +104,11 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeProperties) { } // Check the binning value positions - CHECK_CLOSE_ABS(box.binningBorder(Acts::binX), hx, s_epsilon); - CHECK_CLOSE_ABS(box.binningBorder(Acts::binY), hy, s_epsilon); - CHECK_CLOSE_ABS(box.binningBorder(Acts::binZ), hz, s_epsilon); - CHECK_CLOSE_ABS(box.binningBorder(Acts::binR), std::sqrt(hx * hx + hy * hy), - s_epsilon); + 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), + std::sqrt(hx * hx + hy * hy), s_epsilon); } BOOST_AUTO_TEST_CASE(CuboidVolumeBoundarySurfaces) { diff --git a/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp index d1206870e8a..2cac47c5415 100644 --- a/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(CutoutCylinderVolumeOrientedBoundaries) { Vector3 zaxis(0., 0., 1.); for (auto& os : ccvbOrientedSurfaces) { - auto onSurface = os.surface->binningPosition(geoCtx, binR); + auto onSurface = os.surface->binningPosition(geoCtx, BinningValue::binR); 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 ba7a04142e9..585f4503093 100644 --- a/Tests/UnitTests/Core/Geometry/CylinderVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CylinderVolumeBoundsTests.cpp @@ -306,7 +306,7 @@ BOOST_AUTO_TEST_CASE(CylinderVolumeOrientedBoundaries) { Vector3 zaxis(0., 0., 1.); for (auto& os : cvbOrientedSurfaces) { - auto onSurface = os.surface->binningPosition(geoCtx, binR); + auto onSurface = os.surface->binningPosition(geoCtx, BinningValue::binR); 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 b45a2ee0829..93141684032 100644 --- a/Tests/UnitTests/Core/Geometry/CylinderVolumeStackTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CylinderVolumeStackTests.cpp @@ -106,12 +106,12 @@ BOOST_DATA_TEST_CASE(Baseline, if (shift < 1.0) { BOOST_CHECK_THROW( - CylinderVolumeStack(volumes, binZ, strategy, + CylinderVolumeStack(volumes, BinningValue::binZ, strategy, CylinderVolumeStack::ResizeStrategy::Gap, *logger), std::invalid_argument); return; } - CylinderVolumeStack cylStack(volumes, binZ, strategy, + CylinderVolumeStack cylStack(volumes, BinningValue::binZ, strategy, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -340,7 +340,7 @@ BOOST_AUTO_TEST_CASE(Asymmetric) { std::vector volumes = {vol2.get(), vol1.get(), vol3.get()}; CylinderVolumeStack cylStack( - volumes, binZ, CylinderVolumeStack::AttachmentStrategy::Gap, + volumes, BinningValue::binZ, CylinderVolumeStack::AttachmentStrategy::Gap, CylinderVolumeStack::ResizeStrategy::Gap, *logger); BOOST_CHECK_EQUAL(volumes.size(), 5); @@ -381,7 +381,7 @@ BOOST_DATA_TEST_CASE(RotationInZ, boost::unit_test::data::make(strategies), std::vector volumes = {vol1.get(), vol2.get()}; - CylinderVolumeStack cylStack(volumes, binZ, strategy, + CylinderVolumeStack cylStack(volumes, BinningValue::binZ, strategy, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -477,7 +477,7 @@ BOOST_DATA_TEST_CASE(UpdateStack, transform3}; CylinderVolumeStack cylStack( - volumes, binZ, + volumes, BinningValue::binZ, CylinderVolumeStack::AttachmentStrategy::Gap, // should not make a // difference strategy, *logger); @@ -708,7 +708,7 @@ BOOST_DATA_TEST_CASE( std::vector volumes = {vol1.get(), vol2.get()}; - CylinderVolumeStack cylStack{volumes, binZ, + CylinderVolumeStack cylStack{volumes, BinningValue::binZ, CylinderVolumeStack::AttachmentStrategy::Gap, strategy, *logger}; const auto* originalBounds = @@ -873,13 +873,13 @@ BOOST_DATA_TEST_CASE(Baseline, if (f < 0.0) { BOOST_CHECK_THROW( - CylinderVolumeStack(volumes, binR, strategy, + CylinderVolumeStack(volumes, BinningValue::binR, strategy, CylinderVolumeStack::ResizeStrategy::Gap, *logger), std::invalid_argument); return; } - CylinderVolumeStack cylStack(volumes, binR, strategy, + CylinderVolumeStack cylStack(volumes, BinningValue::binR, strategy, CylinderVolumeStack::ResizeStrategy::Gap, *logger); @@ -1115,7 +1115,7 @@ BOOST_DATA_TEST_CASE(UpdateStack, } cylStack = std::make_unique( - volumes, binR, + volumes, BinningValue::binR, CylinderVolumeStack::AttachmentStrategy::Gap, // should not make a // difference strategy, *logger); @@ -1434,7 +1434,7 @@ BOOST_DATA_TEST_CASE( std::vector volumes = {vol1.get(), vol2.get()}; - CylinderVolumeStack cylStack{volumes, binR, + CylinderVolumeStack cylStack{volumes, BinningValue::binR, CylinderVolumeStack::AttachmentStrategy::Gap, strategy, *logger}; const auto* originalBounds = @@ -1516,7 +1516,7 @@ BOOST_DATA_TEST_CASE(JoinCylinderVolumesInvalidDirection, volumes.push_back(vol1.get()); // Single volume invalid direction still gives an error - BOOST_CHECK_THROW(CylinderVolumeStack(volumes, binY, strategy), + BOOST_CHECK_THROW(CylinderVolumeStack(volumes, BinningValue::binY, strategy), std::invalid_argument); auto vol2 = std::make_shared( @@ -1524,13 +1524,14 @@ BOOST_DATA_TEST_CASE(JoinCylinderVolumesInvalidDirection, std::make_shared(100_mm, 400_mm, 400_mm)); volumes.push_back(vol2.get()); - BOOST_CHECK_THROW(CylinderVolumeStack(volumes, binY, strategy), + BOOST_CHECK_THROW(CylinderVolumeStack(volumes, BinningValue::binY, strategy), std::invalid_argument); } BOOST_DATA_TEST_CASE(JoinCylinderVolumesInvalidInput, (boost::unit_test::data::make(strategies) * - boost::unit_test::data::make(Acts::binZ, Acts::binR)), + boost::unit_test::data::make(Acts::BinningValue::binZ, + Acts::BinningValue::binR)), strategy, direction) { BOOST_TEST_CONTEXT("Empty Volume") { std::vector volumes; @@ -1617,7 +1618,7 @@ BOOST_DATA_TEST_CASE(JoinCylinderVolumesInvalidInput, { std::shared_ptr vol; - if (direction == binZ) { + if (direction == BinningValue::binZ) { vol = std::make_shared( Transform3{Translation3{Vector3{0_mm, 0_mm, 500_mm}}}, invalid); } else { @@ -1641,7 +1642,8 @@ BOOST_DATA_TEST_CASE(JoinCylinderVolumesInvalidInput, } BOOST_DATA_TEST_CASE(JoinCylinderVolumeSingle, - (boost::unit_test::data::make(Acts::binZ, Acts::binR) * + (boost::unit_test::data::make(Acts::BinningValue::binZ, + Acts::BinningValue::binR) * 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 015380b1546..5d987935a28 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(binX), 15_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binX), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(binY), -3_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binY), 3_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(binZ), -10_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binZ), 10_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(binR), rMin, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binR), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(binPhi), phiMin, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binPhi), phiMax, 1e-6); + 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); // Call with histogram filling Extent gExtHist; for (const auto& v : vertices) { - gExtHist.extend(v, {binX}, false, true); + gExtHist.extend(v, {BinningValue::binX}, false, true); } const auto& vHist = gExtHist.valueHistograms(); - auto xVals = vHist[binX]; + auto xVals = vHist[toUnderlying(BinningValue::binX)]; BOOST_CHECK_EQUAL(xVals.size(), 6u); std::vector reference = {15_mm, 18_mm, 15_mm, @@ -69,31 +69,31 @@ BOOST_AUTO_TEST_CASE(ExtentTest) { // Call with ieterator range Extent gExtItr; gExtItr.extend(vertices.begin(), vertices.end()); - CHECK_CLOSE_ABS(gExtItr.min(binX), 15_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.max(binX), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.min(binY), -3_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.max(binY), 3_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.min(binZ), -10_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.max(binZ), 10_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.min(binR), rMin, 1e-6); - CHECK_CLOSE_ABS(gExtItr.max(binR), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExtItr.min(binPhi), phiMin, 1e-6); - CHECK_CLOSE_ABS(gExtItr.max(binPhi), phiMax, 1e-6); + 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); // Create a second Extent Extent gExtCopy; gExtCopy.extend(gExt); - CHECK_CLOSE_ABS(gExtCopy.min(binX), 15_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.max(binX), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.min(binY), -3_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.max(binY), 3_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.min(binZ), -10_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.max(binZ), 10_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.min(binR), rMin, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.max(binR), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.min(binPhi), phiMin, 1e-6); - CHECK_CLOSE_ABS(gExtCopy.max(binPhi), phiMax, 1e-6); + 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 containment Extent unbound; @@ -101,56 +101,56 @@ BOOST_AUTO_TEST_CASE(ExtentTest) { BOOST_CHECK(unbound.contains(gExtCopy)); // Check application of an envelope on it - ExtentEnvelope xEnvelopes = zeroEnvelopes; - xEnvelopes[binX] = {1., 2.}; + ExtentEnvelope xEnvelopes = ExtentEnvelope::Zero(); + xEnvelopes[BinningValue::binX] = {1., 2.}; // Take the extent and extend by an envelope Extent envelope(xEnvelopes); gExt.extend(envelope); // Changed ones - CHECK_CLOSE_ABS(gExt.min(binX), 14_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binX), 20_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.min(BinningValue::binX), 14_mm, 1e-6); + CHECK_CLOSE_ABS(gExt.max(BinningValue::binX), 20_mm, 1e-6); // Unchanged ones - CHECK_CLOSE_ABS(gExt.min(binY), -3_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binY), 3_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(binZ), -10_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binZ), 10_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(binR), rMin, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binR), 18_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.min(binPhi), phiMin, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binPhi), phiMax, 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); // Fill it with envelope Extent gExtEnv(envelope); gExtEnv.extend(vertices.begin(), vertices.end()); // Changed ones - CHECK_CLOSE_ABS(gExtEnv.min(binX), 14_mm, 1e-6); - CHECK_CLOSE_ABS(gExtEnv.max(binX), 20_mm, 1e-6); + CHECK_CLOSE_ABS(gExtEnv.min(BinningValue::binX), 14_mm, 1e-6); + CHECK_CLOSE_ABS(gExtEnv.max(BinningValue::binX), 20_mm, 1e-6); // Check the set method - gExt.set(binX, 2_mm, 8_mm); - CHECK_CLOSE_ABS(gExt.min(binX), 2_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binX), 8_mm, 1e-6); + 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); // Radius can not go below 0 - gExt.set(binR, -2_mm, 18_mm); - CHECK_CLOSE_ABS(gExt.min(binR), 0_mm, 1e-6); - CHECK_CLOSE_ABS(gExt.max(binR), 18_mm, 1e-6); + 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); // Take an Extent and add a constraint Extent gExtConst; - gExtConst.set(binR, 0., 5.); + gExtConst.set(BinningValue::binR, 0., 5.); Extent gExtNonConst; - BOOST_CHECK(!gExtNonConst.constrains(binR)); + BOOST_CHECK(!gExtNonConst.constrains(BinningValue::binR)); gExtNonConst.addConstrain(gExtConst); - BOOST_CHECK(gExtNonConst.constrains(binR)); + BOOST_CHECK(gExtNonConst.constrains(BinningValue::binR)); std::string tString = gExtConst.toString(); BOOST_CHECK(!tString.empty()); // Check single vertex containment Extent gExtVertexCheck; - gExtVertexCheck.set(binR, 0., 5.); + gExtVertexCheck.set(BinningValue::binR, 0., 5.); BOOST_CHECK(gExtVertexCheck.contains(Vector3(1., 0., 0.))); BOOST_CHECK(!gExtVertexCheck.contains(Vector3(6., 0., 0.))); } @@ -164,16 +164,16 @@ BOOST_AUTO_TEST_CASE(ProtoSupportCaseTests) { Vector3(18_mm, 0_mm, 10_mm), Vector3(15_mm, 3_mm, 10_mm)}; Extent volumeExtent; - volumeExtent.set(binZ, -300_mm, 300_mm); + volumeExtent.set(BinningValue::binZ, -300_mm, 300_mm); - BOOST_CHECK(volumeExtent.constrains(binZ)); - BOOST_CHECK(!volumeExtent.constrains(binR)); + BOOST_CHECK(volumeExtent.constrains(BinningValue::binZ)); + BOOST_CHECK(!volumeExtent.constrains(BinningValue::binR)); for (const auto& v : vertices) { - volumeExtent.extend(v, {binR}); + volumeExtent.extend(v, {BinningValue::binR}); } - BOOST_CHECK(volumeExtent.constrains(binR)); + BOOST_CHECK(volumeExtent.constrains(BinningValue::binR)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Core/Geometry/KDTreeTrackingGeometryBuilderTests.cpp b/Tests/UnitTests/Core/Geometry/KDTreeTrackingGeometryBuilderTests.cpp index 4f3cf125bfe..ea6caa240ae 100644 --- a/Tests/UnitTests/Core/Geometry/KDTreeTrackingGeometryBuilderTests.cpp +++ b/Tests/UnitTests/Core/Geometry/KDTreeTrackingGeometryBuilderTests.cpp @@ -100,33 +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::binR, 0., 17); + beamPipeContainer.extent.set(Acts::BinningValue::binR, 0., 17); Acts::ProtoVolume beamPipe; beamPipe.name = "odd-beam-pipe-l"; - beamPipe.extent.set(Acts::binR, 2., 16.); + beamPipe.extent.set(Acts::BinningValue::binR, 2., 16.); beamPipe.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; beamPipeContainer.container = Acts::ProtoVolume::ContainerStructure{ - {beamPipe}, {Acts::BinningData(Acts::open, Acts::binR, {0., 1.})}, true}; + {beamPipe}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1.})}, + true}; // Pixel section Acts::ProtoVolume pixelContainer; pixelContainer.name = "odd-pixel"; - pixelContainer.extent.set(Acts::binR, 18., 200); + pixelContainer.extent.set(Acts::BinningValue::binR, 18., 200); Acts::ProtoVolume pixelNec; pixelNec.name = "odd-pixel-nec"; - pixelNec.extent.set(Acts::binZ, -1000., -580); + pixelNec.extent.set(Acts::BinningValue::binZ, -1000., -580); Acts::ProtoVolume pixNecD1; pixNecD1.name = "odd-pixel-nec-d1"; - pixNecD1.extent.set(Acts::binZ, -720., -680); + pixNecD1.extent.set(Acts::BinningValue::binZ, -720., -680); Acts::ProtoVolume pixNecD0; pixNecD0.name = "odd-pixel-nec-d0"; - pixNecD0.extent.set(Acts::binZ, -620., -580); + pixNecD0.extent.set(Acts::BinningValue::binZ, -620., -580); pixelNec.container = Acts::ProtoVolume::ContainerStructure{ {pixNecD1, pixNecD0}, - {Acts::BinningData(Acts::open, Acts::binZ, {0., 1.})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1.})}, true}; for (auto& cv : pixelNec.container.value().constituentVolumes) { cv.internal = @@ -135,52 +137,52 @@ BOOST_AUTO_TEST_CASE(KDTreeTrackingGeometryBuilder_simple) { Acts::ProtoVolume pixelBarrel; pixelBarrel.name = "odd-pixel-barrel"; - pixelBarrel.extent.set(Acts::binZ, -580., 580); + pixelBarrel.extent.set(Acts::BinningValue::binZ, -580., 580); Acts::ProtoVolume pixBarrelL0; pixBarrelL0.name = "odd-pixel-barrel-l0"; - pixBarrelL0.extent.set(Acts::binR, 28., 48.); - pixBarrelL0.extent.set(Acts::binZ, -580., 580); + pixBarrelL0.extent.set(Acts::BinningValue::binR, 28., 48.); + pixBarrelL0.extent.set(Acts::BinningValue::binZ, -580., 580); pixBarrelL0.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; Acts::ProtoVolume pixBarrelL1; pixBarrelL1.name = "odd-pixel-barrel-l1"; - pixBarrelL1.extent.set(Acts::binR, 62., 76); - pixBarrelL1.extent.set(Acts::binZ, -580., 580); + pixBarrelL1.extent.set(Acts::BinningValue::binR, 62., 76); + pixBarrelL1.extent.set(Acts::BinningValue::binZ, -580., 580); pixBarrelL1.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; Acts::ProtoVolume pixBarrelL2; pixBarrelL2.name = "odd-pixel-barrel-l2"; - pixBarrelL2.extent.set(Acts::binR, 100., 120.); - pixBarrelL2.extent.set(Acts::binZ, -580., 580); + pixBarrelL2.extent.set(Acts::BinningValue::binR, 100., 120.); + pixBarrelL2.extent.set(Acts::BinningValue::binZ, -580., 580); pixBarrelL2.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; Acts::ProtoVolume pixBarrelL3; pixBarrelL3.name = "odd-pixel-barrel-l3"; - pixBarrelL3.extent.set(Acts::binR, 160., 180.); - pixBarrelL3.extent.set(Acts::binZ, -580., 580); + pixBarrelL3.extent.set(Acts::BinningValue::binR, 160., 180.); + pixBarrelL3.extent.set(Acts::BinningValue::binZ, -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::binR, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1})}, true}; Acts::ProtoVolume pixelPec; pixelPec.name = "odd-pixel-pec"; - pixelPec.extent.set(Acts::binZ, 580., 1000.); + pixelPec.extent.set(Acts::BinningValue::binZ, 580., 1000.); Acts::ProtoVolume pixPecD0; pixPecD0.name = "odd-pixel-pec-d0"; - pixPecD0.extent.set(Acts::binZ, 580., 620); + pixPecD0.extent.set(Acts::BinningValue::binZ, 580., 620); Acts::ProtoVolume pixPecD1; pixPecD1.name = "odd-pixel-pec-d1"; - pixPecD1.extent.set(Acts::binZ, 680., 720); + pixPecD1.extent.set(Acts::BinningValue::binZ, 680., 720); pixelPec.container = Acts::ProtoVolume::ContainerStructure{ {pixPecD0, pixPecD1}, - {Acts::BinningData(Acts::open, Acts::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, true}; for (auto& cv : pixelPec.container.value().constituentVolumes) { cv.internal = @@ -189,15 +191,16 @@ BOOST_AUTO_TEST_CASE(KDTreeTrackingGeometryBuilder_simple) { pixelContainer.container = Acts::ProtoVolume::ContainerStructure{ {pixelNec, pixelBarrel, pixelPec}, - {Acts::BinningData(Acts::open, Acts::binZ, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {-1000., -580., 580., 1000.})}}; Acts::ProtoVolume detectorContainer; detectorContainer.name = "odd-detector"; - detectorContainer.extent.set(Acts::binR, 0., 200); + detectorContainer.extent.set(Acts::BinningValue::binR, 0., 200); detectorContainer.container = Acts::ProtoVolume::ContainerStructure{ {beamPipeContainer, pixelContainer}, - {Acts::BinningData(Acts::open, Acts::binR, {0., 17.5, 200.})}}; + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, + {0., 17.5, 200.})}}; Acts::ProtoDetector detector; detector.name = "odd"; diff --git a/Tests/UnitTests/Core/Geometry/LayerCreatorTests.cpp b/Tests/UnitTests/Core/Geometry/LayerCreatorTests.cpp index c0306af56d1..fcf862ef126 100644 --- a/Tests/UnitTests/Core/Geometry/LayerCreatorTests.cpp +++ b/Tests/UnitTests/Core/Geometry/LayerCreatorTests.cpp @@ -240,8 +240,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_createCylinderLayer, LayerCreatorFixture) { // CASE I double envR = 0.1, envZ = 0.5; ProtoLayer pl(tgContext, srf); - pl.envelope[Acts::binR] = {envR, envR}; - pl.envelope[Acts::binZ] = {envZ, envZ}; + pl.envelope[Acts::BinningValue::binR] = {envR, envR}; + pl.envelope[Acts::BinningValue::binZ] = {envZ, envZ}; std::shared_ptr layer = std::dynamic_pointer_cast( p_LC->cylinderLayer(tgContext, srf, equidistant, equidistant, pl)); @@ -265,8 +265,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_createCylinderLayer, LayerCreatorFixture) { // CASE II ProtoLayer pl2(tgContext, srf); - pl2.envelope[Acts::binR] = {envR, envR}; - pl2.envelope[Acts::binZ] = {envZ, envZ}; + pl2.envelope[Acts::BinningValue::binR] = {envR, envR}; + pl2.envelope[Acts::BinningValue::binZ] = {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); @@ -301,8 +301,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_createCylinderLayer, LayerCreatorFixture) { // CASE III ProtoLayer pl3; - pl3.extent.range(Acts::binR).set(1, 20); - pl3.extent.range(Acts::binZ).set(-25, 25); + pl3.extent.range(Acts::BinningValue::binR).set(1, 20); + pl3.extent.range(Acts::BinningValue::binZ).set(-25, 25); layer = std::dynamic_pointer_cast( p_LC->cylinderLayer(tgContext, srf, equidistant, equidistant, pl3)); CHECK_CLOSE_REL(layer->thickness(), 19, 1e-3); @@ -335,8 +335,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_createDiscLayer, LayerCreatorFixture) { draw_surfaces(surfaces, "LayerCreator_createDiscLayer_EC_1.obj"); ProtoLayer pl(tgContext, surfaces); - pl.extent.range(binZ).set(-10, 10); - pl.extent.range(binR).set(5., 25.); + pl.extent.range(BinningValue::binZ).set(-10, 10); + pl.extent.range(BinningValue::binR).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); @@ -363,8 +363,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[binR] = {envMinR, envMaxR}; - pl2.envelope[binZ] = {envZ, envZ}; + pl2.envelope[BinningValue::binR] = {envMinR, envMaxR}; + pl2.envelope[BinningValue::binZ] = {envZ, envZ}; layer = std::dynamic_pointer_cast( p_LC->discLayer(tgContext, surfaces, nBinsR, nBinsPhi, pl2)); @@ -419,8 +419,8 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_barrelStagger, LayerCreatorFixture) { double envR = 0, envZ = 0; ProtoLayer pl(tgContext, brl); - pl.envelope[binR] = {envR, envR}; - pl.envelope[binZ] = {envZ, envZ}; + pl.envelope[BinningValue::binR] = {envR, envR}; + pl.envelope[BinningValue::binZ] = {envZ, envZ}; std::shared_ptr layer = std::dynamic_pointer_cast( p_LC->cylinderLayer(tgContext, brl, equidistant, equidistant, pl)); @@ -439,7 +439,7 @@ BOOST_FIXTURE_TEST_CASE(LayerCreator_barrelStagger, LayerCreatorFixture) { // std::cout << "dPHi = " << A->center().phi() - B->center().phi() << // std::endl; - Vector3 ctr = A->binningPosition(tgContext, binR); + Vector3 ctr = A->binningPosition(tgContext, BinningValue::binR); auto binContent = layer->surfaceArray()->at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 2u); std::set act; diff --git a/Tests/UnitTests/Core/Geometry/PolyhedronTests.cpp b/Tests/UnitTests/Core/Geometry/PolyhedronTests.cpp index e7dd166984d..0d92383745f 100644 --- a/Tests/UnitTests/Core/Geometry/PolyhedronTests.cpp +++ b/Tests/UnitTests/Core/Geometry/PolyhedronTests.cpp @@ -83,28 +83,31 @@ BOOST_AUTO_TEST_CASE(PolyhedronExtent) { Polyhedron rectangle(rvertices, rfaces, rmesh); auto rExtent = rectangle.extent(); - CHECK_CLOSE_ABS(rExtent.min(binX), -1., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binX), 1., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(binY), -2., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binY), -1., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(binZ), 0., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binZ), 0., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(binR), 1., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binR), VectorHelpers::perp(rvertices[0]), 1e-6); - CHECK_CLOSE_ABS(rExtent.min(binPhi), VectorHelpers::phi(rvertices[3]), 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binPhi), VectorHelpers::phi(rvertices[2]), 1e-6); + 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), + VectorHelpers::perp(rvertices[0]), 1e-6); + CHECK_CLOSE_ABS(rExtent.min(BinningValue::binPhi), + VectorHelpers::phi(rvertices[3]), 1e-6); + CHECK_CLOSE_ABS(rExtent.max(BinningValue::binPhi), + VectorHelpers::phi(rvertices[2]), 1e-6); // Now shift the Extent Vector3 shift(-1., 0., 1.); Transform3 shiftedTransform = Transform3::Identity(); shiftedTransform.pretranslate(shift); rExtent = rectangle.extent(shiftedTransform); - CHECK_CLOSE_ABS(rExtent.min(binX), -2., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binX), 0., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(binY), -2., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binY), -1., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(binZ), 1., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binZ), 1., 1e-6); + 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); // Test a rectangle in yz - pane (at x == 3) rvertices = {Vector3(3_mm, -5_mm, -10_mm), Vector3(3_mm, 5_mm, -10_mm), @@ -112,14 +115,14 @@ BOOST_AUTO_TEST_CASE(PolyhedronExtent) { rectangle = Polyhedron(rvertices, rfaces, rmesh); rExtent = rectangle.extent(); - CHECK_CLOSE_ABS(rExtent.min(binX), 3., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binX), 3., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(binY), -5., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binY), 5., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(binZ), -10., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binZ), 10., 1e-6); - CHECK_CLOSE_ABS(rExtent.min(binR), 3., 1e-6); - CHECK_CLOSE_ABS(rExtent.max(binR), std::sqrt(9. + 25.), 1e-6); + 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); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Core/Geometry/ProtoLayerHelperTests.cpp b/Tests/UnitTests/Core/Geometry/ProtoLayerHelperTests.cpp index 57c6db68935..e316b2f29aa 100644 --- a/Tests/UnitTests/Core/Geometry/ProtoLayerHelperTests.cpp +++ b/Tests/UnitTests/Core/Geometry/ProtoLayerHelperTests.cpp @@ -73,7 +73,8 @@ BOOST_AUTO_TEST_CASE(ProtoLayerHelperTests) { // Sort into ProtoLayers auto radialLayers = plHelper.protoLayers( - tgContext, cylinderSurfaces, ProtoLayerHelper::SortingConfig(binR, 5.)); + tgContext, cylinderSurfaces, + ProtoLayerHelper::SortingConfig(BinningValue::binR, 5.)); BOOST_CHECK_EQUAL(radialLayers.size(), 4); @@ -127,7 +128,8 @@ BOOST_AUTO_TEST_CASE(ProtoLayerHelperTests) { objVis.clear(); // Sort into ProtoLayers - auto discLayersZ = plHelper.protoLayers(tgContext, discSurfaces, {binZ, 5.}); + auto discLayersZ = + plHelper.protoLayers(tgContext, discSurfaces, {BinningValue::binZ, 5.}); BOOST_CHECK_EQUAL(discLayersZ.size(), 4); @@ -178,16 +180,17 @@ BOOST_AUTO_TEST_CASE(ProtoLayerHelperTests) { // First: Sort into ProtoLayers radially auto rSorted = plHelper.protoLayers( - tgContext, ringSurfaces, ProtoLayerHelper::SortingConfig(binR, 1.)); + tgContext, ringSurfaces, + ProtoLayerHelper::SortingConfig(BinningValue::binR, 1.)); BOOST_CHECK_EQUAL(rSorted.size(), 3); ColorRGB dColor = {0, 0, 0}; int ir = 0; for (auto& rBatch : rSorted) { - auto lSorted = - plHelper.protoLayers(tgContext, rBatch.surfaces(), - ProtoLayerHelper::SortingConfig(binZ, 5.)); + auto lSorted = plHelper.protoLayers( + tgContext, rBatch.surfaces(), + ProtoLayerHelper::SortingConfig(BinningValue::binZ, 5.)); il = 0; dColor[ir] = 256; for (auto& layer : lSorted) { @@ -204,7 +207,8 @@ BOOST_AUTO_TEST_CASE(ProtoLayerHelperTests) { // Perform the split at once auto rzSorted = - plHelper.protoLayers(tgContext, ringSurfaces, {{binR, 1.}, {binZ, 5}}); + plHelper.protoLayers(tgContext, ringSurfaces, + {{BinningValue::binR, 1.}, {BinningValue::binZ, 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 38b504d3a19..0a0d9434c90 100644 --- a/Tests/UnitTests/Core/Geometry/ProtoLayerTests.cpp +++ b/Tests/UnitTests/Core/Geometry/ProtoLayerTests.cpp @@ -105,20 +105,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(BinningValue::binX), 12., 1e-8); + CHECK_CLOSE_ABS(protoLayer.medium(BinningValue::binX), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayer.min(BinningValue::binX), -6., 1e-8); + CHECK_CLOSE_ABS(protoLayer.max(BinningValue::binX), 6., 1e-8); + CHECK_CLOSE_ABS(protoLayer.range(BinningValue::binY), 6., 1e-8); + CHECK_CLOSE_ABS(protoLayer.medium(BinningValue::binY), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayer.min(BinningValue::binY), -3., 1e-8); + CHECK_CLOSE_ABS(protoLayer.max(BinningValue::binY), 3., 1e-8); + CHECK_CLOSE_ABS(protoLayer.range(BinningValue::binZ), 12., 1e-8); + CHECK_CLOSE_ABS(protoLayer.medium(BinningValue::binZ), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayer.min(BinningValue::binZ), -6., 1e-8); + CHECK_CLOSE_ABS(protoLayer.max(BinningValue::binZ), 6., 1e-8); + CHECK_CLOSE_ABS(protoLayer.max(BinningValue::binR), std::hypot(3, 6), 1e-8); + CHECK_CLOSE_ABS(protoLayer.min(BinningValue::binR), 3., 1e-8); // Test 1a @@ -127,15 +127,16 @@ 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(BinningValue::binX), -6.); + CHECK_CLOSE_ABS(protoLayerRot.medium(BinningValue::binX), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.medium(BinningValue::binY), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.range(BinningValue::binZ), 12., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.medium(BinningValue::binZ), 0., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.min(BinningValue::binZ), -6., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.max(BinningValue::binZ), 6., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.min(BinningValue::binR), 3., 1e-8); + CHECK_CLOSE_ABS(protoLayerRot.max(BinningValue::binR), std::hypot(3, 6), + 1e-8); std::stringstream sstream; protoLayerRot.toStream(sstream); diff --git a/Tests/UnitTests/Core/Geometry/SurfaceArrayCreatorTests.cpp b/Tests/UnitTests/Core/Geometry/SurfaceArrayCreatorTests.cpp index fdbac2fce6f..6f68b8b7315 100644 --- a/Tests/UnitTests/Core/Geometry/SurfaceArrayCreatorTests.cpp +++ b/Tests/UnitTests/Core/Geometry/SurfaceArrayCreatorTests.cpp @@ -590,7 +590,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_completeBinning, // actually filled SA for (const auto& srf : brl) { - Vector3 ctr = srf->binningPosition(tgContext, binR); + Vector3 ctr = srf->binningPosition(tgContext, BinningValue::binR); auto binContent = sa.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 1u); @@ -640,7 +640,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_barrelStagger, auto A = pr.first; auto B = pr.second; - Vector3 ctr = A->binningPosition(tgContext, binR); + Vector3 ctr = A->binningPosition(tgContext, BinningValue::binR); auto binContent = sa.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 2u); std::set act; @@ -710,7 +710,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_barrelStagger, auto A = pr.first; auto B = pr.second; - Vector3 ctr = A->binningPosition(tgContext, binR); + Vector3 ctr = A->binningPosition(tgContext, BinningValue::binR); 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 4831f23b19e..efd2da5e8b6 100644 --- a/Tests/UnitTests/Core/Geometry/SurfaceBinningMatcherTests.cpp +++ b/Tests/UnitTests/Core/Geometry/SurfaceBinningMatcherTests.cpp @@ -55,24 +55,26 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceMatcher) { Surface::makeShared(identity, similarPhiBounds); SurfaceBinningMatcher sbm; - sbm.tolerances[binR] = {rMinTol, rMaxTol}; - sbm.tolerances[binPhi] = {phiTol, phiTol}; + sbm.tolerances[toUnderlying(BinningValue::binR)] = {rMinTol, rMaxTol}; + sbm.tolerances[toUnderlying(BinningValue::binPhi)] = {phiTol, phiTol}; // Always true - for (int ib = 0; ib < binValues; ++ib) { - BOOST_CHECK( - sbm(tgContext, (BinningValue)ib, oneSurface.get(), oneSurface.get())); + for (BinningValue ib : allBinningValues()) { + BOOST_CHECK(sbm(tgContext, ib, oneSurface.get(), oneSurface.get())); } // Not matching in R - BOOST_CHECK(!sbm(tgContext, binR, oneSurface.get(), otherSurface.get())); + BOOST_CHECK(!sbm(tgContext, BinningValue::binR, oneSurface.get(), + otherSurface.get())); // Not matching in phi - BOOST_CHECK(!sbm(tgContext, binPhi, oneSurface.get(), otherSurface.get())); + BOOST_CHECK(!sbm(tgContext, BinningValue::binPhi, oneSurface.get(), + otherSurface.get())); // Good enough matching in R - BOOST_CHECK(sbm(tgContext, binR, oneSurface.get(), similarRSurface.get())); + BOOST_CHECK(sbm(tgContext, BinningValue::binR, oneSurface.get(), + similarRSurface.get())); // Good enough matching in phi - BOOST_CHECK( - sbm(tgContext, binPhi, oneSurface.get(), similarPhiSurface.get())); + BOOST_CHECK(sbm(tgContext, BinningValue::binPhi, oneSurface.get(), + similarPhiSurface.get())); } } // namespace Acts::Test diff --git a/Tests/UnitTests/Core/Geometry/TrackingVolumeCreation.hpp b/Tests/UnitTests/Core/Geometry/TrackingVolumeCreation.hpp index e47d51306ce..58a7b30380a 100644 --- a/Tests/UnitTests/Core/Geometry/TrackingVolumeCreation.hpp +++ b/Tests/UnitTests/Core/Geometry/TrackingVolumeCreation.hpp @@ -95,14 +95,15 @@ MutableTrackingVolumePtr constructContainerVolume(const GeometryContext& gctx, const std::string& name) { /// create the volume array using VAP = std::pair; - std::vector volumes = {{iVolume, iVolume->binningPosition(gctx, binR)}, - {oVolume, oVolume->binningPosition(gctx, binR)}}; + std::vector volumes = { + {iVolume, iVolume->binningPosition(gctx, BinningValue::binR)}, + {oVolume, oVolume->binningPosition(gctx, BinningValue::binR)}}; /// 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, binR); + auto vUtility = std::make_unique( + volumes.size(), 0., hVolumeR, open, BinningValue::binR); 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 64d749cb38c..93d86595b12 100644 --- a/Tests/UnitTests/Core/Geometry/VolumeTests.cpp +++ b/Tests/UnitTests/Core/Geometry/VolumeTests.cpp @@ -72,7 +72,8 @@ BOOST_AUTO_TEST_CASE(VolumeTest) { // Binning test GeometryContext gctx; - BOOST_CHECK_EQUAL(volume.binningPosition(gctx, binX), volume.center()); + BOOST_CHECK_EQUAL(volume.binningPosition(gctx, BinningValue::binX), + volume.center()); } BOOST_AUTO_TEST_CASE(VolumeUpdateTest) { diff --git a/Tests/UnitTests/Core/Material/AccumulatedSurfaceMaterialTests.cpp b/Tests/UnitTests/Core/Material/AccumulatedSurfaceMaterialTests.cpp index b5f41f55185..edb601fe5ad 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, binX); + BinUtility binUtility1D(10, -5., 5., open, BinningValue::binX); 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, binX); - binUtility2D += BinUtility(20, -10., 10., open, binY); + BinUtility binUtility2D(10, -5., 5., open, BinningValue::binX); + binUtility2D += BinUtility(20, -10., 10., open, BinningValue::binY); 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, binX); - binUtility2D += BinUtility(2, -1., 1., open, binY); + BinUtility binUtility2D(2, -1., 1., open, BinningValue::binX); + binUtility2D += BinUtility(2, -1., 1., open, BinningValue::binY); AccumulatedSurfaceMaterial material2D{binUtility2D}; const std::vector> bin; diff --git a/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialAccumulaterTests.cpp b/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialAccumulaterTests.cpp index c93938c8149..f4aea23e2dc 100644 --- a/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialAccumulaterTests.cpp +++ b/Tests/UnitTests/Core/Material/BinnedSurfaceMaterialAccumulaterTests.cpp @@ -85,14 +85,14 @@ BOOST_AUTO_TEST_CASE(AccumulationTest) { std::make_shared(mp, 1.)); // Second surface is binned Phi / Z - BinUtility sb1(4, -M_PI, M_PI, closed, binPhi); - sb1 += BinUtility(2, -100., 100., open, binZ); + BinUtility sb1(4, -M_PI, M_PI, closed, BinningValue::binPhi); + sb1 += BinUtility(2, -100., 100., open, BinningValue::binZ); surfaces[1u]->assignSurfaceMaterial( std::make_shared(sb1)); // Third is binned std::vector mps = {mp, mp, mp}; - BinUtility sb2(3, -100., 100., open, binZ); + BinUtility sb2(3, -100., 100., open, BinningValue::binZ); 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 1468cb8f0b9..7cd38d324b4 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, binX); - xyBinning += BinUtility(3, -3., 3., open, binY); + BinUtility xyBinning(2, -1., 1., open, BinningValue::binX); + xyBinning += BinUtility(3, -3., 3., open, BinningValue::binY); // Constructor a few material properties MaterialSlab a00(Material::fromMolarDensity(1., 2., 3., 4., 5.), 6.); diff --git a/Tests/UnitTests/Core/Material/MaterialGridHelperTests.cpp b/Tests/UnitTests/Core/Material/MaterialGridHelperTests.cpp index 28d82704f64..2eebf107fc9 100644 --- a/Tests/UnitTests/Core/Material/MaterialGridHelperTests.cpp +++ b/Tests/UnitTests/Core/Material/MaterialGridHelperTests.cpp @@ -39,8 +39,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, binX); - bu += BinUtility(3, -2., 2., open, binY); + BinUtility bu(7, -3., 3., open, BinningValue::binX); + bu += BinUtility(3, -2., 2., open, BinningValue::binY); auto bd = bu.binningData(); std::function transfoGlobalToLocal; @@ -130,8 +130,8 @@ 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, binZ); - bu += BinUtility(3, -M_PI, M_PI, closed, binPhi); + BinUtility bu(2, -2., 2., open, BinningValue::binZ); + bu += BinUtility(3, -M_PI, M_PI, closed, BinningValue::binPhi); auto bd = bu.binningData(); std::function transfoGlobalToLocal; @@ -221,9 +221,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, binX); - bu += BinUtility(3, -2., 2., open, binY); - bu += BinUtility(2, -1., 1., open, binZ); + BinUtility bu(7, -3., 3., open, BinningValue::binX); + bu += BinUtility(3, -2., 2., open, BinningValue::binY); + bu += BinUtility(2, -1., 1., open, BinningValue::binZ); auto bd = bu.binningData(); std::function transfoGlobalToLocal; @@ -315,9 +315,9 @@ 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, binR); - bu += BinUtility(3, -M_PI, M_PI, closed, binPhi); - bu += BinUtility(2, -2., 2., open, binZ); + BinUtility bu(4, 1., 4., open, BinningValue::binR); + bu += BinUtility(3, -M_PI, M_PI, closed, BinningValue::binPhi); + bu += BinUtility(2, -2., 2., open, BinningValue::binZ); auto bd = bu.binningData(); std::function transfoGlobalToLocal; diff --git a/Tests/UnitTests/Core/Material/PropagatorMaterialAssignerTests.cpp b/Tests/UnitTests/Core/Material/PropagatorMaterialAssignerTests.cpp index 105aca93ea6..9f33c2d62b1 100644 --- a/Tests/UnitTests/Core/Material/PropagatorMaterialAssignerTests.cpp +++ b/Tests/UnitTests/Core/Material/PropagatorMaterialAssignerTests.cpp @@ -68,8 +68,8 @@ BOOST_AUTO_TEST_CASE(FindSurfaceIntersectionsTrackingGeometry) { LayerArrayCreator::Config lacConfig; LayerArrayCreator lac = LayerArrayCreator(lacConfig); - auto layers = - lac.layerArray(tContext, {pCylinderLayer}, rMin, rMid, arbitrary, binR); + auto layers = lac.layerArray(tContext, {pCylinderLayer}, rMin, rMid, + arbitrary, BinningValue::binR); auto innerVolume = std::make_shared( Transform3::Identity(), vCylinderInner, nullptr, std::move(layers), @@ -84,8 +84,8 @@ BOOST_AUTO_TEST_CASE(FindSurfaceIntersectionsTrackingGeometry) { TrackingVolumeArrayCreator::Config tvacConfig; TrackingVolumeArrayCreator tvac = TrackingVolumeArrayCreator(tvacConfig); - auto volumes = - tvac.trackingVolumeArray(tContext, {innerVolume, outerVolume}, binR); + auto volumes = tvac.trackingVolumeArray(tContext, {innerVolume, outerVolume}, + BinningValue::binR); 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 bb084a3ccd1..a5b28beee03 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, binX); - smpBU += BinUtility(10, -10., 10., open, binY); + BinUtility smpBU(10, -10., 10., open, BinningValue::binX); + smpBU += BinUtility(10, -10., 10., open, BinningValue::binY); // Constructor from arguments ProtoSurfaceMaterial smp(smpBU); diff --git a/Tests/UnitTests/Core/Material/ProtoVolumeMaterialTests.cpp b/Tests/UnitTests/Core/Material/ProtoVolumeMaterialTests.cpp index d075e4db2d5..a3ebc0e527a 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, binX); - vmpBU += BinUtility(10, -10., 10., open, binY); - vmpBU += BinUtility(10, -10., 10., open, binZ); + BinUtility vmpBU(10, -10., 10., open, BinningValue::binX); + vmpBU += BinUtility(10, -10., 10., open, BinningValue::binY); + vmpBU += BinUtility(10, -10., 10., open, BinningValue::binZ); // Constructor from arguments ProtoVolumeMaterial vmp(vmpBU); diff --git a/Tests/UnitTests/Core/Material/SurfaceMaterialMapperTests.cpp b/Tests/UnitTests/Core/Material/SurfaceMaterialMapperTests.cpp index 6e3754083d5..661463fcb11 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, binZ); + BinUtility zbinned(8, -40, 40, open, BinningValue::binZ); 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 fc2bbe378d6..406cf9deabe 100644 --- a/Tests/UnitTests/Core/Material/VolumeMaterialMapperTests.cpp +++ b/Tests/UnitTests/Core/Material/VolumeMaterialMapperTests.cpp @@ -86,17 +86,17 @@ namespace Acts::Test { BOOST_AUTO_TEST_CASE(SurfaceMaterialMapper_tests) { using namespace Acts::UnitLiterals; - BinUtility bu1(4, 0_m, 1_m, open, binX); - bu1 += BinUtility(2, -0.5_m, 0.5_m, open, binY); - bu1 += BinUtility(2, -0.5_m, 0.5_m, open, binZ); + 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 bu2(4, 1_m, 2_m, open, binX); - bu2 += BinUtility(2, -0.5_m, 0.5_m, open, binY); - bu2 += BinUtility(2, -0.5_m, 0.5_m, open, binZ); + 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 bu3(4, 2_m, 3_m, open, binX); - bu3 += BinUtility(2, -0.5_m, 0.5_m, open, binY); - bu3 += BinUtility(2, -0.5_m, 0.5_m, open, binZ); + 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); // Build a vacuum volume CuboidVolumeBuilder::VolumeConfig vCfg1; diff --git a/Tests/UnitTests/Core/Navigation/DetectorVolumeFindersTests.cpp b/Tests/UnitTests/Core/Navigation/DetectorVolumeFindersTests.cpp index 51c02317ac6..959aae85be8 100644 --- a/Tests/UnitTests/Core/Navigation/DetectorVolumeFindersTests.cpp +++ b/Tests/UnitTests/Core/Navigation/DetectorVolumeFindersTests.cpp @@ -130,8 +130,8 @@ BOOST_AUTO_TEST_CASE(IndexedDetectorVolumeFinder) { g.atPosition(std::array{50.}) = 1u; g.atPosition(std::array{150.}) = 2u; - Acts::Experimental::IndexedDetectorVolumesImpl idv(std::move(g), - {Acts::binR}); + Acts::Experimental::IndexedDetectorVolumesImpl idv( + std::move(g), {Acts::BinningValue::binR}); // 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 d89c4dc7b63..5c8b4ee6866 100644 --- a/Tests/UnitTests/Core/Navigation/MultiWireNavigationTests.cpp +++ b/Tests/UnitTests/Core/Navigation/MultiWireNavigationTests.cpp @@ -75,10 +75,11 @@ BOOST_AUTO_TEST_CASE(Navigation_in_Indexed_Surfaces) { mlCfg.name = "Multi_Layer_With_Wires"; mlCfg.mlSurfaces = strawSurfaces; - mlCfg.mlBinning = {ProtoBinning(Acts::binX, Acts::AxisBoundaryType::Bound, - -vBounds[0], vBounds[0], nSurfacesX, 1u), - ProtoBinning(Acts::binY, Acts::AxisBoundaryType::Bound, - -vBounds[1], vBounds[1], nSurfacesY, 0u)}; + mlCfg.mlBinning = { + ProtoBinning(Acts::BinningValue::binX, Acts::AxisBoundaryType::Bound, + -vBounds[0], vBounds[0], nSurfacesX, 1u), + ProtoBinning(Acts::BinningValue::binY, Acts::AxisBoundaryType::Bound, + -vBounds[1], vBounds[1], nSurfacesY, 0u)}; mlCfg.mlBounds = vBounds; MultiWireStructureBuilder mlBuilder(mlCfg); diff --git a/Tests/UnitTests/Core/Navigation/NavigationStateUpdatersTests.cpp b/Tests/UnitTests/Core/Navigation/NavigationStateUpdatersTests.cpp index 3d9250391ab..7efecc884c9 100644 --- a/Tests/UnitTests/Core/Navigation/NavigationStateUpdatersTests.cpp +++ b/Tests/UnitTests/Core/Navigation/NavigationStateUpdatersTests.cpp @@ -265,7 +265,8 @@ BOOST_AUTO_TEST_CASE(AllPortalsGrid1DSurfaces) { Acts::Experimental::IInternalNavigation, decltype(grid), Acts::Experimental::IndexedSurfacesExtractor, Acts::Experimental::SurfacesFiller>; - auto grid1DSurfaces = Grid1DSurfacesProvider(std::move(grid), {Acts::binR}); + auto grid1DSurfaces = + Grid1DSurfacesProvider(std::move(grid), {Acts::BinningValue::binR}); auto allPortalsGrid1DSurfaces = Acts::Experimental::ChainedNavigation< Acts::Experimental::IInternalNavigation, AllPortalsProvider, @@ -291,8 +292,8 @@ BOOST_AUTO_TEST_CASE(AllPortalsGrid2DSurfaces) { Acts::Experimental::IInternalNavigation, decltype(grid), Acts::Experimental::IndexedSurfacesExtractor, Acts::Experimental::SurfacesFiller>; - auto grid2DSurfaces = - Grid2DSurfacesProvider(std::move(grid), {Acts::binR, Acts::binZ}); + auto grid2DSurfaces = Grid2DSurfacesProvider( + std::move(grid), {Acts::BinningValue::binR, Acts::BinningValue::binZ}); 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 c5bf26e88dd..a379d72c4eb 100644 --- a/Tests/UnitTests/Core/Navigation/PortalNavigationTests.cpp +++ b/Tests/UnitTests/Core/Navigation/PortalNavigationTests.cpp @@ -75,8 +75,8 @@ BOOST_AUTO_TEST_CASE(VolumeArrayUpdate) { std::vector volumes = { volumeA.get(), volumeB.get(), volumeC.get(), volumeD.get()}; - Acts::Experimental::BoundVolumesGrid1Navigation bvg(zArray, Acts::binZ, - volumes); + Acts::Experimental::BoundVolumesGrid1Navigation bvg( + zArray, Acts::BinningValue::binZ, 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::binZ, volumes, shift300.inverse()); + zArray, Acts::BinningValue::binZ, 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/Surfaces/ConeSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp index 8aee4c889f1..9719f811c3a 100644 --- a/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp @@ -6,7 +6,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//#include +// #include #include #include "Acts/Definitions/Algebra.hpp" @@ -220,14 +220,22 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceExtent) { auto pConeExtent = pCone->polyhedronRepresentation(tgContext, 1).extent(); double rMax = zMax * std::tan(alpha); - CHECK_CLOSE_ABS(zMin, pConeExtent.min(binZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(zMax, pConeExtent.max(binZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(0., pConeExtent.min(binR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pConeExtent.max(binR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pConeExtent.min(binX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pConeExtent.max(binX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pConeExtent.min(binY), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pConeExtent.max(binY), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(zMin, pConeExtent.min(BinningValue::binZ), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(zMax, pConeExtent.max(BinningValue::binZ), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(0., pConeExtent.min(BinningValue::binR), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMax, pConeExtent.max(BinningValue::binR), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(-rMax, pConeExtent.min(BinningValue::binX), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMax, pConeExtent.max(BinningValue::binX), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(-rMax, pConeExtent.min(BinningValue::binY), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMax, pConeExtent.max(BinningValue::binY), + s_onSurfaceTolerance); // Now a sector double halfPhiSector = M_PI / 8.; @@ -236,10 +244,14 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceExtent) { pCone = Surface::makeShared(pTransform, pConeBounds); pConeExtent = pCone->polyhedronRepresentation(tgContext, 1).extent(); - CHECK_CLOSE_ABS(zMin, pConeExtent.min(binZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(zMax, pConeExtent.max(binZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(0., pConeExtent.min(binR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pConeExtent.max(binR), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(zMin, pConeExtent.min(BinningValue::binZ), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(zMax, pConeExtent.max(BinningValue::binZ), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(0., pConeExtent.min(BinningValue::binR), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMax, pConeExtent.max(BinningValue::binR), + s_onSurfaceTolerance); } /// Unit test for testing ConeSurface alignment derivatives diff --git a/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp index 35bb40438b5..3635591f6ab 100644 --- a/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp @@ -261,14 +261,22 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceExtent) { auto cylinderExtent = cylinderSurface->polyhedronRepresentation(testContext, 1).extent(); - CHECK_CLOSE_ABS(-8, cylinderExtent.min(binZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(12, cylinderExtent.max(binZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(radius, cylinderExtent.min(binR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(radius, cylinderExtent.max(binR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-radius, cylinderExtent.min(binX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(radius, cylinderExtent.max(binX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-radius, cylinderExtent.min(binY), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(radius, cylinderExtent.max(binY), s_onSurfaceTolerance); + 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); } /// Unit test for testing CylinderSurface alignment derivatives @@ -316,17 +324,21 @@ 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, binR); + Vector3 bp = cylinder->binningPosition(testContext, BinningValue::binR); CHECK_CLOSE_ABS(bp, exp, 1e-10); - CHECK_CLOSE_ABS(cylinder->binningPositionValue(testContext, binR), - VectorHelpers::perp(exp), 1e-10); + CHECK_CLOSE_ABS( + cylinder->binningPositionValue(testContext, BinningValue::binR), + VectorHelpers::perp(exp), 1e-10); - bp = cylinder->binningPosition(testContext, binRPhi); + bp = cylinder->binningPosition(testContext, BinningValue::binRPhi); CHECK_CLOSE_ABS(bp, exp, 1e-10); - CHECK_CLOSE_ABS(cylinder->binningPositionValue(testContext, binRPhi), - VectorHelpers::phi(exp) * VectorHelpers::perp(exp), 1e-10); + CHECK_CLOSE_ABS( + cylinder->binningPositionValue(testContext, BinningValue::binRPhi), + VectorHelpers::phi(exp) * VectorHelpers::perp(exp), 1e-10); - for (auto b : {binX, binY, binZ, binEta, binH, binMag}) { + for (auto b : + {BinningValue::binX, BinningValue::binY, BinningValue::binZ, + BinningValue::binEta, BinningValue::binH, BinningValue::binMag}) { BOOST_TEST_CONTEXT("binValue: " << b) { BOOST_CHECK_EQUAL(cylinder->binningPosition(testContext, b), cylinder->center(testContext)); @@ -353,61 +365,67 @@ BOOST_DATA_TEST_CASE(IncompatibleZDirection, auto cyl2 = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 200_mm}, 30_mm, 100_mm); - BOOST_CHECK_THROW(cyl->mergedWith(testContext, *cyl2, Acts::binPhi, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW( + cyl->mergedWith(testContext, *cyl2, Acts::BinningValue::binPhi, *logger), + SurfaceMergingException); auto cylShiftedXy = Surface::makeShared( base * Translation3{Vector3{1_mm, 2_mm, 200_mm}}, 30_mm, 100_mm); - BOOST_CHECK_THROW( - cyl->mergedWith(testContext, *cylShiftedXy, Acts::binZ, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cyl->mergedWith(testContext, *cylShiftedXy, + Acts::BinningValue::binZ, *logger), + SurfaceMergingException); auto cylRotatedZ = Surface::makeShared( base * AngleAxis3{10_degree, Vector3::UnitZ()} * Translation3{Vector3::UnitZ() * 200_mm}, 30_mm, 100_mm); - BOOST_CHECK_THROW( - cyl->mergedWith(testContext, *cylRotatedZ, Acts::binZ, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cyl->mergedWith(testContext, *cylRotatedZ, + Acts::BinningValue::binZ, *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(testContext, *cylRotatedX, Acts::binZ, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cyl->mergedWith(testContext, *cylRotatedX, + Acts::BinningValue::binZ, *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(testContext, *cyl3, Acts::binZ, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW( + cyl->mergedWith(testContext, *cyl3, Acts::BinningValue::binZ, *logger), + SurfaceMergingException); // Cylinder with bevel auto cyl4 = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 200_mm}, 30_mm, 100_mm, M_PI, 0, M_PI / 8.0); - BOOST_CHECK_THROW(cyl->mergedWith(testContext, *cyl4, Acts::binZ, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW( + cyl->mergedWith(testContext, *cyl4, Acts::BinningValue::binZ, *logger), + SurfaceMergingException); auto cyl5 = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 200_mm}, 30_mm, 100_mm, M_PI, 0, 0, M_PI / 8.0); - BOOST_CHECK_THROW(cyl->mergedWith(testContext, *cyl5, Acts::binZ, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW( + cyl->mergedWith(testContext, *cyl5, Acts::BinningValue::binZ, *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(testContext, *cyl6, Acts::binZ, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW( + cyl->mergedWith(testContext, *cyl6, Acts::BinningValue::binZ, *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(testContext, *cyl7, Acts::binZ, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW( + cyl->mergedWith(testContext, *cyl7, Acts::BinningValue::binZ, *logger), + SurfaceMergingException); } BOOST_DATA_TEST_CASE(ZDirection, @@ -426,10 +444,12 @@ BOOST_DATA_TEST_CASE(ZDirection, auto cyl2 = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 200_mm}, 30_mm, 100_mm); - auto cyl3 = cyl->mergedWith(testContext, *cyl2, Acts::binZ, *logger); + auto cyl3 = + cyl->mergedWith(testContext, *cyl2, Acts::BinningValue::binZ, *logger); BOOST_REQUIRE_NE(cyl3, nullptr); - auto cyl3Reversed = cyl2->mergedWith(testContext, *cyl, Acts::binZ, *logger); + auto cyl3Reversed = + cyl2->mergedWith(testContext, *cyl, Acts::BinningValue::binZ, *logger); BOOST_REQUIRE_NE(cyl3Reversed, nullptr); BOOST_CHECK(*cyl3 == *cyl3Reversed); @@ -465,24 +485,24 @@ 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(testContext, *cylPhi2, Acts::binRPhi, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cylPhi->mergedWith(testContext, *cylPhi2, + Acts::BinningValue::binRPhi, *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(testContext, *cylPhi3, Acts::binRPhi, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cylPhi->mergedWith(testContext, *cylPhi3, + Acts::BinningValue::binRPhi, *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(testContext, *cylPhi4, Acts::binRPhi, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(cylPhi->mergedWith(testContext, *cylPhi4, + Acts::BinningValue::binRPhi, *logger), + SurfaceMergingException); } BOOST_DATA_TEST_CASE(RPhiDirection, @@ -506,12 +526,13 @@ BOOST_DATA_TEST_CASE(RPhiDirection, auto cyl2 = Surface::makeShared(base, 30_mm, 100_mm, 45_degree, a(95_degree)); - auto cyl3 = cyl->mergedWith(testContext, *cyl2, Acts::binRPhi, *logger); + auto cyl3 = + cyl->mergedWith(testContext, *cyl2, Acts::BinningValue::binRPhi, *logger); BOOST_REQUIRE_NE(cyl3, nullptr); BOOST_CHECK_EQUAL(base.matrix(), cyl3->transform(testContext).matrix()); auto cyl3Reversed = - cyl2->mergedWith(testContext, *cyl, Acts::binRPhi, *logger); + cyl2->mergedWith(testContext, *cyl, Acts::BinningValue::binRPhi, *logger); BOOST_REQUIRE_NE(cyl3Reversed, nullptr); BOOST_CHECK(*cyl3 == *cyl3Reversed); @@ -527,11 +548,13 @@ BOOST_DATA_TEST_CASE(RPhiDirection, 20_degree, a(170_degree)); auto cyl5 = Surface::makeShared(base, 30_mm, 100_mm, 10_degree, a(-160_degree)); - auto cyl45 = cyl4->mergedWith(testContext, *cyl5, Acts::binRPhi, *logger); + auto cyl45 = cyl4->mergedWith(testContext, *cyl5, Acts::BinningValue::binRPhi, + *logger); BOOST_REQUIRE_NE(cyl45, nullptr); BOOST_CHECK_EQUAL(base.matrix(), cyl45->transform(testContext).matrix()); - auto cyl54 = cyl5->mergedWith(testContext, *cyl4, Acts::binRPhi, *logger); + auto cyl54 = cyl5->mergedWith(testContext, *cyl4, Acts::BinningValue::binRPhi, + *logger); BOOST_REQUIRE_NE(cyl54, nullptr); BOOST_CHECK(*cyl54 == *cyl45); diff --git a/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp index 4db74e0af17..40e16d69c36 100644 --- a/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceProperties) { // /// Test binningPosition // auto binningPosition= - // discSurfaceObject.binningPosition(BinningValue::binRPhi ); + // discSurfaceObject.binningPosition(BinningValue::BinningValue::binRPhi ); // std::cout<binningPosition(tgContext, BinningValue::binRPhi), @@ -245,29 +245,47 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceExtent) { Surface::makeShared(Transform3::Identity(), 0., rMax); auto pDiscExtent = pDisc->polyhedronRepresentation(tgContext, 1).extent(); - CHECK_CLOSE_ABS(0., pDiscExtent.min(binZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(0., pDiscExtent.max(binZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(0., pDiscExtent.min(binR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pDiscExtent.max(binR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pDiscExtent.min(binX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pDiscExtent.max(binX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pDiscExtent.min(binY), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pDiscExtent.max(binY), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-M_PI, pDiscExtent.min(binPhi), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(M_PI, pDiscExtent.max(binPhi), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(0., pDiscExtent.min(BinningValue::binZ), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(0., pDiscExtent.max(BinningValue::binZ), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(0., pDiscExtent.min(BinningValue::binR), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMax, pDiscExtent.max(BinningValue::binR), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(-rMax, pDiscExtent.min(BinningValue::binX), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMax, pDiscExtent.max(BinningValue::binX), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(-rMax, pDiscExtent.min(BinningValue::binY), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMax, pDiscExtent.max(BinningValue::binY), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(-M_PI, pDiscExtent.min(BinningValue::binPhi), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(M_PI, pDiscExtent.max(BinningValue::binPhi), + s_onSurfaceTolerance); auto pRing = Surface::makeShared(Transform3::Identity(), rMin, rMax); auto pRingExtent = pRing->polyhedronRepresentation(tgContext, 1).extent(); - CHECK_CLOSE_ABS(0., pRingExtent.min(binZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(0., pRingExtent.max(binZ), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMin, pRingExtent.min(binR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pRingExtent.max(binR), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pRingExtent.min(binX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pRingExtent.max(binX), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(-rMax, pRingExtent.min(binY), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(rMax, pRingExtent.max(binY), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(0., pRingExtent.min(BinningValue::binZ), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(0., pRingExtent.max(BinningValue::binZ), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMin, pRingExtent.min(BinningValue::binR), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMax, pRingExtent.max(BinningValue::binR), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(-rMax, pRingExtent.min(BinningValue::binX), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMax, pRingExtent.max(BinningValue::binX), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(-rMax, pRingExtent.min(BinningValue::binY), + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(rMax, pRingExtent.max(BinningValue::binY), + s_onSurfaceTolerance); } /// Unit test for testing DiscSurface alignment derivatives @@ -324,22 +342,25 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceBinningPosition) { auto bounds = std::make_shared(minR, maxR, M_PI / 8, 0.1); auto disc = Acts::Surface::makeShared(trf, bounds); - Vector3 bp = disc->binningPosition(tgContext, binR); + Vector3 bp = disc->binningPosition(tgContext, BinningValue::binR); 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, binR), + BOOST_CHECK_EQUAL(disc->binningPositionValue(tgContext, BinningValue::binR), VectorHelpers::perp(exp)); - bp = disc->binningPosition(tgContext, binPhi); + bp = disc->binningPosition(tgContext, BinningValue::binPhi); BOOST_CHECK_EQUAL(bp, exp); - BOOST_CHECK_EQUAL(disc->binningPositionValue(tgContext, binPhi), - VectorHelpers::phi(exp)); + BOOST_CHECK_EQUAL( + disc->binningPositionValue(tgContext, BinningValue::binPhi), + VectorHelpers::phi(exp)); - for (auto b : {binX, binY, binZ, binEta, binRPhi, binH, binMag}) { + for (auto b : {BinningValue::binX, BinningValue::binY, BinningValue::binZ, + BinningValue::binEta, BinningValue::binRPhi, + BinningValue::binH, BinningValue::binMag}) { BOOST_TEST_CONTEXT("binValue: " << b) { BOOST_CHECK_EQUAL(disc->binningPosition(tgContext, b), disc->center(tgContext)); @@ -357,7 +378,7 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceBinningPosition) { auto disc = Acts::Surface::makeShared(trf, bounds); - Vector3 bp = disc->binningPosition(tgContext, binR); + Vector3 bp = disc->binningPosition(tgContext, BinningValue::binR); 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}; @@ -365,10 +386,12 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceBinningPosition) { BOOST_CHECK_EQUAL(bp, exp); - bp = disc->binningPosition(tgContext, binPhi); + bp = disc->binningPosition(tgContext, BinningValue::binPhi); BOOST_CHECK_EQUAL(bp, exp); - for (auto b : {binX, binY, binZ, binEta, binRPhi, binH, binMag}) { + for (auto b : {BinningValue::binX, BinningValue::binY, BinningValue::binZ, + BinningValue::binEta, BinningValue::binRPhi, + BinningValue::binH, BinningValue::binMag}) { BOOST_TEST_CONTEXT("binValue: " << b) { BOOST_CHECK_EQUAL(disc->binningPosition(tgContext, b), disc->center(tgContext)); @@ -398,11 +421,13 @@ BOOST_AUTO_TEST_CASE(IncompatibleBounds) { auto discTrap2 = Surface::makeShared(base, 20_mm, 40_mm, 30_mm, 100_mm); - BOOST_CHECK_THROW(discRadial->mergedWith(tgContext, *discTrap, binR, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW( + discRadial->mergedWith(tgContext, *discTrap, BinningValue::binR, *logger), + SurfaceMergingException); - BOOST_CHECK_THROW(discTrap2->mergedWith(tgContext, *discTrap, binR, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW( + discTrap2->mergedWith(tgContext, *discTrap, BinningValue::binR, *logger), + SurfaceMergingException); } BOOST_DATA_TEST_CASE(IncompatibleRDirection, @@ -422,37 +447,38 @@ BOOST_DATA_TEST_CASE(IncompatibleRDirection, // Disc with overlap in r auto discOverlap = makeDisc(base, 90_mm, 150_mm); - BOOST_CHECK_THROW( - disc->mergedWith(tgContext, *discOverlap, Acts::binR, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(disc->mergedWith(tgContext, *discOverlap, + Acts::BinningValue::binR, *logger), + SurfaceMergingException); // Disc with gap in r auto discGap = makeDisc(base, 110_mm, 150_mm); - BOOST_CHECK_THROW(disc->mergedWith(tgContext, *discGap, Acts::binR, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW( + disc->mergedWith(tgContext, *discGap, Acts::BinningValue::binR, *logger), + SurfaceMergingException); auto discShiftedZ = Surface::makeShared( base * Translation3{Vector3::UnitZ() * 10_mm}, 100_mm, 150_mm); - BOOST_CHECK_THROW( - disc->mergedWith(tgContext, *discShiftedZ, Acts::binR, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(disc->mergedWith(tgContext, *discShiftedZ, + Acts::BinningValue::binR, *logger), + SurfaceMergingException); auto discShiftedXy = makeDisc( base * Translation3{Vector3{1_mm, 2_mm, 200_mm}}, 100_mm, 150_mm); - BOOST_CHECK_THROW( - disc->mergedWith(tgContext, *discShiftedXy, Acts::binZ, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(disc->mergedWith(tgContext, *discShiftedXy, + Acts::BinningValue::binZ, *logger), + SurfaceMergingException); auto discRotatedZ = makeDisc(base * AngleAxis3{10_degree, Vector3::UnitZ()}, 100_mm, 150_mm); - BOOST_CHECK_THROW( - disc->mergedWith(tgContext, *discRotatedZ, Acts::binR, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(disc->mergedWith(tgContext, *discRotatedZ, + Acts::BinningValue::binR, *logger), + SurfaceMergingException); auto discRotatedX = makeDisc(base * AngleAxis3{10_degree, Vector3::UnitX()}, 100_mm, 150_mm); - BOOST_CHECK_THROW( - disc->mergedWith(tgContext, *discRotatedX, Acts::binR, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(disc->mergedWith(tgContext, *discRotatedX, + Acts::BinningValue::binR, *logger), + SurfaceMergingException); } BOOST_DATA_TEST_CASE(RDirection, @@ -470,10 +496,12 @@ BOOST_DATA_TEST_CASE(RDirection, auto disc2 = makeDisc(base, 100_mm, 150_mm); - auto disc3 = disc->mergedWith(tgContext, *disc2, Acts::binR, *logger); + auto disc3 = + disc->mergedWith(tgContext, *disc2, Acts::BinningValue::binR, *logger); BOOST_REQUIRE_NE(disc3, nullptr); - auto disc3Reversed = disc2->mergedWith(tgContext, *disc, Acts::binR, *logger); + auto disc3Reversed = + disc2->mergedWith(tgContext, *disc, Acts::BinningValue::binR, *logger); BOOST_REQUIRE_NE(disc3Reversed, nullptr); BOOST_CHECK(*disc3 == *disc3Reversed); @@ -508,28 +536,28 @@ 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(tgContext, *discPhi2, Acts::binPhi, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(discPhi->mergedWith(tgContext, *discPhi2, + Acts::BinningValue::binPhi, *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(tgContext, *discPhi3, Acts::binPhi, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(discPhi->mergedWith(tgContext, *discPhi3, + Acts::BinningValue::binPhi, *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(tgContext, *discPhi4, Acts::binPhi, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(discPhi->mergedWith(tgContext, *discPhi4, + Acts::BinningValue::binPhi, *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(tgContext, *discPhi5, Acts::binPhi, *logger), - SurfaceMergingException); + BOOST_CHECK_THROW(discPhi->mergedWith(tgContext, *discPhi5, + Acts::BinningValue::binPhi, *logger), + SurfaceMergingException); } BOOST_DATA_TEST_CASE(PhiDirection, @@ -551,12 +579,13 @@ BOOST_DATA_TEST_CASE(PhiDirection, auto disc = makeDisc(base, 30_mm, 100_mm, 10_degree, a(40_degree)); auto disc2 = makeDisc(base, 30_mm, 100_mm, 45_degree, a(95_degree)); - auto disc3 = disc->mergedWith(tgContext, *disc2, Acts::binPhi, *logger); + auto disc3 = + disc->mergedWith(tgContext, *disc2, Acts::BinningValue::binPhi, *logger); BOOST_REQUIRE_NE(disc3, nullptr); BOOST_CHECK_EQUAL(base.matrix(), disc3->transform(tgContext).matrix()); auto disc3Reversed = - disc2->mergedWith(tgContext, *disc, Acts::binPhi, *logger); + disc2->mergedWith(tgContext, *disc, Acts::BinningValue::binPhi, *logger); BOOST_REQUIRE_NE(disc3Reversed, nullptr); BOOST_CHECK(*disc3 == *disc3Reversed); @@ -571,11 +600,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 = disc4->mergedWith(tgContext, *disc5, Acts::binPhi, *logger); + auto disc45 = + disc4->mergedWith(tgContext, *disc5, Acts::BinningValue::binPhi, *logger); BOOST_REQUIRE_NE(disc45, nullptr); BOOST_CHECK_EQUAL(base.matrix(), disc45->transform(tgContext).matrix()); - auto disc54 = disc5->mergedWith(tgContext, *disc4, Acts::binPhi, *logger); + auto disc54 = + disc5->mergedWith(tgContext, *disc4, Acts::BinningValue::binPhi, *logger); BOOST_REQUIRE_NE(disc54, nullptr); BOOST_CHECK(*disc54 == *disc45); diff --git a/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp index 3c922a51740..780a9fd9071 100644 --- a/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp @@ -96,8 +96,8 @@ BOOST_AUTO_TEST_CASE(LineSurface_allNamedMethods_test) { Transform3 transform(translation); LineSurfaceStub line(transform, 2.0, 20.); Vector3 referencePosition{0., 1., 2.}; - CHECK_CLOSE_ABS(referencePosition, line.binningPosition(tgContext, binX), - 1e-6); + CHECK_CLOSE_ABS(referencePosition, + line.binningPosition(tgContext, BinningValue::binX), 1e-6); // // bounds() auto pLineBounds = std::make_shared(2., 10.0); diff --git a/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp index 17ffbb2fb30..51f24d09c28 100644 --- a/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp @@ -234,14 +234,21 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceExtent) { auto planeExtent = plane->polyhedronRepresentation(tgContext, 1).extent(); - CHECK_CLOSE_ABS(planeExtent.min(binZ), -rHx, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.max(binZ), rHx, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.min(binX), -rHy, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.max(binX), rHy, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.min(binY), yPs, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.max(binY), yPs, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.min(binR), yPs, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtent.max(binR), std::hypot(yPs, rHy), + CHECK_CLOSE_ABS(planeExtent.min(BinningValue::binZ), -rHx, + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtent.max(BinningValue::binZ), rHx, + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtent.min(BinningValue::binX), -rHy, + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtent.max(BinningValue::binX), rHy, + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtent.min(BinningValue::binY), yPs, + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtent.max(BinningValue::binY), yPs, + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtent.min(BinningValue::binR), yPs, + s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtent.max(BinningValue::binR), std::hypot(yPs, rHy), s_onSurfaceTolerance); // Now rotate @@ -253,17 +260,19 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceExtent) { auto planeExtentRot = planeRot->polyhedronRepresentation(tgContext, 1).extent(); - CHECK_CLOSE_ABS(planeExtentRot.min(binZ), -rHx, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.max(binZ), rHx, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.min(binX), -rHy * std::cos(alpha), - s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.max(binX), rHy * std::cos(alpha), + CHECK_CLOSE_ABS(planeExtentRot.min(BinningValue::binZ), -rHx, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.min(binY), yPs - rHy * std::sin(alpha), + CHECK_CLOSE_ABS(planeExtentRot.max(BinningValue::binZ), rHx, s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.max(binY), yPs + rHy * std::sin(alpha), + CHECK_CLOSE_ABS(planeExtentRot.min(BinningValue::binX), + -rHy * std::cos(alpha), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtentRot.max(BinningValue::binX), rHy * std::cos(alpha), s_onSurfaceTolerance); - CHECK_CLOSE_ABS(planeExtentRot.min(binR), yPs * std::cos(alpha), + CHECK_CLOSE_ABS(planeExtentRot.min(BinningValue::binY), + yPs - rHy * std::sin(alpha), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtentRot.max(BinningValue::binY), + yPs + rHy * std::sin(alpha), s_onSurfaceTolerance); + CHECK_CLOSE_ABS(planeExtentRot.min(BinningValue::binR), yPs * std::cos(alpha), s_onSurfaceTolerance); } diff --git a/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp b/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp index 53a98eeb991..b37649eebc5 100644 --- a/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp @@ -72,14 +72,14 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { auto oneConePh = oneCone->polyhedronRepresentation(tgContext, segments); const auto extent = oneConePh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 0_mm, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0_mm, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), hzPos, epsAbs); + 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); const unsigned int expectedFaces = segments < 4 ? 4 : segments; BOOST_CHECK_EQUAL(oneConePh.faces.size(), expectedFaces); @@ -98,14 +98,14 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { oneConePiece->polyhedronRepresentation(tgContext, segments); const auto extent = oneConePiecePh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), rMin, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), hzpMin, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), hzPos, epsAbs); + 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); } /// The full cone on both sides @@ -115,14 +115,14 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { auto twoConesPh = twoCones->polyhedronRepresentation(tgContext, segments); const auto extent = twoConesPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 0_mm, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), hzNeg, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), hzPos, epsAbs); + 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); const unsigned int expectedFaces = segments < 4 ? 8 : 2 * segments; BOOST_CHECK_EQUAL(twoConesPh.faces.size(), expectedFaces); @@ -141,14 +141,15 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { sectoralCones->polyhedronRepresentation(tgContext, segments); const auto extent = sectoralConesPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), 0, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), rMax, epsAbs); - // CHECK_CLOSE_ABS(extent.range(binY).min(), ???, epsAbs); - // CHECK_CLOSE_ABS(extent.range(binY).max(), ???, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 0_mm, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), rMax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), hzNeg, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), hzPos, epsAbs); + 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(), ???, + // epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), + // ???, 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); } } } @@ -175,14 +176,14 @@ BOOST_AUTO_TEST_CASE(CylinderSurfacePolyhedrons) { fullCylinder->polyhedronRepresentation(tgContext, segments); const auto extent = fullCylinderPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -r, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -r, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), -hZ, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), hZ, epsAbs); + 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); const unsigned int expectedFaces = segments < 4 ? 4 : segments; const unsigned int expectedVertices = segments < 4 ? 8 : 2 * segments; @@ -201,17 +202,17 @@ BOOST_AUTO_TEST_CASE(CylinderSurfacePolyhedrons) { centerSectoredCylinder->polyhedronRepresentation(tgContext, segments); const auto extent = centerSectoredCylinderPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), r * std::cos(phiSector), - epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -r * std::sin(phiSector), - epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), r * std::sin(phiSector), - epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), r, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), -hZ, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), hZ, epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), + r * std::cos(phiSector), epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), r, epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), + -r * std::sin(phiSector), epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binY).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); } } } @@ -237,14 +238,14 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { auto fullDiscPh = fullDisc->polyhedronRepresentation(tgContext, segments); const auto extent = fullDiscPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + 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); const unsigned int expectedFaces = 1; const unsigned int expectedVertices = segments > 4 ? segments + 1 : 4 + 1; @@ -259,14 +260,14 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { auto radialPh = radialDisc->polyhedronRepresentation(tgContext, segments); const auto extent = radialPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), innerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + 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); } /// Sectoral disc - around 0. @@ -276,16 +277,16 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { auto sectorPh = sectorDisc->polyhedronRepresentation(tgContext, segments); const auto extent = sectorPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -outerR * std::sin(phiSector), - epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), outerR * std::sin(phiSector), - epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + 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(), + -outerR * std::sin(phiSector), epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binY).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); } /// Sectoral ring - around 0. @@ -298,17 +299,17 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { sectorRingDisc->polyhedronRepresentation(tgContext, segments); const auto extent = sectorRingDiscPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), innerR * std::cos(phiSector), - epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -outerR * std::sin(phiSector), - epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), outerR * std::sin(phiSector), - epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), innerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), outerR, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), + innerR * std::cos(phiSector), epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), outerR, epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), + -outerR * std::sin(phiSector), epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binY).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); } /// Trapezoid for a disc @@ -324,18 +325,19 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { trapezoidDiscSf->polyhedronRepresentation(tgContext, segments); const auto extent = trapezoidDiscSfPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -std::abs(outerR - innerR) / 2., - epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), std::abs(outerR - innerR) / 2., + CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), + -std::abs(outerR - innerR) / 2., epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), + std::abs(outerR - innerR) / 2., epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), -halfXmax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -halfXmax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), halfXmax, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), + 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(), std::hypot(std::abs(outerR - innerR) / 2., halfXmax), epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); } /// AnnulusBounds for a disc @@ -353,14 +355,18 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { annulusDisc->polyhedronRepresentation(tgContext, segments); const auto extent = annulusDiscPh.extent(); - // CHECK_CLOSE_ABS(extent.range(binX).min(), ???, epsAbs); - // CHECK_CLOSE_ABS(extent.range(binX).max(), ???, epsAbs); - // CHECK_CLOSE_ABS(extent.range(binY).min(), ???, epsAbs); - // CHECK_CLOSE_ABS(extent.range(binY).max(), ???, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), minRadius, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), maxRadius, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + // CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), ???, + // epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), + // ???, epsAbs); + // CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), ???, + // epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), + // ???, epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), minRadius, + epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), maxRadius, + epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); } } } @@ -387,14 +393,15 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { rectangularPlane->polyhedronRepresentation(tgContext, segments); const auto extent = rectangularPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -rhX, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), rhX, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -rhY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), rhY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), std::hypot(rhX, rhY), epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + 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(), + 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); BOOST_CHECK_EQUAL(rectangularPh.vertices.size(), 4); BOOST_CHECK_EQUAL(rectangularPh.faces.size(), 1); @@ -416,15 +423,17 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { trapezoidalPlane->polyhedronRepresentation(tgContext, segments); const auto extent = trapezoidalPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -std::max(thX1, thX2), epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), std::max(thX1, thX2), epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -thY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), thY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), + CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), + -std::max(thX1, thX2), epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binX).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(), std::hypot(std::max(thX1, thX2), thY), epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); BOOST_CHECK_EQUAL(trapezoidalPh.vertices.size(), 4); BOOST_CHECK_EQUAL(trapezoidalPh.faces.size(), 1); @@ -447,14 +456,16 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { ellipsoidPlane->polyhedronRepresentation(tgContext, segments); const auto extent = ellipsoidPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -rMaxX, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), rMaxX, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -rMaxY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), rMaxY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), std::min(rMinX, rMinY), epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), std::max(rMaxX, rMaxY), epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + 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(), + std::min(rMinX, rMinY), epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binR).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); } { @@ -470,14 +481,16 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { ellipsoidRingPlane->polyhedronRepresentation(tgContext, segments); const auto extent = ellipsoidRingPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -rMaxX, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), rMaxX, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -rMaxY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), rMaxY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), std::min(rMinX, rMinY), epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), std::max(rMaxX, rMaxY), epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + 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(), + std::min(rMinX, rMinY), epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binR).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); } /// ConvexPolygonBounds test @@ -493,14 +506,15 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { hexagonPlane->polyhedronRepresentation(tgContext, segments); const auto extent = hexagonPlanePh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -40, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), 30, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -30, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), 50, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 0, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), std::sqrt(2900), epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + 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), + epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); } /// Diamond shaped plane @@ -518,15 +532,15 @@ BOOST_AUTO_TEST_CASE(PlaneSurfacePolyhedrons) { diamondPlane->polyhedronRepresentation(tgContext, segments); const auto extent = diamondPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -hMedX, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), hMedX, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -hMinY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), hMaxY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), std::hypot(hMaxX, hMaxY), - epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + 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(), + 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); BOOST_CHECK_EQUAL(diamondPh.vertices.size(), 6); BOOST_CHECK_EQUAL(diamondPh.faces.size(), 1); @@ -561,15 +575,17 @@ BOOST_AUTO_TEST_CASE(ShiftedSurfacePolyhedrons) { rectangularPlane->polyhedronRepresentation(tgContext, segments); const auto extent = rectangularPh.extent(); - CHECK_CLOSE_ABS(extent.range(binX).min(), -rhX, epsAbs); - CHECK_CLOSE_ABS(extent.range(binX).max(), rhX, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).min(), -rhY + shiftY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binY).max(), rhY + shiftY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).min(), 25, epsAbs); - CHECK_CLOSE_ABS(extent.range(binR).max(), std::hypot(rhX, rhY + shiftY), + 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, + epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), rhY + shiftY, epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).min(), 0., epsAbs); - CHECK_CLOSE_ABS(extent.range(binZ).max(), 0., epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 25, epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binR).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); 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 0f1ccee9d65..0425c91897d 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceArrayTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceArrayTests.cpp @@ -210,7 +210,7 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArray_create, SurfaceArrayFixture) { sa.toStream(tgContext, std::cout); for (const auto& srf : brl) { - Vector3 ctr = srf->binningPosition(tgContext, binR); + Vector3 ctr = srf->binningPosition(tgContext, BinningValue::binR); std::vector binContent = sa.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 1u); @@ -230,7 +230,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, binR); + Vector3 ctr = srf->binningPosition(tgContext, BinningValue::binR); std::vector binContent = sa2.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 1u); diff --git a/Tests/UnitTests/Core/Utilities/BinAdjustmentTests.cpp b/Tests/UnitTests/Core/Utilities/BinAdjustmentTests.cpp index 7772073d75d..ff21fc6659d 100644 --- a/Tests/UnitTests/Core/Utilities/BinAdjustmentTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinAdjustmentTests.cpp @@ -27,8 +27,8 @@ namespace Acts::Test { BOOST_AUTO_TEST_CASE(BinAdjustment_Radial) { RadialBounds bound(50, 75, M_PI, 0); BinUtility bu; - bu += BinUtility(1, 0, 1, Acts::open, Acts::binR); - bu += BinUtility(1, 0, 1, Acts::closed, Acts::binPhi); + bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binR); + bu += BinUtility(1, 0, 1, Acts::closed, Acts::BinningValue::binPhi); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); @@ -42,8 +42,8 @@ BOOST_AUTO_TEST_CASE(BinAdjustment_Radial) { BOOST_AUTO_TEST_CASE(BinAdjustment_Cylinder) { CylinderBounds bound(25, 50, M_PI / 4, 0); BinUtility bu; - bu += BinUtility(1, 0, 1, Acts::open, Acts::binPhi); - bu += BinUtility(1, 0, 1, Acts::open, Acts::binZ); + bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binPhi); + bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binZ); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); @@ -57,8 +57,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::binX); - bu += BinUtility(1, 0, 1, Acts::open, Acts::binY); + bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binX); + bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binY); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); @@ -72,8 +72,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::binX); - bu += BinUtility(1, 0, 1, Acts::open, Acts::binY); + bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binX); + bu += BinUtility(1, 0, 1, Acts::open, Acts::BinningValue::binY); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); diff --git a/Tests/UnitTests/Core/Utilities/BinAdjustmentVolumeTests.cpp b/Tests/UnitTests/Core/Utilities/BinAdjustmentVolumeTests.cpp index 7422dfd5dd3..eab989e5e0a 100644 --- a/Tests/UnitTests/Core/Utilities/BinAdjustmentVolumeTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinAdjustmentVolumeTests.cpp @@ -26,9 +26,9 @@ namespace Acts::Test { BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_Cylinder) { CylinderVolumeBounds bound(10, 50, 150, M_PI / 2, 0); BinUtility bu; - bu += BinUtility(1, 0, 1, Acts::open, Acts::binR); - bu += BinUtility(1, 0, 1, Acts::open, Acts::binPhi); - bu += BinUtility(1, 0, 1, Acts::open, Acts::binZ); + 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); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); @@ -44,9 +44,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::binR); - bu += BinUtility(1, 0, 1, Acts::closed, Acts::binPhi); - bu += BinUtility(1, 0, 1, Acts::open, Acts::binZ); + 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); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); @@ -62,9 +62,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::binX); - bu += BinUtility(1, 0, 1, Acts::open, Acts::binY); - bu += BinUtility(1, 0, 1, Acts::open, Acts::binZ); + 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); BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity()); diff --git a/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp b/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp index d08eaeff295..83b2cfc796b 100644 --- a/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp @@ -26,12 +26,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, binX); - BinUtility yUtil_eq(10, 0., 10., open, binY); - BinUtility zUtil_eq(10, 0., 10., open, binZ); + 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); BOOST_CHECK_EQUAL(xUtil_eq.bins(), std::size_t{10}); // make it 2-dim - BinUtility xyUtil_eq(10, 0., 10., open, binX); + BinUtility xyUtil_eq(10, 0., 10., open, BinningValue::binX); xyUtil_eq += yUtil_eq; BOOST_CHECK_EQUAL(xyUtil_eq.bins(), 100u); // make it 3-dim @@ -44,7 +44,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, binX); + BinUtility xUtil_eq_copy(10, 0., 10., open, BinningValue::binX); BOOST_CHECK_EQUAL(xUtil_eq_copy, xUtil_eq); BOOST_CHECK_NE(yUtil_eq, xUtil_eq); @@ -69,7 +69,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::binX); + BinUtility xUtil(bvalues, Acts::open, Acts::BinningValue::binX); // Underflow BOOST_CHECK_EQUAL(xUtil.bin(Vector3(-6., 0., 0.)), 0u); @@ -93,9 +93,9 @@ BOOST_AUTO_TEST_CASE(BinUtility_transform) { Transform3 transform_GtoL = transform_LtoG.inverse(); - BinUtility rUtil(10, 0., 100., open, binR); - BinUtility phiUtil(10, -M_PI, M_PI, closed, binPhi); - BinUtility zUtil(10, -100., 100., open, binZ); + BinUtility rUtil(10, 0., 100., open, BinningValue::binR); + BinUtility phiUtil(10, -M_PI, M_PI, closed, BinningValue::binPhi); + BinUtility zUtil(10, -100., 100., open, BinningValue::binZ); BinUtility noTranform; noTranform += rUtil; diff --git a/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp b/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp index 18371852613..a7effbe4200 100644 --- a/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp @@ -36,36 +36,36 @@ Vector2 rphiPosition(3.5, M_PI / 8.); // x/y/zData // bin boundaries // | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -BinningData xData_eq(open, binX, 10, 0., 10.); -BinningData yData_eq(open, binY, 10, 0., 10.); -BinningData zData_eq(open, binZ, 10, 0., 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.); // r/phi/rphiData // bin boundaries // | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -BinningData rData_eq(open, binR, 10, 0., 10.); +BinningData rData_eq(open, BinningValue::binR, 10, 0., 10.); // bin boundaries // > -M_PI | -3/5 M_PI | -1/5 M_PI | 1/5 M_PI | 3/5 M_PI | M_PI < -BinningData phiData_eq(closed, binPhi, 5, -M_PI, M_PI); -// BinningData rPhiData_eq(closed, binRPhi, 5, -M_PI, M_PI); +BinningData phiData_eq(closed, BinningValue::binPhi, 5, -M_PI, M_PI); +// BinningData rPhiData_eq(closed, BinningValue::binRPhi, 5, -M_PI, M_PI); // h/etaData // bin boundaries // | 0 | 2 | 4 | 6 | 8 | 10 | -// BinningData hData_eq(open, binH, 5, 0., 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, binEta, 5, -2.5, 2.5); +BinningData etaData_eq(open, BinningValue::binEta, 5, -2.5, 2.5); // Fest equality operator -BinningData xData_eq_copy(open, binX, 10, 0., 10.); +BinningData xData_eq_copy(open, BinningValue::binX, 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, binX, values); -BinningData yData_arb(open, binY, values); +BinningData xData_arb(open, BinningValue::binX, values); +BinningData yData_arb(open, BinningValue::binY, values); // | -M_PI | -2 | -1 | 1 | 2 | M_PI | std::vector phiValues = {-M_PI, -2., -1., 1., 2., M_PI}; -BinningData phiData_arb(closed, binPhi, phiValues); +BinningData phiData_arb(closed, BinningValue::binPhi, phiValues); // the binnings - arbitrary when switching to binary search - for boundary // sizes >= 50 @@ -78,16 +78,22 @@ double phiDelta = 0.1064; // the binning - substructure std::vector sstr = {0., 1., 1.5, 2., 3.}; // multiplicative -auto xData_sstr_mult = std::make_unique(open, binX, sstr); +auto xData_sstr_mult = + std::make_unique(open, BinningValue::binX, sstr); // | 0 | 1 | 1.5 | 2 | 3 | 4 | 4.5 | 5 | 6 | 7 | 7.5 | 8 | 9 | -BinningData xData_mult(open, binX, 3, 0., 9., std::move(xData_sstr_mult)); +BinningData xData_mult(open, BinningValue::binX, 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, binX, sstr); -BinningData xData_add(open, binX, main_sstr, std::move(xData_sstr_add)); - -// enum BinningValue { binX, binY, binZ, binR, binPhi, binRPhi, binH, binEta } +auto xData_sstr_add = + std::make_unique(open, BinningValue::binX, sstr); +BinningData xData_add(open, BinningValue::binX, 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 } // // test the different binning values BOOST_AUTO_TEST_CASE(BinningData_BinningValue) { @@ -100,8 +106,9 @@ 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, binX, values_binary); - BinningData phiData_arb_binary(closed, binPhi, phiValues_binary); + BinningData xData_arb_binary(open, BinningValue::binX, values_binary); + BinningData phiData_arb_binary(closed, BinningValue::binPhi, + phiValues_binary); /// x/y/zData /// check the global position requests // | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | @@ -161,8 +168,9 @@ 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, binX, values_binary); - BinningData phiData_arb_binary(closed, binPhi, phiValues_binary); + BinningData xData_arb_binary(open, BinningValue::binX, values_binary); + BinningData phiData_arb_binary(closed, BinningValue::binPhi, + phiValues_binary); /// x/y/zData /// check the global position requests // | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | @@ -228,8 +236,9 @@ 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, binX, values_binary); - BinningData phiData_arb_binary(closed, binPhi, phiValues_binary); + BinningData xData_arb_binary(open, BinningValue::binX, values_binary); + BinningData phiData_arb_binary(closed, BinningValue::binPhi, + phiValues_binary); // check the global inside BOOST_CHECK_EQUAL(xData_eq.inside(xyzPosition), true); BOOST_CHECK_EQUAL(yData_eq.inside(xyzPosition), true); @@ -271,8 +280,9 @@ 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, binX, values_binary); - BinningData phiData_arb_binary(closed, binPhi, phiValues_binary); + BinningData xData_arb_binary(open, BinningValue::binX, values_binary); + BinningData phiData_arb_binary(closed, BinningValue::binPhi, + phiValues_binary); // open values BOOST_CHECK_EQUAL(xData_eq.searchGlobal(xyzPositionOutside), std::size_t{9}); BOOST_CHECK_EQUAL(yData_eq.searchGlobal(xyzPositionOutside), std::size_t{0}); @@ -323,8 +333,9 @@ 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, binX, values_binary); - BinningData phiData_arb_binary(closed, binPhi, phiValues_binary); + BinningData xData_arb_binary(open, BinningValue::binX, values_binary); + BinningData phiData_arb_binary(closed, BinningValue::binPhi, + phiValues_binary); /// check the global position requests // | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | BOOST_CHECK_EQUAL(xData_eq.center(3), 3.5); @@ -369,7 +380,8 @@ BOOST_AUTO_TEST_CASE(BinningData_phi_modules) { // n phi modules with phi boundary at -M_Pi/+M_PI are checked above // one module expands over -M_Pi/+M_PI float deltaPhi = 0.1; - BinningData phiData_mod(closed, binPhi, 5, -M_PI + deltaPhi, M_PI + deltaPhi); + BinningData phiData_mod(closed, BinningValue::binPhi, 5, -M_PI + deltaPhi, + M_PI + deltaPhi); float phiStep = M_PI * 2. / 5.; std::vector phiBoundaries_mod = { static_cast(-M_PI + deltaPhi), diff --git a/Tests/UnitTests/Core/Utilities/GridAccessHelpersTests.cpp b/Tests/UnitTests/Core/Utilities/GridAccessHelpersTests.cpp index 33d9cb2bc21..a69298fe222 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::binX}; - std::vector sCast = {Acts::binY}; - std::vector tCast = {Acts::binZ}; + std::vector fCast = {Acts::BinningValue::binX}; + std::vector sCast = {Acts::BinningValue::binY}; + std::vector tCast = {Acts::BinningValue::binZ}; auto fgAccess = GridAccessHelpers::castPosition(gPosition, fCast); auto sgAccess = GridAccessHelpers::castPosition(gPosition, sCast); @@ -56,9 +56,11 @@ BOOST_AUTO_TEST_CASE(Grid1DAccess) { BOOST_CHECK_EQUAL(grid.atPosition(tgAccess), 6u); // Can this go into a delegate? - auto gsu = std::make_unique>(); + auto gsu = std::make_unique< + const Acts::GridAccess::GlobalSubspace>(); Acts::GridAccess::GlobalToGridLocal1DimDelegate gsuDelegate; - gsuDelegate.connect<&Acts::GridAccess::GlobalSubspace::toGridLocal>( + gsuDelegate.connect< + &Acts::GridAccess::GlobalSubspace::toGridLocal>( std::move(gsu)); BOOST_CHECK(gsuDelegate.connected()); @@ -86,23 +88,26 @@ BOOST_AUTO_TEST_CASE(Grid2DAccess) { // Global access Vector3 gPosition{0.5, 3.5, 6.5}; - std::vector fCast = {Acts::binX, Acts::binY}; + std::vector fCast = {Acts::BinningValue::binX, + Acts::BinningValue::binY}; auto fgAccess = GridAccessHelpers::castPosition(gPosition, fCast); BOOST_CHECK_EQUAL(grid.atPosition(fgAccess), 300u); } BOOST_AUTO_TEST_CASE(GlobalToGridLocalTests) { - Acts::GridAccess::GlobalSubspace gssXY; + 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::Affine3Transformed< + Acts::GridAccess::GlobalSubspace> gssZT(gssZ, Acts::Transform3{Acts::Transform3::Identity()}.pretranslate( Vector3{0., 0., 100.})); diff --git a/Tests/UnitTests/Examples/Io/Json/JsonDigitizationConfigTests.cpp b/Tests/UnitTests/Examples/Io/Json/JsonDigitizationConfigTests.cpp index 85cd2e5c1c2..a5b29cb257b 100644 --- a/Tests/UnitTests/Examples/Io/Json/JsonDigitizationConfigTests.cpp +++ b/Tests/UnitTests/Examples/Io/Json/JsonDigitizationConfigTests.cpp @@ -156,8 +156,10 @@ BOOST_AUTO_TEST_CASE(DigitizationConfigRoundTrip) { ActsExamples::GeometricConfig gdc; Acts::BinUtility segmentation; - segmentation += Acts::BinUtility(336, -8.4, 8.4, Acts::open, Acts::binX); - segmentation += Acts::BinUtility(1280, -36, 36, Acts::open, Acts::binY); + segmentation += + Acts::BinUtility(336, -8.4, 8.4, Acts::open, Acts::BinningValue::binX); + segmentation += + Acts::BinUtility(1280, -36, 36, Acts::open, Acts::BinningValue::binY); gdc.segmentation = segmentation; gdc.threshold = 0.01; diff --git a/Tests/UnitTests/Fatras/Digitization/PlanarSurfaceTestBeds.hpp b/Tests/UnitTests/Fatras/Digitization/PlanarSurfaceTestBeds.hpp index 07a3b2a2cbd..14fd079c56a 100644 --- a/Tests/UnitTests/Fatras/Digitization/PlanarSurfaceTestBeds.hpp +++ b/Tests/UnitTests/Fatras/Digitization/PlanarSurfaceTestBeds.hpp @@ -52,8 +52,10 @@ struct PlanarSurfaceTestBeds { auto rectangle = std::make_shared(xhalf, yhalf); auto rSurface = Acts::Surface::makeShared( Acts::Transform3::Identity(), rectangle); - Acts::BinUtility pixelated(15, -xhalf, xhalf, Acts::open, Acts::binX); - pixelated += Acts::BinUtility(26, -yhalf, yhalf, Acts::open, Acts::binY); + Acts::BinUtility pixelated(15, -xhalf, xhalf, Acts::open, + Acts::BinningValue::binX); + pixelated += Acts::BinUtility(26, -yhalf, yhalf, Acts::open, + Acts::BinningValue::binY); RectangleRandom rRandom(xhalf * rScale, yhalf * rScale); // Cartesian strip test in Trapezoid @@ -64,8 +66,10 @@ struct PlanarSurfaceTestBeds { std::make_shared(xhalfminy, xhalfmaxy, yhalf); auto tSurface = Acts::Surface::makeShared( Acts::Transform3::Identity(), trapezoid); - Acts::BinUtility stripsX(35, -xhalfmaxy, xhalfmaxy, Acts::open, Acts::binX); - stripsX += Acts::BinUtility(1, -yhalf, yhalf, Acts::open, Acts::binY); + Acts::BinUtility stripsX(35, -xhalfmaxy, xhalfmaxy, Acts::open, + Acts::BinningValue::binX); + stripsX += Acts::BinUtility(1, -yhalf, yhalf, Acts::open, + Acts::BinningValue::binY); TrapezoidRandom tRandom(xhalfminy * rScale, xhalfmaxy * rScale, yhalf * rScale); @@ -81,9 +85,10 @@ struct PlanarSurfaceTestBeds { std::make_shared(xmin, xmax, rmin, rmax); auto dtSurface = Acts::Surface::makeShared( Acts::Transform3::Identity(), discTrapezoid); - Acts::BinUtility stripsPhi(1, rmin, rmax, Acts::open, Acts::binR); + Acts::BinUtility stripsPhi(1, rmin, rmax, Acts::open, + Acts::BinningValue::binR); stripsPhi += Acts::BinUtility(25, M_PI_2 - alpha, M_PI_2 + alpha, - Acts::open, Acts::binPhi); + Acts::open, Acts::BinningValue::binPhi); TrapezoidRandom dtRandom(xmin * rScale, xmax * rScale, rmin * irScale, ymax * rScale); @@ -92,9 +97,10 @@ struct PlanarSurfaceTestBeds { std::make_shared(rmin, rmax, M_PI_4, M_PI_2); auto dSurface = Acts::Surface::makeShared( Acts::Transform3::Identity(), discRadial); - Acts::BinUtility rphiseg(10, rmin, rmax, Acts::open, Acts::binR); + Acts::BinUtility rphiseg(10, rmin, rmax, Acts::open, + Acts::BinningValue::binR); rphiseg += Acts::BinUtility(20, (M_PI_2 - M_PI_4), (M_PI_2 + M_PI_4), - Acts::open, Acts::binPhi); + Acts::open, Acts::BinningValue::binPhi); DiscRandom dRandom(rmin * irScale, rmax * rScale, (M_PI_2 - M_PI_4) * irScale, (M_PI_2 + M_PI_4) * rScale); @@ -119,9 +125,10 @@ struct PlanarSurfaceTestBeds { rmax = std::max(rmax, r); }); - Acts::BinUtility stripsPhiA(1, rmin, rmax, Acts::open, Acts::binR); - stripsPhiA += - Acts::BinUtility(12, phimin, phimax, Acts::open, Acts::binPhi); + Acts::BinUtility stripsPhiA(1, rmin, rmax, Acts::open, + Acts::BinningValue::binR); + stripsPhiA += Acts::BinUtility(12, phimin, phimax, Acts::open, + Acts::BinningValue::binPhi); 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 8bca761f28e..4680d39f974 100644 --- a/Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp +++ b/Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp @@ -47,8 +47,9 @@ BOOST_AUTO_TEST_CASE(SegmentizerCartesian) { Acts::Transform3::Identity(), rectangleBounds); // The segmentation - Acts::BinUtility pixelated(20, -1., 1., Acts::open, Acts::binX); - pixelated += Acts::BinUtility(20, -1., 1., Acts::open, Acts::binY); + Acts::BinUtility pixelated(20, -1., 1., Acts::open, Acts::BinningValue::binX); + pixelated += + Acts::BinUtility(20, -1., 1., Acts::open, Acts::BinningValue::binY); Segmentizer cl; @@ -91,8 +92,9 @@ BOOST_AUTO_TEST_CASE(SegmentizerPolarRadial) { Acts::Transform3::Identity(), radialBounds); // The segmentation - Acts::BinUtility strips(2, 5., 10., Acts::open, Acts::binR); - strips += Acts::BinUtility(250, -0.25, 0.25, Acts::open, Acts::binPhi); + Acts::BinUtility strips(2, 5., 10., Acts::open, Acts::BinningValue::binR); + strips += Acts::BinUtility(250, -0.25, 0.25, Acts::open, + Acts::BinningValue::binPhi); Segmentizer cl; @@ -167,8 +169,8 @@ BOOST_DATA_TEST_CASE( } // 1 - write the grid grid.open("Segmentizer" + name + "Grid.csv"); - if (segmentation.binningData()[0].binvalue == Acts::binX && - segmentation.binningData()[1].binvalue == Acts::binY) { + if (segmentation.binningData()[0].binvalue == Acts::BinningValue::binX && + segmentation.binningData()[1].binvalue == Acts::BinningValue::binY) { double bxmin = segmentation.binningData()[0].min; double bxmax = segmentation.binningData()[0].max; double bymin = segmentation.binningData()[1].min; @@ -181,8 +183,10 @@ BOOST_DATA_TEST_CASE( for (const auto yval : yboundaries) { csvHelper.writeLine(grid, {bxmin, yval}, {bxmax, yval}); } - } else if (segmentation.binningData()[0].binvalue == Acts::binR && - segmentation.binningData()[1].binvalue == Acts::binPhi) { + } else if (segmentation.binningData()[0].binvalue == + Acts::BinningValue::binR && + segmentation.binningData()[1].binvalue == + Acts::BinningValue::binPhi) { 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/DetectorSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/DetectorSvgConverterTests.cpp index 349f6a77112..cb28a9766ff 100644 --- a/Tests/UnitTests/Plugins/ActSVG/DetectorSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/DetectorSvgConverterTests.cpp @@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(CylindricalDetector) { // Create the barrel container builder CylindricalContainerBuilder::Config barrelRCfg; barrelRCfg.builders = {barrel0, barrel1, barrel2}; - barrelRCfg.binning = {binR}; + barrelRCfg.binning = {BinningValue::binR}; auto barrel = std::make_shared( barrelRCfg, getDefaultLogger("BarrelBuilderR", Logging::VERBOSE)); @@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(CylindricalDetector) { // Create the barrel container builder CylindricalContainerBuilder::Config barrelEndcapCfg; barrelEndcapCfg.builders = {endcapN, barrel, endcapP}; - barrelEndcapCfg.binning = {binZ}; + barrelEndcapCfg.binning = {BinningValue::binZ}; auto barrelEndcap = std::make_shared( barrelEndcapCfg, @@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE(CylindricalDetector) { // Create the barrel container builder CylindricalContainerBuilder::Config detectorCfg; detectorCfg.builders = {beampipe, barrelEndcap}; - detectorCfg.binning = {binR}; + detectorCfg.binning = {BinningValue::binR}; auto containerBuilder = std::make_shared( detectorCfg, getDefaultLogger("DetectorBuilder", Logging::VERBOSE)); diff --git a/Tests/UnitTests/Plugins/ActSVG/DetectorVolumeSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/DetectorVolumeSvgConverterTests.cpp index ac2cc63e392..7d6241e8f4e 100644 --- a/Tests/UnitTests/Plugins/ActSVG/DetectorVolumeSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/DetectorVolumeSvgConverterTests.cpp @@ -149,7 +149,8 @@ BOOST_AUTO_TEST_CASE(EndcapVolumeWithSurfaces) { lsConfig.auxiliary = "*** Endcap with 22 surfaces ***"; lsConfig.surfacesProvider = endcapSurfaces; lsConfig.binnings = {Acts::Experimental::ProtoBinning( - Acts::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, 22u, 1u)}; + Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, + 22u, 1u)}; auto layerBuilder = std::make_shared( @@ -218,10 +219,12 @@ BOOST_AUTO_TEST_CASE(BarrelVolumeWithSurfaces) { lsConfig.auxiliary = "*** Barrel with 448 surfaces ***"; lsConfig.surfacesProvider = barrelSurfaces; lsConfig.binnings = { - Acts::Experimental::ProtoBinning{ - Acts::binZ, Acts::AxisBoundaryType::Bound, -480., 480., 14u, 1u}, - Acts::Experimental::ProtoBinning( - Acts::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, 32u, 1u)}; + Acts::Experimental::ProtoBinning{Acts::BinningValue::binZ, + Acts::AxisBoundaryType::Bound, -480., + 480., 14u, 1u}, + Acts::Experimental::ProtoBinning(Acts::BinningValue::binPhi, + Acts::AxisBoundaryType::Closed, -M_PI, + M_PI, 32u, 1u)}; auto barrelBuilder = std::make_shared( diff --git a/Tests/UnitTests/Plugins/ActSVG/GridSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/GridSvgConverterTests.cpp index a543f8ee930..01ee38ab44b 100644 --- a/Tests/UnitTests/Plugins/ActSVG/GridSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/GridSvgConverterTests.cpp @@ -56,7 +56,8 @@ BOOST_AUTO_TEST_CASE(BoundGridXY) { Grid gridXY(Type>, axisX, axisY); Svg::GridConverter::Options cOptions; - auto pGrid = Svg::GridConverter::convert(gridXY, {binX, binY}, cOptions); + auto pGrid = Svg::GridConverter::convert( + gridXY, {BinningValue::binX, BinningValue::binY}, cOptions); BOOST_CHECK_EQUAL(pGrid._type, actsvg::proto::grid::type::e_x_y); // Labelling the grid tiles @@ -108,8 +109,8 @@ BOOST_AUTO_TEST_CASE(BoundGridXY) { std::vector captionText = { "Binning schema for global and local bins: ", - "- axis 0 : AxisBoundaryType::Bound, (-200., 200, 4), binX", - "- axis 1 : AxisBoundaryType::Bound, (-200, 200, 6), binY"}; + "- axis 0 : AxisBoundaryType::Bound, (-200., 200, 4), BinningValue::binX", + "- axis 1 : AxisBoundaryType::Bound, (-200, 200, 6), BinningValue::binY"}; auto caption = actsvg::draw::text("caption", {-180, -220}, captionText); @@ -132,7 +133,8 @@ BOOST_AUTO_TEST_CASE(OpenGridXY) { Grid gridXY(Type>, axisX, axisY); Svg::GridConverter::Options cOptions; - auto pGrid = Svg::GridConverter::convert(gridXY, {binX, binY}, cOptions); + auto pGrid = Svg::GridConverter::convert( + gridXY, {BinningValue::binX, BinningValue::binY}, cOptions); BOOST_CHECK_EQUAL(pGrid._type, actsvg::proto::grid::type::e_x_y); // Labelling the grid tiles @@ -183,8 +185,8 @@ BOOST_AUTO_TEST_CASE(OpenGridXY) { std::vector captionText = { "Binning schema for global and local bins: ", - "- axis 0 : AxisBoundaryType::Open, (-200., 200, 4), binX", - "- axis 1 : AxisBoundaryType::Open, (-200, 200, 6), binY"}; + "- axis 0 : AxisBoundaryType::Open, (-200., 200, 4), BinningValue::binX", + "- axis 1 : AxisBoundaryType::Open, (-200, 200, 6), BinningValue::binY"}; auto caption = actsvg::draw::text("caption", {-180, -220}, captionText); auto oGrid = actsvg::display::grid("OpenGridXY", pGrid); @@ -208,7 +210,8 @@ BOOST_AUTO_TEST_CASE(ClosedCylinderGridZPhi) { Grid gridZPhi(Type>, axisZ, axisPhi); Svg::GridConverter::Options cOptions; - auto pGrid = Svg::GridConverter::convert(gridZPhi, {binZ, binPhi}, cOptions); + auto pGrid = Svg::GridConverter::convert( + gridZPhi, {BinningValue::binZ, BinningValue::binPhi}, cOptions); BOOST_CHECK_EQUAL(pGrid._type, actsvg::proto::grid::type::e_z_phi); pGrid._reference_r = 80.; @@ -260,8 +263,8 @@ BOOST_AUTO_TEST_CASE(ClosedCylinderGridZPhi) { std::vector captionText = { "Binning schema for global and local bins: ", - "- axis 0 : AxisBoundaryType::Bound, (-200., 200, 3), binZ", - "- axis 1 : AxisBoundaryType::Closed, (-PI, PI, 6), binPhi", + "- axis 0 : AxisBoundaryType::Bound, (-200., 200, 3), BinningValue::binZ", + "- axis 1 : AxisBoundaryType::Closed, (-PI, PI, 6), BinningValue::binPhi", "- draw reference radius set to 80"}; auto caption = actsvg::draw::text("caption", {-180, -270}, captionText); @@ -286,7 +289,8 @@ BOOST_AUTO_TEST_CASE(ClosedDiscGridRPhi) { Grid gridRPhi(Type>, axisR, axisPhi); Svg::GridConverter::Options cOptions; - auto pGrid = Svg::GridConverter::convert(gridRPhi, {binR, binPhi}, cOptions); + auto pGrid = Svg::GridConverter::convert( + gridRPhi, {BinningValue::binR, BinningValue::binPhi}, cOptions); BOOST_CHECK_EQUAL(pGrid._type, actsvg::proto::grid::type::e_r_phi); // Labelling the grid tiles @@ -343,7 +347,8 @@ BOOST_AUTO_TEST_CASE(ClosedDiscGridRPhi) { std::vector captionText = { "Binning schema for global and local bins: ", "- axis 0 : AxisBoundaryType::Bound, (100., 400, 3), binR", - "- axis 1 : AxisBoundaryType::Closed, (-PI, PI, 4), binPhi"}; + "- axis 1 : AxisBoundaryType::Closed, (-PI, PI, 4), " + "binPhi"}; auto caption = actsvg::draw::text("caption", {-180, -420}, captionText); auto oGrid = actsvg::display::grid("ClosedDiscGridRPhi", pGrid); diff --git a/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp index d51417b3d5a..1f4bcebd77f 100644 --- a/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(RingDisc1D) { 55., 0., 2., 22u); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {binPhi}}; + irSurfaces{rSurfaces, {}, {BinningValue::binPhi}}; GridAxisGenerators::EqClosed aGenerator{{-M_PI, M_PI}, 44u}; PolyhedronReferenceGenerator<1u, true> rGenerator; @@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE(RingDisc1DWithSupport) { rSurfaces.push_back(dSurface.get()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {rSurfaces.size() - 1u}, {binPhi}}; + irSurfaces{rSurfaces, {rSurfaces.size() - 1u}, {BinningValue::binPhi}}; GridAxisGenerators::EqClosed aGenerator{{-M_PI, M_PI}, 44u}; PolyhedronReferenceGenerator<1u, true> rGenerator; @@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE(RingDisc2D) { rSurfaces.insert(rSurfaces.end(), rSurfacesR1.begin(), rSurfacesR1.end()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {binR, binPhi}}; + irSurfaces{rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}}; GridAxisGenerators::VarBoundEqClosed aGenerator{ {24., 74., 110.}, {-M_PI, M_PI}, 44u}; @@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE(RingDisc2DFine) { rSurfaces.insert(rSurfaces.end(), rSurfacesR2.begin(), rSurfacesR2.end()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {binR, binPhi}}; + irSurfaces{rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {24., 152}, 8u, {-M_PI, M_PI}, 88u}; @@ -190,7 +190,8 @@ BOOST_AUTO_TEST_CASE(RingDisc2DFineExpanded) { rSurfaces.insert(rSurfaces.end(), rSurfacesR2.begin(), rSurfacesR2.end()); IndexedSurfacesGenerator - irSurfaces{rSurfaces, {}, {binR, binPhi}, {2u, 4u}}; + irSurfaces{ + rSurfaces, {}, {BinningValue::binR, BinningValue::binPhi}, {2u, 4u}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {24., 152}, 8u, {-M_PI, M_PI}, 88u}; @@ -211,7 +212,8 @@ BOOST_AUTO_TEST_CASE(Cylinder2D) { 116., 3., 2., {52, 14}); IndexedSurfacesGenerator - icSurfaces{surfaces, {}, {binZ, binPhi}, {1u, 1u}}; + icSurfaces{ + surfaces, {}, {BinningValue::binZ, BinningValue::binPhi}, {1u, 1u}}; GridAxisGenerators::EqBoundEqClosed aGenerator{ {-500., 500}, 28, {-M_PI, M_PI}, 52u}; diff --git a/Tests/UnitTests/Plugins/DD4hep/DD4hepCylinderLayerStructureTests.cpp b/Tests/UnitTests/Plugins/DD4hep/DD4hepCylinderLayerStructureTests.cpp index f4cd1f6a573..cf1550a5886 100644 --- a/Tests/UnitTests/Plugins/DD4hep/DD4hepCylinderLayerStructureTests.cpp +++ b/Tests/UnitTests/Plugins/DD4hep/DD4hepCylinderLayerStructureTests.cpp @@ -36,7 +36,7 @@ const char* beampipe_head_xml = - + )""""; const char* cylinder_layer_head_xml = @@ -295,15 +295,16 @@ BOOST_AUTO_TEST_CASE(DD4hepPluginCylinderLayerStructureAutoRange) { lsOptions.name = "AutoRangeLayer"; auto extent = Acts::Extent(); lsOptions.extent = extent; - lsOptions.extentConstraints = {Acts::binZ, Acts::binR}; + lsOptions.extentConstraints = {Acts::BinningValue::binZ, + Acts::BinningValue::binR}; 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::binZ)); - BOOST_CHECK(barrelExt.value().constrains(Acts::binR)); + BOOST_CHECK(barrelExt.value().constrains(Acts::BinningValue::binZ)); + BOOST_CHECK(barrelExt.value().constrains(Acts::BinningValue::binR)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Plugins/Geant4/Geant4SurfaceProviderTests.cpp b/Tests/UnitTests/Plugins/Geant4/Geant4SurfaceProviderTests.cpp index d5de645fc17..0349d32ff8b 100644 --- a/Tests/UnitTests/Plugins/Geant4/Geant4SurfaceProviderTests.cpp +++ b/Tests/UnitTests/Plugins/Geant4/Geant4SurfaceProviderTests.cpp @@ -270,8 +270,9 @@ BOOST_AUTO_TEST_CASE(Geant4SurfaceProviderRanges) { std::map> ranges; std::array g4Axes{0}; - for (auto& bv : {Acts::binX, Acts::binY, Acts::binZ}) { - g4Axes[bv] = Acts::binToGeant4Axis(bv); + for (auto& bv : {Acts::BinningValue::binX, Acts::BinningValue::binY, + Acts::BinningValue::binZ}) { + g4Axes[toUnderlying(bv)] = Acts::binToGeant4Axis(bv); } ranges[g4Axes[0]] = std::make_tuple(armOffset - 5, armOffset + 100); diff --git a/Tests/UnitTests/Plugins/Json/DetectorJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/DetectorJsonConverterTests.cpp index cea7400562b..224549bb340 100644 --- a/Tests/UnitTests/Plugins/Json/DetectorJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/DetectorJsonConverterTests.cpp @@ -169,7 +169,8 @@ BOOST_AUTO_TEST_CASE(BeamPipeEndcapBarrelDetector) { lsConfig.auxiliary = "*** Endcap with 22 surfaces ***"; lsConfig.surfacesProvider = endcapSurfaces; lsConfig.binnings = {Acts::Experimental::ProtoBinning( - Acts::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, 22u, 1u)}; + Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, + 22u, 1u)}; auto layerBuilder = std::make_shared( @@ -230,10 +231,12 @@ BOOST_AUTO_TEST_CASE(BeamPipeEndcapBarrelDetector) { lsConfig.auxiliary = "*** Barrel with 448 surfaces ***"; lsConfig.surfacesProvider = barrelSurfaces; lsConfig.binnings = { - Acts::Experimental::ProtoBinning{ - Acts::binZ, Acts::AxisBoundaryType::Bound, -480., 480., 14u, 1u}, - Acts::Experimental::ProtoBinning( - Acts::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, 32u, 1u)}; + Acts::Experimental::ProtoBinning{Acts::BinningValue::binZ, + Acts::AxisBoundaryType::Bound, -480., + 480., 14u, 1u}, + Acts::Experimental::ProtoBinning(Acts::BinningValue::binPhi, + Acts::AxisBoundaryType::Closed, -M_PI, + M_PI, 32u, 1u)}; auto barrelBuilder = std::make_shared( @@ -277,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::binR}; + ccBarrelBuilderCfg.binning = {Acts::BinningValue::binR}; auto ccBarrelBuilder = std::make_shared( @@ -288,7 +291,7 @@ BOOST_AUTO_TEST_CASE(BeamPipeEndcapBarrelDetector) { Acts::Experimental::CylindricalContainerBuilder::Config ccBarrelEcBuilderCfg; ccBarrelEcBuilderCfg.builders = {endcapBuilders[0u], ccBarrelBuilder, endcapBuilders[1u]}; - ccBarrelEcBuilderCfg.binning = {Acts::binZ}; + ccBarrelEcBuilderCfg.binning = {Acts::BinningValue::binZ}; auto ccBarrelEndcapBuilder = std::make_shared( @@ -315,7 +318,7 @@ BOOST_AUTO_TEST_CASE(BeamPipeEndcapBarrelDetector) { // Full detector Acts::Experimental::CylindricalContainerBuilder::Config detCompBuilderCfg; detCompBuilderCfg.builders = {bpBuilder, ccBarrelEndcapBuilder}; - detCompBuilderCfg.binning = {Acts::binR}; + detCompBuilderCfg.binning = {Acts::BinningValue::binR}; auto detCompBuilder = std::make_shared( diff --git a/Tests/UnitTests/Plugins/Json/DetectorVolumeFinderJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/DetectorVolumeFinderJsonConverterTests.cpp index 2b1a57e0b35..f9842a182d5 100644 --- a/Tests/UnitTests/Plugins/Json/DetectorVolumeFinderJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/DetectorVolumeFinderJsonConverterTests.cpp @@ -51,7 +51,8 @@ BOOST_AUTO_TEST_CASE(RzVolumes) { grid.atPosition(p22) = 22u; grid.atPosition(p23) = 23u; - auto casts = std::array{Acts::binZ, Acts::binR}; + auto casts = std::array{Acts::BinningValue::binZ, + Acts::BinningValue::binR}; 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 2b8a314d05c..126322514e2 100644 --- a/Tests/UnitTests/Plugins/Json/DetectorVolumeJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/DetectorVolumeJsonConverterTests.cpp @@ -148,7 +148,8 @@ BOOST_AUTO_TEST_CASE(EndcapVolumeWithSurfaces) { lsConfig.auxiliary = "*** Endcap with 22 surfaces ***"; lsConfig.surfacesProvider = endcapSurfaces; lsConfig.binnings = {Acts::Experimental::ProtoBinning( - Acts::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, 22u, 1u)}; + Acts::BinningValue::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, + 22u, 1u)}; auto layerBuilder = std::make_shared( @@ -226,10 +227,12 @@ BOOST_AUTO_TEST_CASE(BarrelVolumeWithSurfaces) { lsConfig.auxiliary = "*** Barrel with 448 surfaces ***"; lsConfig.surfacesProvider = barrelSurfaces; lsConfig.binnings = { - Acts::Experimental::ProtoBinning{ - Acts::binZ, Acts::AxisBoundaryType::Bound, -480., 480., 14u, 1u}, - Acts::Experimental::ProtoBinning( - Acts::binPhi, Acts::AxisBoundaryType::Closed, -M_PI, M_PI, 32u, 1u)}; + Acts::Experimental::ProtoBinning{Acts::BinningValue::binZ, + Acts::AxisBoundaryType::Bound, -480., + 480., 14u, 1u}, + Acts::Experimental::ProtoBinning(Acts::BinningValue::binPhi, + Acts::AxisBoundaryType::Closed, -M_PI, + M_PI, 32u, 1u)}; auto barrelBuilder = std::make_shared( diff --git a/Tests/UnitTests/Plugins/Json/EqualityHelpers.hpp b/Tests/UnitTests/Plugins/Json/EqualityHelpers.hpp index 44a6499fdd0..546ba6d8be7 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, Acts::ActsScalar tolerance = 0.) { bool equalConstrains = true; bool equalRange = true; - for (auto& bVal : s_binningValues) { + for (auto& bVal : allBinningValues()) { 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 914dc29099e..f8e943c66c3 100644 --- a/Tests/UnitTests/Plugins/Json/ExtentJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/ExtentJsonConverterTests.cpp @@ -22,18 +22,24 @@ BOOST_AUTO_TEST_SUITE(ExtentJsonConverter) BOOST_AUTO_TEST_CASE(ExtentRoundtripTests) { Extent e; - e.set(binR, 0, 200); - e.set(binZ, -50, 50); + e.set(BinningValue::binR, 0, 200); + e.set(BinningValue::binZ, -50, 50); nlohmann::json j; j["extent"] = e; + std::cout << j.dump(2) << std::endl; + Extent eIn = j["extent"]; - CHECK_CLOSE_ABS(eIn.min(binR), e.min(binR), 10e-5); - CHECK_CLOSE_ABS(eIn.max(binR), e.max(binR), 10e-5); - CHECK_CLOSE_ABS(eIn.min(binZ), e.min(binZ), 10e-5); - CHECK_CLOSE_ABS(eIn.max(binZ), e.max(binZ), 10e-5); + CHECK_CLOSE_ABS(eIn.min(BinningValue::binR), e.min(BinningValue::binR), + 10e-5); + CHECK_CLOSE_ABS(eIn.max(BinningValue::binR), e.max(BinningValue::binR), + 10e-5); + CHECK_CLOSE_ABS(eIn.min(BinningValue::binZ), e.min(BinningValue::binZ), + 10e-5); + CHECK_CLOSE_ABS(eIn.max(BinningValue::binZ), e.max(BinningValue::binZ), + 10e-5); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Plugins/Json/GridJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/GridJsonConverterTests.cpp index 0cf3c030368..07a92711ebf 100644 --- a/Tests/UnitTests/Plugins/Json/GridJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/GridJsonConverterTests.cpp @@ -361,12 +361,12 @@ 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> sspace1D; // Check the tuple for 1D @@ -375,16 +375,26 @@ 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> sspace2D = {}; // Check the tuple for 2D diff --git a/Tests/UnitTests/Plugins/Json/MaterialJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/MaterialJsonConverterTests.cpp index cbef8dafbce..2a755ef8dad 100644 --- a/Tests/UnitTests/Plugins/Json/MaterialJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/MaterialJsonConverterTests.cpp @@ -53,10 +53,11 @@ BOOST_AUTO_TEST_CASE(IndexedSurfaceMaterial1DTests) { bToX.connect<&Acts::GridAccess::LocalSubspace<0u>::toGridLocal>( std::move(localX)); - auto globalX = - std::make_unique>(); + auto globalX = std::make_unique< + const Acts::GridAccess::GlobalSubspace>(); Acts::IndexedSurfaceMaterial::GlobalToGridLocalDelegate gToX; - gToX.connect<&Acts::GridAccess::GlobalSubspace::toGridLocal>( + gToX.connect< + &Acts::GridAccess::GlobalSubspace::toGridLocal>( std::move(globalX)); Acts::IndexedSurfaceMaterial ism( @@ -127,11 +128,11 @@ BOOST_AUTO_TEST_CASE(IndexedSurfaceMaterial2DTests) { std::move(boundToGrid)); // With z shift 10 - auto globalToGrid = std::make_unique< - const Acts::GridAccess::GlobalSubspace>(); + auto globalToGrid = std::make_unique>(); Acts::IndexedSurfaceMaterial::GlobalToGridLocalDelegate gToZphi; - gToZphi.connect< - &Acts::GridAccess::GlobalSubspace::toGridLocal>( + gToZphi.connect<&Acts::GridAccess::GlobalSubspace< + Acts::BinningValue::binZ, Acts::BinningValue::binPhi>::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 b9405d7e0f4..7bc829a1c88 100644 --- a/Tests/UnitTests/Plugins/Json/PortalJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/PortalJsonConverterTests.cpp @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(PortalMultiConnected) { Acts::Experimental::detail::PortalHelper::attachDetectorVolumesUpdater( tContext, *portal, {forwardVolumeA, forwardVolumeB, forwardVolumeC}, - Acts::Direction::Forward, {-100, 10, 20, 200}, Acts::binX); + Acts::Direction::Forward, {-100, 10, 20, 200}, Acts::BinningValue::binX); 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 5b7daaea467..f728f900542 100644 --- a/Tests/UnitTests/Plugins/Json/ProtoDetectorJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/ProtoDetectorJsonConverterTests.cpp @@ -115,65 +115,67 @@ bool isEqual(const Acts::ProtoVolume& one, const Acts::ProtoVolume& two, BOOST_AUTO_TEST_SUITE(ProtoDetectorJsonConverter) BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { - Acts::ExtentEnvelope cylinderLayerEnvelope = zeroEnvelopes; - cylinderLayerEnvelope[Acts::binR] = {1., 1.}; - cylinderLayerEnvelope[Acts::binZ] = {2., 2.}; + Acts::ExtentEnvelope cylinderLayerEnvelope = ExtentEnvelope::Zero(); + cylinderLayerEnvelope[Acts::BinningValue::binR] = {1., 1.}; + cylinderLayerEnvelope[Acts::BinningValue::binZ] = {2., 2.}; - Acts::ExtentEnvelope discLayerEnvelope = zeroEnvelopes; - discLayerEnvelope[Acts::binR] = {1., 1.}; - discLayerEnvelope[Acts::binZ] = {1., 1.}; + Acts::ExtentEnvelope discLayerEnvelope = ExtentEnvelope::Zero(); + discLayerEnvelope[Acts::BinningValue::binR] = {1., 1.}; + discLayerEnvelope[Acts::BinningValue::binZ] = {1., 1.}; // Beam Pipe container Acts::ProtoVolume beamPipeContainer; beamPipeContainer.name = "odd-beam-pipe"; - beamPipeContainer.extent.set(Acts::binR, 0., 25); + beamPipeContainer.extent.set(Acts::BinningValue::binR, 0., 25); Acts::ProtoVolume beamPipe; beamPipe.name = "odd-beam-pipe-l"; - beamPipe.extent.set(Acts::binR, 2., 24.); + beamPipe.extent.set(Acts::BinningValue::binR, 2., 24.); beamPipe.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; beamPipeContainer.container = Acts::ProtoVolume::ContainerStructure{ - {beamPipe}, {Acts::BinningData(Acts::open, Acts::binR, {0., 1.})}, true}; + {beamPipe}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1.})}, + true}; // Pixel section Acts::ProtoVolume pixelContainer; pixelContainer.name = "odd-pixel"; - pixelContainer.extent.set(Acts::binR, 25., 200); + pixelContainer.extent.set(Acts::BinningValue::binR, 25., 200); Acts::ProtoVolume pixelNec; pixelNec.name = "odd-pixel-nec"; - pixelNec.extent.set(Acts::binZ, -3100., -580); + pixelNec.extent.set(Acts::BinningValue::binZ, -3100., -580); Acts::ProtoVolume pixNecD6; pixNecD6.name = "odd-pixel-nec-d6"; - pixNecD6.extent.set(Acts::binZ, -1540., -1500); + pixNecD6.extent.set(Acts::BinningValue::binZ, -1540., -1500); Acts::ProtoVolume pixNecD5; pixNecD5.name = "odd-pixel-nec-d5"; - pixNecD5.extent.set(Acts::binZ, -1340., -1300); + pixNecD5.extent.set(Acts::BinningValue::binZ, -1340., -1300); Acts::ProtoVolume pixNecD4; pixNecD4.name = "odd-pixel-nec-d4"; - pixNecD4.extent.set(Acts::binZ, -1140., -1100); + pixNecD4.extent.set(Acts::BinningValue::binZ, -1140., -1100); Acts::ProtoVolume pixNecD3; pixNecD3.name = "odd-pixel-nec-d3"; - pixNecD3.extent.set(Acts::binZ, -1000., -960.); + pixNecD3.extent.set(Acts::BinningValue::binZ, -1000., -960.); Acts::ProtoVolume pixNecD2; pixNecD2.name = "odd-pixel-nec-d2"; - pixNecD2.extent.set(Acts::binZ, -860., -820); + pixNecD2.extent.set(Acts::BinningValue::binZ, -860., -820); Acts::ProtoVolume pixNecD1; pixNecD1.name = "odd-pixel-nec-d1"; - pixNecD1.extent.set(Acts::binZ, -740., -700); + pixNecD1.extent.set(Acts::BinningValue::binZ, -740., -700); Acts::ProtoVolume pixNecD0; pixNecD0.name = "odd-pixel-nec-d0"; - pixNecD0.extent.set(Acts::binZ, -640., -600); + pixNecD0.extent.set(Acts::BinningValue::binZ, -640., -600); pixelNec.container = Acts::ProtoVolume::ContainerStructure{ {pixNecD6, pixNecD5, pixNecD4, pixNecD3, pixNecD2, pixNecD1, pixNecD0}, - {Acts::BinningData(Acts::open, Acts::binZ, {0., 1.})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1.})}, true}; Acts::BinningData pixEcBinningR = - Acts::BinningData(Acts::open, Acts::binR, 2., 0., 1.); - Acts::BinningData pixEcBinningPhi = - Acts::BinningData(Acts::closed, Acts::binPhi, 30., -M_PI, M_PI); + Acts::BinningData(Acts::open, Acts::BinningValue::binR, 2., 0., 1.); + Acts::BinningData pixEcBinningPhi = Acts::BinningData( + Acts::closed, Acts::BinningValue::binPhi, 30., -M_PI, M_PI); for (auto& cv : pixelNec.container.value().constituentVolumes) { cv.extent.setEnvelope(discLayerEnvelope); @@ -183,28 +185,28 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume pixelBarrel; pixelBarrel.name = "odd-pixel-barrel"; - pixelBarrel.extent.set(Acts::binZ, -580., 580); + pixelBarrel.extent.set(Acts::BinningValue::binZ, -580., 580); Acts::ProtoVolume pixBarrelL0; pixBarrelL0.name = "odd-pixel-barrel-l0"; - pixBarrelL0.extent.set(Acts::binR, 28., 48.); - pixBarrelL0.extent.set(Acts::binZ, -580., 580); + pixBarrelL0.extent.set(Acts::BinningValue::binR, 28., 48.); + pixBarrelL0.extent.set(Acts::BinningValue::binZ, -580., 580); Acts::ProtoVolume pixBarrelL1; pixBarrelL1.name = "odd-pixel-barrel-l1"; - pixBarrelL1.extent.set(Acts::binR, 62., 76); - pixBarrelL1.extent.set(Acts::binZ, -580., 580); + pixBarrelL1.extent.set(Acts::BinningValue::binR, 62., 76); + pixBarrelL1.extent.set(Acts::BinningValue::binZ, -580., 580); Acts::ProtoVolume pixBarrelL2; pixBarrelL2.name = "odd-pixel-barrel-l2"; - pixBarrelL2.extent.set(Acts::binR, 100., 120.); - pixBarrelL2.extent.set(Acts::binZ, -580., 580); + pixBarrelL2.extent.set(Acts::BinningValue::binR, 100., 120.); + pixBarrelL2.extent.set(Acts::BinningValue::binZ, -580., 580); Acts::ProtoVolume pixBarrelL3; pixBarrelL3.name = "odd-pixel-barrel-l3"; - pixBarrelL3.extent.set(Acts::binR, 160., 180.); - pixBarrelL3.extent.set(Acts::binZ, -580., 580); + pixBarrelL3.extent.set(Acts::BinningValue::binR, 160., 180.); + pixBarrelL3.extent.set(Acts::BinningValue::binZ, -580., 580); pixelBarrel.container = Acts::ProtoVolume::ContainerStructure{ {pixBarrelL0, pixBarrelL1, pixBarrelL2, pixBarrelL3}, - {Acts::BinningData(Acts::open, Acts::binR, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1})}, true}; for (auto& cv : pixelBarrel.container.value().constituentVolumes) { @@ -215,33 +217,33 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume pixelPec; pixelPec.name = "odd-pixel-pec"; - pixelPec.extent.set(Acts::binZ, 580., 3100.); + pixelPec.extent.set(Acts::BinningValue::binZ, 580., 3100.); Acts::ProtoVolume pixPecD0; pixPecD0.name = "odd-pixel-pec-d0"; - pixPecD0.extent.set(Acts::binZ, 600., 640); + pixPecD0.extent.set(Acts::BinningValue::binZ, 600., 640); Acts::ProtoVolume pixPecD1; pixPecD1.name = "odd-pixel-pec-d1"; - pixPecD1.extent.set(Acts::binZ, 700., 740); + pixPecD1.extent.set(Acts::BinningValue::binZ, 700., 740); Acts::ProtoVolume pixPecD2; pixPecD2.name = "odd-pixel-pec-d2"; - pixPecD2.extent.set(Acts::binZ, 820., 860.); + pixPecD2.extent.set(Acts::BinningValue::binZ, 820., 860.); Acts::ProtoVolume pixPecD3; pixPecD3.name = "odd-pixel-pec-d3"; - pixPecD3.extent.set(Acts::binZ, 960., 1000.); + pixPecD3.extent.set(Acts::BinningValue::binZ, 960., 1000.); Acts::ProtoVolume pixPecD4; pixPecD4.name = "odd-pixel-pec-d4"; - pixPecD4.extent.set(Acts::binZ, 1100., 1140); + pixPecD4.extent.set(Acts::BinningValue::binZ, 1100., 1140); Acts::ProtoVolume pixPecD5; pixPecD5.name = "odd-pixel-pec-d5"; - pixPecD5.extent.set(Acts::binZ, 1300., 1340.); + pixPecD5.extent.set(Acts::BinningValue::binZ, 1300., 1340.); Acts::ProtoVolume pixPecD6; pixPecD6.name = "odd-pixel-pec-d6"; - pixPecD6.extent.set(Acts::binZ, 1500., 1540.); + pixPecD6.extent.set(Acts::BinningValue::binZ, 1500., 1540.); pixelPec.container = Acts::ProtoVolume::ContainerStructure{ {pixPecD0, pixPecD1, pixPecD2, pixPecD3, pixPecD4, pixPecD5, pixPecD6}, - {Acts::BinningData(Acts::open, Acts::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, true}; for (auto& cv : pixelPec.container.value().constituentVolumes) { @@ -252,57 +254,59 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { pixelContainer.container = Acts::ProtoVolume::ContainerStructure{ {pixelNec, pixelBarrel, pixelPec}, - {Acts::BinningData(Acts::open, Acts::binZ, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {-3100., -580., 580., 3100.})}}; // Short Strip section Acts::ProtoVolume pstContainer; pstContainer.name = "odd-pst"; - pstContainer.extent.set(Acts::binR, 200., 210.); + pstContainer.extent.set(Acts::BinningValue::binR, 200., 210.); Acts::ProtoVolume pst; pst.name = "odd-pst-l"; - pst.extent.set(Acts::binR, 201., 209.); + pst.extent.set(Acts::BinningValue::binR, 201., 209.); pst.internal = Acts::ProtoVolume::InternalStructure{ Acts::Surface::SurfaceType::Cylinder}; pstContainer.container = Acts::ProtoVolume::ContainerStructure{ - {pst}, {Acts::BinningData(Acts::open, Acts::binR, {0., 1.})}, true}; + {pst}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1.})}, + true}; // Short Strip section Acts::ProtoVolume sstripContainer; sstripContainer.name = "odd-sstrip"; - sstripContainer.extent.set(Acts::binR, 210., 720); + sstripContainer.extent.set(Acts::BinningValue::binR, 210., 720); Acts::BinningData sstripEcBinningR = - Acts::BinningData(Acts::open, Acts::binR, 3., 0., 1.); - Acts::BinningData sstripEcBinningPhi = - Acts::BinningData(Acts::closed, Acts::binPhi, 42., -M_PI, M_PI); + Acts::BinningData(Acts::open, Acts::BinningValue::binR, 3., 0., 1.); + Acts::BinningData sstripEcBinningPhi = Acts::BinningData( + Acts::closed, Acts::BinningValue::binPhi, 42., -M_PI, M_PI); Acts::ProtoVolume sstripNec; sstripNec.name = "odd-sstrip-nec"; - sstripNec.extent.set(Acts::binZ, -3100., -1200); + sstripNec.extent.set(Acts::BinningValue::binZ, -3100., -1200); Acts::ProtoVolume sstripNecD5; sstripNecD5.name = "odd-sstrip-nec-d5"; - sstripNecD5.extent.set(Acts::binZ, -3000, -2900.); + sstripNecD5.extent.set(Acts::BinningValue::binZ, -3000, -2900.); Acts::ProtoVolume sstripNecD4; sstripNecD4.name = "odd-sstrip-nec-d4"; - sstripNecD4.extent.set(Acts::binZ, -2600., -2500.); + sstripNecD4.extent.set(Acts::BinningValue::binZ, -2600., -2500.); Acts::ProtoVolume sstripNecD3; sstripNecD3.name = "odd-sstrip-nec-d3"; - sstripNecD3.extent.set(Acts::binZ, -2250, -2150.); + sstripNecD3.extent.set(Acts::BinningValue::binZ, -2250, -2150.); Acts::ProtoVolume sstripNecD2; sstripNecD2.name = "odd-sstrip-nec-d2"; - sstripNecD2.extent.set(Acts::binZ, -1900, -1800.); + sstripNecD2.extent.set(Acts::BinningValue::binZ, -1900, -1800.); Acts::ProtoVolume sstripNecD1; sstripNecD1.name = "odd-sstrip-nec-d1"; - sstripNecD1.extent.set(Acts::binZ, -1600., -1500.); + sstripNecD1.extent.set(Acts::BinningValue::binZ, -1600., -1500.); Acts::ProtoVolume sstripNecD0; sstripNecD0.name = "odd-sstrip-nec-d0"; - sstripNecD0.extent.set(Acts::binZ, -1350., -1250.); + sstripNecD0.extent.set(Acts::BinningValue::binZ, -1350., -1250.); sstripNec.container = Acts::ProtoVolume::ContainerStructure{ {sstripNecD5, sstripNecD4, sstripNecD3, sstripNecD2, sstripNecD1, sstripNecD0}, - {Acts::BinningData(Acts::open, Acts::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, true}; for (auto& cv : sstripNec.container.value().constituentVolumes) { @@ -314,24 +318,24 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume sstripBarrel; sstripBarrel.name = "odd-sstrip-barrel"; - sstripBarrel.extent.set(Acts::binZ, -1200., 1200); + sstripBarrel.extent.set(Acts::BinningValue::binZ, -1200., 1200); Acts::ProtoVolume sstripBarrelL0; sstripBarrelL0.name = "odd-sstrip-barrel-l0"; - sstripBarrelL0.extent.set(Acts::binR, 240., 280.); + sstripBarrelL0.extent.set(Acts::BinningValue::binR, 240., 280.); Acts::ProtoVolume sstripBarrelL1; sstripBarrelL1.name = "odd-sstrip-barrel-l1"; - sstripBarrelL1.extent.set(Acts::binR, 340., 380.); + sstripBarrelL1.extent.set(Acts::BinningValue::binR, 340., 380.); Acts::ProtoVolume sstripBarrelL2; sstripBarrelL2.name = "odd-sstrip-barrel-l2"; - sstripBarrelL2.extent.set(Acts::binR, 480., 520.); + sstripBarrelL2.extent.set(Acts::BinningValue::binR, 480., 520.); Acts::ProtoVolume sstripBarrelL3; sstripBarrelL3.name = "odd-sstrip-barrel-l3"; - sstripBarrelL3.extent.set(Acts::binR, 640., 680.); + sstripBarrelL3.extent.set(Acts::BinningValue::binR, 640., 680.); sstripBarrel.container = Acts::ProtoVolume::ContainerStructure{ {sstripBarrelL0, sstripBarrelL1, sstripBarrelL2, sstripBarrelL3}, - {Acts::BinningData(Acts::open, Acts::binR, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1})}, true}; for (auto& cv : sstripBarrel.container.value().constituentVolumes) { @@ -342,31 +346,31 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume sstripPec; sstripPec.name = "odd-sstrip-pec"; - sstripPec.extent.set(Acts::binZ, 1200., 3100); + sstripPec.extent.set(Acts::BinningValue::binZ, 1200., 3100); Acts::ProtoVolume sstripPecD0; sstripPecD0.name = "odd-sstrip-pec-d0"; - sstripPecD0.extent.set(Acts::binZ, 1250., 1350); + sstripPecD0.extent.set(Acts::BinningValue::binZ, 1250., 1350); Acts::ProtoVolume sstripPecD1; sstripPecD1.name = "odd-sstrip-pec-d1"; - sstripPecD1.extent.set(Acts::binZ, 1500., 1600.); + sstripPecD1.extent.set(Acts::BinningValue::binZ, 1500., 1600.); Acts::ProtoVolume sstripPecD2; sstripPecD2.name = "odd-sstrip-pec-d2"; - sstripPecD2.extent.set(Acts::binZ, 1800., 1900.); + sstripPecD2.extent.set(Acts::BinningValue::binZ, 1800., 1900.); Acts::ProtoVolume sstripPecD3; sstripPecD3.name = "odd-sstrip-pec-d3"; - sstripPecD3.extent.set(Acts::binZ, 2150., 2250.); + sstripPecD3.extent.set(Acts::BinningValue::binZ, 2150., 2250.); Acts::ProtoVolume sstripPecD4; sstripPecD4.name = "odd-sstrip-pec-d4"; - sstripPecD4.extent.set(Acts::binZ, 2500., 2600.); + sstripPecD4.extent.set(Acts::BinningValue::binZ, 2500., 2600.); Acts::ProtoVolume sstripPecD5; sstripPecD5.name = "odd-sstrip-pec-d5"; - sstripPecD5.extent.set(Acts::binZ, 2900., 3000.); + sstripPecD5.extent.set(Acts::BinningValue::binZ, 2900., 3000.); sstripPec.container = Acts::ProtoVolume::ContainerStructure{ {sstripPecD0, sstripPecD1, sstripPecD2, sstripPecD3, sstripPecD4, sstripPecD5}, - {Acts::BinningData(Acts::open, Acts::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, true}; for (auto& cv : sstripPec.container.value().constituentVolumes) { cv.extent.setEnvelope(discLayerEnvelope); @@ -377,40 +381,40 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { sstripContainer.container = Acts::ProtoVolume::ContainerStructure{ {sstripNec, sstripBarrel, sstripPec}, - {Acts::BinningData(Acts::open, Acts::binZ, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {-3100., -1200., 1200., 3100.})}}; // Long Strip section Acts::ProtoVolume lstripContainer; lstripContainer.name = "odd-lstrip"; - lstripContainer.extent.set(Acts::binR, 720, 1100.); + lstripContainer.extent.set(Acts::BinningValue::binR, 720, 1100.); Acts::ProtoVolume lstripNec; lstripNec.name = "odd-lstrip-nec"; - lstripNec.extent.set(Acts::binZ, -3100., -1200); + lstripNec.extent.set(Acts::BinningValue::binZ, -3100., -1200); Acts::ProtoVolume lstripNecD5; lstripNecD5.name = "odd-lstrip-nec-d5"; - lstripNecD5.extent.set(Acts::binZ, -3050, -2900.); + lstripNecD5.extent.set(Acts::BinningValue::binZ, -3050, -2900.); Acts::ProtoVolume lstripNecD4; lstripNecD4.name = "odd-lstrip-nec-d4"; - lstripNecD4.extent.set(Acts::binZ, -2650., -2500.); + lstripNecD4.extent.set(Acts::BinningValue::binZ, -2650., -2500.); Acts::ProtoVolume lstripNecD3; lstripNecD3.name = "odd-lstrip-nec-d3"; - lstripNecD3.extent.set(Acts::binZ, -2300, -2150.); + lstripNecD3.extent.set(Acts::BinningValue::binZ, -2300, -2150.); Acts::ProtoVolume lstripNecD2; lstripNecD2.name = "odd-lstrip-nec-d2"; - lstripNecD2.extent.set(Acts::binZ, -1950, -1800.); + lstripNecD2.extent.set(Acts::BinningValue::binZ, -1950, -1800.); Acts::ProtoVolume lstripNecD1; lstripNecD1.name = "odd-lstrip-nec-d1"; - lstripNecD1.extent.set(Acts::binZ, -1650., -1500.); + lstripNecD1.extent.set(Acts::BinningValue::binZ, -1650., -1500.); Acts::ProtoVolume lstripNecD0; lstripNecD0.name = "odd-lstrip-nec-d0"; - lstripNecD0.extent.set(Acts::binZ, -1400., -1250.); + lstripNecD0.extent.set(Acts::BinningValue::binZ, -1400., -1250.); lstripNec.container = Acts::ProtoVolume::ContainerStructure{ {lstripNecD5, lstripNecD4, lstripNecD3, lstripNecD2, lstripNecD1, lstripNecD0}, - {Acts::BinningData(Acts::open, Acts::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, true}; for (auto& cv : lstripNec.container.value().constituentVolumes) { @@ -421,18 +425,18 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume lstripBarrel; lstripBarrel.name = "odd-lstrip-barrel"; - lstripBarrel.extent.set(Acts::binZ, -1200., 1200); + lstripBarrel.extent.set(Acts::BinningValue::binZ, -1200., 1200); Acts::ProtoVolume lstripBarrelL0; lstripBarrelL0.name = "odd-lstrip-barrel-l0"; - lstripBarrelL0.extent.set(Acts::binR, 800., 840.); + lstripBarrelL0.extent.set(Acts::BinningValue::binR, 800., 840.); Acts::ProtoVolume lstripBarrelL1; lstripBarrelL1.name = "odd-lstrip-barrel-l1"; - lstripBarrelL1.extent.set(Acts::binR, 1000., 1050.); + lstripBarrelL1.extent.set(Acts::BinningValue::binR, 1000., 1050.); lstripBarrel.container = Acts::ProtoVolume::ContainerStructure{ {lstripBarrelL0, lstripBarrelL1}, - {Acts::BinningData(Acts::open, Acts::binR, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 1})}, true}; for (auto& cv : lstripBarrel.container.value().constituentVolumes) { @@ -443,31 +447,31 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { Acts::ProtoVolume lstripPec; lstripPec.name = "odd-lstrip-pec"; - lstripPec.extent.set(Acts::binZ, 1200., 3100); + lstripPec.extent.set(Acts::BinningValue::binZ, 1200., 3100); Acts::ProtoVolume lstripPecD0; lstripPecD0.name = "odd-lstrip-pec-d0"; - lstripPecD0.extent.set(Acts::binZ, 1250., 1400); + lstripPecD0.extent.set(Acts::BinningValue::binZ, 1250., 1400); Acts::ProtoVolume lstripPecD1; lstripPecD1.name = "odd-lstrip-pec-d1"; - lstripPecD1.extent.set(Acts::binZ, 1500., 1650.); + lstripPecD1.extent.set(Acts::BinningValue::binZ, 1500., 1650.); Acts::ProtoVolume lstripPecD2; lstripPecD2.name = "odd-lstrip-pec-d2"; - lstripPecD2.extent.set(Acts::binZ, 1800., 1950.); + lstripPecD2.extent.set(Acts::BinningValue::binZ, 1800., 1950.); Acts::ProtoVolume lstripPecD3; lstripPecD3.name = "odd-lstrip-pec-d3"; - lstripPecD3.extent.set(Acts::binZ, 2150., 2300.); + lstripPecD3.extent.set(Acts::BinningValue::binZ, 2150., 2300.); Acts::ProtoVolume lstripPecD4; lstripPecD4.name = "odd-lstrip-pec-d4"; - lstripPecD4.extent.set(Acts::binZ, 2500., 2650.); + lstripPecD4.extent.set(Acts::BinningValue::binZ, 2500., 2650.); Acts::ProtoVolume lstripPecD5; lstripPecD5.name = "odd-lstrip-pec-d5"; - lstripPecD5.extent.set(Acts::binZ, 2900., 3050.); + lstripPecD5.extent.set(Acts::BinningValue::binZ, 2900., 3050.); lstripPec.container = Acts::ProtoVolume::ContainerStructure{ {lstripPecD0, lstripPecD1, lstripPecD2, lstripPecD3, lstripPecD4, lstripPecD5}, - {Acts::BinningData(Acts::open, Acts::binZ, {0., 1})}, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {0., 1})}, true}; for (auto& cv : lstripPec.container.value().constituentVolumes) { cv.internal = @@ -476,18 +480,18 @@ BOOST_AUTO_TEST_CASE(ProtoDetectorRoundTrip) { } lstripContainer.container = Acts::ProtoVolume::ContainerStructure{ {lstripNec, lstripBarrel, lstripPec}, - {Acts::BinningData(Acts::open, Acts::binZ, + {Acts::BinningData(Acts::open, Acts::BinningValue::binZ, {-3100., -1200., 1200., 3100.})}}; // The overall container Acts::ProtoVolume detectorContainer; detectorContainer.name = "odd-light-world"; - detectorContainer.extent.set(Acts::binR, 0., 1100.); - detectorContainer.extent.set(Acts::binZ, -3100., 3100.); + detectorContainer.extent.set(Acts::BinningValue::binR, 0., 1100.); + detectorContainer.extent.set(Acts::BinningValue::binZ, -3100., 3100.); detectorContainer.container = Acts::ProtoVolume::ContainerStructure{ {beamPipeContainer, pixelContainer, pstContainer, sstripContainer, lstripContainer}, - {Acts::BinningData(Acts::open, Acts::binR, + {Acts::BinningData(Acts::open, Acts::BinningValue::binR, {0., 25., 200., 210., 720., 1100.})}}; // ---------------------------------------------------------- diff --git a/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp index a2b0e56ea68..8a5b1c9c533 100644 --- a/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp @@ -30,7 +30,7 @@ using namespace Acts; BOOST_AUTO_TEST_SUITE(UtilitiesJsonConverter) BOOST_AUTO_TEST_CASE(BinUtilityRoundTripTests) { - BinUtility reference(2, 0., 4., open, binR); + BinUtility reference(2, 0., 4., open, BinningValue::binR); std::ofstream out; @@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(BinUtilityRoundTripTests) { BOOST_CHECK(isEqual(reference, test, 0.0001)); // Increase to two dimensions - reference += BinUtility(10., -M_PI, M_PI, closed, binPhi); + reference += BinUtility(10., -M_PI, M_PI, closed, BinningValue::binPhi); nlohmann::json jtwoDimOut; to_json(jtwoDimOut, reference); out.open("BinUtility_2D.json"); @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(BinUtilityRoundTripTests) { // Increase to three dimensions std::vector boundaries = {-4., -1.5, 0., 10.}; - reference += BinUtility(boundaries, open, binZ); + reference += BinUtility(boundaries, open, BinningValue::binZ); 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 7adf9b986d0..3c00279d813 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoLayerBuilderTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoLayerBuilderTests.cpp @@ -56,7 +56,8 @@ BOOST_AUTO_TEST_CASE(TGeoLayerBuilderTests) { b0Config.sensorNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5", "PixelActiveo6"}; b0Config.localAxes = "XYZ"; - b0Config.parseRanges = {{binR, {0., 40_mm}}, {binZ, {-60_mm, 15_mm}}}; + b0Config.parseRanges = {{BinningValue::binR, {0., 40_mm}}, + {BinningValue::binZ, {-60_mm, 15_mm}}}; b0Config.envelope = {0_mm, 0_mm}; TglConfig eAllConfig; @@ -64,8 +65,9 @@ BOOST_AUTO_TEST_CASE(TGeoLayerBuilderTests) { eAllConfig.sensorNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5", "PixelActiveo6"}; eAllConfig.localAxes = "XYZ"; - eAllConfig.parseRanges = {{binR, {0., 40_mm}}, {binZ, {16_mm, 60_mm}}}; - eAllConfig.splitConfigs = {{binZ, 5_mm}}; + eAllConfig.parseRanges = {{BinningValue::binR, {0., 40_mm}}, + {BinningValue::binZ, {16_mm, 60_mm}}}; + eAllConfig.splitConfigs = {{BinningValue::binZ, 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 b2acbae4871..e91fe6413de 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({binR, {0., 40.}}); - tgpOptions.parseRanges.push_back({binZ, {-60., 15.}}); + tgpOptions.parseRanges.push_back({BinningValue::binR, {0., 40.}}); + tgpOptions.parseRanges.push_back({BinningValue::binZ, {-60., 15.}}); tgpOptions.unit = 10.; std::string axes = "XYZ";