ATLAS Offline Software
Loading...
Searching...
No Matches
Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef ACTSEVENT_TRACKSUMMARYCONTAINER_H
5#define ACTSEVENT_TRACKSUMMARYCONTAINER_H
6#include <type_traits>
7#include <string_view>
8
9#include "Acts/EventData/TrackContainer.hpp"
10#include "Acts/Surfaces/Surface.hpp"
11#include "Acts/Utilities/HashedString.hpp"
17
18namespace ActsTrk {
22
23} // namespace ActsTrk
24
25namespace Acts {
26class Surface;
27template <typename T>
29
30template <typename T>
32
33template <typename T>
35
36template <>
37struct IsReadOnlyTrackContainer<ActsTrk::TrackSummaryContainer>
38 : std::true_type {};
39
40template <>
41struct IsReadOnlyTrackContainer<ActsTrk::MutableTrackSummaryContainer>
42 : std::false_type {};
43
44
45} // namespace Acts
46
47namespace ActsTrk {
48
49using ConstParameters = Acts::TrackStateTraits<3>::Parameters;
50using ConstCovariance = Acts::TrackStateTraits<3>::Covariance;
51using Parameters = Acts::TrackStateTraits<3, false>::Parameters;
52using Covariance = Acts::TrackStateTraits<3, false>::Covariance;
53
55
57 public:
58 using IndexType = uint32_t; // TODO find common place for it
59 static constexpr auto kInvalid = Acts::MultiTrajectoryTraits::kInvalid;
61 static const std::set<std::string> staticVariables;
62 static const std::set<Acts::HashedString> staticVariableHashes;
66 constexpr bool hasColumn_impl(Acts::HashedString key) const;
67
71 const Acts::Surface* referenceSurface_impl(ActsTrk::IndexType itrack) const;
72
76 Acts::ParticleHypothesis particleHypothesis_impl(IndexType itrack) const;
77
81 std::size_t size_impl() const;
82
86 std::any component_impl(Acts::HashedString key,
87 ActsTrk::IndexType itrack) const;
88
93
98
100
101 template<typename T>
104
105 void restoreDecorations();
106
108
109 std::vector<Acts::HashedString> dynamicKeys_impl() const;
110
111 protected:
112
114 std::vector<ActsTrk::detail::Decoration> m_decorations;
115 std::vector<std::shared_ptr<const Acts::Surface>> m_surfaces; // decoded transient form of surfaces
116};
117
119 public:
125
130
135
139 template <typename T>
140 constexpr void addColumn_impl(std::string_view key);
141
146 Acts::HashedString key,
147 const std::any& src_ptr);
148
149
153 std::any component_impl(Acts::HashedString key,
154 ActsTrk::IndexType itrack);
156
162
168
174
178 void reserve(ActsTrk::IndexType size);
179
183 void clear();
184
190 std::shared_ptr<const Acts::Surface> surface);
197 const Acts::ParticleHypothesis& particleHypothesis);
198
200
201
205
206 void encodeSurfaces(xAOD::TrackSurfaceAuxContainer* dest, const Acts::GeometryContext&);
207
208 private:
209 std::unique_ptr<xAOD::TrackSummaryContainer> m_mutableTrackBackend;
210 std::unique_ptr<xAOD::TrackSummaryAuxContainer> m_mutableTrackBackendAux;
211};
212
213
215 Acts::HashedString key) const {
216 using namespace Acts::HashedStringLiteral;
217 switch (key) {
218 case "params"_hash:
219 case "cov"_hash:
220 case "nMeasurements"_hash:
221 case "nHoles"_hash:
222 case "d0"_hash:
223 case "chi2"_hash:
224 case "ndf"_hash:
225 case "nOutliers"_hash:
226 case "hSharedHits"_hash:
227 case "tipIndex"_hash:
228 case "stemIndex"_hash:
229
230 return true;
231 }
232 for (auto& d : m_decorations) {
233 if (d.hash == key) {
234 return true;
235 }
236 }
237 return false;
238}
239
240namespace details{
241} // EOF detail
242
243template <typename T>
245 std::string_view name) {
247 throw std::runtime_error(
248 "TrackSummaryContainer::addColumn_impl: "
249 "unsupported decoration type");
250 }
252 name,
256 ));
257}
258
259} // namespace ActsTrk
260
263#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
void reserve(ActsTrk::IndexType size)
preallocate number of track objects
MutableTrackSummaryContainer(const MutableTrackSummaryContainer &)=delete
ActsTrk::IndexType addTrack_impl()
adds new track to the tail of the container
std::unique_ptr< xAOD::TrackSummaryAuxContainer > m_mutableTrackBackendAux
std::any component_impl(Acts::HashedString key, ActsTrk::IndexType itrack)
write access to decorations
void setParticleHypothesis_impl(ActsTrk::IndexType itrack, const Acts::ParticleHypothesis &particleHypothesis)
sets particle hypothesis
void copyDynamicFrom_impl(ActsTrk::IndexType itrack, Acts::HashedString key, const std::any &src_ptr)
copies decorations from other container
void ensureDynamicColumns_impl(const MutableTrackSummaryContainer &other)
synchronizes decorations
void removeTrack_impl(ActsTrk::IndexType itrack)
clears track data under index
constexpr void addColumn_impl(std::string_view key)
enables the container to support decoration of given name and type
MutableTrackSummaryContainer operator=(const MutableTrackSummaryContainer &)=delete
void setReferenceSurface_impl(ActsTrk::IndexType itrack, std::shared_ptr< const Acts::Surface > surface)
point given track to surface The surface ownership is shared
void encodeSurfaces(xAOD::TrackSurfaceAuxContainer *dest, const Acts::GeometryContext &)
ActsTrk::Covariance covariance(ActsTrk::IndexType itrack)
write access to covariance
ActsTrk::Parameters parameters(ActsTrk::IndexType itrack)
write access to parameters
const Acts::Surface * referenceSurface_impl(ActsTrk::IndexType itrack) const
return pointer to reference surface
Acts::ParticleHypothesis particleHypothesis_impl(IndexType itrack) const
return pointer to reference surface
std::any component_impl(Acts::HashedString key, ActsTrk::IndexType itrack) const
access to components by pointer with type
ActsTrk::ConstParameters parameters(ActsTrk::IndexType itrack) const
parameters of the track
constexpr bool hasColumn_impl(Acts::HashedString key) const
return true if the container has specific decoration
std::size_t size_impl() const
returns number of stored tracks
std::vector< Acts::HashedString > dynamicKeys_impl() const
ActsTrk::ConstCovariance covariance(ActsTrk::IndexType itrack) const
covariance of the track fit
static const std::set< Acts::HashedString > staticVariableHashes
void fillFrom(ActsTrk::MutableTrackSummaryContainer &mtb)
std::vector< std::shared_ptr< const Acts::Surface > > m_surfaces
void decodeSurfaces(const xAOD::TrackSurfaceContainer *src)
TrackSummaryContainer(const DataLink< xAOD::TrackSummaryContainer > &lin=nullptr)
void decorationCopier(SG::IAuxStore *dst, ActsTrk::IndexType dst_idx, SG::auxid_t decorationId, const std::any &src_ptr)
Definition Decoration.h:76
const std::any constDecorationGetter(const SG::IConstAuxStore *container, ActsTrk::IndexType idx, SG::auxid_t decorationId)
Definition Decoration.h:49
static Decoration decoration(std::string_view n, GetterType g, CopierType c, SetterType s=static_cast< SetterType >(nullptr))
Definition Decoration.h:83
std::any decorationSetter(SG::IAuxStore *container, ActsTrk::IndexType idx, SG::auxid_t decorationId)
Definition Decoration.h:67
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Acts::TrackStateTraits< 3 >::Covariance ConstCovariance
Acts::TrackStateTraits< 3, false >::Covariance Covariance
Acts::TrackStateTraits< 3, false >::Parameters Parameters
Acts::TrackStateTraits< 3 >::Parameters ConstParameters
std::uint32_t IndexType
Definition Decoration.h:14
TrackSurfaceAuxContainer_v1 TrackSurfaceAuxContainer
TrackSurfaceContainer_v1 TrackSurfaceContainer