File Detector.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

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

Public Functions

inline const DetectorVolumeUpdator &detectorVolumeFinder() const

Const access to the volume finder.

const DetectorVolume *findDetectorVolume(const GeometryContext &gctx, const Vector3 &position) const

Find a volume from a position.

Note

this creates internally a NavigationState object

Parameters
  • gctx – is the Geometry context of the call

  • position – is the position of the call

Returns

the volume pointer or nullptr (if outside)

const DetectorVolume *findDetectorVolume(const std::string &name) const

Find a volume by name.

Parameters

name – with which the volume is searched for

Returns

the volume pointer or nullptr (if not found)

std::shared_ptr<Detector> 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 Detector> 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

inline const std::string &name() const

Return the name of the detector.

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

Update the current volume of a given navigation state.

Parameters
  • gctx – is the Geometry context of the call

  • nState – [in, out] is the navigation state

inline void updateDetectorVolumeFinder(DetectorVolumeUpdator &&mVolumeFinder)

Update the volume finder.

Parameters

mVolumeFinder – the new volume finder

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.

Returns

a vector to const DetectorVolume raw pointers

Public Static Functions

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

Factory for producing memory managed instances of Detector.

Will forward all parameters and will attempt to find a suitable constructor.

Template Parameters

Args – the arguments that will be forwarded

Protected Functions

Detector(const std::string &name, const std::vector<std::shared_ptr<DetectorVolume>> &volumes, DetectorVolumeUpdator &&volumeFinder) noexcept(false)

Create a detector from volumes.

Note

will throw an exception if volumes vector is empty

Note

will throw an exception if duplicate volume names exist

Note

will throw an exception if the delegate is not connected

Parameters
  • name – the detecor name

  • volumes – the objets contained by this detector

  • volumeFinder – is a Delegate to find the assocaited volume

Private Members

std::string m_name = "Unnamed"

Name of the detector.

DetectorVolumeUpdator m_volumeFinder

A volume finder delegate.

std::unordered_map<std::string, size_t> m_volumeNameIndex

Name/index map to find volumes by name and detect duplicates.

DetectorVolume::ObjectStore<std::shared_ptr<DetectorVolume>> m_volumes

Volume store (internal/external)