ATLAS Offline Software
Loading...
Searching...
No Matches
Decoration.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#include "Acts/Utilities/HashedString.hpp"
7
8namespace ActsTrk{
9 std::optional<TrackContainer::ConstTrackProxy> getActsTrack(const xAOD::TrackParticle& trkPart) {
10 static const SG::AuxElement::ConstAccessor<ElementLink<TrackContainer> > acc("actsTrack");
11 static_assert( std::is_same<ElementLink<TrackContainer>::ElementConstReference,
12 std::optional<TrackContainer::ConstTrackProxy> >::value);
13
14 if (!acc.isAvailable(trkPart) || !acc(trkPart).isValid()) {
15 return std::nullopt;
16 }
17 return(*acc(trkPart));
18
19}
20
21}
22
23namespace ActsTrk::detail {
24
25template<typename T>
26bool build (const std::type_info* typeInfo, const std::string& name, std::vector<Decoration>& decorations){
27 if (*typeInfo == typeid(T)) {
28 decorations.emplace_back(
31 return true;
32 }
33 return false;
34}
35
36
37std::vector<Decoration> restoreDecorations(
38 const SG::IConstAuxStore* container,
39 const std::set<std::string>& staticVariables) {
40 std::vector<Decoration> decorations;
41 for (auto id : container->getAuxIDs()) {
42 const std::string name = SG::AuxTypeRegistry::instance().getName(id);
43 const std::type_info* typeInfo =
45 if (staticVariables.count(name) == 1) {
46 continue;
47 }
48
49 // try making decoration accessor of matching type
50 // there is a fixed set of supported types (as there is a fixed set
51 // available in MutableMTJ) setters are not needed so replaced by a
52 if ( build<float>(typeInfo, name, decorations) ||
53 build<double>(typeInfo, name, decorations) ||
54 build<short>(typeInfo, name, decorations) ||
55 build<int>(typeInfo, name, decorations) ||
56 build<uint8_t>(typeInfo, name, decorations) ||
57 build<uint16_t>(typeInfo, name, decorations) ||
58 build<uint32_t>(typeInfo, name, decorations) ||
59 build<uint64_t>(typeInfo, name, decorations) ||
60 build<int8_t>(typeInfo, name, decorations) ||
61 build<int16_t>(typeInfo, name, decorations) ||
62 build<int32_t>(typeInfo, name, decorations) ||
63 build<int64_t>(typeInfo, name, decorations)
64 ) {
65 continue;
66 }
67 throw std::runtime_error("Can't restore decoration of " + name +
68 " because it is of an unsupported type");
69 }
70 return decorations;
71}
72} // namespace ActsTrk::detail
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
const SG::auxid_set_t & getAuxIDs() const
Return a set of identifiers for existing data items in store associated with this object.
Athena definition of the Eigen plugin.
void decorationCopier(SG::IAuxStore *dst, ActsTrk::IndexType dst_idx, SG::auxid_t decorationId, const std::any &src_ptr)
Definition Decoration.h:78
const std::any constDecorationGetter(const SG::IConstAuxStore *container, ActsTrk::IndexType idx, SG::auxid_t decorationId)
Definition Decoration.h:51
bool build(const std::type_info *typeInfo, const std::string &name, std::vector< Decoration > &decorations)
static Decoration decoration(std::string_view n, GetterType g, CopierType c, SetterType s=static_cast< SetterType >(nullptr))
Definition Decoration.h:85
std::vector< Decoration > restoreDecorations(const SG::IConstAuxStore *container, const std::set< std::string > &staticVariables)
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::optional< ActsTrk::TrackContainer::ConstTrackProxy > getActsTrack(const xAOD::TrackParticle &trkPart)
Return the proxy to the Acts track from which the track particle was made frome.
Definition Decoration.cxx:9
TrackParticle_v1 TrackParticle
Reference the current persistent version: