File DetectorVolume.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

namespace Experimental

Typedefs

using PortalGenerator = Delegate<std::vector<std::shared_ptr<Portal>>(const Transform3&, const VolumeBounds&, const std::shared_ptr<DetectorVolume>&)>

The Portal genertor definition.

struct AllPortalsExtractor
#include <Acts/Detector/DetectorVolume.hpp>

Helper extractors: all portals.

Public Static Functions

static inline const std::vector<const Portal*> extract([[maybe_unused]] const GeometryContext &gctx, const NavigationState &nState)

Extract the portals from the volume.

Parameters
  • gctx – the geometry contextfor this extraction call

  • nState – is the current navigation state

Returns

a vector of raw Portal pointers

struct AllSubVolumesExtractor
#include <Acts/Detector/DetectorVolume.hpp>

Helper extractors: all sub volumes of a volume.

Public Static Functions

static inline const std::vector<const DetectorVolume*> extract([[maybe_unused]] const GeometryContext &gctx, const NavigationState &nState, [[maybe_unused]] const std::vector<size_t> &indices = {})

Extract the sub volumes from the volume.

Parameters
  • gctx – the geometry contextfor this extraction call

  • nState – is the current navigation state

  • indices – are access indices into the volume store (ignored)

Returns

a vector of raw DetectorVolume pointers

struct AllSurfacesExtractor
#include <Acts/Detector/DetectorVolume.hpp>

Helper extractors: all surfaces.

Public Static Functions

static inline const std::vector<const Surface*> extract([[maybe_unused]] const GeometryContext &gctx, const NavigationState &nState, [[maybe_unused]] const std::vector<size_t> &indices = {})

Extract the surfaces from the volume.

Parameters
  • gctx – the geometry contextfor this extraction call

  • nState – is the current navigation state

  • indices – is an ignored index vector

Returns

a vector of raw Surface pointers

class DetectorVolume : public std::enable_shared_from_this<DetectorVolume>
#include <Acts/Detector/DetectorVolume.hpp>

A detector volume description which can be:

Note

A detector volume holds non-const objects internally that are allowed to be modified as long as the geometry is not yet closed. Using this, material can be attached, and GeometryIdentifier can be set at construction time.

Note

The construction of DetectorVolumes is done via a dedicated factory, this is necessary as then the shared_ptr is non-weak and it can be registred in the portal generator for further geometry processing.

Note

Navigation is always done by plain pointers, while object ownership is done by shared/unique pointers.

Public Types

using BoundingBox = Acts::AxisAlignedBoundingBox<Acts::Experimental::DetectorVolume, Acts::ActsScalar, 3>

Public Functions

inline void assignDetector(const Detector &detector)

Assign Detector to this volume (for back navigation issues)

Parameters

detector – the parenting detector class

void assignSurfaceCandidatesUpdator(SurfaceCandidatesUpdator &&surfaceCandidateUpdator, const std::vector<std::shared_ptr<Surface>> &surfaces = {}, const std::vector<std::shared_ptr<DetectorVolume>> &volumes = {})

This method allows to udate the navigation state updator module.

Parameters
  • surfaceCandidateUpdator – the new navigation state updator for surfaces

  • surfaces – the surfaces the new navigation state updator points to

  • volumes – the volumes the new navigation state updator points to

inline void assignVolumeMaterial(std::shared_ptr<IVolumeMaterial> material)

Assign the volume material description.

This method allows to load a material description during the detector geometry building, and assigning it (potentially multiple) times to detector volumes.

Parameters

material – Material description associated to this volumw

inline Vector3 center(const GeometryContext &gctx = GeometryContext()) const

Const access to the center.

Note

the geometry context is currently ignored, but is a placeholder for eventually misaligned volumes

Parameters

gctx – the geometry contect

Returns

a contextually created center

void closePortals()

Final closing of portal, i.e. this sets the end of world.

inline const Detector *detector() const

Const access to the detector.

Extent extent(const GeometryContext &gctx, size_t nseg = 1) const

The Extent for this volume.

Parameters
  • gctx – is the geometry context

  • nseg – is the number of segements to approximate

Returns

an Extent object

inline const GeometryIdentifier &geometryId() const
Returns

the geometry identifier

const BoundingBox &getBoundingBox() const
std::shared_ptr<DetectorVolume> getSharedPtr()

Retrieve a std::shared_ptr for this surface (non-const version)

Note

Will error if this was not created through the makeShared factory since it needs access to the original reference. In C++14 this is undefined behavior (but most likely implemented as a bad_weak_ptr exception), in C++17 it is defined as that exception.

Note

Only call this if you need shared ownership of this object.

Returns

The shared pointer

std::shared_ptr<const DetectorVolume> getSharedPtr() const

Retrieve a std::shared_ptr for this surface (const version)

Note

Will error if this was not created through the makeShared factory since it needs access to the original reference. In C++14 this is undefined behavior, but most likely implemented as a bad_weak_ptr exception, in C++17 it is defined as that exception.

Note

Only call this if you need shared ownership of this object.

Returns

The shared pointer

bool inside(const GeometryContext &gctx, const Vector3 &position, bool excludeInserts = true) const

Inside/outside method.

Parameters
  • gctx – the geometry context

  • position – the position for the inside check

  • excludeInserts – steers whether inserted volumes overwrite this

Returns

a bool to indicate inside/outside

inline const std::string &name() const
Returns

the name of the volume

inline std::vector<std::shared_ptr<Portal>> &portalPtrs()

Non-const access to the portals.

Returns

the portal shared pointer store

inline const std::vector<const Portal*> &portals() const

Const access to the detector portals.

Note

an empty vector indicates a container volume that has not been properly connected

Returns

a vector to const Portal raw pointers

inline const SurfaceCandidatesUpdator &surfaceCandidatesUpdator() const

Const access to the navigation state updator.

inline std::vector<std::shared_ptr<Surface>> &surfacePtrs()

Non-const access to the surfaces.

Returns

the surfaces shared pointer store

inline const std::vector<const Surface*> &surfaces() const

Const access to the surfaces.

Note

an empty vector indicates either gap volume or container volume, a non-empty vector indicates a layer volume.

Returns

a vector to const Surface raw pointers

inline const Transform3 &transform(const GeometryContext &gctx = GeometryContext()) const

Const access to the transform.

Note

the geometry context is currently ignored, but is a placeholder for eventually misaligned volumes

Parameters

gctx – the geometry contect

Returns

const reference to the contextual transform

void updateNavigationState(const GeometryContext &gctx, NavigationState &nState) const

Initialize/update the navigation status in this environment.

This method calls:

  • the local navigation delegate for candidate surfaces

  • the portal navigation delegate for candidate exit portals

  • set the current detector volume

Parameters
  • gctx – is the current geometry context

  • nState – [in,out] is the detector navigation state to be updated

void updatePortal(std::shared_ptr<Portal> portal, unsigned int pIndex) noexcept(false)

Update a portal given a portal index.

Note

throws exception if portal index out of bounds

Parameters
  • portal – the portal to be updated

  • pIndex – the portal index

inline const VolumeBounds &volumeBounds() const

Const access to the volume bounds.

Returns

const reference to the volume bounds object

inline const IVolumeMaterial *volumeMaterial() const

Const access to the volume amterial.

inline std::shared_ptr<IVolumeMaterial> volumeMaterialPtr()

Non-const access to the voume material (for scaling, e.g.)

inline std::vector<std::shared_ptr<DetectorVolume>> &volumePtrs()

Non-const access to the volumes.

Returns

the volumes shared pointer store

inline const std::vector<const DetectorVolume*> &volumes() const

Const access to sub volumes.

Note

and empty vector indicates this is either a gap volume or a layer volume, in any case it means the volume is on navigation level and the portals need to be connected

Returns

a vector to const DetectorVolume raw pointers

Protected Functions

DetectorVolume(const GeometryContext &gctx, const std::string &name, const Transform3 &transform, std::unique_ptr<VolumeBounds> bounds, const std::vector<std::shared_ptr<Surface>> &surfaces, const std::vector<std::shared_ptr<DetectorVolume>> &volumes, SurfaceCandidatesUpdator &&surfaceCandidateUpdator) noexcept(false)

Create a detector volume - with surfaces and/or inserted volumes.

Note

throws exception if misconfigured: no bounds

Note

throws exception if ghe portal general or navigation state updator delegates are not connected

Parameters
  • gctx – the geometry context while building - for future contextual store

  • name – the volume name

  • transform – the transform defining the volume position

  • bounds – the volume bounds

  • surfaces – are the contained surfaces of this volume

  • volumes – are the containes volumes of this volume

  • surfaceCandidateUpdator – the navigation state updator for surfaces/portals

DetectorVolume(const GeometryContext &gctx, const std::string &name, const Transform3 &transform, std::unique_ptr<VolumeBounds> bounds, SurfaceCandidatesUpdator &&surfaceCandidateUpdator) noexcept(false)

Create a detector volume - empty/gap volume constructor.

Note

throws exception if misconfigured: no bounds

Note

throws exception if ghe portal general or navigation state updator delegates are not connected

Parameters
  • gctx – the geometry context while building - for future contextual store

  • name – the volume name

  • transform – the transform defining the volume position

  • bounds – the volume bounds

  • surfaceCandidateUpdator – the navigation state updator for surfaces/portals

Protected Static Functions

template<typename ...Args>
static inline std::shared_ptr<DetectorVolume> makeShared(Args&&... args)

Private Functions

bool checkContainment(const GeometryContext &gctx, size_t nseg = 1) const
Parameters
  • gctx – the current geometry context object, e.g. alignment

  • nseg – is the number of segements to approximate

Returns

a boolean indicating if the objects are properly contained

void construct(const GeometryContext &gctx, const PortalGenerator &portalGenerator) noexcept(false)

Internal construction method that calls the portal generator.

Note

throws exception if provided parameters are inconsistent

Parameters
  • gctx – the current geometry context object, e.g. alignment

  • portalGenerator – the generator for portals

void createBoundingBox(const GeometryContext &gctx)

build the bounding box

Private Members

std::shared_ptr<const BoundingBox> m_boundingBox

BoundingBox.

std::unique_ptr<VolumeBounds> m_bounds = nullptr

Volume boundaries.

const Detector *m_detector = nullptr

The detector it belongs to.

GeometryIdentifier m_geometryId = {0}

GeometryIdentifier of this volume.

std::string m_name = "Unnamed"

Name of the volume.

ObjectStore<std::shared_ptr<Portal>> m_portals

Portal store (internal/external)

SurfaceCandidatesUpdator m_surfaceCandidatesUpdator

The navigation state updator.

ObjectStore<std::shared_ptr<Surface>> m_surfaces

Surface store (internal/external)

Transform3 m_transform = Transform3::Identity()

Transform to place the bolume.

std::shared_ptr<IVolumeMaterial> m_volumeMaterial = nullptr

Volume material (optional)

ObjectStore<std::shared_ptr<DetectorVolume>> m_volumes

Volume store (internal/external)

Friends

friend class DetectorVolumeFactory
template<typename internal_type>
struct ObjectStore
#include <Acts/Detector/DetectorVolume.hpp>

Nested object store that holds the internal (non-const), reference counted objects and provides an external (const raw pointer) access.

Template Parameters

internal_type – is the internal storage representation, has to comply with std::shared_ptr semantics

Public Functions

inline ObjectStore(const std::vector<internal_type> &objects)

Store constructor.

Parameters

objects – are the ones copied into the internal store

ObjectStore() = default

Public Members

std::vector<const typename internal_type::element_type*> external = {}

The external storage vector, const raw pointer.

std::vector<internal_type> internal = {}

The internal storage vector.

class DetectorVolumeFactory
#include <Acts/Detector/DetectorVolume.hpp>

A detector volume factory which first constructs the detector volume and then constructs the portals.

This ensures that the std::shared_ptr holding the detector volume is not weak when assigning to the portals.

Public Static Functions

template<typename ...Args>
static inline std::shared_ptr<DetectorVolume> construct(const PortalGenerator &portalGenerator, const GeometryContext &gctx, Args&&... args)

Create a detector volume - from factory.

Parameters
  • portalGenerator – the volume portal generator

  • gctx – the geometry context for construction and potential contextual store

  • args – the arguments forwarded to the detector volume contructor

Returns

a shared object DetectorVolume

struct IndexedSubVolumesExtractor
#include <Acts/Detector/DetectorVolume.hpp>

Helper extractors: indexed sub volume of a volume.

Public Static Functions

static inline const std::vector<const DetectorVolume*> extract([[maybe_unused]] const GeometryContext &gctx, const NavigationState &nState, const std::vector<size_t> &indices)

Extract the sub volumes from the volume.

Parameters
  • gctx – the geometry contextfor this extraction call

  • nState – is the current navigation state

  • indices – are access indices into the volume store

Returns

a vector of raw DetectorVolume pointers

struct IndexedSurfacesExtractor
#include <Acts/Detector/DetectorVolume.hpp>

Helper extractors: indexed surfaces.

Public Static Functions

static inline const std::vector<const Surface*> extract([[maybe_unused]] const GeometryContext &gctx, const NavigationState &nState, const std::vector<size_t> &indices)

Extract the surfaces from the volume.

Parameters
  • gctx – the geometry contextfor this extraction call

  • nState – is the current navigation state

  • indices – are access indices into the surfaces store

Returns

a vector of raw Surface pointers