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::Parameters parameters_impl (ActsTrk::IndexType index) const
ConstTrackStateProxy::Covariance covariance_impl (ActsTrk::IndexType index) const
ConstTrackStateProxy::Covariance jacobian_impl (ActsTrk::IndexType istate) const
template<std::size_t measdim>
ConstTrackStateProxy::template Calibrated< measdim > calibrated_impl (IndexType istate) const
template<std::size_t measdim>
ConstTrackStateProxy::template CalibratedCovariance< 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 421 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 616 of file MultiTrajectory.cxx.

622 : m_trackStatesAux(trackStates),
623 m_trackParametersAux(trackParameters),
624 m_trackJacobiansAux(trackJacobians),
625 m_trackMeasurementsAux(trackMeasurements),
626 m_trackSurfacesAux(trackSurfaces),
627 m_trackStatesIface (trackStates->size()) {
628 m_trackStatesIface.setStore (trackStates.cptr());
629 INSPECTCALL("ctor from backends" << this << " " << m_trackStatesIface.size());
631}
#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 633 of file MultiTrajectory.cxx.

634 : m_trackStatesAux(other.m_trackStatesAux.get()),
635 m_trackParametersAux(other.m_trackParametersAux.get()),
636 m_trackJacobiansAux(other.m_trackJacobiansAux.get()),
637 m_trackMeasurementsAux(other.m_trackMeasurementsAux.get()),
638 m_trackSurfacesAux(other.m_surfacesBackendAux.get()),
639 m_surfaces(other.m_surfaces) {
640 other.trim();
641 INSPECTCALL("ctor from MutableMTJ" << this << " " << m_trackStatesAux->size());
643}
std::vector< StoredSurface > m_surfaces

Member Function Documentation

◆ calibrated_impl()

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

Definition at line 458 of file MultiTrajectory.h.

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

◆ calibratedCovariance_impl()

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

Definition at line 465 of file MultiTrajectory.h.

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

◆ calibratedSize_impl()

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

Definition at line 741 of file MultiTrajectory.cxx.

741 {
742 return m_trackStatesAux->measDim[istate];
743}

◆ component_impl()

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

Definition at line 666 of file MultiTrajectory.cxx.

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

◆ covariance_impl()

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

Definition at line 445 of file MultiTrajectory.h.

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

◆ dynamicKeys_impl()

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

Definition at line 755 of file MultiTrajectory.cxx.

755 {
756 std::vector<Acts::HashedString> keys;
757 for ( const ActsTrk::detail::Decoration& d: m_decorations) {
758 keys.push_back(d.hash);
759 }
760 return keys;
761}

◆ 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 764 of file MultiTrajectory.cxx.

764 {
765 if ( not m_surfaces.empty() )
766 return;
767 m_surfaces.resize(m_trackStatesIface.size(), nullptr);
768 for ( IndexType i = 0; i < m_trackStatesIface.size(); i++ ) {
769 auto geoID = m_trackStatesAux->geometryId[i];
770 if ( geoID == InvalidGeoID ) {
771 m_surfaces[i] = nullptr;
772 continue;
773 }
774 if ( geoID != 0 ) {
775 m_surfaces[i] = geo->findSurface(Acts::GeometryIdentifier{geoID});
776 } else {
777 unsigned int backendIndex = m_trackStatesAux->surfaceIndex[i];
778 std::shared_ptr<const Acts::Surface> surface = decodeSurface(m_trackSurfacesAux, backendIndex);
779 m_surfaces[i] = surface; // TODO
780
781 }
782 }
783}
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:14

◆ getUncalibratedSourceLink_impl()

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

Definition at line 810 of file MultiTrajectory.cxx.

811 {
812 assert(istate < m_trackStatesIface.size());
813 // at the moment when converting Trk::Track to Acts tracks the measurements on track
814 // are not converted to xAOD::UncalibratedMeasurements, and the Acts::SourceLinks
815 // just contain a pointer to the Trk::Measurement. To keep this functionality
816 // SourceLinks are either stored in the m_uncalibratedSourceLinks cache
817 // or taken from the xAOD backend.
818 static const SG::ConstAccessor<const xAOD::UncalibratedMeasurement*> acc{"uncalibratedMeasurement"};
819 if (const xAOD::UncalibratedMeasurement* ptr = acc.withDefault(m_trackStatesIface, istate, nullptr))
820 {
821 return Acts::SourceLink( ptr );
822 }
823 return m_uncalibratedSourceLinks[istate].value();
824}
std::vector< std::optional< Acts::SourceLink > > m_uncalibratedSourceLinks
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 646 of file MultiTrajectory.cxx.

647 {
648 // const auto& trackStates = *m_trackStates;
649 std::optional<bool> inTrackState = ::has_impl(m_trackStatesAux, key, istate);
650 if (inTrackState.has_value())
651 return inTrackState.value();
652 // TODO remove once EL based source links are in use only
653 using namespace Acts::HashedStringLiteral;
654 if (key == "uncalibratedSourceLink"_hash) {
655 static const SG::ConstAccessor<const xAOD::UncalibratedMeasurement*> acc{"uncalibratedMeasurement"};
656 if (acc.isAvailable (m_trackStatesIface)) {
657 return acc(m_trackStatesIface, istate) != nullptr;
658 }
659 else {
660 return (istate < m_uncalibratedSourceLinks.size() && m_uncalibratedSourceLinks[istate].has_value());
661 }
662 }
663 return false;
664}
bool has_impl(Acts::HashedString key, ActsTrk::IndexType istate) const

◆ hasColumn_impl()

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

Definition at line 711 of file MultiTrajectory.cxx.

712 {
713 using namespace Acts::HashedStringLiteral;
714 // TODO try using staticVariables set
715 switch (key) {
716 case "previous"_hash:
717 case "next"_hash:
718 case "chi2"_hash:
719 case "pathLength"_hash:
720 case "predicted"_hash:
721 case "filtered"_hash:
722 case "smoothed"_hash:
723 case "jacobian"_hash:
724 case "projector"_hash:
725 case "uncalibratedSourceLink"_hash:
726 case "calibrated"_hash:
727 case "calibratedCov"_hash:
728 case "measdim"_hash:
729 case "typeFlags"_hash:
730 return true;
731 }
732 for (auto& d : m_decorations) {
733 if (d.hash == key) {
734 return true;
735 }
736 }
737 return false;
738}

◆ jacobian_impl()

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

Definition at line 450 of file MultiTrajectory.h.

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

◆ moveLinks()

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

Definition at line 750 of file MultiTrajectory.cxx.

750 {
753}
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 745 of file MultiTrajectory.cxx.

745 {
746 m_surfaces = std::move(mtj->m_surfaces);
747}
std::vector< StoredSurface > m_surfaces

◆ parameters_impl()

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

Definition at line 440 of file MultiTrajectory.h.

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

◆ referenceSurface_impl()

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

Definition at line 786 of file MultiTrajectory.cxx.

786 {
787 INSPECTCALL( this << " " << istate << " " << m_trackStatesIface.size() << " " << m_surfaces.size() << " surf ptr " << toSurfacePtr(m_surfaces[istate]));
788 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");
789 return toSurfacePtr(m_surfaces[istate]);
790}

◆ size_impl()

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

Definition at line 469 of file MultiTrajectory.h.

469{ return m_trackStatesAux->size(); }

Member Data Documentation

◆ m_calibratedSourceLinks

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

Definition at line 499 of file MultiTrajectory.h.

◆ m_decorations

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

Definition at line 496 of file MultiTrajectory.h.

◆ m_surfaces

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

Definition at line 505 of file MultiTrajectory.h.

◆ m_trackJacobiansAux

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

Definition at line 493 of file MultiTrajectory.h.

◆ m_trackMeasurementsAux

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

Definition at line 494 of file MultiTrajectory.h.

◆ m_trackParametersAux

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

Definition at line 492 of file MultiTrajectory.h.

◆ m_trackStatesAux

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

Definition at line 491 of file MultiTrajectory.h.

◆ m_trackStatesIface

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

Definition at line 507 of file MultiTrajectory.h.

◆ m_trackSurfacesAux

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

Definition at line 495 of file MultiTrajectory.h.

◆ m_uncalibratedSourceLinks

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

Definition at line 503 of file MultiTrajectory.h.


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