Class Acts::SurfaceArray¶
-
class SurfaceArray¶
Provides Surface binning in N dimensions.
Uses
Grid
under the hood to implement the storage and lookup Contains a lookup struct which talks to theGrid
and performs utility actions. This struct needs to be initialised externally and passed toSurfaceArray
on construction.Public Functions
Default constructor which takes a
SurfaceLookup
and a vector of surfaces.- Parameters
gridLookup – The grid storage.
SurfaceArray
does not fill it on its ownsurfaces – The input vector of surfaces. This is only for bookkeeping, so we can ask
transform – Optional additional transform for this SurfaceArray
Constructor with a single surface.
- Parameters
srf – The one and only surface
-
inline SurfaceVector &at(const Vector3 &position)¶
Get all surfaces in bin given by position.
- Parameters
position – the lookup position
- Returns
reference to
SurfaceVector
contained in bin at that position
-
inline const SurfaceVector &at(const Vector3 &position) const¶
Get all surfaces in bin given by position
pos
.- Parameters
position – the lookup position
- Returns
const reference to
SurfaceVector
contained in bin at that position
-
inline SurfaceVector &at(size_t bin)¶
Get all surfaces in bin given by global bin index
bin
.- Parameters
bin – the global bin index
- Returns
reference to
SurfaceVector
contained in bin
-
inline const SurfaceVector &at(size_t bin) const¶
Get all surfaces in bin given by global bin index.
- Parameters
bin – the global bin index
- Returns
const reference to
SurfaceVector
contained in bin
-
inline std::vector<BinningValue> binningValues() const¶
The binning values described by this surface grid lookup They are in order of the axes.
-
inline std::vector<const IAxis*> getAxes() const¶
Get vector of axes spanning the grid as
AnyAxis
.Note
The axes in the vector are copies. Only use for introspection and querying.
- Returns
vector of
AnyAxis
-
inline Vector3 getBinCenter(size_t bin)¶
Get the center of the bin identified by global bin index
bin
.- Parameters
bin – the global bin index
- Returns
Center position of the bin in global coordinates
-
inline bool isValidBin(size_t bin) const¶
Checks if global bin is valid.
Note
Valid means that the index points to a bin which is not a under or overflow bin or out of range in any axis.
- Parameters
bin – the global bin index
- Returns
bool if the bin is valid
-
inline const SurfaceVector &neighbors(const Vector3 &position) const¶
Get all surfaces in bin at
pos
and its neighbors.Note
The
SurfaceVector
will be combined. For technical reasons, the different bin content vectors have to be copied, so the resulting vector contains copies.- Parameters
position – The position to lookup as nominal
- Returns
Merged
SurfaceVector
of neighbors and nominal
-
inline size_t size() const¶
Get the size of the underlying grid structure including under/overflow bins.
- Returns
the size
-
inline const SurfaceVector &surfaces() const¶
Get all surfaces attached to this
SurfaceArray
.Note
This does not reflect the actual state of the grid. It only returns what was given in the constructor, without any checks if that is actually whats in the grid.
- Returns
Reference to
SurfaceVector
containing all surfaces
-
std::ostream &toStream(const GeometryContext &gctx, std::ostream &sl) const¶
String representation of this
SurfaceArray
.- Parameters
gctx – The current geometry context object, e.g. alignment
sl – Output stream to write to
- Returns
the output stream given as
sl
-
inline const Transform3 &transform() const¶
-
struct ISurfaceGridLookup¶
Base interface for all surface lookups.
Subclassed by Acts::SurfaceArray::SingleElementLookup, Acts::SurfaceArray::SurfaceGridLookup< Axes >
Public Functions
-
virtual ~ISurfaceGridLookup() = 0¶
Pure virtual destructor.
-
inline virtual std::vector<BinningValue> binningValues() const¶
The binning values described by this surface grid lookup They are in order of the axes (optional) and empty for eingle lookups.
-
virtual size_t completeBinning(const GeometryContext &gctx, const SurfaceVector &surfaces) = 0¶
Attempts to fix sub-optimal binning by filling closest Surfaces into empty bin.
- Parameters
gctx – The current geometry context object, e.g. alignment
surfaces – The surface pointers to fill
- Returns
number of bins that were filled
-
virtual size_t dimensions() const = 0¶
Get the number of dimensions of the grid.
- Returns
number of dimensions
-
virtual void fill(const GeometryContext &gctx, const SurfaceVector &surfaces) = 0¶
Fill provided surfaces into the contained
Grid
.- Parameters
gctx – The current geometry context object, e.g. alignment
surfaces – Input surface pointers
-
virtual std::vector<const IAxis*> getAxes() const = 0¶
Returns copies of the axes used in the grid as
AnyAxis
.Note
This returns copies. Use for introspection and querying.
- Returns
The axes
-
virtual Vector3 getBinCenter(size_t bin) const = 0¶
Gets the center position of bin
bin
in global coordinates.- Parameters
bin – the global bin index
- Returns
The bin center
-
virtual bool isValidBin(size_t bin) const = 0¶
Checks if global bin is valid.
Note
Valid means that the index points to a bin which is not a under or overflow bin or out of range in any axis.
- Parameters
bin – the global bin index
- Returns
bool if the bin is valid
-
virtual SurfaceVector &lookup(const Vector3 &position) = 0¶
Performs lookup at
pos
and returns bin content as reference.- Parameters
position – Lookup position
- Returns
SurfaceVector
at given bin
-
virtual const SurfaceVector &lookup(const Vector3 &position) const = 0¶
Performs lookup at
pos
and returns bin content as const reference.- Parameters
position – Lookup position
- Returns
SurfaceVector
at given bin
-
virtual SurfaceVector &lookup(size_t bin) = 0¶
Performs lookup at global bin and returns bin content as reference.
- Parameters
bin – Global lookup bin
- Returns
SurfaceVector
at given bin
-
virtual const SurfaceVector &lookup(size_t bin) const = 0¶
Performs lookup at global bin and returns bin content as const reference.
- Parameters
bin – Global lookup bin
- Returns
SurfaceVector
at given bin
-
virtual const SurfaceVector &neighbors(const Vector3 &position) const = 0¶
Performs a lookup at
pos
, but returns neighbors as well.- Parameters
position – Lookup position
- Returns
SurfaceVector
at given bin. Copy of all bins selected
-
virtual size_t size() const = 0¶
Returns the total size of the grid (including under/overflow bins)
- Returns
Size of the grid data structure
-
virtual ~ISurfaceGridLookup() = 0¶
-
struct SingleElementLookup : public Acts::SurfaceArray::ISurfaceGridLookup¶
Lookup implementation which wraps one element and always returns this element when lookup is called.
Public Functions
-
inline SingleElementLookup(SurfaceVector::value_type element)¶
Default constructor.
- Parameters
element – the one and only element.
-
inline virtual size_t completeBinning(const GeometryContext&, const SurfaceVector&) override¶
Comply with concept and provide completeBinning method.
Note
Does nothing
-
inline virtual size_t dimensions() const override¶
Get the number of dimensions.
- Returns
always 0
-
inline virtual void fill(const GeometryContext&, const SurfaceVector&) override¶
Comply with concept and provide fill method.
Note
Does nothing
-
inline virtual std::vector<const IAxis*> getAxes() const override¶
Returns an empty vector of
AnyAxis
.- Returns
empty vector
-
inline virtual Vector3 getBinCenter(size_t bin) const override¶
Gets the bin center, but always returns (0, 0, 0)
- Parameters
bin – is ignored
- Returns
(0, 0, 0)
-
inline virtual bool isValidBin(size_t bin) const override¶
Returns if the bin is valid (it is)
- Parameters
bin – is ignored
- Returns
always true
-
inline virtual SurfaceVector &lookup(const Vector3 &position) override¶
Lookup, always returns
element
.- Parameters
position – is ignored
- Returns
reference to vector containing only
element
-
inline virtual const SurfaceVector &lookup(const Vector3 &position) const override¶
Lookup, always returns
element
.- Parameters
position – is ignored
- Returns
reference to vector containing only
element
-
inline virtual SurfaceVector &lookup(size_t bin) override¶
Lookup, always returns
element
.- Parameters
bin – is ignored
- Returns
reference to vector containing only
element
-
inline virtual const SurfaceVector &lookup(size_t bin) const override¶
Lookup, always returns
element
.- Parameters
bin – is ignored
- Returns
reference to vector containing only
element
-
inline virtual const SurfaceVector &neighbors(const Vector3 &position) const override¶
Lookup, always returns
element
.- Parameters
position – is ignored
- Returns
reference to vector containing only
element
-
inline virtual size_t size() const override¶
returns 1
- Returns
1
-
inline SingleElementLookup(SurfaceVector::value_type element)¶
-
template<class ...Axes>
struct SurfaceGridLookup : public Acts::SurfaceArray::ISurfaceGridLookup¶ Lookup helper which encapsulates a
Grid
.- Template Parameters
Axes – The axes used for the grid
Public Types
-
using Grid_t = detail::Grid<SurfaceVector, Axes...>¶
-
using point_t = std::conditional_t<DIM == 1, std::array<double, 1>, ActsVector<DIM>>¶
Specifies the local coordinate type.
This resolves to
ActsVector<DIM>
for DIM > 1, elsestd::array<double, 1>
Public Functions
-
inline SurfaceGridLookup(std::function<point_t(const Vector3&)> globalToLocal, std::function<Vector3(const point_t&)> localToGlobal, std::tuple<Axes...> axes, std::vector<BinningValue> bValues = {})¶
Default constructor.
Note
Signature of localToGlobal and globalToLocal depends on
DIM
. If DIM > 1, local coords areActsVector<DIM>
elsestd::array<double, 1>
.- Parameters
globalToLocal – Callable that converts from global to local
localToGlobal – Callable that converts from local to global
axes – The axes to build the grid data structure.
bValues – What the axes represent (optional)
-
inline virtual std::vector<BinningValue> binningValues() const override¶
The binning values described by this surface grid lookup They are in order of the axes.
-
inline virtual size_t completeBinning(const GeometryContext &gctx, const SurfaceVector &surfaces) override¶
Attempts to fix sub-optimal binning by filling closest Surfaces into empty bins.
Note
This does not always do what you want.
- Parameters
gctx – The current geometry context object, e.g. alignment
surfaces – The surface pointers to fill
- Returns
number of bins that were filled
-
inline virtual size_t dimensions() const override¶
Get the number of dimensions of the grid.
- Returns
number of dimensions
-
inline virtual void fill(const GeometryContext &gctx, const SurfaceVector &surfaces) override¶
Fill provided surfaces into the contained
Grid
.This is done by iterating, accessing the binningPosition, lookup and append. Also populates the neighbor map by combining the filled bins of all bins around a given one.
- Parameters
gctx – The current geometry context object, e.g. alignment
surfaces – Input surface pointers
-
inline virtual std::vector<const IAxis*> getAxes() const override¶
Returns copies of the axes used in the grid as
AnyAxis
.Note
This returns copies. Use for introspection and querying.
- Returns
The axes
-
inline virtual Vector3 getBinCenter(size_t bin) const override¶
Gets the center position of bin
bin
in global coordinates.- Parameters
bin – the global bin index
- Returns
The bin center
-
inline virtual bool isValidBin(size_t bin) const override¶
Checks if global bin is valid.
Note
Valid means that the index points to a bin which is not a under or overflow bin or out of range in any axis.
- Parameters
bin – the global bin index
- Returns
bool if the bin is valid
-
inline virtual SurfaceVector &lookup(const Vector3 &position) override¶
Performs lookup at
pos
and returns bin content as reference.- Parameters
position – Lookup position
- Returns
SurfaceVector
at given bin
-
inline virtual const SurfaceVector &lookup(const Vector3 &position) const override¶
Performs lookup at
pos
and returns bin content as const reference.- Parameters
position – Lookup position
- Returns
SurfaceVector
at given bin
-
inline virtual SurfaceVector &lookup(size_t bin) override¶
Performs lookup at global bin and returns bin content as reference.
- Parameters
bin – Global lookup bin
- Returns
SurfaceVector
at given bin
-
inline virtual const SurfaceVector &lookup(size_t bin) const override¶
Performs lookup at global bin and returns bin content as const reference.
- Parameters
bin – Global lookup bin
- Returns
SurfaceVector
at given bin
-
inline virtual const SurfaceVector &neighbors(const Vector3 &position) const override¶
Performs a lookup at
pos
, but returns neighbors as well.- Parameters
position – Lookup position
- Returns
SurfaceVector
at given bin. Copy of all bins selected
-
inline virtual size_t size() const override¶
Returns the total size of the grid (including under/overflow bins)
- Returns
Size of the grid data structure