Interface for iterating over entries of vertically ("chained") and/or horizontally ("joined") combined RNTuples.
Example usage (see ntpl012_processor_chain.C and ntpl015_processor_join.C for bigger examples):
An RNTupleProcessor is created either:
The RNTupleProcessor provides an iterator which gives access to the index of the current global entry of the processor, i.e. taking into account previously processed RNTuples.
Because the schemas of each RNTuple that are part of an RNTupleProcessor may not necessarily be identical, or because it can occur that entries are only partially complete in a join-based processor, field values may be marked as "invalid", at which point their data should not be read. This is handled by the RNTupleProcessorOptionalPtr that is returned by RequestField().
Definition at line 244 of file RNTupleProcessor.hxx.
Classes | |
| 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. | |
| 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 |
| void | PrintStructure (std::ostream &output=std::cout) |
| Print a graphical representation of the processor composition. | |
| template<typename T> | |
| RNTupleProcessorOptionalPtr< T > | RequestField (std::string_view fieldName, void *valuePtr=nullptr) |
| Request access to a field for reading during processing. | |
Static Public Member Functions | |
| static std::unique_ptr< RNTupleProcessor > | Create (RNTupleOpenSpec ntuple, std::string_view processorName="") |
| Create an RNTupleProcessor for a single RNTuple. | |
| static std::unique_ptr< RNTupleProcessor > | CreateChain (std::vector< RNTupleOpenSpec > ntuples, std::string_view processorName="") |
| 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="") |
| Create an RNTupleProcessor for a chain (i.e., a vertical combination) of other RNTupleProcessors. | |
| static std::unique_ptr< RNTupleProcessor > | CreateJoin (RNTupleOpenSpec primaryNTuple, RNTupleOpenSpec auxNTuple, const std::vector< std::string > &joinFields, std::string_view processorName="") |
| Create an RNTupleProcessor for a join (i.e., a horizontal combination) of RNTuples. | |
| static std::unique_ptr< RNTupleProcessor > | CreateJoin (std::unique_ptr< RNTupleProcessor > primaryProcessor, std::unique_ptr< RNTupleProcessor > auxProcessor, const std::vector< std::string > &joinFields, std::string_view processorName="") |
| Create an RNTupleProcessor for a join (i.e., a horizontal combination) of RNTuples. | |
Protected Member Functions | |
| RNTupleProcessor (std::string_view processorName) | |
| Create a new base RNTupleProcessor. | |
| virtual void | AddEntriesToJoinTable (Internal::RNTupleJoinTable &joinTable, ROOT::NTupleSize_t entryOffset=0)=0 |
| Add the entry mappings for this processor to the provided join table. | |
| virtual ROOT::RResult< Internal::RNTupleProcessorEntry::FieldIndex_t > | AddFieldToEntry (std::string_view fieldName, void *valuePtr, const Internal::RNTupleProcessorProvenance &provenance)=0 |
| Add a field to the entry. | |
| virtual bool | CanReadFieldFromDisk (std::string_view fieldName)=0 |
| Check if a field exists on-disk and can be read by the processor. | |
| virtual void | Connect (const std::unordered_set< Internal::RNTupleProcessorEntry::FieldIndex_t > &fieldIdxs, const Internal::RNTupleProcessorProvenance &provenance, bool updateFields)=0 |
| Connect fields to the page source of the processor's underlying RNTuple(s). | |
| virtual ROOT::NTupleSize_t | GetNEntries ()=0 |
| Get the total number of entries in this processor. | |
| const ROOT::RNTupleModel & | GetProtoModel () const |
| Get the proto model used by the processor. | |
| virtual void | Initialize (std::shared_ptr< Internal::RNTupleProcessorEntry > entry)=0 |
| Initialize the processor, by setting fProtoModel and creating an (initially empty) fEntry, or setting an existing one. | |
| bool | IsInitialized () const |
| Check if the processor already has been initialized. | |
| virtual ROOT::NTupleSize_t | LoadEntry (ROOT::NTupleSize_t entryNumber)=0 |
| Load the entry identified by the provided entry number. | |
| virtual void | PrintStructureImpl (std::ostream &output) const =0 |
| Processor-specific implementation for printing its structure, called by PrintStructure(). | |
Protected Attributes | |
| ROOT::NTupleSize_t | fCurrentEntryNumber = 0 |
| std::size_t | fCurrentProcessorNumber = 0 |
| std::shared_ptr< Internal::RNTupleProcessorEntry > | fEntry = nullptr |
| std::unordered_set< Internal::RNTupleProcessorEntry::FieldIndex_t > | fFieldIdxs |
| ROOT::NTupleSize_t | fNEntries = kInvalidNTupleIndex |
| Total number of entries. | |
| ROOT::NTupleSize_t | fNEntriesProcessed = 0 |
| std::string | fProcessorName |
| std::unique_ptr< ROOT::RNTupleModel > | fProtoModel = nullptr |
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. |
Definition at line 348 of file RNTupleProcessor.hxx.
|
delete |
|
delete |
|
virtualdefault |
|
protectedpure virtual |
Add the entry mappings for this processor to the provided join table.
| [in] | joinTable | the join table to map the entries to. |
| [in] | entryOffset | In case the entry mapping is added from a chain, the offset of the entry indexes to use with respect to the processor's position in the chain. |
Implemented in ROOT::Experimental::RNTupleChainProcessor, ROOT::Experimental::RNTupleJoinProcessor, and ROOT::Experimental::RNTupleSingleProcessor.
|
protectedpure virtual |
Add a field to the entry.
| [in] | fieldName | Name of the field to add. |
| [in] | valuePtr | Pointer to bind to the field's value in the entry. If this is a nullptr, a pointer will be created. |
| [in] | provenance | Provenance of the processor. |
In case the field was already present in the entry, the index of the existing field is returned.
Implemented in ROOT::Experimental::RNTupleChainProcessor, ROOT::Experimental::RNTupleJoinProcessor, and ROOT::Experimental::RNTupleSingleProcessor.
|
inline |
Definition at line 482 of file RNTupleProcessor.hxx.
|
protectedpure virtual |
Check if a field exists on-disk and can be read by the processor.
| [in] | fieldName | Name of the field to check. |
Implemented in ROOT::Experimental::RNTupleChainProcessor, ROOT::Experimental::RNTupleJoinProcessor, and ROOT::Experimental::RNTupleSingleProcessor.
|
protectedpure virtual |
Connect fields to the page source of the processor's underlying RNTuple(s).
| [in] | fieldIdxs | Indices of the fields to connect. |
| [in] | provenance | Provenance of the processor. |
| [in] | updateFields | Whether the fields in the entry need to be updated, because the current underlying RNTuple source changed. |
Implemented in ROOT::Experimental::RNTupleChainProcessor, ROOT::Experimental::RNTupleJoinProcessor, and ROOT::Experimental::RNTupleSingleProcessor.
|
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. If empty, the name of the input RNTuple is used. |
Definition at line 37 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. If empty, the name of the first RNTuple is used. |
Definition at line 43 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. If empty, the name of the first inner processor is used. |
Definition at line 59 of file RNTupleProcessor.cxx.
|
static |
Create an RNTupleProcessor for a join (i.e., a horizontal combination) of RNTuples.
| [in] | primaryNTuple | The name and location of the primary RNTuple. Its entries are processed in sequential order. |
| [in] | auxNTuple | The name and location of the RNTuple to join the primary RNTuple with. The order in which its entries are processed is determined by the primary RNTuple and doesn't necessarily have to be sequential. |
| [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] | processorName | The name to give to the processor. If empty, the name of the primary RNTuple is used. |
Definition at line 69 of file RNTupleProcessor.cxx.
|
static |
Create an RNTupleProcessor for a join (i.e., a horizontal combination) of RNTuples.
| [in] | primaryProcessor | The primary processor. Its entries are processed in sequential order. |
| [in] | auxProcessor | The processor to join the primary processor with. The order in which its entries are processed is determined by the primary processor and doesn't necessarily have to be sequential. |
| [in] | joinFields | The names of the fields on which to join, in case the specified processors are unaligned. The join is made based on the combined join field values, and therefore each field has to be present in each specified processors. If an empty list is provided, it is assumed that the specified processors are fully aligned. |
| [in] | processorName | The name to give to the processor. If empty, the name of the primary processor is used. |
Definition at line 89 of file RNTupleProcessor.cxx.
|
inline |
Definition at line 483 of file RNTupleProcessor.hxx.
|
inline |
Get the entry number that is currently being processed.
Definition at line 363 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 369 of file RNTupleProcessor.hxx.
|
protectedpure virtual |
Get the total number of entries in this processor.
Implemented in ROOT::Experimental::RNTupleChainProcessor, ROOT::Experimental::RNTupleJoinProcessor, and ROOT::Experimental::RNTupleSingleProcessor.
|
inline |
Get the total number of entries processed so far.
Definition at line 359 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 processor for RNTupleJoinProcessor.
Definition at line 377 of file RNTupleProcessor.hxx.
|
inlineprotected |
Get the proto model used by the processor.
A processor's proto model contains all fields that can be accessed and is inferred from the descriptors of the underlying RNTuples. It is used in RequestField() to check that the requested field is actually valid.
Definition at line 296 of file RNTupleProcessor.hxx.
|
protectedpure virtual |
Initialize the processor, by setting fProtoModel and creating an (initially empty) fEntry, or setting an existing one.
Implemented in ROOT::Experimental::RNTupleChainProcessor, ROOT::Experimental::RNTupleJoinProcessor, and ROOT::Experimental::RNTupleSingleProcessor.
|
inlineprotected |
Check if the processor already has been initialized.
Definition at line 271 of file RNTupleProcessor.hxx.
|
protectedpure virtual |
Load the entry identified by the provided entry number.
| [in] | entryNumber | Entry number to load |
Implemented in ROOT::Experimental::RNTupleChainProcessor, ROOT::Experimental::RNTupleJoinProcessor, and ROOT::Experimental::RNTupleSingleProcessor.
|
delete |
|
delete |
|
inline |
Print a graphical representation of the processor composition.
| [in,out] | output | Stream to print to (default is stdout). |
The structure of a processor representing a join between a single primary RNTuple and a chain of two auxiliary RNTuples will be printed as follows:
Definition at line 420 of file RNTupleProcessor.hxx.
|
protectedpure virtual |
Processor-specific implementation for printing its structure, called by PrintStructure().
| [in,out] | output | Output stream to print to. |
Implemented in ROOT::Experimental::RNTupleChainProcessor, ROOT::Experimental::RNTupleJoinProcessor, and ROOT::Experimental::RNTupleSingleProcessor.
|
inline |
Request access to a field for reading during processing.
| T | Type of the requested field. |
| [in] | fieldName | Name of the requested field. |
Definition at line 394 of file RNTupleProcessor.hxx.
|
friend |
Definition at line 247 of file RNTupleProcessor.hxx.
|
friend |
Definition at line 248 of file RNTupleProcessor.hxx.
|
friend |
Definition at line 246 of file RNTupleProcessor.hxx.
|
friend |
Definition at line 245 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 261 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 262 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 253 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 254 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 258 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 260 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 251 of file RNTupleProcessor.hxx.
|
protected |
Definition at line 252 of file RNTupleProcessor.hxx.