Skip to content

Commit

Permalink
Merge branch 'main' into AddClusterizationWithTime
Browse files Browse the repository at this point in the history
  • Loading branch information
CarloVarni authored Oct 2, 2024
2 parents ea0b2fc + d468122 commit 21ade8b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CI/test_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def call(cmd):

ret, gcovr_version_text = check_output(["gcovr", "--version"])
gcovr_version = tuple(
map(int, re.match("gcovr (\d+\.\d+)", gcovr_version_text).group(1).split("."))
map(int, re.match(r"gcovr (\d+\.\d+)", gcovr_version_text).group(1).split("."))
)

extra_flags = []
Expand All @@ -63,7 +63,7 @@ def call(cmd):
if not os.path.exists(coverage_dir):
os.makedirs(coverage_dir)

excludes = ["-e", "../Tests/", "-e", ".*json\.hpp"]
excludes = ["-e", "../Tests/", "-e", r".*json\.hpp"]

# create the html report
call(
Expand Down
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

0 comments on commit 21ade8b

Please sign in to comment.