Skip to content

Commit

Permalink
refactor: Remove VolumeBoundsPtr typedef (#3032)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger authored Mar 13, 2024
1 parent dac4a44 commit 226c844
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 25 deletions.
3 changes: 2 additions & 1 deletion Core/include/Acts/Geometry/CylinderVolumeBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,8 @@ class CylinderVolumeBuilder : public ITrackingVolumeBuilder {
/// processing
MutableTrackingVolumePtr trackingVolume(
const GeometryContext& gctx, TrackingVolumePtr existingVolume = nullptr,
VolumeBoundsPtr externalBounds = nullptr) const override;
std::shared_ptr<const VolumeBounds> externalBounds =
nullptr) const override;

/// Set configuration method
///
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Geometry/CylinderVolumeHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper {
MutableTrackingVolumePtr createTrackingVolume(
const GeometryContext& gctx, const LayerVector& layers,
std::shared_ptr<const IVolumeMaterial> volumeMaterial,
VolumeBoundsPtr volumeBounds, MutableTrackingVolumeVector mtvVector = {},
std::shared_ptr<const VolumeBounds> volumeBounds,
MutableTrackingVolumeVector mtvVector = {},
const Transform3& transform = Transform3::Identity(),
const std::string& volumeName = "UndefinedVolume",
BinningType bType = arbitrary) const override;
Expand Down
3 changes: 1 addition & 2 deletions Core/include/Acts/Geometry/ITrackingVolumeBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Layer;
class Volume;
using TrackingVolumePtr = std::shared_ptr<const TrackingVolume>;
using MutableTrackingVolumePtr = std::shared_ptr<TrackingVolume>;
using VolumeBoundsPtr = std::shared_ptr<const VolumeBounds>;
using LayerPtr = std::shared_ptr<const Layer>;
using LayerVector = std::vector<LayerPtr>;
/// @class ITrackingVolumeBuilder
Expand Down Expand Up @@ -51,7 +50,7 @@ class ITrackingVolumeBuilder {
/// @return shared pointer to a newly created TrackingVolume
virtual MutableTrackingVolumePtr trackingVolume(
const GeometryContext& gctx, TrackingVolumePtr oppositeVolume = nullptr,
VolumeBoundsPtr outsideBounds = nullptr) const = 0;
std::shared_ptr<const VolumeBounds> outsideBounds = nullptr) const = 0;
};

} // namespace Acts
4 changes: 2 additions & 2 deletions Core/include/Acts/Geometry/ITrackingVolumeHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class IVolumeMaterial;
using LayerPtr = std::shared_ptr<const Layer>;
using TrackingVolumePtr = std::shared_ptr<const TrackingVolume>;
using MutableTrackingVolumePtr = std::shared_ptr<TrackingVolume>;
using VolumeBoundsPtr = std::shared_ptr<const VolumeBounds>;

using LayerVector = std::vector<LayerPtr>;
using TrackingVolumeVector = std::vector<TrackingVolumePtr>;
Expand Down Expand Up @@ -64,7 +63,8 @@ class ITrackingVolumeHelper {
virtual MutableTrackingVolumePtr createTrackingVolume(
const GeometryContext& gctx, const LayerVector& layers,
std::shared_ptr<const IVolumeMaterial> volumeMaterial,
VolumeBoundsPtr volumeBounds, MutableTrackingVolumeVector mtvVector = {},
std::shared_ptr<const VolumeBounds> volumeBounds,
MutableTrackingVolumeVector mtvVector = {},
const Transform3& transform = Transform3::Identity(),
const std::string& volumeName = "UndefinedVolume",
BinningType btype = arbitrary) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Geometry/TrackingGeometryBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TrackingGeometryBuilder : public ITrackingGeometryBuilder {
/// The list of tracking volume builders
std::vector<std::function<std::shared_ptr<TrackingVolume>(
const GeometryContext& gctx, const TrackingVolumePtr&,
const VolumeBoundsPtr&)>>
const std::shared_ptr<const VolumeBounds>&)>>
trackingVolumeBuilders;

/// The tracking volume helper for detector construction
Expand Down
12 changes: 8 additions & 4 deletions Core/include/Acts/Geometry/TrackingVolume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class TrackingVolume : public Volume {
///
/// @return shared pointer to a new TrackingVolume
static MutableTrackingVolumePtr create(
const Transform3& transform, VolumeBoundsPtr volumeBounds,
const Transform3& transform,
std::shared_ptr<const VolumeBounds> volumeBounds,
const std::shared_ptr<const TrackingVolumeArray>& containedVolumes =
nullptr,
const std::string& volumeName = "undefined") {
Expand All @@ -146,7 +147,8 @@ class TrackingVolume : public Volume {
///
/// @return shared pointer to a new TrackingVolume
static MutableTrackingVolumePtr create(
const Transform3& transform, VolumeBoundsPtr volumeBounds,
const Transform3& transform,
std::shared_ptr<const VolumeBounds> volumeBounds,
std::shared_ptr<const IVolumeMaterial> volumeMaterial,
std::unique_ptr<const LayerArray> containedLayers = nullptr,
std::shared_ptr<const TrackingVolumeArray> containedVolumes = nullptr,
Expand Down Expand Up @@ -435,7 +437,8 @@ class TrackingVolume : public Volume {
/// @param volbounds is the description of the volume boundaries
/// @param containedVolumeArray are the static volumes that fill this volume
/// @param volumeName is a string identifier
TrackingVolume(const Transform3& transform, VolumeBoundsPtr volbounds,
TrackingVolume(const Transform3& transform,
std::shared_ptr<const VolumeBounds> volbounds,
const std::shared_ptr<const TrackingVolumeArray>&
containedVolumeArray = nullptr,
const std::string& volumeName = "undefined");
Expand All @@ -452,7 +455,8 @@ class TrackingVolume : public Volume {
/// @param denseVolumeVector The contained dense volumes
/// @param volumeName is a string identifier
TrackingVolume(
const Transform3& transform, VolumeBoundsPtr volumeBounds,
const Transform3& transform,
std::shared_ptr<const VolumeBounds> volumeBounds,
std::shared_ptr<const IVolumeMaterial> volumeMaterial,
std::unique_ptr<const LayerArray> staticLayerArray = nullptr,
std::shared_ptr<const TrackingVolumeArray> containedVolumeArray = nullptr,
Expand Down
2 changes: 0 additions & 2 deletions Core/include/Acts/Geometry/VolumeBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ class Surface;
class VolumeBounds;
class Direction;

using VolumeBoundsPtr = std::shared_ptr<const VolumeBounds>;

using OrientedSurface = std::pair<std::shared_ptr<RegularSurface>, Direction>;
using OrientedSurfaces = std::vector<OrientedSurface>;

Expand Down
2 changes: 1 addition & 1 deletion Core/src/Geometry/CuboidVolumeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ std::shared_ptr<Acts::TrackingVolume> Acts::CuboidVolumeBuilder::buildVolume(

Acts::MutableTrackingVolumePtr Acts::CuboidVolumeBuilder::trackingVolume(
const GeometryContext& gctx, Acts::TrackingVolumePtr /*gctx*/,
Acts::VolumeBoundsPtr /*bounds*/) const {
std::shared_ptr<const VolumeBounds> /*bounds*/) const {
// Build volumes
std::vector<std::shared_ptr<TrackingVolume>> volumes;
volumes.reserve(m_cfg.volumeCfg.size());
Expand Down
2 changes: 1 addition & 1 deletion Core/src/Geometry/CylinderVolumeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void Acts::CylinderVolumeBuilder::setLogger(
std::shared_ptr<Acts::TrackingVolume>
Acts::CylinderVolumeBuilder::trackingVolume(
const GeometryContext& gctx, TrackingVolumePtr existingVolume,
VolumeBoundsPtr externalBounds) const {
std::shared_ptr<const VolumeBounds> externalBounds) const {
ACTS_DEBUG("Configured to build volume : " << m_cfg.volumeName);
if (existingVolume) {
ACTS_DEBUG("- will wrap/enclose : " << existingVolume->volumeName());
Expand Down
4 changes: 2 additions & 2 deletions Core/src/Geometry/CylinderVolumeHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ Acts::CylinderVolumeHelper::createTrackingVolume(
const Transform3 transform = Transform3(Translation3(0., 0., zPosition));
// call to the creation method with Bounds & Translation3
return createTrackingVolume(gctx, layers, volumeMaterial,
VolumeBoundsPtr(cBounds), mtvVector, transform,
volumeName, bType);
std::shared_ptr<const VolumeBounds>(cBounds),
mtvVector, transform, volumeName, bType);
}

std::shared_ptr<Acts::TrackingVolume>
Expand Down
5 changes: 3 additions & 2 deletions Core/src/Geometry/TrackingVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ISurfaceMaterial;
} // namespace Acts

Acts::TrackingVolume::TrackingVolume(
const Transform3& transform, VolumeBoundsPtr volbounds,
const Transform3& transform, std::shared_ptr<const VolumeBounds> volbounds,
const std::shared_ptr<const TrackingVolumeArray>& containedVolumeArray,
const std::string& volumeName)
: Volume(transform, std::move(volbounds)),
Expand All @@ -52,7 +52,8 @@ Acts::TrackingVolume::TrackingVolume(

// constructor for arguments
Acts::TrackingVolume::TrackingVolume(
const Transform3& transform, VolumeBoundsPtr volumeBounds,
const Transform3& transform,
std::shared_ptr<const VolumeBounds> volumeBounds,
std::shared_ptr<const IVolumeMaterial> volumeMaterial,
std::unique_ptr<const LayerArray> staticLayerArray,
std::shared_ptr<const TrackingVolumeArray> containedVolumeArray,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ ActsExamples::Telescope::buildDetector(
// The volume bounds is set to be a bit larger than either cubic with planes
// or cylinder with discs
auto length = positions.back() - positions.front();
Acts::VolumeBoundsPtr boundsVol = nullptr;
std::shared_ptr<const Acts::VolumeBounds> boundsVol = nullptr;
if (surfaceType == TelescopeSurfaceType::Plane) {
boundsVol = std::make_shared<const Acts::CuboidVolumeBounds>(
bounds[0] + 5._mm, bounds[1] + 5._mm, length + 10._mm);
Expand Down
4 changes: 2 additions & 2 deletions Plugins/DD4hep/src/ConvertDD4hepDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ std::unique_ptr<const TrackingGeometry> convertDD4hepDetector(

std::vector<std::function<std::shared_ptr<TrackingVolume>(
const GeometryContext&, const TrackingVolumePtr&,
const VolumeBoundsPtr&)>>
const std::shared_ptr<const VolumeBounds>&)>>
volumeFactories;

for (const auto& vb : volumeBuilders) {
volumeFactories.push_back(
[vb](const GeometryContext& vgctx,
const std::shared_ptr<const TrackingVolume>& inner,
const VolumeBoundsPtr&) {
const std::shared_ptr<const VolumeBounds>&) {
return vb->trackingVolume(vgctx, inner);
});
}
Expand Down
7 changes: 4 additions & 3 deletions Tests/UnitTests/Alignment/Kernel/AlignmentTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ struct TelescopeDetector {
// The volume transform
Translation3 transVol(0, 0, 0);
Transform3 trafoVol(rotation * transVol);
VolumeBoundsPtr boundsVol = std::make_shared<const CuboidVolumeBounds>(
rBounds->halfLengthX() + 10._mm, rBounds->halfLengthY() + 10._mm,
length + 10._mm);
std::shared_ptr<const VolumeBounds> boundsVol =
std::make_shared<const CuboidVolumeBounds>(
rBounds->halfLengthX() + 10._mm, rBounds->halfLengthY() + 10._mm,
length + 10._mm);

LayerArrayCreator::Config lacConfig;
LayerArrayCreator layArrCreator(
Expand Down

0 comments on commit 226c844

Please sign in to comment.