ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::SurfaceArray Class Reference

Provides Surface binning in 2 dimensions. More...

#include <Acts/Surfaces/SurfaceArray.hpp>

Classes

struct  ISurfaceGridLookup
 Base interface for all surface lookups. More...
struct  SingleElementLookup
 Lookup implementation which wraps one element and always returns this element when lookup is called. More...
struct  SurfaceGridLookup
 Lookup helper which encapsulates a Grid. More...

Public Member Functions

 SurfaceArray (const GeometryContext &gctx, std::vector< std::shared_ptr< const Surface > > surfaces, std::shared_ptr< RegularSurface > representative, double tolerance, std::tuple< const IAxis &, const IAxis & > axes)
 Constructor to create a surface grid lookup for a given representative surface, tolerance, and axes.
 SurfaceArray (std::shared_ptr< const Surface > srf)
 Constructor with a single surface.
 SurfaceArray (std::unique_ptr< ISurfaceGridLookup > gridLookup, std::vector< std::shared_ptr< const Surface > > surfaces, const Transform3 &transform=Transform3::Identity())
 Default constructor which takes a SurfaceLookup and a vector of surfaces.
std::span< const Surface *const > at (const GeometryContext &gctx, const Vector3 &position, const Vector3 &direction) const
 Get all surfaces in bin given by position pos.
const std::vector< const Surface * > & at (const Vector3 &position, const Vector3 &direction) const
 Get all surfaces in bin given by position pos.
std::span< const Surface *const > at (std::array< std::size_t, 2 > gridIndices, std::uint8_t neighborDistance) const
 Get all surfaces in bin given by local grid indices and neighbor distance.
std::vector< const Surface * > & at (std::size_t bin)
 Get all surfaces in bin given by global bin index bin.
const std::vector< const Surface * > & at (std::size_t bin) const
 Get all surfaces in bin given by global bin index.
std::vector< AxisDirectionbinningValues () const
 The binning values described by this surface grid lookup.
std::vector< const IAxis * > getAxes () const
 Get vector of axes spanning the grid as AnyAxis.
Vector3 getBinCenter (std::size_t bin) const
 Get the center of the bin identified by global bin index bin.
const ISurfaceGridLookupgridLookup () const
 Return the lookup object.
bool isValidBin (std::size_t bin) const
 Checks if global bin is valid.
std::uint8_t maxNeighborDistance () const
 Get the maximum neighbor distance that is supported by this lookup.
std::span< const Surface *const > neighbors (const GeometryContext &gctx, const Vector3 &position, const Vector3 &direction) const
 Get all surfaces in bin at pos and its neighbors.
const std::vector< const Surface * > & neighbors (const Vector3 &position, const Vector3 &direction) const
 Get all surfaces in bin at pos and its neighbors.
std::array< std::size_t, 2 > numLocalBins () const
 Get the number of local bins in each dimension.
std::size_t size () const
 Get the size of the underlying grid structure including under/overflow bins.
const SurfacesurfaceRepresentation () const
 Get the representative surface used for this surface array.
const std::vector< const Surface * > & surfaces () const
 Get all surfaces attached to this SurfaceArray.
std::ostream & toStream (const GeometryContext &gctx, std::ostream &sl) const
 Get string representation of this SurfaceArray.
const Transform3transform () const
 Get the transform of this surface array.

Detailed Description

Provides Surface binning in 2 dimensions.

Uses Grid under the hood to implement the storage and lookup Contains a lookup struct which talks to the Grid and performs utility actions. This struct needs to be initialised externally and passed to SurfaceArray on construction.

Constructor & Destructor Documentation

◆ SurfaceArray() [1/3]

Acts::SurfaceArray::SurfaceArray ( std::unique_ptr< ISurfaceGridLookup > gridLookup,
std::vector< std::shared_ptr< const Surface > > surfaces,
const Transform3 & transform = Transform3::Identity() )

Default constructor which takes a SurfaceLookup and a vector of surfaces.

Parameters
gridLookupThe grid storage. SurfaceArray does not fill it on its own
surfacesThe input vector of surfaces. This is only for bookkeeping, so we can ask
transformOptional additional transform for this SurfaceArray

◆ SurfaceArray() [2/3]

Acts::SurfaceArray::SurfaceArray ( std::shared_ptr< const Surface > srf)
explicit

Constructor with a single surface.

Parameters
srfThe one and only surface

◆ SurfaceArray() [3/3]

Acts::SurfaceArray::SurfaceArray ( const GeometryContext & gctx,
std::vector< std::shared_ptr< const Surface > > surfaces,
std::shared_ptr< RegularSurface > representative,
double tolerance,
std::tuple< const IAxis &, const IAxis & > axes )

Constructor to create a surface grid lookup for a given representative surface, tolerance, and axes.

Parameters
gctxThe current geometry context object, e.g. alignment
surfacesThe input vector of surfaces that will be accessible through this SurfaceArray.
representativeThe surface which is used as representative
toleranceThe tolerance used for intersection checks
axesThe axes used for the grid

Member Function Documentation

◆ at() [1/5]

std::span< const Surface *const > Acts::SurfaceArray::at ( const GeometryContext & gctx,
const Vector3 & position,
const Vector3 & direction ) const

Get all surfaces in bin given by position pos.

Parameters
gctxThe current geometry context object, e.g. alignment
positionthe lookup position
directionthe lookup direction
Returns
span of surface pointers of the bin at that position

◆ at() [2/5]

const std::vector< const Surface * > & Acts::SurfaceArray::at ( const Vector3 & position,
const Vector3 & direction ) const

Get all surfaces in bin given by position pos.

Parameters
positionthe lookup position
directionthe lookup direction
Returns
const reference to surface vector contained in bin at that position

◆ at() [3/5]

std::span< const Surface *const > Acts::SurfaceArray::at ( std::array< std::size_t, 2 > gridIndices,
std::uint8_t neighborDistance ) const

Get all surfaces in bin given by local grid indices and neighbor distance.

Parameters
gridIndicesthe local grid indices
neighborDistancethe neighbor distance to include in the lookup
Returns
span of surface pointers of the bin at that position and its neighbors

◆ at() [4/5]

std::vector< const Surface * > & Acts::SurfaceArray::at ( std::size_t bin)

Get all surfaces in bin given by global bin index bin.

Parameters
binthe global bin index
Returns
mutable reference to surface vector contained in bin

◆ at() [5/5]

const std::vector< const Surface * > & Acts::SurfaceArray::at ( std::size_t bin) const

Get all surfaces in bin given by global bin index.

Parameters
binthe global bin index
Returns
const reference to surface vector contained in bin

◆ binningValues()

std::vector< AxisDirection > Acts::SurfaceArray::binningValues ( ) const

The binning values described by this surface grid lookup.

They are in order of the axes

Returns
Vector of axis directions for binning

◆ getAxes()

std::vector< const IAxis * > Acts::SurfaceArray::getAxes ( ) const

Get vector of axes spanning the grid as AnyAxis.

Returns
vector of AnyAxis
Note
The axes in the vector are copies. Only use for introspection and querying.

◆ getBinCenter()

Vector3 Acts::SurfaceArray::getBinCenter ( std::size_t bin) const

Get the center of the bin identified by global bin index bin.

Parameters
binthe global bin index
Returns
Center position of the bin in global coordinates

◆ gridLookup()

const ISurfaceGridLookup & Acts::SurfaceArray::gridLookup ( ) const

Return the lookup object.

Returns
Reference to the surface grid lookup interface

◆ isValidBin()

bool Acts::SurfaceArray::isValidBin ( std::size_t bin) const

Checks if global bin is valid.

Parameters
binthe global bin index
Returns
bool if the 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.

◆ maxNeighborDistance()

std::uint8_t Acts::SurfaceArray::maxNeighborDistance ( ) const

Get the maximum neighbor distance that is supported by this lookup.

This is used to determine how many neighbors to include in neighbor lookups.

Returns
Maximum neighbor distance

◆ neighbors() [1/2]

std::span< const Surface *const > Acts::SurfaceArray::neighbors ( const GeometryContext & gctx,
const Vector3 & position,
const Vector3 & direction ) const

Get all surfaces in bin at pos and its neighbors.

Parameters
gctxThe current geometry context object, e.g. alignment
positionThe position to lookup
directionThe direction to lookup
Returns
span of surface pointers of neighbors and nominal

◆ neighbors() [2/2]

const std::vector< const Surface * > & Acts::SurfaceArray::neighbors ( const Vector3 & position,
const Vector3 & direction ) const

Get all surfaces in bin at pos and its neighbors.

Parameters
positionThe position to lookup
directionThe direction to lookup
Returns
Merged surface vector of neighbors and nominal

◆ numLocalBins()

std::array< std::size_t, 2 > Acts::SurfaceArray::numLocalBins ( ) const

Get the number of local bins in each dimension.

This is used to determine the size of the grid for neighbor lookups.

Returns
Array of number of local bins in each dimension

◆ size()

std::size_t Acts::SurfaceArray::size ( ) const

Get the size of the underlying grid structure including under/overflow bins.

Returns
the size

◆ surfaceRepresentation()

const Surface * Acts::SurfaceArray::surfaceRepresentation ( ) const

Get the representative surface used for this surface array.

Returns
Surface pointer

◆ surfaces()

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

Get all surfaces attached to this SurfaceArray.

Returns
Reference to vector of all surfaces
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 what's in the grid.

◆ toStream()

std::ostream & Acts::SurfaceArray::toStream ( const GeometryContext & gctx,
std::ostream & sl ) const

Get string representation of this SurfaceArray.

Parameters
gctxThe current geometry context object, e.g. alignment
slOutput stream to write to
Returns
the output stream given as sl

◆ transform()

const Transform3 & Acts::SurfaceArray::transform ( ) const

Get the transform of this surface array.

Returns
Reference to the transformation matrix
Deprecated
This is an implementation detail and will be removed soon