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

Base class for all navigation policies. More...

#include <Acts/Navigation/INavigationPolicy.hpp>

Inheritance diagram for Acts::INavigationPolicy:
[legend]

Classes

struct  EmptyState

Public Member Functions

virtual ~INavigationPolicy ()=default
 Virtual destructor so policies can be held through this base class.
virtual void connect (NavigationDelegate &delegate) const =0
 Connect a policy with a delegate (usually a member of a volume).
virtual void createState (const GeometryContext &gctx, const NavigationArguments &args, NavigationPolicyStateManager &stateManager, const Logger &logger) const
 Create and initialize the state for this policy.
void initializeStatelessCache (const GeometryContext &gctx, const Logger &logger=getDummyLogger())
 One-time initialization step that probes whether this policy pushes only default (empty) states and caches the result (mutating internal state), allowing the navigator to skip the per-volume-entry state creation and the matching pop entirely for volumes with such policies.
bool isStateless () const
 Whether this policy is known to push only default (empty) states, see initializeStatelessCache.
virtual bool isValid (const GeometryContext &gctx, const NavigationArguments &args, NavigationPolicyState &state, const Logger &logger) const
 Check if the policy is in a valid state for navigation.
virtual void popState (NavigationPolicyStateManager &stateManager, const Logger &logger) const
 Remove the state for this policy from the state manager.
virtual void visit (const std::function< void(const INavigationPolicy &)> &visitor) const
 Convenience function to walk over all navigation policies.

Static Public Member Functions

static void noopInitializeCandidates (const GeometryContext &, const NavigationArguments &, NavigationPolicyState &, const AppendOnlyNavigationStream &, const Logger &)
 Noop update function that is suitable as a default for default navigation delegates.

Protected Member Functions

template<NavigationPolicyConcept T>
void connectDefault (NavigationDelegate &delegate) const
 Internal helper function for derived classes that conform to the concept and have a conventional updateState method.

Detailed Description

Base class for all navigation policies.

The policy needs to be connected to a delegate via a virtual method for it to become active. The update method is not part of the class interface. The conventional updateState method is only required for use with the navigation policy factory, otherwise connect is free to connect any function.

Member Function Documentation

◆ connect()

virtual void Acts::INavigationPolicy::connect ( NavigationDelegate & delegate) const
pure virtual

◆ connectDefault()

template<NavigationPolicyConcept T>
void Acts::INavigationPolicy::connectDefault ( NavigationDelegate & delegate) const
protected

Internal helper function for derived classes that conform to the concept and have a conventional updateState method.

Mainly used to save some boilerplate.

Template Parameters
TThe type of the navigation policy
Parameters
delegateThe delegate to connect to

◆ createState()

virtual void Acts::INavigationPolicy::createState ( const GeometryContext & gctx,
const NavigationArguments & args,
NavigationPolicyStateManager & stateManager,
const Logger & logger ) const
virtual

Create and initialize the state for this policy.

Parameters
gctxThe geometry context
argsThe navigation arguments
stateManagerThe state manager to push the new state onto
loggerLogger for debug output

Reimplemented in Acts::MultiNavigationPolicy.

◆ initializeStatelessCache()

void Acts::INavigationPolicy::initializeStatelessCache ( const GeometryContext & gctx,
const Logger & logger = getDummyLogger() )

One-time initialization step that probes whether this policy pushes only default (empty) states and caches the result (mutating internal state), allowing the navigator to skip the per-volume-entry state creation and the matching pop entirely for volumes with such policies.

This is an eager initialization (deliberately not a lazy first-call latch): it is called for all attached policies at the end of Gen3 geometry construction, once every policy is in place. It must be called again should a policy be attached after that point; an uninitialized policy conservatively reports stateful via isStateless, so skipping this step is always safe.

Note
This relies on the contract that the defaultness of the state a navigation policy pushes does not depend on the geometry context or the navigation arguments: a policy either always pushes a real state (it has something to validate) or always pushes the default empty state.
Parameters
gctxThe current geometry context object, e.g. alignment
loggerLogger for debug output

◆ isStateless()

bool Acts::INavigationPolicy::isStateless ( ) const

Whether this policy is known to push only default (empty) states, see initializeStatelessCache.

Returns
true if the policy was probed and found stateless

◆ isValid()

virtual bool Acts::INavigationPolicy::isValid ( const GeometryContext & gctx,
const NavigationArguments & args,
NavigationPolicyState & state,
const Logger & logger ) const
virtual

Check if the policy is in a valid state for navigation.

Parameters
gctxThe geometry context
argsThe navigation arguments
stateThe navigation policy state to check
loggerLogger for debug output
Returns
True if the policy state is valid, false otherwise

Reimplemented in Acts::MultiNavigationPolicy.

◆ popState()

virtual void Acts::INavigationPolicy::popState ( NavigationPolicyStateManager & stateManager,
const Logger & logger ) const
virtual

Remove the state for this policy from the state manager.

Parameters
stateManagerThe state manager to pop the state from
loggerLogger for debug output

Reimplemented in Acts::MultiNavigationPolicy.

◆ visit()

virtual void Acts::INavigationPolicy::visit ( const std::function< void(const INavigationPolicy &)> & visitor) const
virtual

Convenience function to walk over all navigation policies.

The default implementation just calls this on itself, while the MultiNavigationPolicy will call it on all it's children.

Parameters
visitorThe visitor function to call for each policy

Reimplemented in Acts::MultiNavigationPolicy.