ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::AnyTrackProxy< read_only > Class Template Reference

Type-erased track object This class provides a type-erased interface to track proxies without requiring heap allocation per instance. More...

#include <Acts/EventData/AnyTrackProxy.hpp>

Inheritance diagram for Acts::AnyTrackProxy< read_only >:
[legend]
Collaboration diagram for Acts::AnyTrackProxy< read_only >:
[legend]

Public Types

using ConstCovarianceMap = detail_anytrack::ConstCovarianceMap
using ConstParametersMap = detail_anytrack::ConstParametersMap
using ConstProxyType = AnyTrackProxy<true>
using ConstTrackHandle = AnyTrackProxy<true>
 Alias for the const version.
using ContainerPointer = std::conditional_t<ReadOnly, const void*, void*>
using CovarianceMap = detail_anytrack::CovarianceMap
using HandlerPointer
using MutableTrackHandle = AnyTrackProxy<false>
 Alias for the mutable version.
using ParametersMap = detail_anytrack::ParametersMap
Public Types inherited from Acts::TrackProxyCommon< AnyTrackProxy< true >, TrackIndexType, true >
using IndexType
 Index type used for referencing track states.

Public Member Functions

 AnyTrackProxy (const AnyTrackProxy &other)=default
 Copy constructor: const to const or mutable to mutable.
template<TrackProxyConcept track_proxy_t>
requires (ReadOnly || !track_proxy_t::ReadOnly)
 AnyTrackProxy (track_proxy_t track)
 Construct from a concrete track proxy.
double absoluteMomentum () const
 Get the absolute momentum.
double charge () const
 Get the charge.
template<typename T, HashedString key>
requires (!ReadOnly)
T & component ()
 Get a mutable reference to a dynamic column component.
template<typename T, HashedString key>
const T & component () const
 Get a const reference to a dynamic column component.
template<typename T>
requires (!ReadOnly)
T & component (HashedString key)
 Get a mutable reference to a dynamic column component.
template<typename T>
const T & component (HashedString key) const
 Get a const reference to a dynamic column component.
CovarianceMap covariance ()
 Get the mutable covariance map.
ConstCovarianceMap covariance () const
 Get the covariance map.
double & covariance (std::size_t i, std::size_t j)
 Get a mutable reference to a covariance element.
double covariance (std::size_t i, std::size_t j) const
 Get a covariance matrix element.
Vector4 fourMomentum () const
 Get the four-momentum vector: (px, py, pz, e).
bool hasColumn (HashedString key) const
 Check if the track has a specific dynamic column.
bool hasReferenceSurface () const
 Check if track has a reference surface.
TrackIndexType index () const
 Get the index of this track.
double loc0 () const
 Access the loc0 parameter of the track at the reference surface.
double loc1 () const
 Access the loc1 parameter of the track at the reference surface.
unsigned int nTrackStates () const
 Get the number of track states.
AnyTrackProxyoperator= (const AnyTrackProxy &other)=default
 Copy assignment operator: const to const or mutable to mutable.
double & parameter (std::size_t i)
 Get a mutable reference to a parameter component.
double parameter (std::size_t i) const
 Get a parameter value by index.
ParametersMap parameters ()
 Get the mutable bound parameters map.
ConstParametersMap parameters () const
 Get the bound parameters map.
ParticleHypothesis particleHypothesis () const
 Get the particle hypothesis.
double phi () const
 Access the phi parameter of the track at the reference surface.
double qOverP () const
 Access the q/p (curvature) parameter of the track at the reference surface.
const SurfacereferenceSurface () const
 Get the reference surface.
double theta () const
 Access the theta parameter of the track at the reference surface.
double time () const
 Access the time parameter of the track at the reference surface.
double transverseMomentum () const
 Get the transverse momentum.
Public Member Functions inherited from Acts::TrackProxyCommon< AnyTrackProxy< true >, TrackIndexType, true >
double absoluteMomentum () const
 Get the absolute momentum.
double charge () const
 Get the charge.
float chi2 () const
 Return the local chi-squared contribution.
Vector3 direction () const
 Get a unit vector along the track direction at the reference surface.
Vector4 fourMomentum () const
 Get the four-momentum vector: (px, py, pz, e).
double loc0 () const
 Access the loc0 parameter of the track at the reference surface.
double loc1 () const
 Access the loc1 parameter of the track at the reference surface.
Vector3 momentum () const
 Get the global momentum vector.
unsigned int nDoF () const
 Return the number of degrees of freedom.
unsigned int nHoles () const
 Return the number of holes on this track.
unsigned int nMeasurements () const
 Return the number of measurements assigned to this track.
unsigned int nOutliers () const
 Return the number of outliers for this track.
unsigned int nSharedHits () const
 Return the number of shared hits for this track.
double phi () const
 Access the phi parameter of the track at the reference surface.
double qOverP () const
 Access the q/p (curvature) parameter of the track at the reference surface.
IndexType stemIndex () const
 Get the stem index, i.e. the innermost track state in the track.
double theta () const
 Access the theta parameter of the track at the reference surface.
double time () const
 Access the time parameter of the track at the reference surface.
IndexType tipIndex () const
 Get the tip index, i.e. the entry point into the track state container.
double transverseMomentum () const
 Get the transverse momentum.

Static Public Attributes

static constexpr bool ReadOnly = read_only
 Indicates whether this track is read-only.

Additional Inherited Members

Protected Member Functions inherited from Acts::TrackProxyCommon< AnyTrackProxy< true >, TrackIndexType, true >
constexpr AnyTrackProxy< true > & derived ()

Detailed Description

template<bool read_only = true>
class Acts::AnyTrackProxy< read_only >

Type-erased track object This class provides a type-erased interface to track proxies without requiring heap allocation per instance.

It stores a pointer to the track container and the track index, similar to how TrackProxy works internally.

The object does not take ownership of the container - the container must outlive the object.

Template Parameters
read_onlyIf true, provides read-only access to the track

Usage:

TrackContainer tracks = ...;
auto track = tracks.getTrack(0);
AnyMutableTrack AnyTrackProxy(track); // Mutable track
AnyConstTrack constTrack(track); // Read-only track
std::cout << "Chi2: " << AnyTrackProxy.chi2() << std::endl;
friend class AnyTrackProxy
Definition AnyTrackProxy.hpp:528
Track container interface class.
Definition TrackContainer.hpp:41
ConstTrackProxy getTrack(IndexType itrack) const
Get a const track proxy for a track index.
Definition TrackContainer.hpp:159

Member Typedef Documentation

◆ ConstCovarianceMap

template<bool read_only = true>
using Acts::AnyTrackProxy< read_only >::ConstCovarianceMap = detail_anytrack::ConstCovarianceMap

◆ ConstParametersMap

template<bool read_only = true>
using Acts::AnyTrackProxy< read_only >::ConstParametersMap = detail_anytrack::ConstParametersMap

◆ ConstProxyType

template<bool read_only = true>
using Acts::AnyTrackProxy< read_only >::ConstProxyType = AnyTrackProxy<true>

◆ ConstTrackHandle

template<bool read_only = true>
using Acts::AnyTrackProxy< read_only >::ConstTrackHandle = AnyTrackProxy<true>

Alias for the const version.

◆ ContainerPointer

template<bool read_only = true>
using Acts::AnyTrackProxy< read_only >::ContainerPointer = std::conditional_t<ReadOnly, const void*, void*>

◆ CovarianceMap

template<bool read_only = true>
using Acts::AnyTrackProxy< read_only >::CovarianceMap = detail_anytrack::CovarianceMap

◆ HandlerPointer

template<bool read_only = true>
using Acts::AnyTrackProxy< read_only >::HandlerPointer
Initial value:
std::conditional_t<ReadOnly,
const detail_anytrack::TrackHandlerConstBase*,
const detail_anytrack::TrackHandlerMutableBase*>
static constexpr bool ReadOnly
Indicates whether this track is read-only.
Definition AnyTrackProxy.hpp:298

◆ MutableTrackHandle

template<bool read_only = true>
using Acts::AnyTrackProxy< read_only >::MutableTrackHandle = AnyTrackProxy<false>

Alias for the mutable version.

◆ ParametersMap

template<bool read_only = true>
using Acts::AnyTrackProxy< read_only >::ParametersMap = detail_anytrack::ParametersMap

Constructor & Destructor Documentation

◆ AnyTrackProxy() [1/2]

template<bool read_only = true>
Acts::AnyTrackProxy< read_only >::AnyTrackProxy ( const AnyTrackProxy< read_only > & other)
default

Copy constructor: const to const or mutable to mutable.

Parameters
otherthe other track

◆ AnyTrackProxy() [2/2]

template<bool read_only = true>
template<TrackProxyConcept track_proxy_t>
requires (ReadOnly || !track_proxy_t::ReadOnly)
Acts::AnyTrackProxy< read_only >::AnyTrackProxy ( track_proxy_t track)
explicit

Construct from a concrete track proxy.

Template Parameters
track_proxy_tThe concrete track proxy type
Parameters
trackThe track proxy to wrap
Note
Does not take ownership. The track container must outlive this object.
AnyConstTrack can be constructed from both mutable and const track proxies. AnyMutableTrack can only be constructed from mutable track proxies.

Member Function Documentation

◆ absoluteMomentum()

template<bool read_only = true>
double Acts::TrackProxyCommon< AnyTrackProxy< read_only >, TrackIndexType, read_only >::absoluteMomentum ( ) const

Get the absolute momentum.

Returns
The absolute momentum value

◆ charge()

template<bool read_only = true>
double Acts::TrackProxyCommon< AnyTrackProxy< read_only >, TrackIndexType, read_only >::charge ( ) const

Get the charge.

Returns
The charge value

◆ component() [1/4]

template<bool read_only = true>
template<typename T, HashedString key>
requires (!ReadOnly)
T & Acts::AnyTrackProxy< read_only >::component ( )

Get a mutable reference to a dynamic column component.

Template Parameters
TThe type of the component
keyString key for the component to access
Returns
Mutable reference to the component
Note
Only available if ReadOnly is false

◆ component() [2/4]

template<bool read_only = true>
template<typename T, HashedString key>
const T & Acts::AnyTrackProxy< read_only >::component ( ) const

Get a const reference to a dynamic column component.

Template Parameters
TThe type of the component
keyString key for the component to access
Returns
Const reference to the component

◆ component() [3/4]

template<bool read_only = true>
template<typename T>
requires (!ReadOnly)
T & Acts::AnyTrackProxy< read_only >::component ( HashedString key)

Get a mutable reference to a dynamic column component.

Template Parameters
TThe type of the component
Parameters
keyString key for the component to access
Returns
Mutable reference to the component
Note
Only available if ReadOnly is false

◆ component() [4/4]

template<bool read_only = true>
template<typename T>
const T & Acts::AnyTrackProxy< read_only >::component ( HashedString key) const

Get a const reference to a dynamic column component.

Template Parameters
TThe type of the component
Parameters
keyString key for the component to access
Returns
Const reference to the component

◆ covariance() [1/4]

template<bool read_only = true>
CovarianceMap Acts::AnyTrackProxy< read_only >::covariance ( )

Get the mutable covariance map.

◆ covariance() [2/4]

template<bool read_only = true>
ConstCovarianceMap Acts::AnyTrackProxy< read_only >::covariance ( ) const

Get the covariance map.

◆ covariance() [3/4]

template<bool read_only = true>
double & Acts::AnyTrackProxy< read_only >::covariance ( std::size_t i,
std::size_t j )

Get a mutable reference to a covariance element.

Parameters
iRow index
jColumn index
Returns
Mutable reference to the covariance value

◆ covariance() [4/4]

template<bool read_only = true>
double Acts::AnyTrackProxy< read_only >::covariance ( std::size_t i,
std::size_t j ) const

Get a covariance matrix element.

Parameters
iRow index
jColumn index
Returns
The covariance element

◆ fourMomentum()

template<bool read_only = true>
Vector4 Acts::TrackProxyCommon< AnyTrackProxy< read_only >, TrackIndexType, read_only >::fourMomentum ( ) const

Get the four-momentum vector: (px, py, pz, e).

Returns
the four-momentum vector

◆ hasColumn()

template<bool read_only = true>
bool Acts::AnyTrackProxy< read_only >::hasColumn ( HashedString key) const

Check if the track has a specific dynamic column.

Parameters
keyThe hashed column key
Returns
true if the column exists

◆ hasReferenceSurface()

template<bool read_only = true>
bool Acts::AnyTrackProxy< read_only >::hasReferenceSurface ( ) const

Check if track has a reference surface.

Returns
true if a reference surface exists

◆ index()

template<bool read_only = true>
TrackIndexType Acts::AnyTrackProxy< read_only >::index ( ) const

Get the index of this track.

Returns
The track index

◆ loc0()

template<bool read_only = true>
double Acts::TrackProxyCommon< AnyTrackProxy< read_only >, TrackIndexType, read_only >::loc0 ( ) const

Access the loc0 parameter of the track at the reference surface.

Returns
The loc0 parameter

◆ loc1()

template<bool read_only = true>
double Acts::TrackProxyCommon< AnyTrackProxy< read_only >, TrackIndexType, read_only >::loc1 ( ) const

Access the loc1 parameter of the track at the reference surface.

Returns
The loc1 parameter

◆ nTrackStates()

template<bool read_only = true>
unsigned int Acts::AnyTrackProxy< read_only >::nTrackStates ( ) const

Get the number of track states.

Returns
The number of track states

◆ operator=()

template<bool read_only = true>
AnyTrackProxy & Acts::AnyTrackProxy< read_only >::operator= ( const AnyTrackProxy< read_only > & other)
default

Copy assignment operator: const to const or mutable to mutable.

Parameters
otherthe other track
Returns
reference to this track

◆ parameter() [1/2]

template<bool read_only = true>
double & Acts::AnyTrackProxy< read_only >::parameter ( std::size_t i)

Get a mutable reference to a parameter component.

Parameters
iThe parameter index
Returns
Mutable reference to the value

◆ parameter() [2/2]

template<bool read_only = true>
double Acts::AnyTrackProxy< read_only >::parameter ( std::size_t i) const

Get a parameter value by index.

Parameters
iThe parameter index
Returns
The parameter value

◆ parameters() [1/2]

template<bool read_only = true>
ParametersMap Acts::AnyTrackProxy< read_only >::parameters ( )

Get the mutable bound parameters map.

◆ parameters() [2/2]

template<bool read_only = true>
ConstParametersMap Acts::AnyTrackProxy< read_only >::parameters ( ) const

Get the bound parameters map.

◆ particleHypothesis()

template<bool read_only = true>
ParticleHypothesis Acts::AnyTrackProxy< read_only >::particleHypothesis ( ) const

Get the particle hypothesis.

Returns
The particle hypothesis

◆ phi()

template<bool read_only = true>
double Acts::TrackProxyCommon< AnyTrackProxy< read_only >, TrackIndexType, read_only >::phi ( ) const

Access the phi parameter of the track at the reference surface.

Returns
The phi parameter

◆ qOverP()

template<bool read_only = true>
double Acts::TrackProxyCommon< AnyTrackProxy< read_only >, TrackIndexType, read_only >::qOverP ( ) const

Access the q/p (curvature) parameter of the track at the reference surface.

Returns
The q/p parameter

◆ referenceSurface()

template<bool read_only = true>
const Surface & Acts::AnyTrackProxy< read_only >::referenceSurface ( ) const

Get the reference surface.

Returns
Reference to the reference surface

◆ theta()

template<bool read_only = true>
double Acts::TrackProxyCommon< AnyTrackProxy< read_only >, TrackIndexType, read_only >::theta ( ) const

Access the theta parameter of the track at the reference surface.

Returns
The theta parameter

◆ time()

template<bool read_only = true>
double Acts::TrackProxyCommon< AnyTrackProxy< read_only >, TrackIndexType, read_only >::time ( ) const

Access the time parameter of the track at the reference surface.

Returns
The time parameter

◆ transverseMomentum()

template<bool read_only = true>
double Acts::TrackProxyCommon< AnyTrackProxy< read_only >, TrackIndexType, read_only >::transverseMomentum ( ) const

Get the transverse momentum.

Returns
The transverse momentum value

Member Data Documentation

◆ ReadOnly

template<bool read_only = true>
bool Acts::AnyTrackProxy< read_only >::ReadOnly = read_only
staticconstexpr

Indicates whether this track is read-only.