17 #include "TClassEdit.h"
18 #include "TVirtualCollectionProxy.h"
21 #include "ROOT/RNTuple.hxx"
22 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 31, 0 )
23 #include "ROOT/RNTupleReader.hxx"
25 #include "ROOT/RField.hxx"
45 getAuxElementType(
bool standalone, std::string& elementTypeName,
const std::string& storageTypeName)
48 elementTypeName = storageTypeName;
50 if( elementTypeName ==
"std::uint64_t")
return &
typeid(
unsigned long long);
55 if( storageTypeName.rfind(
"vector<", 0) == 0
56 || storageTypeName.rfind(
"std::vector<", 0) == 0 ) {
58 if( !tclass )
return nullptr;
59 TVirtualCollectionProxy*
proxy = tclass->GetCollectionProxy();
60 if( !
proxy )
return nullptr;
61 if(
proxy->GetValueClass() ) {
62 elementTypeName =
proxy->GetValueClass()->GetName();
63 return proxy->GetValueClass()->GetTypeInfo();
66 elementTypeName = elemtype.getTypeName();
67 return elemtype.getTypeInfo();
70 if( storageTypeName.rfind(
"SG::PackedContainer<", 0) == 0) {
71 elementTypeName.clear();
76 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
77 TClassEdit::TSplitType
split( storageTypeName.c_str() );
78 if(
split.fElements.size() > 1 ) {
79 elementTypeName =
split.fElements[1];
82 if( !elementTypeName.empty() ) {
91 getAuxIdForAttribute(
const std::string&
attr_name,
const std::string& attr_type,
bool standalone)
95 if(auxid != SG::null_auxid)
99 const std::type_info* ti = getAuxElementType(standalone, element_type, attr_type);
114 const std::string& field_type,
116 :
AthMessaging( std::string(
"RNTupleAuxDynReader[")+field_name+
"]" ),
117 m_storeFieldName( field_name ),
120 const std::string field_prefix = field_type +
"_";
125 TClass *tc = TClass::GetClass( field_type.c_str() );
127 TClass *storeTC = tc->GetBaseClass(
"SG::IAuxStoreHolder");
131 throw std::runtime_error(
string(
"Class ") + tc->GetName() +
" does not implement SG::IAuxStoreHolder");
134 throw std::runtime_error(
string(
"Class ") + field_type +
" could not be found");
148 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 31, 0 )
149 for(
const auto &
f :
desc.GetTopLevelFields() ) {
151 for(
const auto &
f :
desc->GetTopLevelFields() ) {
153 const string field_name =
f.GetFieldName();
154 if( field_name.rfind(field_prefix,0) == 0 ) {
155 const string attr_infile = field_name.substr(field_prefix.size());
157 const string field_type =
f.GetTypeName();
162 if( auxid != SG::null_auxid ) {
165 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 31, 0 )
166 m_fieldInfos[auxid].view_p = std::make_unique<RNTupleView<void,true>>(
171 msg <<
"Could not find auxid for " << attr_infile <<
" type: " << field_type
172 <<
" standalone=" << standalone;
188 fieldInfo.
auxid = auxid;
204 bool isFieldFound =
false;
208 const string attr_infile = fieldInfo.
fieldName.substr(field_prefix.size());
209 isFieldFound = (attr_infile == fieldInfo.
attribName);
212 if( !isFieldFound ) {
218 if( !
store.standalone() and fieldInfo.
fieldName.rfind(
"SG::PackedContainer<", 0) == 0 )