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

refactor!: Remove BinningType #3826

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
249e66e
locally compiling verison
asalzburger Nov 7, 2024
06c6c75
clang-format
asalzburger Nov 7, 2024
17b1acd
undo replacement
asalzburger Nov 7, 2024
744a8cd
fixing one unit test
asalzburger Nov 7, 2024
8fa9202
fixing unit tests macOS
asalzburger Nov 7, 2024
6cc0695
removing old mentions of bin*
asalzburger Nov 7, 2024
f60e30f
rebasing after +/- pi change
asalzburger Nov 11, 2024
30bdfeb
fix some unit test
asalzburger Nov 11, 2024
8324b2e
fix lint
asalzburger Nov 11, 2024
9511ade
Update CylindricalContainerBuilder.hpp
asalzburger Nov 12, 2024
3172723
Update ProtoDetector.hpp
asalzburger Nov 12, 2024
99afa5f
Update IndexedSurfacesGenerator.hpp
asalzburger Nov 12, 2024
1e9b735
Update ReferenceGenerators.hpp
asalzburger Nov 12, 2024
8201af3
rename binningPosition()
asalzburger Nov 12, 2024
d9101e9
more removal of binning namings
asalzburger Nov 12, 2024
e5ec7e2
bType to aType
asalzburger Nov 12, 2024
66d8ebd
updates here and there
asalzburger Dec 2, 2024
08b02d5
rebase
asalzburger Dec 2, 2024
8f6acf3
Merge branch 'main' into refactor-remove-BinningType
asalzburger Dec 3, 2024
2f71eb2
fixing name conflict
asalzburger Dec 3, 2024
c23e4ed
clang-format
asalzburger Dec 3, 2024
eedea81
Merge branch 'main' into refactor-remove-BinningType
asalzburger Dec 3, 2024
9b6796d
removing bValue namings
asalzburger Dec 3, 2024
8b44fe4
Merge branch 'main' into refactor-remove-BinningType
asalzburger Dec 3, 2024
4c7655f
fixing doc problems
asalzburger Dec 3, 2024
399d713
Merge branch 'main' into refactor-remove-BinningType
asalzburger Dec 3, 2024
645c5b5
Merge branch 'main' into refactor-remove-BinningType
asalzburger Dec 4, 2024
9ccbfeb
Merge branch 'main' into refactor-remove-BinningType
asalzburger Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 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,18 +47,18 @@ struct Node final {
/// @param t the transform
/// @param bt the boundary type
/// @param bv the boundary values
/// @param bss the binning values
/// @param adrs the axis direction values
/// @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>& adrs,
std::vector<std::unique_ptr<Node>> cs = {}, const Extent& e = Extent())
: name(n),
transform(t),
boundsType(bt),
boundaryValues(bv),
children(std::move(cs)),
binning(bss),
axisDirections(adrs),
extent(e) {
for_each(children.begin(), children.end(),
[this](std::unique_ptr<Node>& c) { c->parent = this; });
Expand Down Expand Up @@ -95,10 +95,10 @@ struct Node final {
const Node* parent = nullptr;
/// Branch definitions: children
std::vector<std::unique_ptr<Node>> children = {};
/// Branch definition binning
std::vector<BinningValue> binning = {};
/// Branch definitions: direction of binning axes
std::vector<AxisDirection> axisDirections = {};

/// Portal proto material binning
/// Portal proto material: proto binnig of material
std::map<unsigned int, BinningDescription> portalMaterialBinning = {};

/// Auxiliary information
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 prescription of attachment
AxisDirection axisDirection{};
/// The root volume finder
std::shared_ptr<const IRootVolumeFinderBuilder> rootVolumeFinderBuilder =
nullptr;
Expand Down
14 changes: 7 additions & 7 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,23 +39,23 @@ 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 axis directions 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 = {};
/// Axis direction prescriptions for the attachment
std::vector<AxisDirection> axisDirections = {};
/// The root volume finder
std::shared_ptr<const IRootVolumeFinderBuilder> rootVolumeFinderBuilder =
nullptr;
/// The geometry id generator
std::shared_ptr<const IGeometryIdGenerator> geoIdGenerator = nullptr;
/// Material binning to be assigned to portals
/// Material axis binning directions to be assigned to portals
std::map<unsigned int, BinningDescription> portalMaterialBinning = {};
/// An eventual reverse geometry id generation
bool geoIdReverseGen = false;
Expand Down
5 changes: 1 addition & 4 deletions Core/include/Acts/Detector/DetectorVolume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ class Detector;
/// object ownership is done by shared/unique pointers.
class DetectorVolume : public std::enable_shared_from_this<DetectorVolume> {
public:
using BoundingBox =
Acts::AxisAlignedBoundingBox<Acts::Experimental::DetectorVolume, double,
3>;

using BoundingBox = AxisAlignedBoundingBox<DetectorVolume, double, 3>;
friend class DetectorVolumeFactory;

/// Nested object store that holds the internal (non-const),
Expand Down
11 changes: 6 additions & 5 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 @@ -24,9 +24,10 @@ class DetectorVolume;
/// delegates
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);
/// @brief Constructor with axis definition casts
///
/// @param axisDirections the cast values for the grid binning
IndexedRootVolumeFinderBuilder(std::vector<AxisDirection> axisDirections);

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

private:
std::vector<Acts::BinningValue> m_casts;
std::vector<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
2 changes: 1 addition & 1 deletion Core/include/Acts/Detector/LayerStructureBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include "Acts/Detector/interface/ISurfacesProvider.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/BinningData.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <array>
Expand Down
68 changes: 29 additions & 39 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 @@ -28,11 +27,11 @@ namespace Acts::Experimental {
/// translated into concrete axis types
struct ProtoBinning {
/// The binning value of this
BinningValue binValue;
AxisDirection axisDirection;
/// The axis type: equidistant or variable
Acts::AxisType axisType = Acts::AxisType::Equidistant;
AxisType axisType = AxisType::Equidistant;
/// The axis boundary type: Open, Bound or Closed
Acts::AxisBoundaryType boundaryType = Acts::AxisBoundaryType::Bound;
AxisBoundaryType axisBoundaryType = AxisBoundaryType::Bound;
/// The binning edges
std::vector<double> edges = {};
/// An expansion for the filling (in bins)
Expand All @@ -42,15 +41,15 @@ struct ProtoBinning {

/// Convenience constructors - for variable binning
///
/// @param bValue the value/cast in which this is binned
/// @param aDescr The axis description/direction for the binning
/// @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 aDescr, AxisBoundaryType bType,
const std::vector<double>& e, std::size_t exp = 0u)
: binValue(bValue),
axisType(Acts::AxisType::Variable),
boundaryType(bType),
: axisDirection(aDescr),
axisType(AxisType::Variable),
axisBoundaryType(bType),
edges(e),
expansion(exp) {
if (edges.size() < 2u) {
Expand All @@ -61,18 +60,18 @@ struct ProtoBinning {

/// Convenience constructors - for equidistant binning
///
/// @param bValue the value/cast in which this is binned
/// @param aDescr The axis description/direction for the binning
/// @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 aDescr, AxisBoundaryType bType, double minE,
double maxE, std::size_t nbins, std::size_t exp = 0u)
: binValue(bValue), boundaryType(bType), expansion(exp) {
: axisDirection(aDescr), axisBoundaryType(bType), expansion(exp) {
if (minE >= maxE) {
std::string msg = "ProtoBinning: Invalid binning for value '";
msg += binningValueName(bValue);
msg += axisDirectionToString(aDescr);
msg += "', min edge (" + std::to_string(minE) + ") ";
msg += " needs to be smaller than max edge (";
msg += std::to_string(maxE) + ").";
Expand All @@ -96,14 +95,14 @@ 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 aDescr The axis description/direction for the binning
/// @param bType the axis boundary type
/// @param nbins the number of bins
/// @param exp the expansion (in bins)
ProtoBinning(BinningValue bValue, Acts::AxisBoundaryType bType,
std::size_t nbins, std::size_t exp = 0u)
: binValue(bValue),
boundaryType(bType),
ProtoBinning(AxisDirection aDescr, AxisBoundaryType bType, std::size_t nbins,
std::size_t exp = 0u)
: axisDirection(aDescr),
axisBoundaryType(bType),
edges(nbins + 1, 0.),
expansion(exp),
autorange(true) {}
Expand All @@ -114,10 +113,8 @@ struct ProtoBinning {
// Screen output
std::string toString() const {
std::stringstream ss;
ss << "ProtoBinning: " << bins() << " bins in "
<< binningValueName(binValue);
ss << (axisType == Acts::AxisType::Variable ? ", variable "
: ", equidistant ");
ss << "ProtoBinning: " << bins() << " bins in " << axisDirection;
ss << axisType;
if (!autorange) {
ss << "within [" << edges.front() << ", " << edges.back() << "] ";
} else {
Expand All @@ -135,21 +132,17 @@ struct BinningDescription {
static BinningDescription fromBinUtility(const BinUtility& binUtility) {
BinningDescription bDesc;
for (const auto& bData : binUtility.binningData()) {
// One proto binning per binning data
Acts::AxisBoundaryType boundaryType =
bData.option == open ? Acts::AxisBoundaryType::Bound
: Acts::AxisBoundaryType::Closed;
std::vector<double> edges;
if (bData.type == equidistant) {
bDesc.binning.push_back(ProtoBinning(bData.binvalue, boundaryType,
bData.min, bData.max, bData.bins(),
0u));
if (bData.axisType == AxisType::Equidistant) {
bDesc.binning.push_back(ProtoBinning(bData.axisDirection,
bData.axisBoundaryType, bData.min,
bData.max, bData.bins(), 0u));

} else {
std::for_each(bData.boundaries().begin(), bData.boundaries().end(),
[&](double edge) { edges.push_back(edge); });
bDesc.binning.push_back(
ProtoBinning(bData.binvalue, boundaryType, edges, 0u));
bDesc.binning.push_back(ProtoBinning(
bData.axisDirection, bData.axisBoundaryType, edges, 0u));
}
}
return bDesc;
Expand All @@ -160,17 +153,14 @@ struct BinningDescription {
BinUtility toBinUtility() const {
BinUtility binUtility;
for (const auto& b : binning) {
Acts::BinningOption bOption =
b.boundaryType == Acts::AxisBoundaryType::Bound ? Acts::open
: Acts::closed;
if (b.axisType == Acts::AxisType::Equidistant) {
if (b.axisType == AxisType::Equidistant) {
binUtility += BinUtility(b.bins(), b.edges.front(), b.edges.back(),
bOption, b.binValue);
b.axisBoundaryType, b.axisDirection);
} 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, b.axisBoundaryType, b.axisDirection);
}
}
return binUtility;
Expand Down
10 changes: 5 additions & 5 deletions Core/include/Acts/Detector/ProtoDetector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include "Acts/Geometry/Extent.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/BinningData.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <functional>
Expand Down 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 for which the value 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 for which the value is propagated
void propagateMaxDown(AxisDirection aDir);

/// Constrain the daughter volumes with this volume
///
Expand Down
Loading
Loading