ATLAS Offline Software
RNTupleAuxDynWriter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "RNTupleAuxDynWriter.h"
6 
10 
11 #include "TClass.h"
12 
13 namespace RootAuxDynIO {
14 
17  : AthMessaging(std::string("AuxDynAttrTool")),
19 {
20 }
21 
22 
24 std::vector<attrDataTuple>
25 RNTupleAuxDynWriter::collectAuxAttributes( const std::string& base_name, void* object )
26 {
28  std::vector<attrDataTuple> result;
29  if( !store ) return result;
30  const SG::auxid_set_t selection = store->getSelectedAuxIDs();
31  ATH_MSG_DEBUG("Writing " << base_name << " with " << selection.size()
32  << " Dynamic attributes");
33  for (SG::auxid_t id : selection) {
34  const std::string attr_type = SG::normalizedTypeinfoName(*store->getIOType(id));
35  const std::string attr_name = SG::AuxTypeRegistry::instance().getName(id);
36  const std::string field_name = RootAuxDynIO::auxFieldName(attr_name, base_name);
37  void* attr_data ATLAS_THREAD_SAFE = const_cast<void*>(store->getIOData(id));
38 
39  result.emplace_back(field_name, attr_type, attr_data);
40  }
41  return result;
42 }
43 
44 } // namespace RootAuxDynIO
SGTest::store
TestStore store
Definition: TestStore.cxx:23
RootAuxDynIO::RNTupleAuxDynWriter::collectAuxAttributes
virtual std::vector< attrDataTuple > collectAuxAttributes(const std::string &base_branch, void *object) override final
Collect Aux data information to be written out.
Definition: RNTupleAuxDynWriter.cxx:25
get_generator_info.result
result
Definition: get_generator_info.py:21
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:639
SG::normalizedTypeinfoName
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
Definition: normalizedTypeinfoName.cxx:120
SG::AuxTypeRegistry::getName
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
Definition: AuxTypeRegistry.cxx:881
SG::IAuxStoreIO
Interface providing I/O for a generic auxiliary store.
Definition: IAuxStoreIO.h:44
AthMessaging::ATLAS_THREAD_SAFE
std::atomic_flag m_initialized ATLAS_THREAD_SAFE
Messaging initialized (initMessaging)
Definition: AthMessaging.h:141
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
RootAuxDynIO::AuxDynAttrAccess
Definition: RootAuxDynIO.h:20
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
RootAuxDynIO::auxFieldName
std::string auxFieldName(const std::string &attr_name, const std::string &baseName)
Construct field name for a given dynamic attribute.
Definition: RootAuxDynDefs.h:69
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
RNTupleAuxDynWriter.h
normalizedTypeinfoName.h
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
RootAuxDynIO::AuxDynAttrAccess::castIOStore
SG::IAuxStoreIO * castIOStore(void *object)
Definition: RootAuxDynIO.cxx:45
selection
const std::string selection
Definition: fbtTestBasics.cxx:75
RootAuxDynIO
Specialization of RootAuxDynStore for reading Aux Dynamic attributes from RNTuple.
Definition: RNTupleContainer.h:28
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
AuxStoreInternal.h
An auxiliary data store that holds data internally.
RootAuxDynIO::RNTupleAuxDynWriter::RNTupleAuxDynWriter
RNTupleAuxDynWriter(TClass &tc)
Default Constructor.
Definition: RNTupleAuxDynWriter.cxx:16