Skip to content

[ntuple] add tutorial for RNTuple attributes#21993

Merged
dpiparo merged 1 commit intoroot-project:masterfrom
silverweed:ntuple_attr_tutorial
Apr 21, 2026
Merged

[ntuple] add tutorial for RNTuple attributes#21993
dpiparo merged 1 commit intoroot-project:masterfrom
silverweed:ntuple_attr_tutorial

Conversation

@silverweed
Copy link
Copy Markdown
Contributor

No description provided.

@silverweed silverweed added this to the 6.40.00 milestone Apr 21, 2026
@silverweed silverweed self-assigned this Apr 21, 2026
@silverweed silverweed requested a review from couet as a code owner April 21, 2026 11:22
@silverweed silverweed force-pushed the ntuple_attr_tutorial branch from 0e27bff to 1bc7fdf Compare April 21, 2026 11:22
Copy link
Copy Markdown
Contributor

@jblomer jblomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle looks good to me, but I think we should make the example a little closer to HEP vocabulary. E.g., as main data, store a struct Event (even if empty). The attribute set could be one of the examples we give in the presentation (e.g. a set named Provenance and then we add a different run number for every 10 entries or so).

Copy link
Copy Markdown
Contributor

@jblomer jblomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@github-actions
Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 5h 39m 59s ⏱️
 3 839 tests  3 837 ✅  1 💤  1 ❌
75 735 runs  75 706 ✅ 18 💤 11 ❌

For more details on these failures, see this check.

Results for commit 8a31b38.

@dpiparo
Copy link
Copy Markdown
Member

dpiparo commented Apr 21, 2026

All failures due to SOFIE custom CMake.

@dpiparo dpiparo merged commit 73c1c68 into root-project:master Apr 21, 2026
18 of 30 checks passed
@silverweed silverweed deleted the ntuple_attr_tutorial branch April 22, 2026 06:37
Copy link
Copy Markdown
Member

@hahnjo hahnjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tutorial should be mentioned in tutorials/io/ntuple/index.md

// fields in the attribute model; all the main RNTuple data you filled in before committing the range
// will have those values as metadata associated to it.
//
// Beginning an attribute range is done like this (note that attrEntry is an REntry, so filling
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attrEntry isn't used in the tutorial?

// in the attribute values uses the same interface of the regular values):
auto attrRange = attrSet->BeginRange();

// Here you can assign values to your attributes. In this case we only have 1 attribute (the string "myAttr"),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this was changed from myAttr to runNumber?


std::cout << "\nOpened attribute set '" << attrSet->GetDescriptor().GetName() << "' with description: \""
<< attrSet->GetDescriptor().GetDescription() << "\"\n";
// Loop over the main entries and, for each, print its associated attribute "myAttr"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print its associated run number?

@silverweed
Copy link
Copy Markdown
Contributor Author

@hahnjo thanks. I opened a new PR to fix the issues here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants