Excellent! Thank you - using your code to create a “skimmed model” does work and reports only 48B read. The updated code I used is ignore.cxx (4.2 KB)
regarding views
One of the main goals of our framework is to have “processors” that do specific tasks with some input data but do not care about the source of that input data. Specifically, we would like these processors to be able to run after reading the data from a file (via RNTupleReader) or after some other “source” produced their required inputs (e.g. a simulation creating sim hits rather than reading those sim hits from a previously-generated file or a decoder unpacking raw data into structured data) without any change to the processor’s code.
The GetView breaks this symmetry for two reasons:
- Needing access to a
RNTupleReaderin order to callGetViewin the first place. What would I do to support the no-reader processing situation? - Even if we can get around that hurdle, needing to know the entry index to supply to the
RNTupleView::operator()in order to trigger the read. What should the entry index be if there is no reader?
We avoid these intricacies by having processor’s get their inputs using model.GetDefaultEntry().GetPtr and then holding that address for the entire execution of the program. The data source (reader or otherwise) updates the data at the address location as entries are processed and the processor can then read from that shared address.
I was previously unaware of the RNTupleDescriptor which is exactly what I want in this use case (look at the file to see available fields, construct a model from the available fields dropping some that we want to ignore). I don’t think view needs to change since it is well suited to an “analysis” workflow where a few specific columns are needed and the user can avoid all this descriptor/model/field juggling. I’m venturing to update a more intricate framework where I’m willing to take on the extra descriptor/model/field juggling.
Edit: Feel free to poke around the mock framework (same link as in original post) if you’re curious. Feedback is welcome especially if I’m doing something dangerous/wrong/stupid with ROOT RNTuple{Reader, Writer, Model}.