Looping Over Sub-Fields in an RNTuple Field Using RFieldDescriptorIterable

Hi ROOT,

I’m working with an RNTuple and need to loop over all child fields within a particular field. In the case of TBranch, I would use GetListOfBranches() to retrieve all sub-branches.
For an RNTuple, I found the RFieldDescriptorIterable where the documentation says it is used to loop over a field’s child fields.
However, I’m unsure of how to correctly use this class for my purpose.

I need to access something that I could use to identify the field, hope you guys can help me

Thanks in advance!

Cheers,
Nikolaj


ROOT Version: 6.35.01
Platform: Not Provided
Compiler: g++ (GCC) 14.2.0


Hello,

maybe the tutorial ntpl010 can help here.

Let me also tag @jblomer or @silverweed to check.

You have several options depending on the context. The RNTupleDescriptor and related classes are used to query the on-disk data schema. You can also use RFieldBase and related classes, which represents the in-memory data model. The on-disk and the in-memory schemas are compatible but not necessarily identical (e.g., due to schema evolution).

If you want to iterate over the subfields of an RFieldBase object, you can use RFieldBase::GetSubFields() to access the direct subfields. You can also use RFieldBase::begin() and RFieldBase::end() to access the entire subfield hierarchy.

If you can provide a little more context of your problem, that would help to decide which iteration API is the best fit.

Thanks! RFieldBase::GetSubFields() provided the functionality I needed

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.