17 #include "TClassEdit.h"
18 #include "TVirtualCollectionProxy.h"
20 #include "ROOT/RNTuple.hxx"
21 #include "ROOT/RNTupleReader.hxx"
22 #include "ROOT/RField.hxx"
42 getAuxElementType(
bool standalone, std::string& elementTypeName,
const std::string& storageTypeName)
45 elementTypeName = storageTypeName;
47 if( elementTypeName ==
"std::uint64_t")
return &
typeid(
unsigned long long);
52 if( storageTypeName.rfind(
"vector<", 0) == 0
53 || storageTypeName.rfind(
"std::vector<", 0) == 0 ) {
55 if( !tclass )
return nullptr;
56 TVirtualCollectionProxy*
proxy = tclass->GetCollectionProxy();
57 if( !
proxy )
return nullptr;
58 if(
proxy->GetValueClass() ) {
59 elementTypeName =
proxy->GetValueClass()->GetName();
60 return proxy->GetValueClass()->GetTypeInfo();
63 elementTypeName = elemtype.getTypeName();
64 return elemtype.getTypeInfo();
67 if( storageTypeName.rfind(
"SG::PackedContainer<", 0) == 0) {
68 elementTypeName.clear();
73 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
74 TClassEdit::TSplitType
split( storageTypeName.c_str() );
75 if(
split.fElements.size() > 1 ) {
76 elementTypeName =
split.fElements[1];
79 if( !elementTypeName.empty() ) {
89 const ROOT::RNTupleDescriptor&
desc,
90 const std::string& field_prefix,
91 const std::string& attr_name,
92 const std::string& attr_type,
98 const ROOT::RNTupleDescriptor&
desc,
99 const std::string& field_prefix,
100 const std::string& attr_name,
101 const std::string& attr_type,
107 ROOT::DescriptorId_t did =
desc.FindFieldId (field_prefix + linked_attr);
108 if (did != ROOT::kInvalidDescriptorId) {
109 const ROOT::RFieldDescriptor& linked_f =
desc.GetFieldDescriptor (did);
110 linked_auxid = getAuxIdForAttribute (
r,
desc, field_prefix,
111 linked_attr, linked_f.GetTypeName(),
standalone);
113 if (linked_auxid == SG::null_auxid) {
115 msg <<
"Could not find linked variable for " << attr_name
116 <<
" type: " << attr_type;
125 const ROOT::RNTupleDescriptor&
desc,
126 const std::string& field_prefix,
127 const std::string& attr_name,
128 const std::string& attr_type,
132 if(auxid != SG::null_auxid)
136 const std::type_info* ti = getAuxElementType(
standalone, element_type, attr_type);
153 const std::string& field_type,
154 ROOT::RNTupleReader*
reader)
155 :
AthMessaging( std::string(
"RNTupleAuxDynReader[")+field_name+
"]" ),
156 m_storeFieldName( field_name ),
159 const std::string field_prefix = field_type +
"_";
167 TClass *tc = TClass::GetClass( field_type.c_str() );
169 TClass *storeTC = tc->GetBaseClass(
"SG::IAuxStoreHolder");
173 throw std::runtime_error(
string(
"Class ") + tc->GetName() +
" does not implement SG::IAuxStoreHolder");
176 throw std::runtime_error(
string(
"Class ") + field_type +
" could not be found");
190 for(
const auto &
f :
desc.GetTopLevelFields() ) {
191 const string field_name =
f.GetFieldName();
192 if( field_name.starts_with(field_prefix) ) {
193 const string attr_infile = field_name.substr(field_prefix.size());
195 const string field_type =
f.GetTypeName();
201 if( auxid != SG::null_auxid ) {
209 msg <<
"Could not find auxid for " << attr_infile <<
" type: " << field_type
226 fieldInfo.
auxid = auxid;
248 if( !
store.standalone() and fieldInfo.
fieldName.rfind(
"SG::PackedContainer<", 0) == 0 )