ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::Direction Class Referencefinal

The direction is always with respect to a given momentum, surface normal or other general axes. More...

#include <Acts/Definitions/Direction.hpp>

Public Member Functions

constexpr std::size_t index () const
 Convert dir to index [0,1] which allows to store direction dependent objects in std::array<T, 2u>.
constexpr Direction invert () const
 Reverse the direction.
constexpr int sign () const
 Turns the direction into a signed value.
std::string toString () const
 Convert direction to string representation.

Static Public Member Functions

static constexpr Direction AlongNormal ()
 Create direction along normal (positive).
static constexpr Direction Backward ()
 Create backward direction (equivalent to negative).
static constexpr Direction Forward ()
 Create forward direction (equivalent to positive).
static constexpr Direction fromIndex (std::size_t index)
 Convert and index [0,1] to a direction e.g.
static constexpr Direction fromScalar (double scalar)
 This turns a signed value into a direction.
static constexpr Direction fromScalarZeroAsPositive (double scalar)
 This turns a signed value into a direction and 0 will be handled as a positive direction.
static constexpr Direction Negative ()
 Create negative direction (-1).
static constexpr Direction OppositeNormal ()
 Create direction opposite to normal (negative).
static constexpr Direction Positive ()
 Create positive direction (+1).

Detailed Description

The direction is always with respect to a given momentum, surface normal or other general axes.

Member Function Documentation

◆ AlongNormal()

constexpr Direction Acts::Direction::AlongNormal ( )
staticconstexpr

Create direction along normal (positive).

Returns
Direction with positive value, along surface normal

◆ Backward()

constexpr Direction Acts::Direction::Backward ( )
staticconstexpr

Create backward direction (equivalent to negative).

Returns
Direction with negative value for backward propagation

◆ Forward()

constexpr Direction Acts::Direction::Forward ( )
staticconstexpr

Create forward direction (equivalent to positive).

Returns
Direction with positive value for forward propagation

◆ fromIndex()

constexpr Direction Acts::Direction::fromIndex ( std::size_t index)
staticconstexpr

Convert and index [0,1] to a direction e.g.

for sorting in std::array<T, 2u>

Parameters
indexis the direction at input
Returns
Direction corresponding to the index (0->Negative, 1->Positive)

◆ fromScalar()

constexpr Direction Acts::Direction::fromScalar ( double scalar)
staticconstexpr

This turns a signed value into a direction.

Will assert on zero.

Parameters
scalaris the signed value
Returns
a direction enum

◆ fromScalarZeroAsPositive()

constexpr Direction Acts::Direction::fromScalarZeroAsPositive ( double scalar)
staticconstexpr

This turns a signed value into a direction and 0 will be handled as a positive direction.

Only use this when you are convinced that the 0 case is properly handled downstream.

Parameters
scalaris the signed value
Returns
a direction enum

◆ index()

std::size_t Acts::Direction::index ( ) const
constexpr

Convert dir to index [0,1] which allows to store direction dependent objects in std::array<T, 2u>.

Returns
either 0 or 1

◆ invert()

Direction Acts::Direction::invert ( ) const
constexpr

Reverse the direction.

Returns
an opposite direction

◆ Negative()

constexpr Direction Acts::Direction::Negative ( )
staticconstexpr

Create negative direction (-1).

Returns
Direction with negative value

◆ OppositeNormal()

constexpr Direction Acts::Direction::OppositeNormal ( )
staticconstexpr

Create direction opposite to normal (negative).

Returns
Direction with negative value, opposite to surface normal

◆ Positive()

constexpr Direction Acts::Direction::Positive ( )
staticconstexpr

Create positive direction (+1).

Returns
Direction with positive value

◆ sign()

int Acts::Direction::sign ( ) const
constexpr

Turns the direction into a signed value.

Returns
a signed value

◆ toString()

std::string Acts::Direction::toString ( ) const

Convert direction to string representation.

Returns
String representation of the direction ("positive" or "negative")