-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for reading several rntuple files #708
base: master
Are you sure you want to change the base?
Conversation
include/podio/RNTupleReader.h
Outdated
// Map category to a vector that contains at how many entries each reader starts | ||
// For example, if we have 3 readers and the first one has 10 entries, the second one 20 and the third one 30 | ||
// then the vector will be {0, 10, 30, 60} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I fully understand why we need to store the final sum of entries here? Is it because of the upper_bound
below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't have to be stored (and it isn't) but since it has to be computed anyway I think the code looks cleaner like it is (computing it and storing it in the vector and later removing it) than having to check if it's the last entry every time and not add it in that case. For the comment I can remove the last number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ubuntu CI is failing because the use of std::ranges
effectively requires c++20 and gcc11 that is used there is not yet enough. That should resolve itself with #698 I think.
BEGINRELEASENOTES
ENDRELEASENOTES
Now it will work correctly for multiple files. For TTrees reading multiple files with random access (needed because we can read any entry) is provided through
TChain
andTBranch
. ForRNTuples
there is not such thing, there is aRNTupleProcessor
but it is intended for iterative access and not random access:https://root.cern.ch/doc/master/classROOT_1_1Experimental_1_1RNTupleProcessor.html
So the idea is to save a vector with how many entries each file has, and then every time an entry is read do a lookup in the vector to find out which file we are at and get the corresponding reader for that file. Scales as log N in the number of files, which is probably OK for most cases.
Requires C++20 for
std::ranges::upper_bound
.