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

A blueprint node that can contain multiple child volumes. More...

#include <Acts/Geometry/ContainerBlueprintNode.hpp>

Inheritance diagram for Acts::Experimental::ContainerBlueprintNode:
[legend]
Collaboration diagram for Acts::Experimental::ContainerBlueprintNode:
[legend]

Public Member Functions

 ContainerBlueprintNode (const std::string &name, AxisDirection axis, VolumeAttachmentStrategy attachmentStrategy, std::pair< VolumeResizeStrategy, VolumeResizeStrategy > resizeStrategies)
 Main constructor for the container node.
 ContainerBlueprintNode (const std::string &name, AxisDirection axis, VolumeAttachmentStrategy attachmentStrategy=VolumeAttachmentStrategy::Midpoint, VolumeResizeStrategy resizeStrategy=VolumeResizeStrategy::Expand)
 Main constructor for the container node.
void addToGraphviz (std::ostream &os) const override
 Method that writes a representatiohn of this node only to graphviz.
VolumeAttachmentStrategy attachmentStrategy () const
 Accessor to the attachment strategy.
Volumebuild (const Experimental::BlueprintOptions &options, const GeometryContext &gctx, const Logger &logger=Acts::getDummyLogger()) override
 This participates in the construction of the geometry via the blueprint tree.
AxisDirection direction () const
 Accessor to the stacking direction.
void finalize (const Experimental::BlueprintOptions &options, const GeometryContext &gctx, TrackingVolume &parent, const Logger &logger) override
 This participates in the construction of the geometry via the blueprint tree.
const std::string & name () const override
 Get the name of this node.
std::pair< VolumeResizeStrategy, VolumeResizeStrategyresizeStrategies () const
 Accessor to the resize strategies.
ContainerBlueprintNodesetAttachmentStrategy (VolumeAttachmentStrategy attachmentStrategy)
 Setter for the attachment strategy.
ContainerBlueprintNodesetDirection (AxisDirection direction)
 Setter for the stacking direction.
ContainerBlueprintNodesetResizeStrategies (VolumeResizeStrategy inner, VolumeResizeStrategy outer)
 Setter for the resize strategies.
ContainerBlueprintNodesetResizeStrategy (VolumeResizeStrategy resizeStrategy)
 Setter for the resize strategy.
Public Member Functions inherited from Acts::Experimental::BlueprintNode
virtual ~BlueprintNode ()=default
 Virtual destructor to ensure correct cleanup.
BlueprintNodeaddChild (std::shared_ptr< BlueprintNode > child)
 Register a child to this node.
MutableChildRange children ()
 Return a MutableChildRange to the children of this node.
ChildRange children () const
 Return a ChildRange to the children of this node.
void clearChildren ()
 Remove all children from this node.
std::size_t depth () const
 Return the depth of this node in the blueprint tree.
void graphviz (std::ostream &os) const
 Print the node tree starting from this node to graphviz format.
virtual PortalShellBaseconnect (const BlueprintOptions &options, const GeometryContext &gctx, const Logger &logger=Acts::getDummyLogger())=0
 This method is called during the connect phase.
StaticBlueprintNodeaddStaticVolume (std::unique_ptr< TrackingVolume > volume, const std::function< void(StaticBlueprintNode &cylinder)> &callback={})
 This method creates a new Acts::Experimental::StaticBlueprintNode wrapping volume and adds it to this node as a child.
StaticBlueprintNodeaddStaticVolume (const Transform3 &transform, std::shared_ptr< VolumeBounds > volumeBounds, const std::string &volumeName="undefined", const std::function< void(StaticBlueprintNode &cylinder)> &callback={})
 Alternative overload for creating a Acts::Experimental::StaticBlueprintNode.
CylinderContainerBlueprintNodeaddCylinderContainer (const std::string &name, AxisDirection direction, const std::function< void(CylinderContainerBlueprintNode &cylinder)> &callback={})
 Convenience method for creating a cylinder specialization of Acts::Experimental::ContainerBlueprintNode.
CuboidContainerBlueprintNodeaddCuboidContainer (const std::string &name, AxisDirection direction, const std::function< void(CuboidContainerBlueprintNode &cylinder)> &callback={})
 Convenience method for creating a cuboid specialization of Acts::Experimental::ContainerBlueprintNode.
MaterialDesignatorBlueprintNodeaddMaterial (const std::string &name, const std::function< void(MaterialDesignatorBlueprintNode &material)> &callback={})
 Convenience method for creating a Acts::Experimental::MaterialDesignatorBlueprintNode.
LayerBlueprintNodeaddLayer (const std::string &name, const std::function< void(LayerBlueprintNode &layer)> &callback={})
 Convenience method for creating a Acts::Experimental::LayerBlueprintNode.
GeometryIdentifierBlueprintNodewithGeometryIdentifier (const std::function< void(GeometryIdentifierBlueprintNode &geometryIdentifier)> &callback={})
 Convenience method for creating a Acts::Experimental::GeometryIdentifierBlueprintNode.

Protected Member Functions

template<typename BaseShell, typename SingleShell>
std::vector< BaseShell * > collectChildShells (const Experimental::BlueprintOptions &options, const GeometryContext &gctx, VolumeStack &stack, const std::string &prefix, const Logger &logger)
 Collect shells from child nodes and gap volumes.
template<typename BaseShell, typename SingleShell, typename ShellStack>
PortalShellBaseconnectImpl (const Experimental::BlueprintOptions &options, const GeometryContext &gctx, VolumeStack *stack, const std::string &prefix, const Logger &logger)
 Implementation of the connect method for container nodes.
virtual std::unique_ptr< VolumeStackmakeStack (const GeometryContext &gctx, std::vector< Volume * > &volumes, const Logger &logger)=0
 Make the volume stack for the container.
virtual const std::string & typeName () const =0
 Get the type name of the container.
Protected Member Functions inherited from Acts::Experimental::BlueprintNode
std::string indent () const
 An indentation depending on the depth of this node.
std::string prefix () const
 Printing helper returning a prefix including an indent depending on the depth.
void setDepth (std::size_t depth)
 Set the depth to depth and update children recursively.
virtual void toStream (std::ostream &os) const
 Virtual method to determine stream representation.

Protected Attributes

VolumeAttachmentStrategy m_attachmentStrategy
 Volume attachment strategy for connecting volumes in the stack.
std::vector< Volume * > m_childVolumes
 Container of child volumes managed by this blueprint node.
AxisDirection m_direction = AxisDirection::AxisZ
 Stacking axis direction in local reference frame.
std::vector< std::pair< std::unique_ptr< PortalShellBase >, std::unique_ptr< TrackingVolume > > > m_gaps
 Container of gap volumes and their portal shells created between child volumes.
std::string m_name
 Name of the container node for debugging purposes.
std::pair< VolumeResizeStrategy, VolumeResizeStrategym_resizeStrategies
 Resize strategies for inner and outer sides of the container.
std::unique_ptr< PortalShellBasem_shell {nullptr}
 Portal shell representation of this container for geometry connection.
std::unique_ptr< VolumeStackm_stack {nullptr}
 Volume stack instance created by derived classes during build phase.
std::map< const Volume *, BlueprintNode * > m_volumeToNode
 Mapping from child volumes to their corresponding blueprint nodes.

Additional Inherited Members

Public Types inherited from Acts::Experimental::BlueprintNode
using ChildRange
 A range-like object that allows range based for loops and index access.
using MutableChildRange
 A range-like object that allows range based for loops and index access.

Detailed Description

A blueprint node that can contain multiple child volumes.

It is responsible for managing the child volumes and their shells. The child volumes can be either gap volumes or volumes from child nodes.

The container node is responsible for:

  1. Managing the child volumes and their shells
  2. Creating gap volumes between child volumes
  3. Collecting shells from child nodes and gap volumes
  4. Building the volume stack

The container node is an abstract base class. Derived classes must implement:

  1. makeStack - to create the appropriate volume stack
  2. typeName - to provide the type name for debug output

Constructor & Destructor Documentation

◆ ContainerBlueprintNode() [1/2]

Acts::Experimental::ContainerBlueprintNode::ContainerBlueprintNode ( const std::string & name,
AxisDirection axis,
VolumeAttachmentStrategy attachmentStrategy = VolumeAttachmentStrategy::Midpoint,
VolumeResizeStrategy resizeStrategy = VolumeResizeStrategy::Expand )

Main constructor for the container node.

Parameters
nameThe name of the node (for debug only)
axisThe stacking axis direction in local reference frame
attachmentStrategyThe attachment strategy for the stack
resizeStrategyThe resize strategy for the stack

◆ ContainerBlueprintNode() [2/2]

Acts::Experimental::ContainerBlueprintNode::ContainerBlueprintNode ( const std::string & name,
AxisDirection axis,
VolumeAttachmentStrategy attachmentStrategy,
std::pair< VolumeResizeStrategy, VolumeResizeStrategy > resizeStrategies )

Main constructor for the container node.

Parameters
nameThe name of the node (for debug only)
axisThe stacking axis direction in local reference frame
attachmentStrategyThe attachment strategy for the stack
resizeStrategiesThe resize strategies for the stack

Member Function Documentation

◆ addToGraphviz()

void Acts::Experimental::ContainerBlueprintNode::addToGraphviz ( std::ostream & os) const
overridevirtual

Method that writes a representatiohn of this node only to graphviz.

This should generally not be called on its own, but through the BlueprintNode::graphviz method.

Parameters
osThe stream to print to

Reimplemented from Acts::Experimental::BlueprintNode.

◆ attachmentStrategy()

VolumeAttachmentStrategy Acts::Experimental::ContainerBlueprintNode::attachmentStrategy ( ) const

Accessor to the attachment strategy.

Returns
The attachment strategy

◆ build()

Volume & Acts::Experimental::ContainerBlueprintNode::build ( const Experimental::BlueprintOptions & options,
const GeometryContext & gctx,
const Logger & logger = Acts::getDummyLogger() )
overridevirtual

This participates in the construction of the geometry via the blueprint tree.

The steps are approximately as follows:

  1. Collect all child volumes
  2. Package them into a VolumeStack (cuboid or cylinder), which performs sizing and/or gap creation
  3. Return the VolumeStack as a volume up the tree
Parameters
optionsThe global blueprint options
gctxThe geometry context (nominal usually)
loggerThe logger to use
Returns
The combined VolumeStack

Implements Acts::Experimental::BlueprintNode.

◆ collectChildShells()

template<typename BaseShell, typename SingleShell>
std::vector< BaseShell * > Acts::Experimental::ContainerBlueprintNode::collectChildShells ( const Experimental::BlueprintOptions & options,
const GeometryContext & gctx,
VolumeStack & stack,
const std::string & prefix,
const Logger & logger )
protected

Collect shells from child nodes and gap volumes.

This function is responsible for collecting shells from child nodes and creating shells for gap volumes. It is used by the connect method to prepare the shells for the volume stack.

The function processes each volume in m_childVolumes in two ways:

  1. For gap volumes:
    • Creates a TrackingVolume from the gap volume
    • Assigns a unique name (ContainerName::GapN)
    • Creates a single shell for the gap volume
    • Stores both the shell and gap volume in m_gaps for later use
  2. For child volumes:
    • Looks up the corresponding child node in m_volumeToNode
    • Calls connect() on the child node to get its shell
    • Validates that the shell type matches the expected type
    • Ensures the shell is valid

The function maintains the order of volumes as they appear in m_childVolumes, which is important for the final stack shell construction.

Template Parameters
BaseShellThe base shell type (e.g. CylinderPortalShell)
SingleShellThe single shell type (e.g. SingleCylinderPortalShell)
Parameters
optionsThe blueprint options
gctxThe geometry context
stackThe volume stack
prefixThe prefix for debug output
loggerThe logger to use
Returns
A vector of shells in the same order as m_childVolumes

◆ connectImpl()

template<typename BaseShell, typename SingleShell, typename ShellStack>
PortalShellBase & Acts::Experimental::ContainerBlueprintNode::connectImpl ( const Experimental::BlueprintOptions & options,
const GeometryContext & gctx,
VolumeStack * stack,
const std::string & prefix,
const Logger & logger )
protected

Implementation of the connect method for container nodes.

This method is responsible for:

  1. Collecting shells from child nodes and gap volumes
  2. Validating that the number of shells matches the number of child volumes
  3. Ensuring all shells are valid
  4. Creating a merged stack shell from all collected shells
Template Parameters
BaseShellThe base shell type (e.g. CylinderPortalShell)
SingleShellThe single shell type (e.g. SingleCylinderPortalShell)
ShellStackThe stack shell type (e.g. StackCylinderPortalShell)
Parameters
optionsThe blueprint options
gctxThe geometry context
stackThe volume stack
prefixThe prefix for debug output
loggerThe logger to use
Returns
The merged stack shell

◆ direction()

AxisDirection Acts::Experimental::ContainerBlueprintNode::direction ( ) const

Accessor to the stacking direction.

Returns
The stacking direction

◆ finalize()

void Acts::Experimental::ContainerBlueprintNode::finalize ( const Experimental::BlueprintOptions & options,
const GeometryContext & gctx,
TrackingVolume & parent,
const Logger & logger )
overridevirtual

This participates in the construction of the geometry via the blueprint tree.

The steps are approximately as follows:

  1. Register portals created for gap volumes, as they're not handled by dedicated nodes
  2. Register gap volumes in the parent volume
  3. Create a configured Acts::INavigationPolicy for the gap
  4. Call finalize on all children while passing through parent.
Parameters
optionsThe global blueprint options
gctxThe geometry context (nominal usually)
parentThe parent volume
loggerThe logger to use

Implements Acts::Experimental::BlueprintNode.

◆ makeStack()

virtual std::unique_ptr< VolumeStack > Acts::Experimental::ContainerBlueprintNode::makeStack ( const GeometryContext & gctx,
std::vector< Volume * > & volumes,
const Logger & logger )
protectedpure virtual

Make the volume stack for the container.

This is called by the build method and is implemented by the derived classes.

Parameters
gctxThe current geometry context object, e.g. alignment
volumesThe volumes to stack
loggerThe logger to use
Returns
The volume stack

Implemented in Acts::Experimental::CuboidContainerBlueprintNode, and Acts::Experimental::CylinderContainerBlueprintNode.

◆ name()

const std::string & Acts::Experimental::ContainerBlueprintNode::name ( ) const
overridevirtual

Get the name of this node.

Returns
Reference to the node name string

Implements Acts::Experimental::BlueprintNode.

◆ resizeStrategies()

std::pair< VolumeResizeStrategy, VolumeResizeStrategy > Acts::Experimental::ContainerBlueprintNode::resizeStrategies ( ) const

Accessor to the resize strategies.

Returns
The resize strategies

◆ setAttachmentStrategy()

ContainerBlueprintNode & Acts::Experimental::ContainerBlueprintNode::setAttachmentStrategy ( VolumeAttachmentStrategy attachmentStrategy)

Setter for the attachment strategy.

Parameters
attachmentStrategyThe attachment strategy
Returns
This node for chaining

◆ setDirection()

ContainerBlueprintNode & Acts::Experimental::ContainerBlueprintNode::setDirection ( AxisDirection direction)

Setter for the stacking direction.

Parameters
directionThe stacking direction
Returns
This node for chaining

◆ setResizeStrategies()

ContainerBlueprintNode & Acts::Experimental::ContainerBlueprintNode::setResizeStrategies ( VolumeResizeStrategy inner,
VolumeResizeStrategy outer )

Setter for the resize strategies.

Parameters
innerThe inner resize strategy
outerThe outer resize strategy
Returns
This node for chaining

◆ setResizeStrategy()

ContainerBlueprintNode & Acts::Experimental::ContainerBlueprintNode::setResizeStrategy ( VolumeResizeStrategy resizeStrategy)

Setter for the resize strategy.

Parameters
resizeStrategyThe resize strategy
Note
resizeStrategy is used for both sides of the container
Returns
This node for chaining

◆ typeName()

virtual const std::string & Acts::Experimental::ContainerBlueprintNode::typeName ( ) const
protectedpure virtual

Get the type name of the container.

This is used for the debug output of the container and encoding the volume shape in the dot graph.

Returns
The type name

Implemented in Acts::Experimental::CuboidContainerBlueprintNode, and Acts::Experimental::CylinderContainerBlueprintNode.

Member Data Documentation

◆ m_attachmentStrategy

VolumeAttachmentStrategy Acts::Experimental::ContainerBlueprintNode::m_attachmentStrategy
protected
Initial value:
{
@ Midpoint
Given two volumes, the midpoint between the two volumes is found.
Definition VolumeAttachmentStrategy.hpp:25

Volume attachment strategy for connecting volumes in the stack.

◆ m_childVolumes

std::vector<Volume*> Acts::Experimental::ContainerBlueprintNode::m_childVolumes
protected

Container of child volumes managed by this blueprint node.

◆ m_direction

AxisDirection Acts::Experimental::ContainerBlueprintNode::m_direction = AxisDirection::AxisZ
protected

Stacking axis direction in local reference frame.

◆ m_gaps

std::vector<std::pair<std::unique_ptr<PortalShellBase>, std::unique_ptr<TrackingVolume> > > Acts::Experimental::ContainerBlueprintNode::m_gaps
protected

Container of gap volumes and their portal shells created between child volumes.

◆ m_name

std::string Acts::Experimental::ContainerBlueprintNode::m_name
protected

Name of the container node for debugging purposes.

◆ m_resizeStrategies

std::pair<VolumeResizeStrategy, VolumeResizeStrategy> Acts::Experimental::ContainerBlueprintNode::m_resizeStrategies
protected
Initial value:
{
@ Expand
Extend the volume connected to the respective edge to fit the new bounds.
Definition VolumeResizeStrategy.hpp:18

Resize strategies for inner and outer sides of the container.

◆ m_shell

std::unique_ptr<PortalShellBase> Acts::Experimental::ContainerBlueprintNode::m_shell {nullptr}
protected

Portal shell representation of this container for geometry connection.

◆ m_stack

std::unique_ptr<VolumeStack> Acts::Experimental::ContainerBlueprintNode::m_stack {nullptr}
protected

Volume stack instance created by derived classes during build phase.

Note
This is populated during the build process by makeStack implementations

◆ m_volumeToNode

std::map<const Volume*, BlueprintNode*> Acts::Experimental::ContainerBlueprintNode::m_volumeToNode
protected

Mapping from child volumes to their corresponding blueprint nodes.