ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::MultiTrajectory Class Reference

Read only version of MTJ The implementation is separate as the details are significantly different and in addition only const methods are ever needed. More...

#include <MultiTrajectory.h>

Inheritance diagram for ActsTrk::MultiTrajectory:
Collaboration diagram for ActsTrk::MultiTrajectory:

Public Member Functions

 MultiTrajectory (DataLink< xAOD::TrackStateAuxContainer > trackStates, DataLink< xAOD::TrackParametersAuxContainer > trackParameters, DataLink< xAOD::TrackJacobianAuxContainer > trackJacobians, DataLink< xAOD::TrackMeasurementAuxContainer > trackMeasurements, DataLink< xAOD::TrackSurfaceAuxContainer > trackSurfaces)
 MultiTrajectory (ActsTrk::MutableMultiTrajectory &other)
bool has_impl (Acts::HashedString key, ActsTrk::IndexType istate) const
std::any component_impl (Acts::HashedString key, ActsTrk::IndexType istate) const
bool hasColumn_impl (Acts::HashedString key) const
ConstTrackStateProxy::ConstParameters parameters_impl (ActsTrk::IndexType index) const
ConstTrackStateProxy::ConstCovariance covariance_impl (ActsTrk::IndexType index) const
ConstTrackStateProxy::ConstCovariance jacobian_impl (ActsTrk::IndexType istate) const
template<std::size_t measdim>
ConstTrackStateProxy::template ConstCalibrated< measdim > calibrated_impl (IndexType istate) const
template<std::size_t measdim>
ConstTrackStateProxy::template ConstCalibratedCovariance< measdim > calibratedCovariance_impl (IndexType index) const
Acts::TrackIndexType size_impl () const
ActsTrk::IndexType calibratedSize_impl (ActsTrk::IndexType istate) const
Acts::SourceLink getUncalibratedSourceLink_impl (ActsTrk::IndexType istate) const
const Acts::Surface * referenceSurface_impl (IndexType) const
void fillSurfaces (const Acts::TrackingGeometry *geo)
 Fill surfaces either from persistency or from geometry If the surfaces are already there it means that the container is trainsient and this is void operation.
void moveSurfaces (const ActsTrk::MutableMultiTrajectory *mtj)
 reuse surfaces from MutableMultiTrajectory
void moveLinks (const ActsTrk::MutableMultiTrajectory *mtj)
std::vector< Acts::HashedString > dynamicKeys_impl () const

Private Attributes

const DataLink< xAOD::TrackStateAuxContainerm_trackStatesAux
const DataLink< xAOD::TrackParametersAuxContainerm_trackParametersAux
const DataLink< xAOD::TrackJacobianAuxContainerm_trackJacobiansAux
const DataLink< xAOD::TrackMeasurementAuxContainerm_trackMeasurementsAux
const DataLink< xAOD::TrackSurfaceAuxContainerm_trackSurfacesAux
std::vector< ActsTrk::detail::Decorationm_decorations
std::vector< std::optional< Acts::SourceLink > > m_calibratedSourceLinks
std::vector< std::optional< Acts::SourceLink > > m_uncalibratedSourceLinks
std::vector< StoredSurfacem_surfaces
xAOD::TrackStateContainer m_trackStatesIface

Detailed Description

Read only version of MTJ The implementation is separate as the details are significantly different and in addition only const methods are ever needed.

Definition at line 420 of file MultiTrajectory.h.

Constructor & Destructor Documentation

◆ MultiTrajectory() [1/2]

ActsTrk::MultiTrajectory::MultiTrajectory ( DataLink< xAOD::TrackStateAuxContainer > trackStates,
DataLink< xAOD::TrackParametersAuxContainer > trackParameters,
DataLink< xAOD::TrackJacobianAuxContainer > trackJacobians,
DataLink< xAOD::TrackMeasurementAuxContainer > trackMeasurements,
DataLink< xAOD::TrackSurfaceAuxContainer > trackSurfaces )

Definition at line 628 of file MultiTrajectory.cxx.

634 : m_trackStatesAux(trackStates),
635 m_trackParametersAux(trackParameters),
636 m_trackJacobiansAux(trackJacobians),
637 m_trackMeasurementsAux(trackMeasurements),
638 m_trackSurfacesAux(trackSurfaces),
639 m_trackStatesIface (trackStates->size()) {
640 m_trackStatesIface.setStore (trackStates.cptr());
641 INSPECTCALL("ctor from backends" << this << " " << m_trackStatesIface.size());
643}
#define INSPECTCALL(_INFO)
const DataLink< xAOD::TrackParametersAuxContainer > m_trackParametersAux
const DataLink< xAOD::TrackMeasurementAuxContainer > m_trackMeasurementsAux
std::vector< ActsTrk::detail::Decoration > m_decorations
xAOD::TrackStateContainer m_trackStatesIface
const DataLink< xAOD::TrackStateAuxContainer > m_trackStatesAux
const DataLink< xAOD::TrackSurfaceAuxContainer > m_trackSurfacesAux
const DataLink< xAOD::TrackJacobianAuxContainer > m_trackJacobiansAux
static const std::set< std::string > s_staticVariables
std::vector< Decoration > restoreDecorations(const SG::IConstAuxStore *container, const std::set< std::string > &staticVariables)

◆ MultiTrajectory() [2/2]

ActsTrk::MultiTrajectory::MultiTrajectory ( ActsTrk::MutableMultiTrajectory & other)

Definition at line 645 of file MultiTrajectory.cxx.

646 : m_trackStatesAux(other.m_trackStatesAux.get()),
647 m_trackParametersAux(other.m_trackParametersAux.get()),
648 m_trackJacobiansAux(other.m_trackJacobiansAux.get()),
649 m_trackMeasurementsAux(other.m_trackMeasurementsAux.get()),
650 m_trackSurfacesAux(other.m_surfacesBackendAux.get()),
651 m_surfaces(other.m_surfaces) {
652 other.trim();
653 INSPECTCALL("ctor from MutableMTJ" << this << " " << m_trackStatesAux->size());
655}
std::vector< StoredSurface > m_surfaces

Member Function Documentation

◆ calibrated_impl()

template<std::size_t measdim>
ConstTrackStateProxy::template ConstCalibrated< measdim > ActsTrk::MultiTrajectory::calibrated_impl ( IndexType istate) const
inline

Definition at line 457 of file MultiTrajectory.h.

457 {
458 xAOD::TrackStateIndexType measIdx = m_trackStatesAux->calibrated[istate];
459 return typename ConstTrackStateProxy::template ConstCalibrated<measdim>{m_trackMeasurementsAux->meas[measIdx].data()};
460 }
uint32_t TrackStateIndexType

◆ calibratedCovariance_impl()

template<std::size_t measdim>
ConstTrackStateProxy::template ConstCalibratedCovariance< measdim > ActsTrk::MultiTrajectory::calibratedCovariance_impl ( IndexType index) const
inline

Definition at line 464 of file MultiTrajectory.h.

464 {
465 xAOD::TrackStateIndexType measIdx = m_trackStatesAux->calibrated[index];
466 return typename ConstTrackStateProxy::template ConstCalibratedCovariance<measdim>{m_trackMeasurementsAux->covMatrix[measIdx].data()};
467 }
str index
Definition DeMoScan.py:362

◆ calibratedSize_impl()

ActsTrk::IndexType ActsTrk::MultiTrajectory::calibratedSize_impl ( ActsTrk::IndexType istate) const

Definition at line 753 of file MultiTrajectory.cxx.

753 {
754 return m_trackStatesAux->measDim[istate];
755}

◆ component_impl()

std::any ActsTrk::MultiTrajectory::component_impl ( Acts::HashedString key,
ActsTrk::IndexType istate ) const

Definition at line 678 of file MultiTrajectory.cxx.

679 {
680 using namespace Acts::HashedStringLiteral;
681 switch (key) {
682 case "previous"_hash:
683 return &(m_trackStatesAux->previous[istate]);
684 case "next"_hash:
685 return &(m_trackStatesAux->next[istate]);
686 case "chi2"_hash:
687 return &(m_trackStatesAux->chi2[istate]);
688 case "pathLength"_hash:
689 return &(m_trackStatesAux->pathLength[istate]);
690 case "predicted"_hash:
691 return &(m_trackStatesAux->predicted[istate]);
692 case "filtered"_hash:
693 return &(m_trackStatesAux->filtered[istate]);
694 case "smoothed"_hash:
695 return &(m_trackStatesAux->smoothed[istate]);
696 case "jacobian"_hash:
697 return &(m_trackStatesAux->jacobian[istate]);
698 case "projector"_hash: {
699 return &(m_trackMeasurementsAux->projector.at(m_trackStatesAux->calibrated[istate]));
700 }
701 case "calibrated"_hash: {
702 return &(m_trackStatesAux->calibrated[istate]);
703 }
704 case "calibratedCov"_hash: {
705 return &(m_trackStatesAux->calibrated[istate]);
706 }
707 case "measdim"_hash:
708 return &(m_trackStatesAux->measDim[istate]);
709 case "typeFlags"_hash:
710 return &(m_trackStatesAux->typeFlags[istate]);
711 default: {
712 for (auto& d : m_decorations) {
713 if (d.hash == key) {
714 // TODO the dynamic_cast will disappear
715 return d.getter(m_trackStatesAux.cptr(), istate, d.auxid);
716 }
717 }
718 throw std::runtime_error("MultiTrajectory::component_impl no such component " + std::to_string(key));
719 }
720 }
721}

◆ covariance_impl()

ConstTrackStateProxy::ConstCovariance ActsTrk::MultiTrajectory::covariance_impl ( ActsTrk::IndexType index) const
inline

Definition at line 444 of file MultiTrajectory.h.

445 {
446 return typename ConstTrackStateProxy::ConstCovariance{m_trackParametersAux->covMatrix[index].data()};
447 }

◆ dynamicKeys_impl()

std::vector< Acts::HashedString > ActsTrk::MultiTrajectory::dynamicKeys_impl ( ) const

Definition at line 767 of file MultiTrajectory.cxx.

767 {
768 std::vector<Acts::HashedString> keys;
769 for ( const ActsTrk::detail::Decoration& d: m_decorations) {
770 keys.push_back(d.hash);
771 }
772 return keys;
773}

◆ fillSurfaces()

void ActsTrk::MultiTrajectory::fillSurfaces ( const Acts::TrackingGeometry * geo)

Fill surfaces either from persistency or from geometry If the surfaces are already there it means that the container is trainsient and this is void operation.

Definition at line 776 of file MultiTrajectory.cxx.

776 {
777 if ( not m_surfaces.empty() )
778 return;
779 m_surfaces.resize(m_trackStatesIface.size(), nullptr);
780 for ( IndexType i = 0; i < m_trackStatesIface.size(); i++ ) {
781 auto geoID = m_trackStatesAux->geometryId[i];
782 if ( geoID == InvalidGeoID ) {
783 m_surfaces[i] = nullptr;
784 continue;
785 }
786 if ( geoID != 0 ) {
787 m_surfaces[i] = geo->findSurface(Acts::GeometryIdentifier{geoID});
788 } else {
789 unsigned int backendIndex = m_trackStatesAux->surfaceIndex[i];
790 std::shared_ptr<const Acts::Surface> surface = decodeSurface(m_trackSurfacesAux, backendIndex);
791 m_surfaces[i] = surface; // TODO
792
793 }
794 }
795}
constexpr uint64_t InvalidGeoID
std::shared_ptr< const Acts::Surface > decodeSurface(const xAOD::TrackSurface *backend)
Creates transient Acts Surface objects given a surface backend implementation should be exact mirror ...
std::uint32_t IndexType
Definition Decoration.h:18

◆ getUncalibratedSourceLink_impl()

Acts::SourceLink ActsTrk::MultiTrajectory::getUncalibratedSourceLink_impl ( ActsTrk::IndexType istate) const

Definition at line 822 of file MultiTrajectory.cxx.

823 {
824 assert(istate < m_trackStatesIface.size());
825 // at the moment when converting Trk::Track to Acts tracks the measurements on track
826 // are not converted to xAOD::UncalibratedMeasurements, and the Acts::SourceLinks
827 // just contain a pointer to the Trk::Measurement. To keep this functionality
828 // SourceLinks are either stored in the m_uncalibratedSourceLinks cache
829 // or taken from the xAOD backend.
830 static const SG::ConstAccessor<const xAOD::UncalibratedMeasurement*> acc{"uncalibratedMeasurement"};
831 if (const xAOD::UncalibratedMeasurement* ptr = acc.withDefault(m_trackStatesIface, istate, nullptr))
832 {
834 }
835 return m_uncalibratedSourceLinks[istate].value();
836}
std::vector< std::optional< Acts::SourceLink > > m_uncalibratedSourceLinks
static Acts::SourceLink pack(const Ptr_t &measurement)
Pack the measurement type pointer to an Acts::SourceLink including the intermediate conversion into a...
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.

◆ has_impl()

bool ActsTrk::MultiTrajectory::has_impl ( Acts::HashedString key,
ActsTrk::IndexType istate ) const

Definition at line 658 of file MultiTrajectory.cxx.

659 {
660 // const auto& trackStates = *m_trackStates;
661 std::optional<bool> inTrackState = ::has_impl(m_trackStatesAux, key, istate);
662 if (inTrackState.has_value())
663 return inTrackState.value();
664 // TODO remove once EL based source links are in use only
665 using namespace Acts::HashedStringLiteral;
666 if (key == "uncalibratedSourceLink"_hash) {
667 static const SG::ConstAccessor<const xAOD::UncalibratedMeasurement*> acc{"uncalibratedMeasurement"};
668 if (acc.isAvailable (m_trackStatesIface)) {
669 return acc(m_trackStatesIface, istate) != nullptr;
670 }
671 else {
672 return (istate < m_uncalibratedSourceLinks.size() && m_uncalibratedSourceLinks[istate].has_value());
673 }
674 }
675 return false;
676}
bool has_impl(Acts::HashedString key, ActsTrk::IndexType istate) const

◆ hasColumn_impl()

bool ActsTrk::MultiTrajectory::hasColumn_impl ( Acts::HashedString key) const

Definition at line 723 of file MultiTrajectory.cxx.

724 {
725 using namespace Acts::HashedStringLiteral;
726 // TODO try using staticVariables set
727 switch (key) {
728 case "previous"_hash:
729 case "next"_hash:
730 case "chi2"_hash:
731 case "pathLength"_hash:
732 case "predicted"_hash:
733 case "filtered"_hash:
734 case "smoothed"_hash:
735 case "jacobian"_hash:
736 case "projector"_hash:
737 case "uncalibratedSourceLink"_hash:
738 case "calibrated"_hash:
739 case "calibratedCov"_hash:
740 case "measdim"_hash:
741 case "typeFlags"_hash:
742 return true;
743 }
744 for (auto& d : m_decorations) {
745 if (d.hash == key) {
746 return true;
747 }
748 }
749 return false;
750}

◆ jacobian_impl()

ConstTrackStateProxy::ConstCovariance ActsTrk::MultiTrajectory::jacobian_impl ( ActsTrk::IndexType istate) const
inline

Definition at line 449 of file MultiTrajectory.h.

450 {
451 xAOD::TrackStateIndexType jacIdx = m_trackStatesAux->jacobian[istate];
452 return typename ConstTrackStateProxy::ConstCovariance{m_trackJacobiansAux->jac[jacIdx].data()};
453 }

◆ moveLinks()

void ActsTrk::MultiTrajectory::moveLinks ( const ActsTrk::MutableMultiTrajectory * mtj)

Definition at line 762 of file MultiTrajectory.cxx.

762 {
765}
std::vector< std::optional< Acts::SourceLink > > m_calibratedSourceLinks
std::vector< std::optional< Acts::SourceLink > > m_calibratedSourceLinks
std::vector< std::optional< Acts::SourceLink > > m_uncalibratedSourceLinks

◆ moveSurfaces()

void ActsTrk::MultiTrajectory::moveSurfaces ( const ActsTrk::MutableMultiTrajectory * mtj)

reuse surfaces from MutableMultiTrajectory

Definition at line 757 of file MultiTrajectory.cxx.

757 {
758 m_surfaces = std::move(mtj->m_surfaces);
759}
std::vector< StoredSurface > m_surfaces

◆ parameters_impl()

ConstTrackStateProxy::ConstParameters ActsTrk::MultiTrajectory::parameters_impl ( ActsTrk::IndexType index) const
inline

Definition at line 439 of file MultiTrajectory.h.

440 {
441 return typename ConstTrackStateProxy::ConstParameters{m_trackParametersAux->params[index].data()};
442 }

◆ referenceSurface_impl()

const Acts::Surface * ActsTrk::MultiTrajectory::referenceSurface_impl ( IndexType istate) const

Definition at line 798 of file MultiTrajectory.cxx.

798 {
799 INSPECTCALL( this << " " << istate << " " << m_trackStatesIface.size() << " " << m_surfaces.size() << " surf ptr " << toSurfacePtr(m_surfaces[istate]));
800 if ( istate >= m_surfaces.size() ) throw std::out_of_range("MultiTrajectory index " + std::to_string(istate) + " out of range " + std::to_string(m_surfaces.size()) + " when accessing reference surface");
801 return toSurfacePtr(m_surfaces[istate]);
802}

◆ size_impl()

Acts::TrackIndexType ActsTrk::MultiTrajectory::size_impl ( ) const
inline

Definition at line 468 of file MultiTrajectory.h.

468{ return m_trackStatesAux->size(); }

Member Data Documentation

◆ m_calibratedSourceLinks

std::vector<std::optional<Acts::SourceLink> > ActsTrk::MultiTrajectory::m_calibratedSourceLinks
private

Definition at line 498 of file MultiTrajectory.h.

◆ m_decorations

std::vector<ActsTrk::detail::Decoration> ActsTrk::MultiTrajectory::m_decorations
private

Definition at line 495 of file MultiTrajectory.h.

◆ m_surfaces

std::vector<StoredSurface> ActsTrk::MultiTrajectory::m_surfaces
private

Definition at line 504 of file MultiTrajectory.h.

◆ m_trackJacobiansAux

const DataLink<xAOD::TrackJacobianAuxContainer> ActsTrk::MultiTrajectory::m_trackJacobiansAux
private

Definition at line 492 of file MultiTrajectory.h.

◆ m_trackMeasurementsAux

const DataLink<xAOD::TrackMeasurementAuxContainer> ActsTrk::MultiTrajectory::m_trackMeasurementsAux
private

Definition at line 493 of file MultiTrajectory.h.

◆ m_trackParametersAux

const DataLink<xAOD::TrackParametersAuxContainer> ActsTrk::MultiTrajectory::m_trackParametersAux
private

Definition at line 491 of file MultiTrajectory.h.

◆ m_trackStatesAux

const DataLink<xAOD::TrackStateAuxContainer> ActsTrk::MultiTrajectory::m_trackStatesAux
private

Definition at line 490 of file MultiTrajectory.h.

◆ m_trackStatesIface

xAOD::TrackStateContainer ActsTrk::MultiTrajectory::m_trackStatesIface
private

Definition at line 506 of file MultiTrajectory.h.

◆ m_trackSurfacesAux

const DataLink<xAOD::TrackSurfaceAuxContainer> ActsTrk::MultiTrajectory::m_trackSurfacesAux
private

Definition at line 494 of file MultiTrajectory.h.

◆ m_uncalibratedSourceLinks

std::vector<std::optional<Acts::SourceLink> > ActsTrk::MultiTrajectory::m_uncalibratedSourceLinks
private

Definition at line 502 of file MultiTrajectory.h.


The documentation for this class was generated from the following files: