Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tutorials/io/ntuple/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ RNTuple is the evolution of TTree, offering better performance and new, more rob
| ntpl016_streaming_vector.C | A special purpose container that reads large vectors piece-wise |
| ntpl017_shared_reader.C | Efficient multi-threaded reading when multiple threads share a single reader |
| ntpl018_low_precision_floats.C | Creating low-precision floating point fields |
| ntpl019_attributes.C | Write and read metadata via the Attributes interface (experimental) |
7 changes: 3 additions & 4 deletions tutorials/io/ntuple/ntpl019_attributes.C
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@ static void Write()
// 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
// in the attribute values uses the same interface of the regular values):
// Beginning an attribute range is done like this:
auto attrRange = attrSet->BeginRange();

// Here you can assign values to your attributes. In this case we only have 1 attribute (the string "myAttr"),
// Here you can assign values to your attributes. In this case we only have 1 attribute (the integer "runNumber"),
// so we only fill that.
// Note that attribute values can be assigned anywhere between BeginRange() and CommitRange(), so we could do
// this step even after the main data filling.
Expand Down Expand Up @@ -135,7 +134,7 @@ static void Read()

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"
// Loop over the main entries and, for each, print its associated run number
for (auto mainIdx : reader->GetEntryRange()) {
// There are various ways to access attributes from a main entry index (see the RNTupleAttrSetReader's
// documentation). Here we use GetAttributes to get all attributes associated to the main entry `mainIdx`:
Expand Down
Loading