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

feat(geo): TrackingVolume gets surface storage #3675

Merged
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
20 changes: 20 additions & 0 deletions Core/include/Acts/Geometry/TrackingVolume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,25 @@ class TrackingVolume : public Volume {
/// @param portal The portal to add
void addPortal(std::shared_ptr<Portal> portal);

using MutableSurfaceRange =
detail::TransformRange<detail::Dereference,
std::vector<std::shared_ptr<Surface>>>;
using SurfaceRange =
detail::TransformRange<detail::ConstDereference,
const std::vector<std::shared_ptr<Surface>>>;

/// Return all surfaces registered under this tracking volume
/// @return the range of surfaces
SurfaceRange surfaces() const;

/// Return mutable view of the registered surfaces under this tracking volume
/// @return the range of surfaces
MutableSurfaceRange surfaces();

/// Add a surface to this tracking volume
/// @param surface The surface to add
void addSurface(std::shared_ptr<Surface> surface);

/// Add a child volume to this tracking volume
/// @param volume The volume to add
/// @note The @p volume will have its mother volume assigned to @p this.
Expand Down Expand Up @@ -516,6 +535,7 @@ class TrackingVolume : public Volume {

std::vector<std::unique_ptr<TrackingVolume>> m_volumes;
std::vector<std::shared_ptr<Portal>> m_portals;
std::vector<std::shared_ptr<Surface>> m_surfaces;
};

} // namespace Acts
18 changes: 18 additions & 0 deletions Core/src/Geometry/TrackingVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,25 @@ TrackingVolume::MutablePortalRange TrackingVolume::portals() {
}

void TrackingVolume::addPortal(std::shared_ptr<Portal> portal) {
if (portal == nullptr) {
throw std::invalid_argument("Portal is nullptr");
}
m_portals.push_back(std::move(portal));
}

TrackingVolume::SurfaceRange TrackingVolume::surfaces() const {
return SurfaceRange{m_surfaces};
}

TrackingVolume::MutableSurfaceRange TrackingVolume::surfaces() {
return MutableSurfaceRange{m_surfaces};
}

void TrackingVolume::addSurface(std::shared_ptr<Surface> surface) {
if (surface == nullptr) {
throw std::invalid_argument("Surface is nullptr");
}
m_surfaces.push_back(std::move(surface));
}

} // namespace Acts
Loading