16#ifndef ROOT_RNTupleProcessor
17#define ROOT_RNTupleProcessor
34namespace Experimental {
37struct RNTupleProcessorEntryLoader;
59 std::variant<std::string, TDirectory *>
fStorage;
153 std::unique_ptr<ROOT::RNTupleModel>
fModel;
286 return lh.fCurrentEntryNumber !=
rh.fCurrentEntryNumber;
290 return lh.fCurrentEntryNumber ==
rh.fCurrentEntryNumber;
305 static std::unique_ptr<RNTupleProcessor>
319 static std::unique_ptr<RNTupleProcessor>
330 static std::unique_ptr<RNTupleProcessor>
331 CreateChain(std::vector<RNTupleOpenSpec>
ntuples, std::unique_ptr<ROOT::RNTupleModel> model =
nullptr);
344 static std::unique_ptr<RNTupleProcessor>
CreateChain(std::vector<RNTupleOpenSpec>
ntuples,
346 std::unique_ptr<ROOT::RNTupleModel> model =
nullptr);
357 std::unique_ptr<ROOT::RNTupleModel> model =
nullptr);
372 std::unique_ptr<ROOT::RNTupleModel> model =
nullptr);
393 static std::unique_ptr<RNTupleProcessor>
396 std::vector<std::unique_ptr<ROOT::RNTupleModel>>
auxModels = {});
422 static std::unique_ptr<RNTupleProcessor>
425 std::unique_ptr<ROOT::RNTupleModel>
primaryModel =
nullptr,
426 std::vector<std::unique_ptr<ROOT::RNTupleModel>>
auxModels = {});
473 std::unique_ptr<ROOT::RNTupleModel> model);
536 std::vector<std::unique_ptr<Internal::RNTupleJoinTable>>
fJoinTables;
537 bool fJoinTablesAreBuilt =
false;
564 void SetModel(std::unique_ptr<ROOT::RNTupleModel>
primaryModel,
565 std::vector<std::unique_ptr<ROOT::RNTupleModel>>
auxModels);
569 void ConnectFields();
601 std::unique_ptr<ROOT::RNTupleModel>
primaryModel =
nullptr,
602 std::vector<std::unique_ptr<ROOT::RNTupleModel>>
auxModels = {});
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Processor specialization for vertically combined (chained) RNTupleProcessors.
void SetEntryPointers(const ROOT::REntry &) final
ROOT::NTupleSize_t GetNEntries() final
Get the total number of entries in this processor.
std::vector< ROOT::NTupleSize_t > fInnerNEntries
ROOT::NTupleSize_t LoadEntry(ROOT::NTupleSize_t entryNumber) final
Load the entry identified by the provided (global) entry number (i.e., considering all RNTuples in th...
std::vector< std::unique_ptr< RNTupleProcessor > > fInnerProcessors
Processor specialization for horizontally combined (joined) RNTuples.
RNTupleJoinProcessor(const RNTupleJoinProcessor &)=delete
std::vector< std::unique_ptr< ROOT::Internal::RPageSource > > fAuxiliaryPageSources
RNTupleJoinProcessor(RNTupleJoinProcessor &&)=delete
void SetJoinFieldTokens(const std::vector< std::string > &joinFields)
Populate fJoinFieldTokens with tokens for join fields belonging to the main RNTuple in the join model...
~RNTupleJoinProcessor() override
RNTupleJoinProcessor operator=(const RNTupleJoinProcessor &)=delete
ROOT::NTupleSize_t GetNEntries() final
Get the total number of entries in this processor.
bool HasJoinTable() const
RNTupleJoinProcessor operator=(RNTupleJoinProcessor &&)=delete
std::vector< ROOT::RFieldToken > fJoinFieldTokens
Tokens representing the join fields present in the main RNTuple.
std::vector< std::unique_ptr< Internal::RNTupleJoinTable > > fJoinTables
Specification of the name and location of an RNTuple, used for creating a new RNTupleProcessor.
RNTupleOpenSpec(std::string_view n, const std::string &s)
std::variant< std::string, TDirectory * > fStorage
RNTupleOpenSpec(std::string_view n, TDirectory *s)
std::unique_ptr< ROOT::Internal::RPageSource > CreatePageSource() const
Manager for a field as part of the RNTupleProcessor.
RFieldContext(std::unique_ptr< ROOT::RFieldBase > protoField, ROOT::RFieldToken token, std::size_t ntupleIdx=0)
void ResetConcreteField()
Concrete pages need to be reset explicitly before the page source they belong to is destroyed.
std::unique_ptr< ROOT::RFieldBase > fConcreteField
std::unique_ptr< ROOT::RFieldBase > fProtoField
const ROOT::RFieldBase & GetProtoField() const
Iterator over the entries of an RNTuple, or vertical concatenation thereof.
RNTupleProcessor & fProcessor
std::forward_iterator_tag iterator_category
std::ptrdiff_t difference_type
friend bool operator==(const iterator &lh, const iterator &rh)
friend bool operator!=(const iterator &lh, const iterator &rh)
ROOT::NTupleSize_t fCurrentEntryNumber
RIterator(RNTupleProcessor &processor, ROOT::NTupleSize_t entryNumber)
Interface for iterating over entries of RNTuples and vertically concatenated RNTuples (chains).
const std::string & GetProcessorName() const
Get the name of the processor.
std::unique_ptr< ROOT::REntry > fEntry
virtual ROOT::NTupleSize_t GetNEntries()=0
Get the total number of entries in this processor.
std::size_t fCurrentProcessorNumber
std::unique_ptr< ROOT::RNTupleModel > fModel
static std::unique_ptr< RNTupleProcessor > Create(RNTupleOpenSpec ntuple, std::unique_ptr< ROOT::RNTupleModel > model=nullptr)
Create an RNTupleProcessor for a single RNTuple.
ROOT::NTupleSize_t fNEntries
Total number of entries.
friend struct ROOT::Experimental::Internal::RNTupleProcessorEntryLoader
static std::unique_ptr< RNTupleProcessor > CreateJoin(const RNTupleOpenSpec &primaryNTuple, const std::vector< RNTupleOpenSpec > &auxNTuples, const std::vector< std::string > &joinFields, std::unique_ptr< ROOT::RNTupleModel > primaryModel=nullptr, std::vector< std::unique_ptr< ROOT::RNTupleModel > > auxModels={})
Create an RNTupleProcessor for a join (i.e., a horizontal combination) of RNTuples.
friend class RNTupleJoinProcessor
virtual ~RNTupleProcessor()=default
std::unique_ptr< ROOT::Internal::RPageSource > fPageSource
RNTupleProcessor(RNTupleProcessor &&)=delete
virtual ROOT::NTupleSize_t LoadEntry(ROOT::NTupleSize_t entryNumber)=0
Load the entry identified by the provided entry number.
std::unordered_map< std::string, RFieldContext > fFieldContexts
Maps the (qualified) field name to its corresponding field context.
const ROOT::RNTupleModel & GetModel() const
Get the model used by the processor.
ROOT::NTupleSize_t GetCurrentEntryNumber() const
Get the entry number that is currently being processed.
virtual void SetEntryPointers(const ROOT::REntry &entry)=0
Point the entry's field values of the processor to the pointers from the provided entry.
ROOT::NTupleSize_t fNEntriesProcessed
std::string fProcessorName
std::size_t GetCurrentProcessorNumber() const
Get the number of the inner processor currently being read.
RNTupleProcessor(std::string_view processorName, std::unique_ptr< ROOT::RNTupleModel > model)
Create a new base RNTupleProcessor.
ROOT::NTupleSize_t fCurrentEntryNumber
void ConnectField(RFieldContext &fieldContext, ROOT::Internal::RPageSource &pageSource, ROOT::REntry &entry)
Create and connect a concrete field to the current page source, based on its proto field.
ROOT::NTupleSize_t GetNEntriesProcessed() const
Get the total number of entries processed so far.
RNTupleProcessor(const RNTupleProcessor &)=delete
RNTupleProcessor & operator=(RNTupleProcessor &&)=delete
friend class RNTupleSingleProcessor
static std::unique_ptr< RNTupleProcessor > CreateChain(std::vector< RNTupleOpenSpec > ntuples, std::unique_ptr< ROOT::RNTupleModel > model=nullptr)
Create an RNTupleProcessor for a chain (i.e., a vertical combination) of RNTuples.
const ROOT::REntry & GetEntry() const
Get a reference to the entry used by the processor.
std::vector< RNTupleOpenSpec > fNTuples
RNTupleProcessor & operator=(const RNTupleProcessor &)=delete
Processor specialization for processing a single RNTuple.
void SetEntryPointers(const ROOT::REntry &entry) final
RNTupleOpenSpec fNTupleSpec
void Connect()
Connect the page source of the underlying RNTuple.
ROOT::NTupleSize_t LoadEntry(ROOT::NTupleSize_t entryNumber) final
Load the entry identified by the provided (global) entry number (i.e., considering all RNTuples in th...
ROOT::NTupleSize_t GetNEntries() final
Get the total number of entries in this processor.
Abstract interface to read data from an ntuple.
The REntry is a collection of values in an ntuple corresponding to a complete row in the data set.
A field translates read and write calls from/to underlying columns to/from tree values.
A field token identifies a (sub)field in an entry.
The RNTupleModel encapulates the schema of an RNTuple.
Describe directory structure in memory.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
constexpr NTupleSize_t kInvalidNTupleIndex
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.