ATLAS Offline Software
Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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"
12 #include "ActsEvent/Decoration.h"
17 
18 namespace ActsTrk {
19 class MutableTrackSummaryContainer;
21 class MutableTrackContainerHandlesHelper;
22 
23 } // namespace ActsTrk
24 
25 namespace Acts {
26 class Surface;
27 template <typename T>
29 
30 template <typename T>
32 
33 template <typename T>
35 
36 template <>
38  : std::true_type {};
39 
40 template <>
41 struct IsReadOnlyTrackContainer<ActsTrk::MutableTrackSummaryContainer>
42  : std::false_type {};
43 
44 
45 } // namespace Acts
46 
47 namespace ActsTrk {
48 
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 
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 
107  void decodeSurfaces(const xAOD::TrackSurfaceContainer* src, const Acts::GeometryContext&);
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 
179 
183  void clear();
184 
190  std::shared_ptr<const Acts::Surface> surface);
197  const Acts::ParticleHypothesis& particleHypothesis);
198 
200 
201 
203  return m_mutableTrackBackend.get();
204  }
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 
240 namespace details{
241 } // EOF detail
242 
243 template <typename T>
245  std::string_view name) {
247  throw std::runtime_error(
248  "TrackSummaryContainer::addColumn_impl: "
249  "unsupported decoration type");
250  }
251  m_decorations.emplace_back(ActsTrk::detail::decoration<T>(
252  name,
253  ActsTrk::detail::constDecorationGetter<T>,
254  ActsTrk::detail::decorationCopier<T>,
255  ActsTrk::detail::decorationSetter<T>
256  ));
257 }
258 
259 } // namespace ActsTrk
260 
261 #include "AthenaKernel/CLASS_DEF.h"
263 #endif
ActsTrk::TrackSummaryContainer::IndexType
uint32_t IndexType
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:58
ActsTrk::TrackSummaryContainer::parameters
ActsTrk::ConstParameters parameters(ActsTrk::IndexType itrack) const
parameters of the track
Definition: TrackSummaryContainer.cxx:94
ActsTrk::TrackSummaryContainer::m_surfaces
std::vector< std::shared_ptr< const Acts::Surface > > m_surfaces
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:115
ActsTrk::TrackSummaryContainer::hasColumn_impl
constexpr bool hasColumn_impl(Acts::HashedString key) const
return true if the container has specific decoration
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:214
ActsTrk::TrackSummaryContainer::MutableTrackContainerHandle
friend class MutableTrackContainerHandle
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:102
ActsTrk::MutableTrackSummaryContainer::covariance
ActsTrk::Covariance covariance(ActsTrk::IndexType itrack)
write access to covariance
Definition: TrackSummaryContainer.cxx:231
ActsTrk::Parameters
Acts::TrackStateTraits< 3, false >::Parameters Parameters
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:51
ActsTrk::MutableTrackSummaryContainer::m_mutableTrackBackend
std::unique_ptr< xAOD::TrackSummaryContainer > m_mutableTrackBackend
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:209
ActsTrk::MutableTrackSummaryContainer::setParticleHypothesis_impl
void setParticleHypothesis_impl(ActsTrk::IndexType itrack, const Acts::ParticleHypothesis &particleHypothesis)
sets particle hypothesis
Definition: TrackSummaryContainer.cxx:281
ActsTrk::TrackSummaryContainer::staticVariables
static const std::set< std::string > staticVariables
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:61
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
WriteCellNoiseToCool.src
src
Definition: WriteCellNoiseToCool.py:513
hist_file_dump.d
d
Definition: hist_file_dump.py:137
ActsTrk::TrackSummaryContainer::particleHypothesis_impl
Acts::ParticleHypothesis particleHypothesis_impl(IndexType itrack) const
return pointer to reference surface
Definition: TrackSummaryContainer.cxx:41
Surface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/Surface.h:8
ActsTrk::MutableTrackSummaryContainer::setReferenceSurface_impl
void setReferenceSurface_impl(ActsTrk::IndexType itrack, std::shared_ptr< const Acts::Surface > surface)
point given track to surface The surface ownership is shared
Definition: TrackSummaryContainer.cxx:259
perfmonmt-printer.dest
dest
Definition: perfmonmt-printer.py:189
xAOD::TrackSurfaceAuxContainer_v1
Definition: TrackSurfaceAuxContainer_v1.h:12
ActsTrk::TrackSummaryContainer::component_impl
std::any component_impl(Acts::HashedString key, ActsTrk::IndexType itrack) const
access to components by pointer with type
Definition: TrackSummaryContainer.cxx:78
ActsTrk::TrackSummaryContainer::m_trackBackend
DataLink< xAOD::TrackSummaryContainer > m_trackBackend
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:113
ActsTrk::TrackSummaryContainer::referenceSurface_impl
const Acts::Surface * referenceSurface_impl(ActsTrk::IndexType itrack) const
return pointer to reference surface
Definition: TrackSummaryContainer.cxx:32
ActsTrk::TrackSummaryContainer::restoreDecorations
void restoreDecorations()
Definition: TrackSummaryContainer.cxx:109
ActsTrk::MutableTrackSummaryContainer::clear
void clear()
zeroes container
Definition: TrackSummaryContainer.cxx:254
ActsTrk::MutableTrackSummaryContainer::addTrack_impl
ActsTrk::IndexType addTrack_impl()
adds new track to the tail of the container
Definition: TrackSummaryContainer.cxx:183
ActsTrk::MutableTrackSummaryContainer::reserve
void reserve(ActsTrk::IndexType size)
preallocate number of track objects
Definition: TrackSummaryContainer.cxx:250
ActsTrk::TrackSummaryContainer::size_impl
std::size_t size_impl() const
returns number of stored tracks
Definition: TrackSummaryContainer.cxx:45
ActsTrk::MutableTrackSummaryContainer::copyDynamicFrom_impl
void copyDynamicFrom_impl(ActsTrk::IndexType itrack, Acts::HashedString key, const std::any &src_ptr)
copies decorations from other container
Definition: TrackSummaryContainer.cxx:201
xAOD::TrackSummaryContainer
TrackSummaryContainer_v1 TrackSummaryContainer
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackSummaryContainer.h:11
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
ActsTrk::MutableTrackSummaryContainer::component_impl
std::any component_impl(Acts::HashedString key, ActsTrk::IndexType itrack)
write access to decorations
Definition: TrackSummaryContainer.cxx:211
ActsTrk::ConstParameters
Acts::TrackStateTraits< 3 >::Parameters ConstParameters
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:49
ActsTrk::IndexType
std::uint32_t IndexType
Definition: Decoration.h:14
TrackSummaryAuxContainer.h
details
Definition: IParticleWriter.h:21
Acts
Definition: ChamberAssembleTool.h:18
SurfaceEncoding.h
ActsTrk::MutableTrackSummaryContainer
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:118
ActsTrk::MutableTrackSummaryContainer::operator=
MutableTrackSummaryContainer operator=(const MutableTrackSummaryContainer &)=delete
ActsTrk::TrackSummaryContainer::covariance
ActsTrk::ConstCovariance covariance(ActsTrk::IndexType itrack) const
covariance of the track fit
Definition: TrackSummaryContainer.cxx:99
ActsTrk::Covariance
Acts::TrackStateTraits< 3, false >::Covariance Covariance
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:52
ActsTrk::MutableTrackSummaryContainer::encodeSurfaces
void encodeSurfaces(xAOD::TrackSurfaceAuxContainer *dest, const Acts::GeometryContext &)
Definition: TrackSummaryContainer.cxx:264
ActsTrk::MutableTrackContainerHandlesHelper
Definition: TrackContainerHandlesHelper.h:33
TrackSurfaceContainer.h
ActsTrk::MutableTrackSummaryContainer::removeTrack_impl
void removeTrack_impl(ActsTrk::IndexType itrack)
clears track data under index
Definition: TrackSummaryContainer.cxx:192
ActsTrk::detail::accepted_decoration_types
Definition: Decoration.h:33
Acts::IsReadOnlyTrackContainer
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:28
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
ActsTrk::TrackSummaryContainer::TrackSummaryContainer
TrackSummaryContainer(const DataLink< xAOD::TrackSummaryContainer > &lin=nullptr)
Definition: TrackSummaryContainer.cxx:27
ActsTrk::TrackSummaryContainer::dynamicKeys_impl
std::vector< Acts::HashedString > dynamicKeys_impl() const
Definition: TrackSummaryContainer.cxx:113
ActsTrk::TrackSummaryContainer
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:56
ActsTrk::ConstCovariance
Acts::TrackStateTraits< 3 >::Covariance ConstCovariance
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:50
ActsTrk::MutableTrackSummaryContainer::m_mutableTrackBackendAux
std::unique_ptr< xAOD::TrackSummaryAuxContainer > m_mutableTrackBackendAux
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:210
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrackSummaryContainer.h
ActsTrk::MutableTrackSummaryContainer::MutableTrackSummaryContainer
MutableTrackSummaryContainer()
Definition: TrackSummaryContainer.cxx:136
xAOD::ParticleHypothesis
ParticleHypothesis
Definition: TrackingPrimitives.h:192
ActsTrk::TrackSummaryContainer::fillFrom
void fillFrom(ActsTrk::MutableTrackSummaryContainer &mtb)
Definition: TrackSummaryContainer.cxx:104
ActsTrk::MutableTrackSummaryContainer::ensureDynamicColumns_impl
void ensureDynamicColumns_impl(const MutableTrackSummaryContainer &other)
synchronizes decorations
Definition: TrackSummaryContainer.cxx:236
ActsTrk::TrackSummaryContainer::kInvalid
static constexpr auto kInvalid
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:59
Decoration.h
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
ActsTrk::MutableTrackSummaryContainer::addColumn_impl
constexpr void addColumn_impl(std::string_view key)
enables the container to support decoration of given name and type
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:244
ActsTrk::MutableTrackSummaryContainer::MutableTrackSummaryContainer
MutableTrackSummaryContainer(const MutableTrackSummaryContainer &)=delete
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
ActsTrk::TrackSummaryContainer::m_decorations
std::vector< ActsTrk::detail::Decoration > m_decorations
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:114
ActsTrk::MutableTrackSummaryContainer::trackBackend
xAOD::TrackSummaryContainer * trackBackend()
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:202
ActsTrk::TrackSummaryContainer::decodeSurfaces
void decodeSurfaces(const xAOD::TrackSurfaceContainer *src, const Acts::GeometryContext &)
Definition: TrackSummaryContainer.cxx:124
ActsTrk::TrackSummaryContainer::staticVariableHashes
static const std::set< Acts::HashedString > staticVariableHashes
Definition: Tracking/Acts/ActsEvent/ActsEvent/TrackSummaryContainer.h:62
ActsTrk::MutableTrackSummaryContainer::parameters
ActsTrk::Parameters parameters(ActsTrk::IndexType itrack)
write access to parameters
Definition: TrackSummaryContainer.cxx:226
CLASS_DEF.h
macros to associate a CLID to a type
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37