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

A portal connects two or more neighboring volumes. More...

#include <Acts/Geometry/Portal.hpp>

Classes

struct  Arguments
 Helper struct for the arguments to the portal constructor below using designated initializers. More...

Public Member Functions

 Portal (const GeometryContext &gctx, Arguments &&args)
 Constructor that takes a geometry context and an rvalue reference to a helper struct from above.
 Portal (const GeometryContext &gctx, std::unique_ptr< PortalLinkBase > alongNormal, std::unique_ptr< PortalLinkBase > oppositeNormal)
 Constructor for a portal from two links.
 Portal (Direction direction, std::shared_ptr< RegularSurface > surface, TrackingVolume &volume)
 Constructor for a portal from a surface and volume, where a trivial portal link is automatically constructed.
 Portal (Direction direction, std::unique_ptr< PortalLinkBase > link)
 Constructor for a portal from a single link.
void fill (TrackingVolume &volume)
 Create and attach a trivial portal link to the empty slot of this portal.
const PortalLinkBasegetLink (Direction direction) const
 Get the link associated with the direction.
bool isValid () const
 Returns true if the portal is valid, that means it has at least one non-null link associated.Portals can be in an invalid state after they get merged or fused with other portals.
Result< const TrackingVolume * > resolveVolume (const GeometryContext &gctx, const Vector3 &position, const Vector3 &direction) const
 Resolve the volume for a 3D position and a direction The direction is used to select the right portal link, if it is set.
void setLink (const GeometryContext &gctx, Direction direction, std::shared_ptr< RegularSurface > surface, TrackingVolume &volume)
 Helper function create a trivial portal link based on a surface.
void setLink (const GeometryContext &gctx, Direction direction, std::unique_ptr< PortalLinkBase > link)
 Set a link on the portal into the slot specified by the direction.
RegularSurfacesurface ()
 Access the portal surface that is shared between the two links.
const RegularSurfacesurface () const
 Access the portal surface that is shared between the two links.

Static Public Member Functions

static Portal fuse (const GeometryContext &gctx, Portal &aPortal, Portal &bPortal, const Logger &logger=getDummyLogger())
 Fuse two portals together.
static Portal merge (const GeometryContext &gctx, Portal &aPortal, Portal &bPortal, AxisDirection direction, const Logger &logger=getDummyLogger())
 Merge two adjacent portals with each other to produce a new portal that encompasses both inputs.

Detailed Description

A portal connects two or more neighboring volumes.

Each volume has a set of portals that describes which volumes lie behind the portal in that direction. Portals use associated portal links to perform lookups of target volumes. Each portal has two links (at least one non-null), and a corresponding surface. One link is associated with the direction along the surface's normal vector, and one with the opposite direction.

Constructor & Destructor Documentation

◆ Portal() [1/4]

Acts::Portal::Portal ( Direction direction,
std::unique_ptr< PortalLinkBase > link )

Constructor for a portal from a single link.

Parameters
directionThe direction of the link
linkThe portal link

◆ Portal() [2/4]

Acts::Portal::Portal ( Direction direction,
std::shared_ptr< RegularSurface > surface,
TrackingVolume & volume )

Constructor for a portal from a surface and volume, where a trivial portal link is automatically constructed.

Parameters
directionThe direction of the link
surfaceThe surface from which to create the portal link
volumeThe volume this portal connects to in the direction relative to the normal of surface.

◆ Portal() [3/4]

Acts::Portal::Portal ( const GeometryContext & gctx,
std::unique_ptr< PortalLinkBase > alongNormal,
std::unique_ptr< PortalLinkBase > oppositeNormal )

Constructor for a portal from two links.

One of the links can be nullptr, but at least one of them needs to be set. If both are set, they need to be valid compatible links that can be fused.

Parameters
gctxThe geometry context
alongNormalThe link along the normal of the surface
oppositeNormalThe link opposite to the normal of the

◆ Portal() [4/4]

Acts::Portal::Portal ( const GeometryContext & gctx,
Arguments && args )

Constructor that takes a geometry context and an rvalue reference to a helper struct from above.

This pattern allows you to use designated initializers to construct this object like:

Portal{gctx, {.oppositeNormal = {cyl1, *vol1}}};
Portal{gctx, {.alongNormal = {cyl2, *vol2}}};
Portal(Direction direction, std::unique_ptr< PortalLinkBase > link)
Constructor for a portal from a single link.
Parameters
gctxThe geometry context
argsThe struct containing the arguments

Member Function Documentation

◆ fill()

void Acts::Portal::fill ( TrackingVolume & volume)

Create and attach a trivial portal link to the empty slot of this portal.

Parameters
volumeThe target volume to connect to

◆ fuse()

Portal Acts::Portal::fuse ( const GeometryContext & gctx,
Portal & aPortal,
Portal & bPortal,
const Logger & logger = getDummyLogger() )
static

Fuse two portals together.

Fusing is the combination of two portal links on the same logical surfaces. The actual surface instances can be different, as long as they are geometrically equivalent (within numerical precision). The resulting portal will have one portal along the shared surface's normal vector, and one opposite that vector.

portal1 portal2
+---+ +---+
| | | |
| | | |
<----+ | + | +---->
| | | |
| | | |
+---+ +---+
Note
The input portals need to have compatible link loadaout, e.g. one portal needs to have the along normal slot filled, and the otherone one needs to have the opposite normal slot filled. If portals share a filled slot, the function throws an exception.
This is a destructive operation on the portals involved
Parameters
gctxThe geometry context
aPortalThe first portal
bPortalThe second portal
loggerThe logger to push output to
Returns
A new portal that combines both input portals

◆ getLink()

const PortalLinkBase * Acts::Portal::getLink ( Direction direction) const

Get the link associated with the direction.

Can be null if the associated link is unset.

Parameters
directionThe direction
Returns
The link (can be null)

◆ isValid()

bool Acts::Portal::isValid ( ) const

Returns true if the portal is valid, that means it has at least one non-null link associated.Portals can be in an invalid state after they get merged or fused with other portals.

Returns
True if the portal is valid

◆ merge()

Portal Acts::Portal::merge ( const GeometryContext & gctx,
Portal & aPortal,
Portal & bPortal,
AxisDirection direction,
const Logger & logger = getDummyLogger() )
static

Merge two adjacent portals with each other to produce a new portal that encompasses both inputs.

It is the complementary operation to the fusing of portals. To be able to merge portals, the surfaces of their associated links need to be mergeable, and the portal links need to be compatible. This means that both portals need to have a link along the portal surface normal, opposite the normal, or both. If the equipped links are opposite relative to one another (e.g. one along one opposite), the function will throw an exception.

^ ^
| |
portal1| portal2|
+-------+-------+ +-------+-------+
| | + | |
+-------+-------+ +-------+-------+
| |
| |
v v
Note
This is a destructive operation on both portals, their links will be moved to produce merged links, which can fail if the portal links are not compatible
Parameters
gctxThe geometry context
aPortalThe first portal
bPortalThe second portal
directionThe direction of the merge (e.g. along z)
loggerThe logger to push output to
Returns
A new merged portal that encompasses both input portals

◆ resolveVolume()

Result< const TrackingVolume * > Acts::Portal::resolveVolume ( const GeometryContext & gctx,
const Vector3 & position,
const Vector3 & direction ) const

Resolve the volume for a 3D position and a direction The direction is used to select the right portal link, if it is set.

In case no link is found in the specified direction, a nullptr is returned.

Parameters
gctxThe geometry context
positionThe 3D position
directionThe direction
Returns
The target volume (can be nullptr)

◆ setLink() [1/2]

void Acts::Portal::setLink ( const GeometryContext & gctx,
Direction direction,
std::shared_ptr< RegularSurface > surface,
TrackingVolume & volume )

Helper function create a trivial portal link based on a surface.

Parameters
gctxThe geometry context
directionThe direction of the link to create
surfaceThe surface
Note
The surface must be logically equivalent to the one of the link that's already set on the portal.
Parameters
volumeThe target volume

◆ setLink() [2/2]

void Acts::Portal::setLink ( const GeometryContext & gctx,
Direction direction,
std::unique_ptr< PortalLinkBase > link )

Set a link on the portal into the slot specified by the direction.

Note
The surface associated with link must be logically equivalent to the one of the link that's already set on the portal.
Parameters
gctxThe geometry context
directionThe direction
linkThe link to set

◆ surface() [1/2]

RegularSurface & Acts::Portal::surface ( )

Access the portal surface that is shared between the two links.

Returns
The portal surface

◆ surface() [2/2]

const RegularSurface & Acts::Portal::surface ( ) const

Access the portal surface that is shared between the two links.

Returns
The portal surface