 |
ATLAS Offline Software
|
|
| StatusCode | scanInputTuple () |
| | Scans the input ntuple for auxiliary data fields and sets up the necessary structures to access them. More...
|
| |
| const std::type_info * | auxFieldType (const ROOT::RFieldBase &field, std::string *expectedClassName=nullptr) |
| | This function retrieves the type information for a given auxiliary field. More...
|
| |
| StatusCode | setupAuxField (const ROOT::RFieldBase &field, std::string_view auxName) |
| | This function sets up an auxiliary field by determining its type and attempting to register it with the auxiliary type registry. More...
|
| |
Definition at line 249 of file RAuxStore.cxx.
◆ auxFieldType()
| const std::type_info* xAOD::RAuxStore::impl::auxFieldType |
( |
const ROOT::RFieldBase & |
field, |
|
|
std::string * |
expectedClassName = nullptr |
|
) |
| |
|
inline |
This function retrieves the type information for a given auxiliary field.
It uses the field's inspector to determine the type and handles cases where the expected class or collection proxy is not available.
- Parameters
-
| field | The field to get the type of |
| expectedClassName | The (optional) name of the expected (on disk) class |
- Returns
- A pointer to the type information for the field
Definition at line 347 of file RAuxStore.cxx.
353 ::TClass* expectedClass = ::TClass::GetClass(
typeName.c_str());
354 if (expectedClassName) {
356 *expectedClassName = expectedClass->GetName();
370 const std::type_info* ti =
nullptr;
373 ti = expectedClass->GetTypeInfo();
378 if (!expectedClass) {
379 ::Warning(
"xAOD::RAuxStore::impl::auxFieldType",
380 "Couldn't get the type of field \"%s\"",
381 field.GetFieldName().c_str());
383 ::TVirtualCollectionProxy* prox = expectedClass->GetCollectionProxy();
388 prox = cl2->GetCollectionProxy();
393 ::Warning(
"xAOD::RAuxStore::impl::auxFieldType",
394 "Couldn't get the type of field \"%s\"",
395 field.GetFieldName().c_str());
397 if (prox->GetValueClass()) {
398 ti = prox->GetValueClass()->GetTypeInfo();
◆ scanInputTuple()
| StatusCode xAOD::RAuxStore::impl::scanInputTuple |
( |
| ) |
|
|
inline |
Scans the input ntuple for auxiliary data fields and sets up the necessary structures to access them.
It ensures that the input ntuple is properly scanned and the auxiliary data fields are set up.
- Returns
StatusCode::SUCCESS if the function was successful, something else otherwise
Definition at line 258 of file RAuxStore.cxx.
263 return StatusCode::SUCCESS;
268 return StatusCode::SUCCESS;
272 for (
const ROOT::RFieldBase*
field :
273 #
if ROOT_VERSION_CODE >= ROOT_VERSION(6, 35, 0)
274 m_inTuple->GetModel().GetConstFieldZero().GetConstSubfields()
276 m_inTuple->GetModel().GetConstFieldZero().GetSubFields()
287 for (
const ROOT::RFieldBase* subField :
288 #
if ROOT_VERSION_CODE >= ROOT_VERSION(6, 35, 0)
289 field->GetConstSubfields()
291 field->GetSubFields()
296 const std::string&
typeName = subField->GetTypeName();
299 if (
typeName.starts_with(
"xAOD::") ||
302 typeName.starts_with(
"ILockable")) {
319 ::Error(
"xAOD::RAuxStore::impl::scanInputNtuple",
320 "Dynamic field with empty name found on container: %s",
326 auxName = auxName.substr(auxName.find(
':') + 1);
335 return StatusCode::SUCCESS;
◆ setupAuxField()
| StatusCode xAOD::RAuxStore::impl::setupAuxField |
( |
const ROOT::RFieldBase & |
field, |
|
|
std::string_view |
auxName |
|
) |
| |
|
inline |
This function sets up an auxiliary field by determining its type and attempting to register it with the auxiliary type registry.
If the field type is not known, it tries to create a factory for the field's type. The function handles both static and dynamic fields and updates the set of known auxiliary IDs upon success.
- Parameters
-
| field | The field to set up |
| auxName | The name of the auxiliary property, extracted from the field's name |
- Returns
StatusCode::SUCCESS if the function was successful, something else otherwise
Definition at line 421 of file RAuxStore.cxx.
425 std::string expectedClassName;
429 return StatusCode::SUCCESS;
438 const std::string auxNameStr{auxName};
440 regAuxid != SG::null_auxid) {
442 return StatusCode::SUCCESS;
451 const std::string linkedAttr =
453 const std::string linkedFieldName =
455 const std::type_info* linkedTi =
nullptr;
456 if (::fieldExists(linkedFieldName, *
m_inTuple)) {
462 *linkedTi, linkedAttr,
"",
465 if (linkedAuxId == SG::null_auxid) {
466 ::Error(
"xAOD::RAuxStore::setupAuxField",
467 "Could not find linked variable for %s type %s", auxName.data(),
468 expectedClassName.c_str());
477 if (auxid == SG::null_auxid) {
485 if (
typeName.starts_with(
"std::vector<"))
487 std::string factoryClassName =
489 if (factoryClassName[factoryClassName.size() - 1] ==
'>') {
490 factoryClassName +=
' ';
492 factoryClassName +=
"> >";
495 ::TClass* factoryClass = TClass::GetClass(factoryClassName.c_str());
496 if (factoryClass && factoryClass->IsLoaded()) {
497 ::TClass* baseClass = ::TClass::GetClass(
"SG::IAuxTypeVectorFactory");
498 if (baseClass && baseClass->IsLoaded()) {
499 const Int_t
offset = factoryClass->GetBaseClassOffset(baseClass);
501 void* factoryVoidPointer = factoryClass->New();
502 if (factoryVoidPointer) {
504 reinterpret_cast<unsigned long>(factoryVoidPointer) +
offset;
509 std::unique_ptr<SG::IAuxTypeVectorFactory>(factory));
519 if (auxid == SG::null_auxid && linkedAuxId == SG::null_auxid) {
522 if (vectorClassName[vectorClassName.size() - 1] ==
'>') {
523 vectorClassName +=
' ';
525 vectorClassName +=
'>';
528 ::TClass* vectorClass = ::TClass::GetClass(vectorClassName.c_str());
529 if (vectorClass && vectorClass->IsLoaded()) {
530 auto factory = std::make_unique<TAuxVectorFactory>(vectorClass);
531 if (factory->tiAlloc()) {
532 const std::type_info* tiAlloc = factory->tiAlloc();
533 registry.
addFactory(*ti, *tiAlloc, std::move(factory));
536 registry.
addFactory(*ti, tiAllocName, std::move(factory));
538 auxid = registry.
getAuxID(*ti, auxNameStr,
"",
541 ::Warning(
"xAOD::RAuxStore::setupAuxField",
542 "Couldn't find dictionary for type: %s",
543 vectorClassName.c_str());
548 if (auxid == SG::null_auxid) {
549 if (linkedAuxId != SG::null_auxid) {
550 ::Error(
"xAOD::RAuxStore::setupAuxField",
551 XAOD_MESSAGE(
"Dynamic ROOT vector factory not implemented for "
552 "linked types; field \"%s\""),
553 field.GetFieldName().c_str());
555 ::Error(
"xAOD::RAuxStore::setupAuxField",
556 XAOD_MESSAGE(
"Couldn't assign auxiliary ID to field \"%s\""),
557 field.GetFieldName().c_str());
559 return StatusCode::FAILURE;
564 return StatusCode::SUCCESS;
◆ m_data
| Members& xAOD::RAuxStore::impl::m_data |
Variables coming from AuxStoreBase.
Definition at line 568 of file RAuxStore.cxx.
◆ m_entry
| ::Long64_t xAOD::RAuxStore::impl::m_entry |
The entry to load from the ntuple.
Definition at line 579 of file RAuxStore.cxx.
◆ m_fields
| std::vector<std::unique_ptr<RFieldHandle> > xAOD::RAuxStore::impl::m_fields |
Fields containing the various auxiliary variables.
Definition at line 582 of file RAuxStore.cxx.
◆ m_fieldsWritten
| std::vector<bool> xAOD::RAuxStore::impl::m_fieldsWritten |
"Write status" of the different variables
Definition at line 584 of file RAuxStore.cxx.
◆ m_inputScanned
| bool xAOD::RAuxStore::impl::m_inputScanned = false |
"Scan status" of the input RNTuple
Definition at line 576 of file RAuxStore.cxx.
◆ m_inTuple
| ROOT::RNTupleReader* xAOD::RAuxStore::impl::m_inTuple = nullptr |
◆ m_missingFields
| std::vector<bool> xAOD::RAuxStore::impl::m_missingFields |
Mark fields we've found to be missing.
Definition at line 586 of file RAuxStore.cxx.
◆ m_mutex
| mutex_t xAOD::RAuxStore::impl::m_mutex |
|
mutable |
Mutex object used for multithreaded synchronisation.
Definition at line 589 of file RAuxStore.cxx.
◆ m_outTuple
| ROOT::RNTupleWriter* xAOD::RAuxStore::impl::m_outTuple = nullptr |
The documentation for this struct was generated from the following file:
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
const IAuxTypeVectorFactory * addFactory(const std::type_info &ti, const std::type_info &ti_alloc, std::unique_ptr< const IAuxTypeVectorFactory > factory)
Add a new type -> factory mapping.
StatusCode setupAuxField(const ROOT::RFieldBase &field, std::string_view auxName)
This function sets up an auxiliary field by determining its type and attempting to register it with t...
TClass * lookupVectorType(TClass &cl)
Internal function used by xAOD::TAuxStore and xAOD::RAuxStore.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
SG::auxid_t findAuxID(const std::string &name, const std::string &clsname="") const
Look up a name -> auxid_t mapping.
SG::auxid_set_t m_auxIDs
Internal list of auxiliary variable IDs handled currently by the object.
static std::string linkedName(const std::string &name)
Given a variable name, return the name of the corresponding linked variable.
bool isPrimitiveType(std::string_view typeName)
Check if the type name describes a primitive type.
static bool classNameHasLink(const std::string &className)
Test to see if a class name corresponds to a class with a linked variable.
Members & m_data
Variables coming from AuxStoreBase.
@ kObjectStore
The object describes a single object.
virtual std::string tiAllocName() const =0
Return the (demangled) name of the vector allocator.
Handle mappings between names and auxid_t.
@ Linked
Mark that this variable is linked to another one.
ROOT::RNTupleReader * m_inTuple
The ntuple being read from.
size_t auxid_t
Identifier for a particular aux data item.
std::string getTypeName(const std::type_info &ti)
This function is necessary in order to create type names that ROOT can understand.
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.
Interface for factory objects that create vectors.
virtual const std::type_info * tiAlloc() const =0
Return the type_info of the vector allocator.
std::string m_prefix
Static prefix for the branch names.
static bool isLinkedName(const std::string &name)
Test if a variable name corresponds to a linked variable.
AuxVarFlags
Additional flags to qualify an auxiliary variable.
EStructMode m_structMode
The "structural" mode of the object.
const std::type_info * auxFieldType(const ROOT::RFieldBase &field, std::string *expectedClassName=nullptr)
This function retrieves the type information for a given auxiliary field.
const std::type_info & getTypeInfo(EDataType type)
This function is used when reading a primitive branch from an input file without the user explicitly ...
@ kUndefinedStore
The structure mode is not defined.
std::string m_dynPrefix
Dynamic prefix for the branch names.
bool m_topStore
Flag stating whether this is a "top store".
bool m_inputScanned
"Scan status" of the input RNTuple
SG::auxid_t getAuxID(const std::string &name, const std::string &clsname="", const Flags flags=Flags::None, const SG::auxid_t linkedVariable=SG::null_auxid)
Look up a name -> auxid_t mapping.