[ntuple] Add RField description members#7399
Conversation
|
Starting build on |
|
Build failed on ROOT-performance-centos8-multicore/default. Failing tests:
|
|
Build failed on ROOT-ubuntu16/nortcxxmod. Failing tests:
|
jblomer
left a comment
There was a problem hiding this comment.
Very nice! My only concern is the name MakeFieldWithDescription, which is a little long for my taste. How about MakeField and AddField overloads that take a tuple as a first parameter, so that you can write
MakeField<float>({"pt", "transverse momentum"}, 0.0);
| for (auto& f: ntuple->GetDescriptor().GetTopLevelFields()) { | ||
| fieldDescriptions.push_back(f.GetFieldDescription()); | ||
| } | ||
| ASSERT_EQ(fieldDescriptions.size(), 3); |
There was a problem hiding this comment.
Arguments of ASSERT_EQ and EXPECT_EQ should be reversed
|
I like the tuple approach much better! I'm struggling to build master right now but will rebase with this change as soon as I can. |
RFieldDescriptor already has a descriptor member, so descriptions are already written to and read from the header but are always empty. The next step is to allow setting field descriptions at the RNTupleModel level.
|
Starting build on |
Add overloads to RNTupleModel's field creation methods to allow setting field descriptions.
|
Starting build on |
Also ensure that models as fields get their description set accordingly.
|
Starting build on |
|
Build failed on windows10/cxx14. Errors:
|
jalopezg-git
left a comment
There was a problem hiding this comment.
I was wondering where the field description was [already] serialized/deserialized; I found it in RNTupleDescriptor.cxx: SerializeField().
LGTM. :-)
Allow setting RNTuple field descriptions. The immediate motivation for this PR is for use by the ongoing CMS RNTuple NanoAOD output module. The new APIs are a direct analogue to
TBranch::SetTitle. Field descriptions are added at theRNTupleModellevel. There currently is no way to adjust field descriptions after creation.There is a new
RNTupleModel::AddFieldoverload that takes a description parameter and a newRNTupleModel::MakeFieldWithDescriptionmethod. The latter was added because of difficulties overloading the existing variadic template methodMakeField.