Skip to content

Commit

Permalink
refactor!: remove ProtoBinning in favour of ProtoAxis (#4046)
Browse files Browse the repository at this point in the history
This PR removes the `ProtoBinning` and changes it to the new `ProtoAxis`. For a bit of time, it will be possible to create a `BinUtility` from one or more `ProtoAxis`, but this will disappear with the phase out of `BinUtility` and `BinnedArray`.

To do still on this PR:
- [x] Check that Gen3 works with this already
- [x] Make Gen2 geometry work again
- [x] Make UnitTests work again
- [x] Add additional UnitTests for the new functionality of `ProtoAxis` (mainly copying and assignment)
- [x] Add additional UnitTests for the new functionality of `BinUtility` (albeit will vanish)

The compilation of the `LayerStructure` got heavier as expected. As discussed, this could/should be tackled in the future with abstracting the function body away that does the filling, etc.
  • Loading branch information
asalzburger authored Feb 27, 2025
1 parent eff8cee commit d3969aa
Show file tree
Hide file tree
Showing 55 changed files with 783 additions and 880 deletions.
4 changes: 2 additions & 2 deletions Core/include/Acts/Detector/Blueprint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Common.hpp"
#include "Acts/Detector/ProtoBinning.hpp"
#include "Acts/Geometry/Extent.hpp"
#include "Acts/Geometry/VolumeBounds.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/ProtoAxis.hpp"
#include "Acts/Utilities/StringHelpers.hpp"

#include <map>
Expand Down Expand Up @@ -99,7 +99,7 @@ struct Node final {
std::vector<AxisDirection> binning = {};

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

/// Auxiliary information
std::vector<std::string> auxiliary = {};
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Detector/CylindricalContainerBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

#include "Acts/Detector/Blueprint.hpp"
#include "Acts/Detector/DetectorComponents.hpp"
#include "Acts/Detector/ProtoBinning.hpp"
#include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "Acts/Utilities/ProtoAxis.hpp"

#include <map>
#include <memory>
Expand Down Expand Up @@ -56,7 +56,7 @@ class CylindricalContainerBuilder : public IDetectorComponentBuilder {
/// The geometry id generator
std::shared_ptr<const IGeometryIdGenerator> geoIdGenerator = nullptr;
/// Material binning to be assigned to portals
std::map<unsigned int, BinningDescription> portalMaterialBinning = {};
std::map<unsigned int, std::vector<ProtoAxis>> portalMaterialBinning = {};
/// An eventual reverse geometry id generation
bool geoIdReverseGen = false;
/// Auxiliary information, mainly for screen output
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Detector/DetectorVolumeBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#pragma once

#include "Acts/Detector/DetectorComponents.hpp"
#include "Acts/Detector/ProtoBinning.hpp"
#include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "Acts/Utilities/ProtoAxis.hpp"

#include <memory>
#include <string>
Expand Down Expand Up @@ -43,7 +43,7 @@ class DetectorVolumeBuilder : public IDetectorComponentBuilder {
/// The geometry id generator
std::shared_ptr<const IGeometryIdGenerator> geoIdGenerator = nullptr;
/// Material binning to be assigned to portals
std::map<unsigned int, BinningDescription> portalMaterialBinning = {};
std::map<unsigned int, std::vector<ProtoAxis>> portalMaterialBinning = {};
/// Add eventual internal volume to root
bool addInternalsToRoot = false;
/// Auxiliary information
Expand Down
7 changes: 3 additions & 4 deletions Core/include/Acts/Detector/LayerStructureBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Detector/DetectorComponents.hpp"
#include "Acts/Detector/ProtoBinning.hpp"
#include "Acts/Detector/ProtoSupport.hpp"
#include "Acts/Detector/interface/IInternalStructureBuilder.hpp"
#include "Acts/Detector/interface/ISurfacesProvider.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/BinningData.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "Acts/Utilities/ProtoAxis.hpp"

#include <array>
#include <cstddef>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <vector>

namespace Acts::Experimental {
Expand Down Expand Up @@ -84,7 +83,7 @@ class LayerStructureBuilder : public IInternalStructureBuilder {
/// Definition of Supports
std::vector<ProtoSupport> supports = {};
/// Definition of Binnings
std::vector<ProtoBinning> binnings = {};
std::vector<std::tuple<ProtoAxis, std::size_t>> binnings = {};
/// Optional extent (if already parsed), will trigger binning autorange
/// check
std::optional<Extent> extent = std::nullopt;
Expand Down
5 changes: 3 additions & 2 deletions Core/include/Acts/Detector/MultiWireStructureBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
#pragma once

#include "Acts/Detector/LayerStructureBuilder.hpp"
#include "Acts/Detector/ProtoBinning.hpp"
#include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
#include "Acts/Detector/interface/IExternalStructureBuilder.hpp"
#include "Acts/Detector/interface/IInternalStructureBuilder.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "Acts/Utilities/ProtoAxis.hpp"

#include <iostream>
#include <string>
#include <tuple>
#include <vector>

namespace Acts::Experimental {
Expand All @@ -41,7 +42,7 @@ class MultiWireStructureBuilder {
std::vector<double> mlBounds = {};

// The binning of the multi wire structure
std::vector<ProtoBinning> mlBinning = {};
std::vector<std::tuple<ProtoAxis, std::size_t>> mlBinning = {};

/// A tolerance config
float toleranceOverlap = 10.;
Expand Down
192 changes: 0 additions & 192 deletions Core/include/Acts/Detector/ProtoBinning.hpp

This file was deleted.

4 changes: 2 additions & 2 deletions Core/include/Acts/Detector/ProtoSupport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Common.hpp"
#include "Acts/Detector/ProtoBinning.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/AxisDefinitions.hpp"
#include "Acts/Utilities/BinningData.hpp"
#include "Acts/Utilities/ProtoAxis.hpp"

#include <optional>
#include <stdexcept>
Expand Down Expand Up @@ -63,7 +63,7 @@ struct ProtoSupport {
std::shared_ptr<Surface> surface = nullptr;

/// The (optional) binning description for proto material
std::optional<BinningDescription> protoMaterialBinning = std::nullopt;
std::optional<std::vector<ProtoAxis>> protoMaterialBinning = std::nullopt;

/// Potential splits into planar approximations (valid for cylinder/disc)
unsigned int splits = 1u;
Expand Down
Loading

0 comments on commit d3969aa

Please sign in to comment.