14#ifndef ROOT_RNTupleReader
15#define ROOT_RNTupleReader
35#include <unordered_map>
84 std::unique_ptr<Internal::RPageStorage::RTaskScheduler>
fUnzipTasks;
86 std::unique_ptr<Internal::RPageSource>
fSource;
88 std::unique_ptr<ROOT::RNTupleModel>
fModel;
108 RNTupleReader(std::unique_ptr<ROOT::RNTupleModel> model, std::unique_ptr<Internal::RPageSource>
source,
205 static std::unique_ptr<RNTupleReader>
209 static std::unique_ptr<RNTupleReader>
Open(std::unique_ptr<ROOT::RNTupleModel> model, std::string_view
ntupleName,
212 static std::unique_ptr<RNTupleReader>
Open(std::unique_ptr<ROOT::RNTupleModel> model,
const RNTuple &
ntuple,
222 std::unique_ptr<RNTupleReader>
Clone()
347 template <
typename T>
376 template <
typename T>
385 template <
typename T>
410 template <
typename T>
421 template <
typename T>
432 template <
typename T>
466 template <
typename T>
475 template <
typename T>
495 fSource->GetSharedDescriptorGuard()->GetName() +
"'"));
#define R__unlikely(expr)
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
A collection of Counter objects with a name, a unit, and a description.
Abstract interface to read data from an ntuple.
The REntry is a collection of values in an RNTuple corresponding to a complete row in the data set.
Base class for all ROOT issued exceptions.
A view for a collection, that can itself generate new ntuple views for its nested fields.
static RNTupleCollectionView Create(ROOT::DescriptorId_t fieldId, ROOT::Internal::RPageSource *source)
The on-storage metadata of an RNTuple.
A view variant that provides direct access to the I/O buffers.
static ROOT::RField< T > CreateField(ROOT::DescriptorId_t fieldId, ROOT::Internal::RPageSource &pageSource)
Used to loop over indexes (entries or collections) between start and end.
The RNTupleModel encapulates the schema of an RNTuple.
Common user-tunable settings for reading RNTuples.
void SetEnableMetrics(bool val)
An active entry token is a pledge for the data of a certain entry number not to be evicted from the p...
std::shared_ptr< RActiveEntriesControlBlock > fPtrControlBlock
NTupleSize_t fEntryNumber
RActiveEntryToken & operator=(const RActiveEntryToken &other)
NTupleSize_t GetEntryNumber() const
void ActivateEntry(NTupleSize_t entryNumber)
void Reset()
Release the entry number, i.e.
RActiveEntryToken(std::shared_ptr< RActiveEntriesControlBlock > ptrControlBlock)
void DeactivateEntry(NTupleSize_t entryNumber)
void SetEntryNumber(NTupleSize_t entryNumber)
Set or replace the entry number.
bool operator!=(const iterator &rh) const
pointer operator->() const
std::ptrdiff_t difference_type
RIterator(ROOT::NTupleSize_t index)
ROOT::NTupleSize_t fIndex
ROOT::NTupleSize_t value_type
const ROOT::NTupleSize_t * pointer
reference operator*() const
std::input_iterator_tag iterator_category
const ROOT::NTupleSize_t & reference
bool operator==(const iterator &rh) const
Reads RNTuple data from storage.
ROOT::RNTupleGlobalRange GetEntryRange()
Returns an iterator over the entry indices of the RNTuple.
ROOT::RNTupleView< T > GetView(ROOT::DescriptorId_t fieldId, T *rawPtr)
Provides access to an individual (sub)field from its on-disk ID, reading its values into rawPtr.
ROOT::RNTupleView< T > GetView(std::string_view fieldName, std::shared_ptr< T > objPtr)
Provides access to an individual (sub)field, reading its values into objPtr.
std::unique_ptr< RNTupleReader > fDisplayReader
We use a dedicated on-demand reader for Show().
ROOT::RNTupleView< T > GetView(ROOT::DescriptorId_t fieldId)
Provides access to an individual (sub)field from its on-disk ID.
std::unique_ptr< ROOT::REntry > CreateEntry()
static std::unique_ptr< RNTupleReader > Open(std::string_view ntupleName, std::string_view storage, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Open an RNTuple for reading.
RNTupleReader & operator=(const ROOT::RNTupleReader &)=delete
void InitPageSource(bool enableMetrics)
ROOT::RNTupleDirectAccessView< T > GetDirectAccessView(ROOT::DescriptorId_t fieldId)
Provides direct access to the I/O buffers of a mappable (sub)field from its on-disk ID.
std::unique_ptr< Internal::RPageStorage::RTaskScheduler > fUnzipTasks
Set as the page source's scheduler for parallel page decompression if implicit multi-threading (IMT) ...
RNTupleReader(const ROOT::RNTupleReader &)=delete
ROOT::RNTupleView< T > GetView(std::string_view fieldName)
Provides access to an individual (sub)field, e.g.
ROOT::NTupleSize_t fNEntries
We know that the RNTupleReader is always reading a single RNTuple, so the number of entries is fixed.
std::unique_ptr< ROOT::RNTupleModel > fModel
Needs to be destructed before fSource.
const Experimental::Detail::RNTupleMetrics & GetMetrics() const
ROOT::RNTupleCollectionView GetCollectionView(std::string_view fieldName)
Provides access to a collection field, that can itself generate new RNTupleViews for its nested field...
ROOT::RNTupleDirectAccessView< T > GetDirectAccessView(std::string_view fieldName)
Provides direct access to the I/O buffers of a mappable (sub)field.
const ROOT::RNTupleDescriptor & GetDescriptor()
Returns a cached copy of the page source descriptor.
ROOT::RNTupleView< void > GetView(std::string_view fieldName, void *rawPtr, std::string_view typeName)
Provides access to an individual (sub)field, reading its values into rawPtr as the type provided by t...
std::optional< ROOT::RNTupleDescriptor::RCreateModelOptions > fCreateModelOptions
If not nullopt, these will be used when creating the model.
void PrintInfo(const ENTupleInfo what=ENTupleInfo::kSummary, std::ostream &output=std::cout) const
Prints a detailed summary of the RNTuple, including a list of fields.
std::unique_ptr< Internal::RPageSource > fSource
RNTupleReader(std::unique_ptr< ROOT::RNTupleModel > model, std::unique_ptr< Internal::RPageSource > source, const ROOT::RNTupleReadOptions &options)
const ROOT::RNTupleModel & GetModel()
ROOT::RNTupleView< void > GetView(ROOT::DescriptorId_t fieldId, void *rawPtr, std::string_view typeName)
Provides access to an individual (sub)field from its on-disk ID, reading its values into rawPtr as th...
std::optional< ROOT::RNTupleDescriptor > fCachedDescriptor
The RNTuple descriptor in the page source is protected by a read-write lock.
RNTupleReader(ROOT::RNTupleReader &&)=delete
ROOT::RNTupleCollectionView GetCollectionView(ROOT::DescriptorId_t fieldId)
Provides access to a collection field from its on-disk ID, that can itself generate new RNTupleViews ...
std::unique_ptr< RNTupleReader > Clone()
RNTupleReader & operator=(ROOT::RNTupleReader &&)=delete
std::shared_ptr< RActiveEntriesControlBlock > fActiveEntriesControlBlock
Initialized when the page source is connected.
void ConnectModel(ROOT::RNTupleModel &model, bool allowFieldSubstitutions)
ROOT::NTupleSize_t GetNEntries() const
Returns the number of entries in this RNTuple.
ROOT::RNTupleView< void > GetView(std::string_view fieldName, void *rawPtr, const std::type_info &ti)
Provides access to an individual (sub)field, reading its values into rawPtr as the type provided by t...
ROOT::DescriptorId_t RetrieveFieldId(std::string_view fieldName) const
void Show(ROOT::NTupleSize_t index, std::ostream &output=std::cout)
Shows the values of the i-th entry/row, starting with 0 for the first entry.
ROOT::RNTupleView< T > GetView(std::string_view fieldName, T *rawPtr)
Provides access to an individual (sub)field, reading its values into rawPtr.
RActiveEntryToken CreateActiveEntryToken()
Create a new active entry token, which will not be bound to any entry number initially.
RNTupleReader * GetDisplayReader()
Experimental::Detail::RNTupleMetrics fMetrics
void EnableMetrics()
Enable performance measurements (decompression time, bytes read from storage, etc....
void LoadEntry(ROOT::NTupleSize_t index, ROOT::REntry &entry)
Fills a user provided entry after checking that the entry has been instantiated from the RNTuple mode...
ROOT::RNTupleView< void > GetView(ROOT::DescriptorId_t fieldId, void *rawPtr, const std::type_info &ti)
Provides access to an individual (sub)field from its on-disk ID, reading its values into objPtr as th...
ROOT::RNTupleView< T > GetView(ROOT::DescriptorId_t fieldId, std::shared_ptr< T > objPtr)
Provides access to an individual (sub)field from its on-disk ID, reading its values into objPtr.
void LoadEntry(ROOT::NTupleSize_t index)
Fills the default entry of the model.
static std::unique_ptr< ROOT::RFieldBase > CreateField(ROOT::DescriptorId_t fieldId, Internal::RPageSource &pageSource, std::string_view typeName="")
An RNTupleView for a known type.
Representation of an RNTuple data set in a ROOT file.
ROOT::RNTupleGlobalRange GetFieldRange(const ROOT::RFieldBase &field, const ROOT::Internal::RPageSource &pageSource)
Helper to get the iteration space of the given field that needs to be connected to the given page sou...
std::string GetRenormalizedTypeName(const std::string &metaNormalizedName)
Given a type name normalized by ROOT meta, renormalize it for RNTuple. E.g., insert std::prefix.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr NTupleSize_t kInvalidNTupleIndex
ENTupleInfo
Listing of the different options that can be printed by RNTupleReader::GetInfo()
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId
Modifiers passed to CreateModel()
Shared data structure between the reader and all the issued active entry tokens.
RActiveEntriesControlBlock(Internal::RPageSource *pageSource)
Internal::RPageSource * fPageSource
Points to the page source backing the associated RNTupleReader.
std::unordered_map< ROOT::DescriptorId_t, std::uint64_t > fActiveClusters
Reference counter of clusters pinned in the page source due to entries being marked as active.