ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::GridPortalLink Class Referenceabstract

GridPortalLink implements a subdivided surface where the target volume depends on the position on the surface. More...

#include <Acts/Geometry/GridPortalLink.hpp>

Inheritance diagram for Acts::GridPortalLink:
[legend]
Collaboration diagram for Acts::GridPortalLink:
[legend]

Public Member Functions

 ~GridPortalLink () override
 Override the destructor so we can get away with forward declaration of TrivialPortalLink.
std::span< const TrivialPortalLinkartifactPortalLinks () const
 Get the artifact portal links.
virtual unsigned int dim () const =0
 Get the number of dimensions of the grid.
AxisDirection direction () const
 The binning direction of the grid.
virtual std::unique_ptr< GridPortalLinkextendTo2d (const IAxis *other) const =0
 Expand a 1D grid to a 2D one, by using the provided axis along the missing direction.
virtual const IGridgrid () const =0
 Return the associated grid in a type-erased form.
virtual IGridgrid ()=0
 Return the associated grid in a type-erased form.
void printContents (std::ostream &os) const
 Helper function that prints a textual representation of the grid with the volume names.
void setArtifactPortalLinks (std::vector< TrivialPortalLink > links)
 Set the artifact portal links.
virtual void setVolume (TrackingVolume *volume)=0
 Set the volume on all grid bins.

Static Public Member Functions

static void fillMergedGrid (const GridPortalLink &a, const GridPortalLink &b, GridPortalLink &merged, AxisDirection direction, const Logger &logger)
 Helper function to fill the bin contents after merging.
static std::unique_ptr< GridPortalLinkmake (const std::shared_ptr< RegularSurface > &surface, TrackingVolume &volume, AxisDirection direction)
 Factory function for an automatically sized one-dimensional grid.
template<AxisConcept axis_1_t, AxisConcept axis_2_t>
static std::unique_ptr< GridPortalLinkT< axis_1_t, axis_2_t > > make (std::shared_ptr< RegularSurface > surface, axis_1_t axis1, axis_2_t axis2)
 Factory function for a two-dimensional grid portal link, which allows using template deduction to figure out the right type.
template<AxisConcept axis_t>
static std::unique_ptr< GridPortalLinkT< axis_t > > make (std::shared_ptr< RegularSurface > surface, AxisDirection direction, axis_t &&axis)
 Factory function for a one-dimensional grid portal link, which allows using template deduction to figure out the right type.
static std::unique_ptr< PortalLinkBasemerge (const GridPortalLink &a, const GridPortalLink &b, AxisDirection direction, const Logger &logger=getDummyLogger())
 Merge two grid portal links into a single one.

Protected Types

enum class  FillDirection { loc0 , loc1 }
 Helper enum to declare which local direction to fill. More...

Protected Member Functions

 GridPortalLink (std::shared_ptr< RegularSurface > surface, AxisDirection direction)
 Constructor from a surface and a direction, for initialization by derived class.
std::unique_ptr< GridPortalLinkextendTo2dImpl (const std::shared_ptr< CylinderSurface > &surface, const IAxis *other) const
 Expand a 1D grid to a 2D one for a cylinder surface.
std::unique_ptr< GridPortalLinkextendTo2dImpl (const std::shared_ptr< DiscSurface > &surface, const IAxis *other) const
 Expand a 1D grid to a 2D one for a disc surface.
std::unique_ptr< GridPortalLinkextendTo2dImpl (const std::shared_ptr< PlaneSurface > &surface, const IAxis *other) const
 Expand a 1D grid to a 2D one for a plane surface.

Static Protected Member Functions

static void checkConsistency (const IGrid &grid, AxisDirection direction, const CylinderSurface &cyl)
 Helper function to check consistency for grid on a cylinder surface.
static void checkConsistency (const IGrid &grid, AxisDirection direction, const DiscSurface &disc)
 Helper function to check consistency for grid on a disc surface.
static void checkConsistency (const IGrid &grid, AxisDirection direction, const PlaneSurface &plane)
 Helper function to check consistency for grid on a plane surface.
static void fillGrid1dTo2d (FillDirection dir, const GridPortalLink &grid1d, GridPortalLink &grid2d)
 Helper function to fill a 2D grid from a 1D grid, by extending all bins along the different direction.

Additional Inherited Members

Detailed Description

GridPortalLink implements a subdivided surface where the target volume depends on the position on the surface.

The link can be in two states:

  1. One-dimensional binning with an associated direction to determine which local coordinate to use for the lookup
  2. Two-dimensional binning
    Note
    The grid dimensions and boundaries are required (and checked) to be consistent with the surface bounds.

Member Enumeration Documentation

◆ FillDirection

enum class Acts::GridPortalLink::FillDirection
strongprotected

Helper enum to declare which local direction to fill.

Enumerator
loc0 
loc1 

Constructor & Destructor Documentation

◆ GridPortalLink()

Acts::GridPortalLink::GridPortalLink ( std::shared_ptr< RegularSurface > surface,
AxisDirection direction )
protected

Constructor from a surface and a direction, for initialization by derived class.

Parameters
surfaceThe surface
directionThe binning direction

◆ ~GridPortalLink()

Acts::GridPortalLink::~GridPortalLink ( )
override

Override the destructor so we can get away with forward declaration of TrivialPortalLink.

Member Function Documentation

◆ artifactPortalLinks()

std::span< const TrivialPortalLink > Acts::GridPortalLink::artifactPortalLinks ( ) const

Get the artifact portal links.

Returns
Span of artifact portal links

◆ checkConsistency() [1/3]

void Acts::GridPortalLink::checkConsistency ( const IGrid & grid,
AxisDirection direction,
const CylinderSurface & cyl )
staticprotected

Helper function to check consistency for grid on a cylinder surface.

Parameters
gridthe grid to check
directionThe binning direction
cylThe cylinder surface

◆ checkConsistency() [2/3]

void Acts::GridPortalLink::checkConsistency ( const IGrid & grid,
AxisDirection direction,
const DiscSurface & disc )
staticprotected

Helper function to check consistency for grid on a disc surface.

Parameters
gridthe grid to check
directionThe binning direction
discThe disc surface

◆ checkConsistency() [3/3]

void Acts::GridPortalLink::checkConsistency ( const IGrid & grid,
AxisDirection direction,
const PlaneSurface & plane )
staticprotected

Helper function to check consistency for grid on a plane surface.

Parameters
gridthe grid to check
directionThe binning direction
planeThe plane surface

◆ dim()

virtual unsigned int Acts::GridPortalLink::dim ( ) const
pure virtual

Get the number of dimensions of the grid.

Returns
The number of dimensions

Implemented in Acts::GridPortalLinkT< Axes >.

◆ direction()

AxisDirection Acts::GridPortalLink::direction ( ) const

The binning direction of the grid.

Note
For 2D grids, this will always be the loc0 direction, depending on the surface type.
Returns
The binning direction

◆ extendTo2d()

virtual std::unique_ptr< GridPortalLink > Acts::GridPortalLink::extendTo2d ( const IAxis * other) const
pure virtual

Expand a 1D grid to a 2D one, by using the provided axis along the missing direction.

Parameters
otherThe axis to use for the missing direction, can be null for auto determination
Returns
A unique pointer to the 2D grid portal link

Implemented in Acts::GridPortalLinkT< Axes >.

◆ extendTo2dImpl() [1/3]

std::unique_ptr< GridPortalLink > Acts::GridPortalLink::extendTo2dImpl ( const std::shared_ptr< CylinderSurface > & surface,
const IAxis * other ) const
protected

Expand a 1D grid to a 2D one for a cylinder surface.

Parameters
surfaceThe cylinder surface
otherThe axis to use for the missing direction, can be null for auto determination
Returns
A unique pointer to the 2D grid portal link

◆ extendTo2dImpl() [2/3]

std::unique_ptr< GridPortalLink > Acts::GridPortalLink::extendTo2dImpl ( const std::shared_ptr< DiscSurface > & surface,
const IAxis * other ) const
protected

Expand a 1D grid to a 2D one for a disc surface.

Parameters
surfaceThe disc surface
otherThe axis to use for the missing direction, can be null for auto determination
Returns
A unique pointer to the 2D grid portal link

◆ extendTo2dImpl() [3/3]

std::unique_ptr< GridPortalLink > Acts::GridPortalLink::extendTo2dImpl ( const std::shared_ptr< PlaneSurface > & surface,
const IAxis * other ) const
protected

Expand a 1D grid to a 2D one for a plane surface.

Parameters
surfaceThe plane surface
otherThe axis to use for the missing direction, can be null for auto determination
Returns
A unique pointer to the 2D grid portal link

◆ fillGrid1dTo2d()

void Acts::GridPortalLink::fillGrid1dTo2d ( FillDirection dir,
const GridPortalLink & grid1d,
GridPortalLink & grid2d )
staticprotected

Helper function to fill a 2D grid from a 1D grid, by extending all bins along the different direction.

Parameters
dirThe direction to fill
grid1dThe 1D grid
grid2dThe 2D grid

◆ fillMergedGrid()

void Acts::GridPortalLink::fillMergedGrid ( const GridPortalLink & a,
const GridPortalLink & b,
GridPortalLink & merged,
AxisDirection direction,
const Logger & logger )
static

Helper function to fill the bin contents after merging.

This called by the merging routine, and requires access to the internal grid state.

Parameters
aThe first grid portal link
bThe second grid portal link
mergedThe merged grid portal link
directionThe merging direction
loggerThe logger to use for messages

◆ grid() [1/2]

virtual const IGrid & Acts::GridPortalLink::grid ( ) const
pure virtual

Return the associated grid in a type-erased form.

Returns
The grid

Implemented in Acts::GridPortalLinkT< Axes >.

◆ grid() [2/2]

virtual IGrid & Acts::GridPortalLink::grid ( )
pure virtual

Return the associated grid in a type-erased form.

Returns
The grid

Implemented in Acts::GridPortalLinkT< Axes >.

◆ make() [1/3]

std::unique_ptr< GridPortalLink > Acts::GridPortalLink::make ( const std::shared_ptr< RegularSurface > & surface,
TrackingVolume & volume,
AxisDirection direction )
static

Factory function for an automatically sized one-dimensional grid.

This produces a single-bin grid with boundaries taken from the bounds of surface along direction.

Parameters
surfaceThe surface
volumeThe tracking volume
directionThe binning direction
Returns
A unique pointer to the grid portal link

◆ make() [2/3]

template<AxisConcept axis_1_t, AxisConcept axis_2_t>
std::unique_ptr< GridPortalLinkT< axis_1_t, axis_2_t > > Acts::GridPortalLink::make ( std::shared_ptr< RegularSurface > surface,
axis_1_t axis1,
axis_2_t axis2 )
static

Factory function for a two-dimensional grid portal link, which allows using template deduction to figure out the right type.

Template Parameters
axis_1_tThe first axis type
axis_2_tThe second axis type
Parameters
surfaceThe surface
axis1The first axis to use for the binning
axis2The second axis to use for the binning
Note
The axis boundaries are checked against the bounds of surface.
Returns
A unique pointer to the grid portal link

◆ make() [3/3]

template<AxisConcept axis_t>
std::unique_ptr< GridPortalLinkT< axis_t > > Acts::GridPortalLink::make ( std::shared_ptr< RegularSurface > surface,
AxisDirection direction,
axis_t && axis )
static

Factory function for a one-dimensional grid portal link, which allows using template deduction to figure out the right type.

Template Parameters
axis_tThe axis type
Parameters
surfaceThe surface
directionThe binning direction
axisThe axis to use for the binning
Note
The axis boundaries are checked against the bounds of surface.
Returns
A unique pointer to the grid portal link

◆ merge()

std::unique_ptr< PortalLinkBase > Acts::GridPortalLink::merge ( const GridPortalLink & a,
const GridPortalLink & b,
AxisDirection direction,
const Logger & logger = getDummyLogger() )
static

Merge two grid portal links into a single one.

The routine can merge one-dimensional, two-dimensional and mixed links. The merge will try to preserve equidistant binning in case bin widths match. Otherwise, the merge falls back to variable binning.

1D merge scenarios:

+----------------------------------------------------------+
|Colinear |
| |
| +-------+-------+-------+ +-------+-------+-------+ |
| | | | | | | | | |
| | | | | + | | | | |
| | | | | | | | | |
| +-------+-------+-------+ +-------+-------+-------+ |
| +-------+-------+-------+-------+-------+-------+ |
| | | | | | | | |
| = | | | | | | | |
| | | | | | | | |
| +-------+-------+-------+-------+-------+-------+ |
| |
+----------------------------------------------------------+

Two grid along a shared direction are merged along their shared direction

+-------------------------------------------------+
|Parallel |
| |
| +-------+ +-------+ +-------+-------+ |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| +-------+ +-------+ +-------+-------+ |
| | | | | | | | |
| | | + | | = | | | |
| | | | | | | | |
| +-------+ +-------+ +-------+-------+ |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| +-------+ +-------+ +-------+-------+ |
| |
+-------------------------------------------------+

Two grids along a shared direction a merged in the direction that is orthogonal to their shared direction.

+-------------------------------------------+
|Perpendicular |
| |
| +-------+ |
| | | |
| | | |
| | | |
| +-------+ +-------+-------+-------+ |
| | | | | | | |
| | | + | | | | |
| | | | | | | |
| +-------+ +-------+-------+-------+ |
| | | |
| | | |
| | | +-------+-------+-------+ |
| +-------+ | | | | |
| | | | | |
| | | | | |
| +-------+-------+-------+ |
| | | | | |
| = | | | | |
| | | | | |
| +-------+-------+-------+ |
| | | | | |
| | | | | |
| | | | | |
| +-------+-------+-------+ |
| |
+-------------------------------------------+

Two grids whose directions are not shared are merged (ordering does not matter here). The routine will expand one of the grids to match the other's binning, by subdividing the grid in the as-of-yet unbinned direction, while filling all bins with the original bin contents. Afterwards, a conventional mixed-dimension merge is performed.

Mixed merge scenarios The order is normalized by always taking the 2D grid as the left hand side. The 1D grid is expanded to match the binning in the as-of-yet unbinned direction with the binning taken from the 2D grid.

+-----------------------------------------+
|2D + 1D |
| |
| +-------+-------+ +-------+-------+ |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| +-------+-------+ +-------+-------+ |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| +-------+-------+ = +-------+-------+ |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| +-------+-------+ +-------+-------+ |
| + | | | |
| +-------+-------+ | | | |
| | | | | | | |
| | | | +-------+-------+ |
| | | | |
| +-------+-------+ |
+-----------------------------------------+
+--------------------------------------------------------------+
|2D + 1D |
| |
| +-------+-------+ +-------+ +-------+-------+-------+ |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| +-------+-------+ +-------+ +-------+-------+-------+ |
| | | | | | | | | | |
| | | | + | | = | | | | |
| | | | | | | | | | |
| +-------+-------+ +-------+ +-------+-------+-------+ |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| +-------+-------+ +-------+ +-------+-------+-------+ |
| |
+--------------------------------------------------------------+

2D merges The grids need to already share a common axis. If that is not the case, the merge routine returns a nullptr. This can be handled by composite merging as a fallback if needed. Ordering and direction does not matter here.

+-----------------------------------------+
|2D + 2D |
| |
| +-------+-------+ +-------+-------+ |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| +-------+-------+ +-------+-------+ |
| | | | | | | |
| | | | + | | | |
| | | | | | | |
| +-------+-------+ +-------+-------+ |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| +-------+-------+ +-------+-------+ |
| |
| +-------+-------+-------+-------+ |
| | | | | | |
| | | | | | |
| | | | | | |
| +-------+-------+-------+-------+ |
| | | | | | |
| = | | | | | |
| | | | | | |
| +-------+-------+-------+-------+ |
| | | | | | |
| | | | | | |
| | | | | | |
| +-------+-------+-------+-------+ |
| |
+-----------------------------------------+
Parameters
aThe first grid portal link
bThe second grid portal link
directionThe merging direction
loggerThe logger to use for messages
Returns
The merged grid portal link or nullptr if grid merging did not succeed
Note
The returned pointer can be nullptr, if the grids given are not mergeable, because their binnings are not compatible. This is not an error case, and needs to be handled by th caller! Invalid input is handled via exceptions.

◆ printContents()

void Acts::GridPortalLink::printContents ( std::ostream & os) const

Helper function that prints a textual representation of the grid with the volume names.

Parameters
osThe output stream

◆ setArtifactPortalLinks()

void Acts::GridPortalLink::setArtifactPortalLinks ( std::vector< TrivialPortalLink > links)

Set the artifact portal links.

Parameters
linksVector of trivial portal links to set

◆ setVolume()

virtual void Acts::GridPortalLink::setVolume ( TrackingVolume * volume)
pure virtual

Set the volume on all grid bins.

Parameters
volumeThe volume to set

Implemented in Acts::GridPortalLinkT< Axes >.