26 class IVolumeMaterial;
31 std::shared_ptr<VolumeBounds>
bounds,
32 std::vector<std::shared_ptr<Surface>> surfaces,
33 std::vector<std::shared_ptr<DetectorVolume>>
volumes,
38 m_bounds(std::
move(bounds)),
39 m_surfaces(std::
move(surfaces)),
41 m_detectorVolumeUpdator(std::
move(detectorVolumeUpdator)),
42 m_surfaceCandidatesUpdator(std::
move(surfaceCandidateUpdator)),
43 m_volumeMaterial(nullptr) {
45 throw std::invalid_argument(
46 "DetectorVolume: construction with nullptr bounds.");
49 throw std::invalid_argument(
50 "DetectorVolume: navigation state updator delegate is not connected.");
53 throw std::invalid_argument(
54 "DetectorVolume: navigation state updator delegate is not connected.");
57 [[maybe_unused]]
const auto& gctx_ref =
gctx;
63 std::shared_ptr<VolumeBounds>
bounds,
68 std::shared_ptr<Acts::Experimental::DetectorVolume>
71 std::shared_ptr<VolumeBounds>
bounds,
72 std::vector<std::shared_ptr<Surface>> surfaces,
73 std::vector<std::shared_ptr<DetectorVolume>>
volumes,
82 std::shared_ptr<Acts::Experimental::DetectorVolume>
85 std::shared_ptr<VolumeBounds>
bounds,
87 return std::shared_ptr<DetectorVolume>(
104 return (*m_bounds.get());
107 std::vector<std::shared_ptr<Acts::Experimental::Portal>>&
109 return m_portals.internal;
112 std::vector<std::shared_ptr<Acts::Surface>>&
114 return m_surfaces.internal;
117 std::vector<std::shared_ptr<Acts::Experimental::DetectorVolume>>&
119 return m_volumes.internal;
122 const std::vector<const Acts::Experimental::Portal*>&
124 return m_portals.external;
127 const std::vector<const Acts::Surface*>&
129 return m_surfaces.external;
132 const std::vector<const Acts::Experimental::DetectorVolume*>&
134 return m_volumes.external;
139 return m_detectorVolumeUpdator;
144 return m_surfaceCandidatesUpdator;
148 std::shared_ptr<IVolumeMaterial>
material) {
152 std::shared_ptr<Acts::IVolumeMaterial>
154 return m_volumeMaterial;
159 return m_volumeMaterial.get();
169 m_geometryId = geoID;
180 for (
auto&
v : m_volumes.internal) {
181 v->assignDetector(detector);
191 std::shared_ptr<Portal> portal,
unsigned int pIndex) {
192 if (pIndex >= m_portals.internal.size()) {
193 throw std::invalid_argument(
194 "DetectorVolume: trying to update a portal that does not exist.");
196 m_portals.internal[pIndex] =
std::move(portal);
203 auto portalSurfaces =
206 createBoundingBox(gctx);
209 std::shared_ptr<Acts::Experimental::DetectorVolume>
211 return shared_from_this();
214 std::shared_ptr<const Acts::Experimental::DetectorVolume>
216 return shared_from_this();
222 return volumeBounds().inside(posInVolFrame);
227 if (!inside(gctx, position)) {
232 if (
v->inside(gctx, position)) {
242 m_surfaceCandidatesUpdator(gctx, nState);
248 const std::vector<std::shared_ptr<Surface>>& surfaces,
249 const std::vector<std::shared_ptr<DetectorVolume>>&
volumes) {
250 m_surfaceCandidatesUpdator =
std::move(surfaceCandidateUpdator);
258 for (
const auto*
p : portals()) {
260 p->surface().polyhedronRepresentation(gctx, nseg).extent());
268 auto volumeExtent = extent(gctx, nseg);
270 for (
const auto*
s : surfaces()) {
271 auto sExtent =
s->polyhedronRepresentation(gctx, nseg).extent();
272 if (not volumeExtent.contains(sExtent)) {
278 auto vExtent =
v->extent(gctx, nseg);
279 if (not volumeExtent.contains(vExtent)) {
288 for (
auto&
p : m_portals.internal) {
290 for (
auto [ivu, vu] :
enumerate(
p->detectorVolumeUpdators())) {
291 if (not vu.connected()) {
293 auto eow = std::make_unique<const EndOfWorldImpl>();
296 p->assignDetectorVolumeUpdator(eowDir,
std::move(eowLink), {});
301 for (
auto&
v : m_volumes.internal) {
309 for (
auto p : m_portals.external) {
310 auto surface =
p->surface().polyhedronRepresentation(gctx, 1);
311 auto pVertices =
surface.vertices;
312 for (
const auto&
v : pVertices) {
313 vertices.push_back(
v);
318 for (
const auto&
v : vertices) {
319 vmin = vmin.cwiseMin(
v);
320 vmax = vmax.cwiseMax(
v);
322 std::shared_ptr<Acts::Experimental::DetectorVolume::BoundingBox>
box =
323 std::make_shared<Acts::Experimental::DetectorVolume::BoundingBox>(
330 return *m_boundingBox;