Interface for iterating over entries of RNTuples and vertically concatenated RNTuples (chains).
Example usage (see ntpl012_processor.C for a full example):
An RNTupleProcessor is created by providing one or more RNTupleOpenSpecs, each of which contains the name and storage location of a single RNTuple. The RNTuples are processed in the order in which they were provided.
The RNTupleProcessor constructor also (optionally) accepts an RNTupleModel, which determines which fields should be read. If no model is provided, a default model based on the descriptor of the first specified RNTuple will be used. If a field that was present in the first RNTuple is not found in a subsequent one, an error will be thrown.
The RNTupleProcessor provides an iterator which gives access to the REntry containing the field data for the current entry. Additional bookkeeping information can be obtained through the RNTupleProcessor itself.
Definition at line 79 of file RNTupleProcessor.hxx.
Classes | |
class | RFieldContext |
Manager for a field as part of the RNTupleProcessor. More... | |
class | RIterator |
Iterator over the entries of an RNTuple, or vertical concatenation thereof. More... | |
Public Member Functions | |
RNTupleProcessor (const RNTupleProcessor &)=delete | |
RNTupleProcessor (RNTupleProcessor &&)=delete | |
virtual | ~RNTupleProcessor ()=default |
RIterator | begin () |
RIterator | end () |
ROOT::NTupleSize_t | GetCurrentEntryNumber () const |
Get the entry number that is currently being processed. | |
std::size_t | GetCurrentProcessorNumber () const |
Get the number of the inner processor currently being read. | |
const REntry & | GetEntry () const |
Get a reference to the entry used by the processor. | |
const RNTupleModel & | GetModel () const |
Get the model used by the processor. | |
ROOT::NTupleSize_t | GetNEntriesProcessed () const |
Get the total number of entries processed so far. | |
const std::string & | GetProcessorName () const |
Get the name of the processor. | |
RNTupleProcessor & | operator= (const RNTupleProcessor &)=delete |
RNTupleProcessor & | operator= (RNTupleProcessor &&)=delete |
Static Public Member Functions | |
static std::unique_ptr< RNTupleProcessor > | Create (const RNTupleOpenSpec &ntuple, std::string_view processorName, std::unique_ptr< RNTupleModel > model=nullptr) |
Create an RNTupleProcessor for a single RNTuple. | |
static std::unique_ptr< RNTupleProcessor > | Create (const RNTupleOpenSpec &ntuple, std::unique_ptr< RNTupleModel > model=nullptr) |
Create an RNTupleProcessor for a single RNTuple. | |
static std::unique_ptr< RNTupleProcessor > | CreateChain (const std::vector< RNTupleOpenSpec > &ntuples, std::string_view processorName, std::unique_ptr< RNTupleModel > model=nullptr) |
Create an RNTupleProcessor for a chain (i.e., a vertical combination) of RNTuples. | |
static std::unique_ptr< RNTupleProcessor > | CreateChain (const std::vector< RNTupleOpenSpec > &ntuples, std::unique_ptr< RNTupleModel > model=nullptr) |
Create an RNTupleProcessor for a chain (i.e., a vertical combination) of RNTuples. | |
static std::unique_ptr< RNTupleProcessor > | CreateChain (std::vector< std::unique_ptr< RNTupleProcessor > > innerProcessors, std::string_view processorName, std::unique_ptr< RNTupleModel > model=nullptr) |
Create an RNTupleProcessor for a chain (i.e., a vertical combination) of other RNTupleProcessors. | |
static std::unique_ptr< RNTupleProcessor > | CreateChain (std::vector< std::unique_ptr< RNTupleProcessor > > innerProcessors, std::unique_ptr< RNTupleModel > model=nullptr) |
Create an RNTupleProcessor for a chain (i.e., a vertical combination) of other RNTupleProcessors. | |
static std::unique_ptr< RNTupleProcessor > | CreateJoin (const std::vector< RNTupleOpenSpec > &ntuples, const std::vector< std::string > &joinFields, std::string_view processorName, std::vector< std::unique_ptr< RNTupleModel > > models={}) |
Create an RNTupleProcessor for a join (i.e., a horizontal combination) of RNTuples. | |
static std::unique_ptr< RNTupleProcessor > | CreateJoin (const std::vector< RNTupleOpenSpec > &ntuples, const std::vector< std::string > &joinFields, std::vector< std::unique_ptr< RNTupleModel > > models={}) |
Create an RNTupleProcessor for a join (i.e., a horizontal combination) of RNTuples. | |
Protected Member Functions | |
RNTupleProcessor (std::string_view processorName, std::unique_ptr< RNTupleModel > model) | |
Create a new base RNTupleProcessor. | |
void | ConnectField (RFieldContext &fieldContext, Internal::RPageSource &pageSource, REntry &entry) |
Create and connect a concrete field to the current page source, based on its proto field. | |
virtual ROOT::NTupleSize_t | GetNEntries ()=0 |
Get the total number of entries in this processor. | |
virtual ROOT::NTupleSize_t | LoadEntry (ROOT::NTupleSize_t entryNumber)=0 |
Load the entry identified by the provided entry number. | |
virtual void | SetEntryPointers (const REntry &entry)=0 |
Point the entry's field values of the processor to the pointers from the provided entry. | |
Protected Attributes | |
ROOT::NTupleSize_t | fCurrentEntryNumber = 0 |
std::size_t | fCurrentProcessorNumber = 0 |
std::unique_ptr< REntry > | fEntry |
std::unordered_map< std::string, RFieldContext > | fFieldContexts |
Maps the (qualified) field name to its corresponding field context. | |
std::unique_ptr< RNTupleModel > | fModel |
ROOT::NTupleSize_t | fNEntries = kInvalidNTupleIndex |
Total number of entries. | |
ROOT::NTupleSize_t | fNEntriesProcessed = 0 |
std::vector< RNTupleOpenSpec > | fNTuples |
std::unique_ptr< Internal::RPageSource > | fPageSource |
std::string | fProcessorName |
Friends | |
class | RNTupleChainProcessor |
class | RNTupleJoinProcessor |
class | RNTupleSingleProcessor |
struct | ROOT::Experimental::Internal::RNTupleProcessorEntryLoader |
#include <ROOT/RNTupleProcessor.hxx>
|
inlineprotected |
Create a new base RNTupleProcessor.
[in] | processorName | Name of the processor. By default, this is the name of the underlying RNTuple for RNTupleSingleProcessor, the name of the first processor for RNTupleChainProcessor, or the name of the primary RNTuple for RNTupleJoinProcessor. |
[in] | model | The RNTupleModel representing the entries returned by the processor. |
Definition at line 174 of file RNTupleProcessor.hxx.
|
delete |
|
delete |
|
virtualdefault |
|
inline |
Definition at line 273 of file RNTupleProcessor.hxx.
|
protected |
Create and connect a concrete field to the current page source, based on its proto field.
Definition at line 164 of file RNTupleProcessor.cxx.
|
static |
Create an RNTupleProcessor for a single RNTuple.
[in] | ntuple | The name and storage location of the RNTuple to process. |
[in] | processorName | The name to give to the processor. Use Create(const RNTupleOpenSpec &, std::unique_ptr<RNTupleModel>) to automatically use the name of the input RNTuple instead. |
[in] | model | An RNTupleModel specifying which fields can be read by the processor. If no model is provided, one will be created based on the descriptor of the first ntuple specified. |
Definition at line 41 of file RNTupleProcessor.cxx.
|
static |
Create an RNTupleProcessor for a single RNTuple.
[in] | ntuple | The name and storage location of the RNTuple to process. |
[in] | model | An RNTupleModel specifying which fields can be read by the processor. If no model is provided, one will be created based on the descriptor of the first ntuple specified. |
Definition at line 35 of file RNTupleProcessor.cxx.
|
static |
Create an RNTupleProcessor for a chain (i.e., a vertical combination) of RNTuples.
[in] | ntuples | A list specifying the names and locations of the RNTuples to process. |
[in] | processorName | The name to give to the processor. Use CreateChain(const RNTupleOpenSpec &, std::unique_ptr<RNTupleModel>) to automatically use the name of the first input RNTuple instead. |
[in] | model | An RNTupleModel specifying which fields can be read by the processor. If no model is provided, one will be created based on the descriptor of the first RNTuple specified. |
Definition at line 58 of file RNTupleProcessor.cxx.
|
static |
Create an RNTupleProcessor for a chain (i.e., a vertical combination) of RNTuples.
[in] | ntuples | A list specifying the names and locations of the RNTuples to process. |
[in] | model | An RNTupleModel specifying which fields can be read by the processor. If no model is provided, one will be created based on the descriptor of the first RNTuple specified. |
Definition at line 48 of file RNTupleProcessor.cxx.
|
static |
Create an RNTupleProcessor for a chain (i.e., a vertical combination) of other RNTupleProcessors.
[in] | innerProcessors | A list with the processors to chain. |
[in] | processorName | The name to give to the processor. Use CreateChain(std::vector<std::unique_ptr<RNTupleProcessor>>, std::unique_ptr<RNTupleModel>) to automatically use the name of the first inner processor instead. |
[in] | model | An RNTupleModel specifying which fields can be read by the processor. If no model is provided, one will be created based on the model used by the first inner processor. |
Definition at line 93 of file RNTupleProcessor.cxx.
|
static |
Create an RNTupleProcessor for a chain (i.e., a vertical combination) of other RNTupleProcessors.
[in] | innerProcessors | A list with the processors to chain. |
[in] | model | An RNTupleModel specifying which fields can be read by the processor. If no model is provided, one will be created based on the model used by the first inner processor. |
Definition at line 82 of file RNTupleProcessor.cxx.
|
static |
Create an RNTupleProcessor for a join (i.e., a horizontal combination) of RNTuples.
[in] | ntuples | A list specifying the names and locations of the RNTuples to process. The first RNTuple in the list will be considered the primary RNTuple and drives the processor iteration loop. Subsequent RNTuples are considered auxiliary, whose entries to be read are determined by the primary RNTuple (and do not necessarily have to be in sequential order). |
[in] | joinFields | The names of the fields on which to join, in case the specified RNTuples are unaligned. The join is made based on the combined join field values, and therefore each field has to be present in each specified RNTuple. If an empty list is provided, it is assumed that the specified RNTuple are fully aligned. |
[in] | processorName | The name to give to the processor. Use CreateJoin(const std::vector<RNTupleOpenSpec> &, const std::vector<std::string> &, std::unique_ptr<RNTupleModel>) to automatically use the name of the input RNTuple instead. |
[in] | models | A list of models for the RNTuples. This list must either contain a model for each RNTuple in ntuples (following the specification order), or be empty. When the list is empty, the default model (i.e. containing all fields) will be used for each RNTuple. |
Definition at line 119 of file RNTupleProcessor.cxx.
|
static |
Create an RNTupleProcessor for a join (i.e., a horizontal combination) of RNTuples.
[in] | ntuples | A list specifying the names and locations of the RNTuples to process. The first RNTuple in the list will be considered the primary RNTuple and drives the processor iteration loop. Subsequent RNTuples are considered auxiliary, whose entries to be read are determined by the primary RNTuple (and do not necessarily have to be in sequential order). |
[in] | joinFields | The names of the fields on which to join, in case the specified RNTuples are unaligned. The join is made based on the combined join field values, and therefore each field has to be present in each specified RNTuple. If an empty list is provided, it is assumed that the specified ntuple are fully aligned. |
[in] | models | A list of models for the RNTuples. This list must either contain a model for each RNTuple in ntuples (following the specification order), or be empty. When the list is empty, the default model (i.e. containing all fields) will be used for each RNTuple. |
Definition at line 109 of file RNTupleProcessor.cxx.
|
inline |
Definition at line 274 of file RNTupleProcessor.hxx.
|
inline |
Get the entry number that is currently being processed.
Definition at line 192 of file RNTupleProcessor.hxx.
|
inline |
Get the number of the inner processor currently being read.
This method is only relevant for the RNTupleChainProcessor. For the other processors, 0 is always returned.
Definition at line 198 of file RNTupleProcessor.hxx.
Get a reference to the entry used by the processor.
Definition at line 216 of file RNTupleProcessor.hxx.
|
inline |
Get the model used by the processor.
Definition at line 210 of file RNTupleProcessor.hxx.
|
protectedpure virtual |
Get the total number of entries in this processor.
Implemented in ROOT::Experimental::RNTupleSingleProcessor, ROOT::Experimental::RNTupleChainProcessor, and ROOT::Experimental::RNTupleJoinProcessor.
|
inline |
Get the total number of entries processed so far.
Definition at line 188 of file RNTupleProcessor.hxx.
|
inline |
Get the name of the processor.
Unless this name was explicitly specified during creation of the processor, this is the name of the underlying RNTuple for RNTupleSingleProcessor, the name of the first processor for RNTupleChainProcessor, or the name of the primary RNTuple for RNTupleJoinProcessor.
Definition at line 206 of file RNTupleProcessor.hxx.
|
protectedpure virtual |
Load the entry identified by the provided entry number.
[in] | entryNumber | Entry number to load |
entryNumber
if the entry was successfully loaded, kInvalidNTupleIndex
otherwise. Implemented in ROOT::Experimental::RNTupleSingleProcessor, ROOT::Experimental::RNTupleChainProcessor, and ROOT::Experimental::RNTupleJoinProcessor.
|
delete |
|
delete |
|
protectedpure virtual |
Point the entry's field values of the processor to the pointers from the provided entry.
[in] | entry | The entry whose field values to use. |
Implemented in ROOT::Experimental::RNTupleChainProcessor, ROOT::Experimental::RNTupleJoinProcessor, and ROOT::Experimental::RNTupleSingleProcessor.
|
friend |
Definition at line 82 of file RNTupleProcessor.hxx.
|
friend |
Definition at line 83 of file RNTupleProcessor.hxx.
|
friend |
Definition at line 81 of file RNTupleProcessor.hxx.
|
friend |
Definition at line 80 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 139 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 140 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 127 of file RNTupleProcessor.hxx.
|
protected |
Maps the (qualified) field name to its corresponding field context.
Definition at line 130 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 132 of file RNTupleProcessor.hxx.
|
protected |
Total number of entries.
Only to be used internally by the processor, not meant to be exposed in the public interface.
Definition at line 136 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 138 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 126 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 128 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 125 of file RNTupleProcessor.hxx.