5#include <Acts/Geometry/GeometryIdentifier.hpp>
15constexpr uint64_t
InvalidGeoID = std::numeric_limits<uint64_t>::max();
18 "chi2",
"pathLength",
"typeFlags",
"previous",
"next",
"predicted",
"filtered",
"smoothed",
"jacobian",
"calibrated",
"measDim",
19 "uncalibratedMeasurement",
"uncalibratedMeasurementLink" ,
"geometryId",
"surfaceIndex"
23constexpr std::optional<bool> has_impl(
26 using namespace Acts::HashedStringLiteral;
27 constexpr auto kInvalid = Acts::kTrackIndexInvalid;
32 return trackStates->
previous[istate] < kInvalid;
37 case "pathLength"_hash:{
41 case "typeFlags"_hash:{
45 case "predicted"_hash:{
47 return trackStates->
predicted[istate] < kInvalid;
49 case "filtered"_hash:{
51 return trackStates->
filtered[istate] < kInvalid;
53 case "smoothed"_hash:{
55 return trackStates->
smoothed[istate] < kInvalid;
57 case "jacobian"_hash:{
59 return trackStates->
jacobian[istate] < kInvalid;
61 case "projector"_hash:{
63 return trackStates->
calibrated[istate] < kInvalid;
65 case "calibrated"_hash:{
67 return trackStates->
measDim[istate] < kInvalid;
69 case "calibratedCov"_hash: {
70 INSPECTCALL(key <<
" " << istate <<
" calibratedCov");
71 return trackStates->
measDim[istate] < kInvalid;
73 case "measdim"_hash: {
77 case "referenceSurface"_hash: {
78 INSPECTCALL(key <<
" " << istate <<
" referenceSurfaceEnco");
85 INSPECTCALL(key <<
" " << istate <<
" not a predefined component");
86 return std::optional<bool>();
114 INSPECTCALL(
"copy c-tor " <<
this <<
" src " << &other <<
" " << other.size())
138 template<
typename CONT>
139 void stepResize( CONT* auxPtr,
const size_t realSize,
const size_t sizeStep = 20) {
140 if( realSize >= auxPtr->size() ) auxPtr->resize(auxPtr->size()+sizeStep);
145 Acts::TrackStatePropMask mask,
147 using namespace Acts::HashedStringLiteral;
154 constexpr auto kInvalid = Acts::kTrackIndexInvalid;
156 if (previous >= kInvalid - 1)
159 using namespace Acts;
186 if (ACTS_CHECK_BIT(mask, TrackStatePropMask::Predicted)) {
191 if (ACTS_CHECK_BIT(mask, TrackStatePropMask::Filtered)) {
196 if (ACTS_CHECK_BIT(mask, TrackStatePropMask::Smoothed)) {
201 if (ACTS_CHECK_BIT(mask, TrackStatePropMask::Jacobian)) {
209 if (ACTS_CHECK_BIT(mask, TrackStatePropMask::Calibrated)) {
222 Acts::TrackStatePropMask mask) {
223 using namespace Acts::HashedStringLiteral;
229 constexpr auto kInvalid = Acts::kTrackIndexInvalid;
231 using namespace Acts;
258 ACTS_CHECK_BIT(mask, TrackStatePropMask::Predicted)) {
263 ACTS_CHECK_BIT(mask, TrackStatePropMask::Filtered)) {
268 ACTS_CHECK_BIT(mask, TrackStatePropMask::Smoothed)) {
273 ACTS_CHECK_BIT(mask, TrackStatePropMask::Jacobian)) {
278 ACTS_CHECK_BIT(mask, TrackStatePropMask::Calibrated)) {
288 Acts::TrackStatePropMask shareSource,
289 Acts::TrackStatePropMask shareTarget) {
291 assert(ACTS_CHECK_BIT(this->getTrackState(iother).getMask(), shareSource) &&
292 "Source has incompatible allocation");
294 using PM = Acts::TrackStatePropMask;
296 constexpr auto kInvalid = Acts::kTrackIndexInvalid;
299 switch (shareSource) {
313 throw std::domain_error{
"MutableMultiTrajectory Unable to share this component"};
316 assert(sourceIndex != kInvalid);
318 switch (shareTarget) {
320 assert(shareSource != PM::Jacobian);
324 assert(shareSource != PM::Jacobian);
328 assert(shareSource != PM::Jacobian);
332 assert(shareSource == PM::Jacobian);
336 throw std::domain_error{
"MutableMultiTrajectory Unable to share this component"};
342 Acts::TrackStatePropMask target,
345 using PM = Acts::TrackStatePropMask;
347 constexpr auto kInvalid = Acts::kTrackIndexInvalid;
371 throw std::domain_error{
"MutableMultiTrajectory Unable to unset this component"};
377 using namespace Acts::HashedStringLiteral;
379 "Attempt to reach beyond the Track States container size");
380 INSPECTCALL(key <<
" " << istate <<
" non-const component_impl")
383 case "previous"_hash:
389 case "pathLength"_hash:
391 case "predicted"_hash:
393 case "filtered"_hash:
395 case "smoothed"_hash:
397 case "projector"_hash: {
403 case "typeFlags"_hash:
412 throw std::runtime_error(
"MutableMultiTrajectory::component_impl no such component " + std::to_string(key));
419 Acts::HashedString key,
421 using namespace Acts::HashedStringLiteral;
423 "Attempt to reach beyond the Track States container size");
424 INSPECTCALL(key <<
" " << istate <<
" const component_impl")
426 case "previous"_hash:
432 case "pathLength"_hash:
434 case "predicted"_hash:
436 case "filtered"_hash:
438 case "smoothed"_hash:
440 case "jacobian"_hash:
442 case "projector"_hash:{
446 case "calibrated"_hash: {
449 case "calibratedCov"_hash: {
454 case "typeFlags"_hash:
459 INSPECTCALL(
"getting dynamic variable " << d.name <<
" " << istate);
463 throw std::runtime_error(
"MutableMultiTrajectory::component_impl const no such component " + std::to_string(key));
471 if (inTrackState.has_value())
472 return inTrackState.value();
475 using namespace Acts::HashedStringLiteral;
476 if (key ==
"uncalibratedSourceLink"_hash){
477 INSPECTCALL(key <<
" " << istate <<
" uncalibratedSourceLink")
525 const Acts::SourceLink& sourceLink) {
529 static const Decor_t decor{
"uncalibratedMeasurement"};
531 throw std::range_error(
"istate out of range on TrackStates when attempting to access uncalibrated measurements");
544 uncalibratedMeasurements.at(istate) = std::get<const xAOD::UncalibratedMeasurement*>(unpacked);
549 }
catch (
const std::bad_any_cast &err) {
552 uncalibratedMeasurements.at(istate) = unpacked;
553 }
catch (
const std::bad_any_cast &err1) {
561 std::shared_ptr<const Acts::Surface> surface) {
566 if (surface->geometryId().value() == 0) {
580 if ( std::holds_alternative<const Acts::Surface*>(surfaceVariant))
581 return std::get<const Acts::Surface*>(surfaceVariant);
582 return std::get<std::shared_ptr<const Acts::Surface>>(surfaceVariant).
get();
587 if ( istate >=
m_surfaces.size() )
throw std::out_of_range(
"MutableMultiTrajectory index " + std::to_string(istate) +
" out of range " + std::to_string(
m_surfaces.size()) +
" when accessing reference surface");
592 Acts::HashedString key,
593 const std::any& src_ptr) {
594 INSPECTCALL(
"copy dynamic decoration of key " << key <<
" destination MTJ has " <<
m_decorations.size() <<
" decorations");
596 INSPECTCALL(
"checking for destination of dynamic decoration " << d.name <<
" hash " << d.hash <<
" while looking for the key " << key);
602 throw std::invalid_argument(
"MultiTrajectory::copyDynamicFrom_impl no such decoration in destination MTJ " + std::to_string(key));
606 std::vector<Acts::HashedString> keys;
608 keys.push_back(d.hash);
609 INSPECTCALL(
"collecting dynamic decoration " << d.name <<
" hash " << d.hash);
662 if (inTrackState.has_value())
663 return inTrackState.value();
665 using namespace Acts::HashedStringLiteral;
666 if (key ==
"uncalibratedSourceLink"_hash) {
680 using namespace Acts::HashedStringLiteral;
682 case "previous"_hash:
688 case "pathLength"_hash:
690 case "predicted"_hash:
692 case "filtered"_hash:
694 case "smoothed"_hash:
696 case "jacobian"_hash:
698 case "projector"_hash: {
701 case "calibrated"_hash: {
704 case "calibratedCov"_hash: {
709 case "typeFlags"_hash:
718 throw std::runtime_error(
"MultiTrajectory::component_impl no such component " + std::to_string(key));
724 Acts::HashedString key)
const {
725 using namespace Acts::HashedStringLiteral;
728 case "previous"_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:
741 case "typeFlags"_hash:
768 std::vector<Acts::HashedString> keys;
770 keys.push_back(d.hash);
787 m_surfaces[i] = geo->findSurface(Acts::GeometryIdentifier{geoID});
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");
804typename Acts::SourceLink
821typename Acts::SourceLink
const T * to_const_ptr(const std::unique_ptr< T > &ptr)
constexpr uint64_t InvalidGeoID
#define INSPECTCALL(_INFO)
size_t size() const
Number of registered mappings.
std::vector< std::optional< Acts::SourceLink > > m_uncalibratedSourceLinks
bool has_impl(Acts::HashedString key, ActsTrk::IndexType istate) const
const DataLink< xAOD::TrackParametersAuxContainer > m_trackParametersAux
Acts::SourceLink getUncalibratedSourceLink_impl(ActsTrk::IndexType istate) const
const DataLink< xAOD::TrackMeasurementAuxContainer > m_trackMeasurementsAux
std::vector< ActsTrk::detail::Decoration > m_decorations
xAOD::TrackStateContainer m_trackStatesIface
const DataLink< xAOD::TrackStateAuxContainer > m_trackStatesAux
std::vector< Acts::HashedString > dynamicKeys_impl() const
std::vector< std::optional< Acts::SourceLink > > m_calibratedSourceLinks
std::vector< StoredSurface > m_surfaces
ActsTrk::IndexType calibratedSize_impl(ActsTrk::IndexType istate) const
std::any component_impl(Acts::HashedString key, ActsTrk::IndexType istate) const
void moveSurfaces(const ActsTrk::MutableMultiTrajectory *mtj)
reuse surfaces from MutableMultiTrajectory
const Acts::Surface * referenceSurface_impl(IndexType) const
const DataLink< xAOD::TrackSurfaceAuxContainer > m_trackSurfacesAux
const DataLink< xAOD::TrackJacobianAuxContainer > m_trackJacobiansAux
MultiTrajectory(DataLink< xAOD::TrackStateAuxContainer > trackStates, DataLink< xAOD::TrackParametersAuxContainer > trackParameters, DataLink< xAOD::TrackJacobianAuxContainer > trackJacobians, DataLink< xAOD::TrackMeasurementAuxContainer > trackMeasurements, DataLink< xAOD::TrackSurfaceAuxContainer > trackSurfaces)
void fillSurfaces(const Acts::TrackingGeometry *geo)
Fill surfaces either from persistency or from geometry If the surfaces are already there it means tha...
void moveLinks(const ActsTrk::MutableMultiTrajectory *mtj)
bool hasColumn_impl(Acts::HashedString key) const
Athena implementation of ACTS::MultiTrajectory (ReadWrite version) The data is stored in 4 external b...
std::vector< StoredSurface > m_surfaces
static const std::set< std::string > s_staticVariables
GeometryContext m_geoContext
std::vector< std::optional< Acts::SourceLink > > m_calibratedSourceLinks
size_t m_trackMeasurementsSize
bool has_impl(Acts::HashedString key, ActsTrk::IndexType istate) const
checks if given state has requested component
std::vector< ActsTrk::detail::Decoration > m_decorations
Acts::SourceLink getUncalibratedSourceLink_impl(ActsTrk::IndexType istate) const
Implementation of uncalibrated link fetch.
void setReferenceSurface_impl(IndexType, std::shared_ptr< const Acts::Surface >)
std::unique_ptr< xAOD::TrackParametersAuxContainer > m_trackParametersAux
ActsTrk::IndexType addTrackState_impl(Acts::TrackStatePropMask mask, ActsTrk::IndexType iprevious)
Add state with stograge for data that depends on the mask.
void unset_impl(Acts::TrackStatePropMask target, ActsTrk::IndexType istate)
unsets a given state
std::any component_impl(Acts::HashedString key, ActsTrk::IndexType istate) const
Access component by key.
MutableMultiTrajectory()
Construct a new Multi Trajectory object owning backends.
size_t m_trackParametersSize
xAOD::TrackStateContainer m_trackStatesIface
std::vector< Acts::HashedString > dynamicKeys_impl() const
returns the keys of all the dynamic columns
std::unique_ptr< xAOD::TrackStateAuxContainer > m_trackStatesAux
std::unique_ptr< xAOD::TrackSurfaceAuxContainer > m_surfacesBackendAux
const Acts::Surface * referenceSurface_impl(IndexType) const
std::vector< std::optional< Acts::SourceLink > > m_uncalibratedSourceLinks
std::unique_ptr< xAOD::TrackMeasurementAuxContainer > m_trackMeasurementsAux
void addTrackStateComponents_impl(ActsTrk::IndexType istate, Acts::TrackStatePropMask mask)
Add state components for the given mask.
void copyDynamicFrom_impl(ActsTrk::IndexType istate, Acts::HashedString key, const std::any &src_ptr)
copy dynamic data from another MTJ
std::unique_ptr< xAOD::TrackSurfaceContainer > m_surfacesBackend
bool has_backends() const
checks if the backends are connected (i.e.
void shareFrom_impl(ActsTrk::IndexType iself, ActsTrk::IndexType iother, Acts::TrackStatePropMask shareSource, Acts::TrackStatePropMask shareTarget)
shares from a given state
ActsTrk::IndexType calibratedSize_impl(ActsTrk::IndexType istate) const
Implementation of calibrated size.
size_t m_trackJacobiansSize
std::unique_ptr< xAOD::TrackJacobianAuxContainer > m_trackJacobiansAux
void setUncalibratedSourceLink_impl(ActsTrk::IndexType istate, const Acts::SourceLink &sourceLink)
Implementation of uncalibrated link insertion.
void clear_impl()
clears backends decoration columns are still declared
static Acts::SourceLink pack(const Ptr_t &measurement)
Pack the measurement type pointer to an Acts::SourceLink including the intermediate conversion into a...
static SourceLinkType getType(const Acts::SourceLink &sl)
Returns the enumeration corresponding to the object type cached within the Acts::SourceLink.
static SourceLink_t unpackBase(const Acts::SourceLink &sl)
Unpack the SourceLink_t from the passed Acts source link.
Object reference supporting deferred reading from StoreGate.
const_pointer cptr() const
Dereference the link.
Helper class to provide constant type-safe access to aux data.
std::vector< TrackStateIndexType > measDim
std::vector< TrackStateIndexType > filtered
std::vector< TrackStateIndexType > calibrated
std::vector< TrackStateIndexType > smoothed
std::vector< TrackStateIndexType > predicted
std::vector< TrackStateIndexType > jacobian
std::vector< TrackStateIndexType > previous
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
std::vector< Decoration > restoreDecorations(const SG::IConstAuxStore *container, const std::set< std::string > &staticVariables)
@ xAODUnCalibMeas
UnCalibrated Trk::PrepRawData objects.
void encodeSurface(xAOD::TrackSurfaceAuxContainer *backend, size_t index, const Acts::Surface *surface, const Acts::GeometryContext &geoContext)
Prepares persistifiable representation of surface into xAOD::TrackSurface object.
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::variant< const Acts::Surface *, std::shared_ptr< const Acts::Surface > > StoredSurface
This class is not to needed in AthSimulation.
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
TrackStateAuxContainer_v1 TrackStateAuxContainer
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
TrackSurface_v1 TrackSurface