Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: rename BinningValue to AxisDirection #4005

Merged
merged 16 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Core/include/Acts/Detector/Blueprint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Acts/Detector/ProtoBinning.hpp"
#include "Acts/Geometry/Extent.hpp"
#include "Acts/Geometry/VolumeBounds.hpp"
#include "Acts/Utilities/BinningData.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/StringHelpers.hpp"

#include <map>
Expand Down Expand Up @@ -47,11 +47,11 @@ struct Node final {
/// @param t the transform
/// @param bt the boundary type
/// @param bv the boundary values
/// @param bss the binning values
/// @param bss the axis directions for the binning
/// @param cs the children of the node
/// @param e the estimated extent of the node (optional)
Node(const std::string& n, const Transform3& t, VolumeBounds::BoundsType bt,
const std::vector<double>& bv, const std::vector<BinningValue>& bss,
const std::vector<double>& bv, const std::vector<AxisDirection>& bss,
std::vector<std::unique_ptr<Node>> cs = {}, const Extent& e = Extent())
: name(n),
transform(t),
Expand Down Expand Up @@ -96,7 +96,7 @@ struct Node final {
/// Branch definitions: children
std::vector<std::unique_ptr<Node>> children = {};
/// Branch definition binning
std::vector<BinningValue> binning = {};
std::vector<AxisDirection> binning = {};

/// Portal proto material binning
std::map<unsigned int, BinningDescription> portalMaterialBinning = {};
Expand Down
10 changes: 5 additions & 5 deletions Core/include/Acts/Detector/CuboidalContainerBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "Acts/Detector/DetectorComponents.hpp"
#include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <memory>
Expand All @@ -36,8 +36,8 @@ class IGeometryIdGenerator;
/// @note the builder expects a fully consistent set of sub volume builders
/// that will be executed in a chain
///
/// @note allowed BinningValue(s) for the cuboid container builder are
/// {binX}, {binY}, {binZ}.
/// @note allowed AxisDirection(s) for the cuboid container builder are
/// {AxisX}, {AxisY}, {AxisZ}.
///
/// @note Connecting containers isn't functional yet due to the underlying
/// issues in the CuboidDetectorHelper
Expand All @@ -48,8 +48,8 @@ class CuboidalContainerBuilder : public IDetectorComponentBuilder {
struct Config {
/// The configured volume builders
std::vector<std::shared_ptr<const IDetectorComponentBuilder>> builders = {};
/// Binning prescription of attachment
BinningValue binning{};
/// Axis direction for the binning
AxisDirection binning{};
/// The root volume finder
std::shared_ptr<const IRootVolumeFinderBuilder> rootVolumeFinderBuilder =
nullptr;
Expand Down
12 changes: 6 additions & 6 deletions Core/include/Acts/Detector/CylindricalContainerBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Acts/Detector/ProtoBinning.hpp"
#include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <map>
Expand All @@ -39,17 +39,17 @@ class IGeometryIdGenerator;
/// @note the builder expects a fully consistent set of sub volume builders
/// that will be executed in a chain
///
/// @note allowed BinningValue(s) for the cylindrical container builder are
/// {binZ}, {binR}, {binPhi}, {binZ, binR}, whereas the last option indicates
/// a wrapping setup.
/// @note allowed AxisDirection(s) for the cylindrical container builder are
/// {AxisZ}, {AxisR}, {AxisPhi}, {AxisZ, AxisR}, whereas the last option
/// indicates a wrapping setup.
class CylindricalContainerBuilder : public IDetectorComponentBuilder {
public:
/// Nested configuration object
struct Config {
/// The configured volume builders
std::vector<std::shared_ptr<const IDetectorComponentBuilder>> builders = {};
/// Binning prescription of attachment
std::vector<BinningValue> binning = {};
/// The axis direction for the binning
std::vector<AxisDirection> binning = {};
/// The root volume finder
std::shared_ptr<const IRootVolumeFinderBuilder> rootVolumeFinderBuilder =
nullptr;
Expand Down
6 changes: 3 additions & 3 deletions Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "Acts/Detector/interface/IRootVolumeFinderBuilder.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Navigation/PortalNavigation.hpp"
#include "Acts/Utilities/BinningData.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"

#include <memory>
#include <vector>
Expand All @@ -26,7 +26,7 @@ class IndexedRootVolumeFinderBuilder final : public IRootVolumeFinderBuilder {
public:
/// @brief Constructor with binning casts
/// @param binning the cast values for the grid binning
IndexedRootVolumeFinderBuilder(std::vector<Acts::BinningValue> binning);
IndexedRootVolumeFinderBuilder(std::vector<Acts::AxisDirection> binning);

/// The virtual interface definition for root volume finder builders
///
Expand All @@ -40,7 +40,7 @@ class IndexedRootVolumeFinderBuilder final : public IRootVolumeFinderBuilder {
const final;

private:
std::vector<Acts::BinningValue> m_casts;
std::vector<Acts::AxisDirection> m_casts;
};

} // namespace Acts::Experimental
6 changes: 3 additions & 3 deletions Core/include/Acts/Detector/KdtSurfacesProvider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "Acts/Detector/detail/ReferenceGenerators.hpp"
#include "Acts/Detector/interface/ISurfacesProvider.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/BinningData.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/KDTree.hpp"

#include <array>
Expand Down Expand Up @@ -50,7 +50,7 @@ class KdtSurfaces {
/// @param rgen the reference point generator
KdtSurfaces(const GeometryContext& gctx,
const std::vector<std::shared_ptr<Surface>>& surfaces,
const std::array<BinningValue, kDIM>& casts,
const std::array<AxisDirection, kDIM>& casts,
const reference_generator& rgen =
detail::PolyhedronReferenceGenerator<1u, false>{})
: m_kdt(nullptr), m_casts(casts), m_rGenerator(rgen) {
Expand Down Expand Up @@ -113,7 +113,7 @@ class KdtSurfaces {
std::unique_ptr<KDTS> m_kdt = nullptr;

/// Cast values that turn a global position to lookup position
std::array<BinningValue, kDIM> m_casts = {};
std::array<AxisDirection, kDIM> m_casts = {};

/// Helper to generate reference points for filling
reference_generator m_rGenerator;
Expand Down
35 changes: 17 additions & 18 deletions Core/include/Acts/Detector/ProtoBinning.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Common.hpp"
#include "Acts/Utilities/AxisFwd.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/BinUtility.hpp"
#include "Acts/Utilities/BinningType.hpp"

#include <sstream>
#include <stdexcept>
Expand All @@ -27,8 +26,8 @@ namespace Acts::Experimental {
/// only for convenience that the binning can be defined and then
/// translated into concrete axis types
struct ProtoBinning {
/// The binning value of this
BinningValue binValue;
/// The axis direction
AxisDirection axisDir;
/// The axis type: equidistant or variable
Acts::AxisType axisType = Acts::AxisType::Equidistant;
/// The axis boundary type: Open, Bound or Closed
Expand All @@ -42,13 +41,13 @@ struct ProtoBinning {

/// Convenience constructors - for variable binning
///
/// @param bValue the value/cast in which this is binned
/// @param aDir the value/cast in which this is binned
/// @param bType the axis boundary type
/// @param e the bin edges (variable binning)
/// @param exp the expansion (in bins)
ProtoBinning(BinningValue bValue, Acts::AxisBoundaryType bType,
ProtoBinning(AxisDirection aDir, Acts::AxisBoundaryType bType,
const std::vector<double>& e, std::size_t exp = 0u)
: binValue(bValue),
: axisDir(aDir),
axisType(Acts::AxisType::Variable),
boundaryType(bType),
edges(e),
Expand All @@ -61,18 +60,18 @@ struct ProtoBinning {

/// Convenience constructors - for equidistant binning
///
/// @param bValue the value/cast in which this is binned
/// @param aDir the value/cast in which this is binned
/// @param bType the axis boundary type
/// @param minE the lowest edge of the binning
/// @param maxE the highest edge of the binning
/// @param nbins the number of bins
/// @param exp the expansion (in bins)
ProtoBinning(BinningValue bValue, Acts::AxisBoundaryType bType, double minE,
ProtoBinning(AxisDirection aDir, Acts::AxisBoundaryType bType, double minE,
double maxE, std::size_t nbins, std::size_t exp = 0u)
: binValue(bValue), boundaryType(bType), expansion(exp) {
: axisDir(aDir), boundaryType(bType), expansion(exp) {
if (minE >= maxE) {
std::string msg = "ProtoBinning: Invalid binning for value '";
msg += binningValueName(bValue);
std::string msg = "ProtoBinning: Invalid axis range for direction '";
msg += axisDirectionName(axisDir);
msg += "', min edge (" + std::to_string(minE) + ") ";
msg += " needs to be smaller than max edge (";
msg += std::to_string(maxE) + ").";
Expand All @@ -96,13 +95,13 @@ struct ProtoBinning {
/// when the actual extent is not yet evaluated, only works
/// for equidistant binning obviously
///
/// @param bValue the value/cast in which this is binned
/// @param aDir the value/cast in which this is binned
/// @param bType the axis boundary type
/// @param nbins the number of bins
/// @param exp the expansion (in bins)
ProtoBinning(BinningValue bValue, Acts::AxisBoundaryType bType,
ProtoBinning(AxisDirection aDir, Acts::AxisBoundaryType bType,
std::size_t nbins, std::size_t exp = 0u)
: binValue(bValue),
: axisDir(aDir),
boundaryType(bType),
edges(nbins + 1, 0.),
expansion(exp),
Expand All @@ -115,7 +114,7 @@ struct ProtoBinning {
std::string toString() const {
std::stringstream ss;
ss << "ProtoBinning: " << bins() << " bins in "
<< binningValueName(binValue);
<< axisDirectionName(axisDir);
ss << (axisType == Acts::AxisType::Variable ? ", variable "
: ", equidistant ");
if (!autorange) {
Expand Down Expand Up @@ -165,12 +164,12 @@ struct BinningDescription {
: Acts::closed;
if (b.axisType == Acts::AxisType::Equidistant) {
binUtility += BinUtility(b.bins(), b.edges.front(), b.edges.back(),
bOption, b.binValue);
bOption, b.axisDir);
} else {
std::vector<float> edges;
std::for_each(b.edges.begin(), b.edges.end(),
[&](double edge) { edges.push_back(edge); });
binUtility += BinUtility(edges, bOption, b.binValue);
binUtility += BinUtility(edges, bOption, b.axisDir);
}
}
return binUtility;
Expand Down
8 changes: 4 additions & 4 deletions Core/include/Acts/Detector/ProtoDetector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ struct ProtoVolume {
void extendUp(ProtoVolume& ptVolume);

/// Extend the tracking volume with its own constituents
/// @param bValue the binning value that is propagated
void propagateMinDown(BinningValue bValue);
/// @param aDir the axis direction that is propagated
void propagateMinDown(AxisDirection aDir);

/// Extend the tracking volume with its own constituents
/// @param bValue the binning value that is propagated
void propagateMaxDown(BinningValue bValue);
/// @param aDir the axis direction that is propagated
void propagateMaxDown(AxisDirection aDir);

/// Constrain the daughter volumes with this volume
///
Expand Down
6 changes: 3 additions & 3 deletions Core/include/Acts/Detector/ProtoSupport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "Acts/Definitions/Common.hpp"
#include "Acts/Detector/ProtoBinning.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/AxisFwd.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/BinningData.hpp"

#include <optional>
Expand Down Expand Up @@ -55,7 +55,7 @@ struct ProtoSupport {
/// The internal constraint would overwrite the volume one in order to allow
/// support surfaces to be fitted from global volume extensions to the
/// actually contained internal objects.
std::vector<BinningValue> internalConstraints = {};
std::vector<AxisDirection> internalConstraints = {};

// Building instructions 2 (surface is provided):

Expand All @@ -69,7 +69,7 @@ struct ProtoSupport {
unsigned int splits = 1u;

/// Planar placement (only valid for planar support surfaces)
BinningValue pPlacement = BinningValue::binZ;
AxisDirection pPlacement = AxisDirection::AxisZ;

/// Indicate if the support surface(s) should always be addressed in
/// navigation
Expand Down
8 changes: 4 additions & 4 deletions Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace detail::CuboidalDetectorHelper {
///
/// @param gctx The geometry context
/// @param volumes the volumes
/// @param bValue the binning value (allowed are binX, binY, binZ)
/// @param bValue the binning value (allowed are AxisX, AxisY, AxisZ)
/// @param selectedOnly switch only selected boundaries
/// @param logLevel is the screen logging level
///
Expand All @@ -43,15 +43,15 @@ namespace detail::CuboidalDetectorHelper {
/// @return a proto container with the outside portals
DetectorComponent::PortalContainer connect(
const GeometryContext& gctx,
std::vector<std::shared_ptr<DetectorVolume>>& volumes, BinningValue bValue,
std::vector<std::shared_ptr<DetectorVolume>>& volumes, AxisDirection bValue,
const std::vector<unsigned int>& selectedOnly = {},
Acts::Logging::Level logLevel = Acts::Logging::INFO);

/// @brief Connect containers given a binning value
///
/// @param gctx The geometry context
/// @param containers the containers
/// @param bValue the binning value (allowed are binX, binY, binZ)
/// @param bValue the binning value (allowed are AxisX, AxisY, AxisZ)
/// @param selectedOnly switch only selected boundaries
/// @param logLevel is the screen logging level
///
Expand All @@ -62,7 +62,7 @@ DetectorComponent::PortalContainer connect(
DetectorComponent::PortalContainer connect(
const GeometryContext& gctx,
const std::vector<DetectorComponent::PortalContainer>& containers,
BinningValue bValue, const std::vector<unsigned int>& selectedOnly = {},
AxisDirection bValue, const std::vector<unsigned int>& selectedOnly = {},
Acts::Logging::Level logLevel = Acts::Logging::INFO);

/// @brief Helper method to extract r,z,phi boundaries for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void checkRotationAlignment(
std::vector<double> checkCenterAlignment(
const GeometryContext& gctx,
const std::vector<std::shared_ptr<Experimental::DetectorVolume>>& volumes,
BinningValue axisValue);
AxisDirection axisValue);

} // namespace detail::DetectorVolumeConsistency
} // namespace Acts::Experimental
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct IndexedSurfacesGenerator {
// Indices of surfaces that are to be assigned to all bins
std::vector<std::size_t> assignToAll = {};
/// The binning for the indexing
std::vector<BinningValue> bValues = {};
std::vector<AxisDirection> bValues = {};
// Bin expansion
std::vector<std::size_t> binExpansion = {};
/// The transform into the local binning schema
Expand Down Expand Up @@ -68,7 +68,7 @@ struct IndexedSurfacesGenerator {
typename axis_generator::template grid_type<std::vector<std::size_t>>;
GridType grid(std::move(aGenerator()));

std::array<BinningValue, decltype(grid)::DIM> bvArray = {};
std::array<AxisDirection, decltype(grid)::DIM> bvArray = {};
for (auto [ibv, bv] : enumerate(bValues)) {
bvArray[ibv] = bv;
}
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Detector/detail/PortalHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Portal;
/// gathered from the sub volumes, the binning description
using PortalReplacement =
std::tuple<std::shared_ptr<Experimental::Portal>, unsigned int, Direction,
std::vector<double>, BinningValue>;
std::vector<double>, AxisDirection>;

namespace detail::PortalHelper {

Expand Down Expand Up @@ -63,7 +63,7 @@ void attachDetectorVolumesUpdater(
const GeometryContext& gctx, Portal& portal,
const std::vector<std::shared_ptr<DetectorVolume>>& volumes,
const Direction& direction, const std::vector<double>& boundaries,
const BinningValue& binning);
const AxisDirection& binning);

/// @brief Create and attach the multi link updator, the portal will get
/// a volume updator attached, that points to the different sub volumes
Expand Down
6 changes: 3 additions & 3 deletions Core/include/Acts/Detector/detail/ReferenceGenerators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ struct CenterReferenceGenerator {
///
/// This generator will provide only one filling point and hence
/// only a single bin in the indexed grid.
template <BinningValue bVAL>
struct BinningValueReferenceGenerator {
template <AxisDirection bVAL>
struct AxisDirectionReferenceGenerator {
/// Helper to access a reference position based on binning value
///
/// @param gctx the geometry context of this operation
Expand All @@ -51,7 +51,7 @@ struct BinningValueReferenceGenerator {
/// @return a vector of reference points for filling
const std::vector<Vector3> references(const GeometryContext& gctx,
const Surface& surface) const {
return {surface.binningPosition(gctx, bVAL)};
return {surface.referencePosition(gctx, bVAL)};
}
};

Expand Down
Loading
Loading