Concepts

Todo

Not complete yet

Tracking geometry

Volume

Volume bounds

Tracking volume

Portals

class Portal

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, and a corresponding surface. One link is associated with the direction along the surface’s normal vector, and one with the opposite direction.

Public Functions

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}}};

Parameters:
  • gctx – The geometry context

  • args – The struct containing the arguments

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:
  • gctx – The geometry context

  • alongNormal – The link along the normal of the surface

  • oppositeNormal – The link opposite to the normal of the

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:
  • direction – The direction of the link

  • surface – The surface from which to create the portal link

  • volume – The volume this portal connects to in the direction relative to the normal of surface.

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

Constructor for a portal from a single link.

Parameters:
  • direction – The direction of the link

  • link – The portal link

void fill(TrackingVolume &volume)

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

Parameters:

volume – The target volume to connect to

const PortalLinkBase *getLink(Direction direction) const

Get the link associated with the direction.

Can be null if the associated link is unset.

Parameters:

direction – The direction

Returns:

The link (can be null)

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.

Returns:

True if the portal is valid

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.

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

Parameters:
  • gctx – The geometry context

  • position – The 3D position

  • direction – The direction

Returns:

The target volume (can be nullptr)

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.

Note

The surface must be logically equivalent to the one of the link that’s already set on the portal.

Parameters:
  • gctx – The geometry context

  • direction – The direction of the link to create

  • surface – The surface

  • volume – The target volume

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.

Note

The surface associated with link must be logically equivalent to the one of the link that’s already set on the portal.

Parameters:
  • gctx – The geometry context

  • direction – The direction

  • link – The link to set

RegularSurface &surface()

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

Returns:

The portal surface

const RegularSurface &surface() const

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

Returns:

The portal surface

Public Static Functions

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

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.

Note

This is a destructive operation on the portals involved

Parameters:
  • gctx – The geometry context

  • aPortal – The first portal

  • bPortal – The second portal

  • logger – The logger to push output to

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.

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:
  • gctx – The geometry context

  • aPortal – The first portal

  • bPortal – The second portal

  • direction – The direction of the merge (e.g. along z)

  • logger – The logger to push output to

struct Arguments

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

Public Members

Link alongNormal = {}

Entry for the link along normal Entry for the link opposite normal.

Link oppositeNormal = {}
struct Link

Aggregate over a surface and a volume with optional semantics.

Public Functions

Link() = default
inline Link(std::shared_ptr<RegularSurface> surfaceIn, TrackingVolume &volumeIn)

Constructor from a surface and a volume.

Public Members

std::shared_ptr<RegularSurface> surface = nullptr

The associated surface.

TrackingVolume *volume = nullptr

The associated volume.

Portal shells

class PortalShellBase

The portal shell of a volume is the set of portals that describes connections “outside” of the volume.

Which boundary surfaces of a volume are included in the shell depends on the volume. Portal shells are only used during geometry construction, and are not part of the final geometry description.

This class is the base class for all portal shells

Subclassed by Acts::CylinderPortalShell

Public Functions

virtual ~PortalShellBase() = default

Virtusl destructor.

virtual void applyToVolume() = 0

Instruct the shell to register the portals with the volume, handing over shared ownership in the process.

Note

The target volume depends on the shell type, e.g. composite shells like the CylinerStackPortalShell register portals to the correct volumes.

virtual void fill(TrackingVolume &volume) = 0

Fill the open slots of the shell with a TrivialPortalLink to the given volume.

Parameters:

volume – The volume to connect

virtual bool isValid() const = 0

Check if a portal is valid, e.g.

if non of the portals has two unconnected sides.

Returns:

True if the shell is valid, false otherwise

virtual std::string label() const = 0

Get a label for the portal shell for debugging purposes.

Returns:

A label for the portal shell

virtual std::size_t size() const = 0

Get the number of portals in the shell.

This number depends on the volume type

Returns:

The number of portals in the shell

class CylinderPortalShell : public Acts::PortalShellBase

Base class for cylinder shaped portal shells, e.g.

shells for cylinder volumes

Subclassed by Acts::CylinderStackPortalShell, Acts::SingleCylinderPortalShell

Public Types

using Face = CylinderVolumeBounds::Face
enum class Face

Enum describing the possible faces of a cylinder volume.

Note

These values are synchronized with the BoundarySurfaceFace enum. Once Gen1 is removed, this can be changed.

Values:

Public Functions

virtual void fill(TrackingVolume &volume) override

Fill the open slots of the shell with a TrivialPortalLink to the given volume.

Parameters:

volume – The volume to connect

virtual Portal *portal(Face face) = 0

Retrieve the portal associated to the given face.

Can be nullptr if unset.

Parameters:

face – The face to retrieve the portal for

Returns:

The portal associated to the face

virtual std::shared_ptr<Portal> portalPtr(Face face) = 0

Retrieve a shared_ptr for the portal associated to the given face.

Can be nullptr if unset.

Parameters:

face – The face to retrieve the portal for

Returns:

The portal associated to the face

virtual void setPortal(std::shared_ptr<Portal> portal, Face face) = 0

Set the portal associated to the given face.

Parameters:
  • portal – The portal to set

  • face – The face to set the portal

class SingleCylinderPortalShell : public Acts::CylinderPortalShell

This class describes a cylinder shell containing a single volume.

The available faces depend on the configuration of the cylinder volume bounds. If a phi sector is configured, the shell will have corresponding portal slots. If the inner radius is non-zero, the shell will have an inner cylinder portal slot.

Public Functions

explicit SingleCylinderPortalShell(TrackingVolume &volume)

Construct a single cylinder portal shell for the given volume.

Parameters:

volume – The volume to create the shell for

virtual void applyToVolume() override

Instruct the shell to register the portals with the volume, handing over shared ownership in the process.

Note

The target volume depends on the shell type, e.g. composite shells like the CylinerStackPortalShell register portals to the correct volumes.

virtual bool isValid() const override

Check if a portal is valid, e.g.

if non of the portals has two unconnected sides.

Returns:

True if the shell is valid, false otherwise

virtual std::string label() const override

Get a label for the portal shell for debugging purposes.

Returns:

A label for the portal shell

virtual Portal *portal(Face face) final

Retrieve the portal associated to the given face.

Can be nullptr if unset.

Parameters:

face – The face to retrieve the portal for

Returns:

The portal associated to the face

virtual std::shared_ptr<Portal> portalPtr(Face face) final

Retrieve a shared_ptr for the portal associated to the given face.

Can be nullptr if unset.

Parameters:

face – The face to retrieve the portal for

Returns:

The portal associated to the face

virtual void setPortal(std::shared_ptr<Portal> portal, Face face) final

Set the portal associated to the given face.

Parameters:
  • portal – The portal to set

  • face – The face to set the portal

virtual std::size_t size() const final

Get the number of portals in the shell.

This number depends on the volume type

Returns:

The number of portals in the shell

class CylinderStackPortalShell : public Acts::CylinderPortalShell

This class describes a cylinder shell containing multiple volumes.

The available faces depend on the configuration of the cylinder volume bounds.

Fused +————–

&#8212;+ portals -&#8212;+ | | | | v OuterCylinder | +—&#8212;+—&#8212;+ | | | | | | | |<&#8212;+ +&#8212;+&#8212;+ v | | +&#8212;+——&#8212;+ | | | | | Shared portal | | |<&#8212;+&#8212; (grid) | v | | PositiveDisc +———-&#8212;+ | r ^ | | | | | |<&#8212;+ | | | | +———-&#8212;+ InnerCylinder +–&#8212;> ^ (if rMin>0) z | | +————–&#8212;+

Note

The stack shell currently does not support phi sectors The stack can be oriented along the (local) z or r direction, which drives the stacking. Depending on the direction, portals on the shells of children are merged or fused. Subsequently, portal access respects shared portals between shells. Below is an illustration of a stack in the r direction:

Note

The shells must be ordered in the given direction Depending on the stack direction, the portal lookup will return different portals. In the illustration above, the PositiveDisc portal is shared among all shells, while the OuterCylinder and InnerCylinder portals are looked up from the innermost and outermost shell in the r direction.

Public Functions

CylinderStackPortalShell(const GeometryContext &gctx, std::vector<CylinderPortalShell*> shells, AxisDirection direction, const Logger &logger = getDummyLogger())

Construct the portal shell stack from the given shells.

Note

The shells must be ordered in the given direction

Parameters:
  • gctx – The geometry context

  • shells – The shells to stack

  • direction – The stacking direction

  • logger – A logging instance for debugging

inline virtual void applyToVolume() override

Instruct the shell to register the portals with the volume, handing over shared ownership in the process.

Note

The target volume depends on the shell type, e.g. composite shells like the CylinerStackPortalShell register portals to the correct volumes.

virtual bool isValid() const override

Check if a portal is valid, e.g.

if non of the portals has two unconnected sides.

Returns:

True if the shell is valid, false otherwise

virtual std::string label() const override

Get a label for the portal shell for debugging purposes.

Returns:

A label for the portal shell

virtual Portal *portal(Face face) final

Retrieve the portal associated to the given face.

Can be nullptr if unset.

Parameters:

face – The face to retrieve the portal for

Returns:

The portal associated to the face

virtual std::shared_ptr<Portal> portalPtr(Face face) final

Retrieve a shared_ptr for the portal associated to the given face.

Can be nullptr if unset.

Parameters:

face – The face to retrieve the portal for

Returns:

The portal associated to the face

virtual void setPortal(std::shared_ptr<Portal> portal, Face face) final

Set the portal associated to the given face.

Parameters:
  • portal – The portal to set

  • face – The face to set the portal

virtual std::size_t size() const final

Get the number of portals in the shell.

This number depends on the volume type

Returns:

The number of portals in the shell