35 if (
itr->second++ == 0)
41 const auto descGuard = fPtrControlBlock->fPageSource->GetSharedDescriptorGuard();
47 auto itr = fPtrControlBlock->fActiveClusters.find(
clusterId);
50 if (--(
itr->second) == 0) {
51 fPtrControlBlock->fActiveClusters.erase(
itr);
52 fPtrControlBlock->fPageSource->UnpinCluster(
clusterId);
61 const std::lock_guard<std::mutex>
_(fPtrControlBlock->fLock);
62 if (fPtrControlBlock->fPageSource) {
65 DeactivateEntry(fEntryNumber);
75 const std::lock_guard<std::mutex>
_(fPtrControlBlock->fLock);
76 if (fPtrControlBlock->fPageSource) {
77 DeactivateEntry(fEntryNumber);
84 fPtrControlBlock =
other.fPtrControlBlock;
85 SetEntryNumber(
other.fEntryNumber);
90 std::swap(fEntryNumber,
other.fEntryNumber);
91 std::swap(fPtrControlBlock,
other.fPtrControlBlock);
101 if (
other.fPtrControlBlock.get() != fPtrControlBlock.get()) {
103 fPtrControlBlock =
other.fPtrControlBlock;
105 SetEntryNumber(
other.fEntryNumber);
111 std::swap(fEntryNumber,
other.fEntryNumber);
112 std::swap(fPtrControlBlock,
other.fPtrControlBlock);
141 fUnzipTasks = std::make_unique<Experimental::Internal::RNTupleImtTaskScheduler>();
154 std::unique_ptr<ROOT::Internal::RPageSource>
source,
161 throw RException(
R__FAIL(
"model has projected fields, which is incompatible with providing a read model"));
170 : fSource(std::
move(
source)), fModel(nullptr), fMetrics(
"RNTupleReader")
177 const std::lock_guard<std::mutex>
_(fActiveEntriesControlBlock->fLock);
178 fActiveEntriesControlBlock->fPageSource =
nullptr;
185 return std::unique_ptr<RNTupleReader>(
192 return std::unique_ptr<RNTupleReader>(
196std::unique_ptr<ROOT::RNTupleReader>
199 return std::unique_ptr<RNTupleReader>(
207 return std::unique_ptr<RNTupleReader>(
211std::unique_ptr<ROOT::RNTupleReader>
216 auto reader = std::unique_ptr<RNTupleReader>(
222std::unique_ptr<ROOT::RNTupleReader>
226 auto reader = std::unique_ptr<RNTupleReader>(
235 fModel = fSource->GetSharedDescriptorGuard()->CreateModel(
237 ConnectModel(*fModel,
true );
244 return GetModel().CreateEntry();
264 std::unique_ptr<ROOT::RNTupleModel>
fullModel;
269 opts.SetCreateBare(
true);
272 opts.SetEmulateUnknownTypes(
true);
276 for (
int i = 0; i < (
width / 2 +
width % 2 - 4); ++i)
279 for (
int i = 0; i < (
width / 2 - 4); ++i)
301 for (
int i = 0; i <
width; ++i)
305 for (
int i = 0; i <
width; ++i)
320 if (!fDisplayReader) {
322 opts.SetEmulateUnknownTypes(
true);
323 auto fullModel = fSource->GetSharedDescriptorGuard()->CreateModel(
opts);
324 fDisplayReader = std::unique_ptr<RNTupleReader>(
327 return fDisplayReader.get();
332 auto reader = GetDisplayReader();
333 const auto &
entry =
reader->GetModel().GetDefaultEntry();
349 output <<
"}" << std::endl;
355 if (!fCachedDescriptor || fCachedDescriptor->GetGeneration() !=
descriptorGuard->GetGeneration())
357 return *fCachedDescriptor;
365 fSource->GetSharedDescriptorGuard()->GetName() +
"'"));
#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.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
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
void ObserveMetrics(RNTupleMetrics &observee)
static std::unique_ptr< RPageSourceFile > CreateFromAnchor(const RNTuple &anchor, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Used from the RNTuple class to build a datasource if the anchor is already available.
static std::unique_ptr< RPageSource > Create(std::string_view ntupleName, std::string_view location, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Guess the concrete derived page source from the file name (location)
Visitor used for a pre-processing run to collect information needed by another visitor class.
Contains settings for printing and prints a summary of an RField instance.
Renders a JSON value corresponding to the field.
Base class for all ROOT issued exceptions.
The on-storage metadata of an RNTuple.
The RNTupleModel encapulates the schema of an RNTuple.
Common user-tunable settings for reading RNTuples.
bool GetEnableMetrics() const
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
RActiveEntryToken & operator=(const RActiveEntryToken &other)
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.
Reads RNTuple data from storage.
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.
void InitPageSource(bool enableMetrics)
std::unique_ptr< Internal::RPageStorage::RTaskScheduler > fUnzipTasks
Set as the page source's scheduler for parallel page decompression if implicit multi-threading (IMT) ...
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 ROOT::RNTupleDescriptor & GetDescriptor()
Returns a cached copy of the page source descriptor.
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()
std::shared_ptr< RActiveEntriesControlBlock > fActiveEntriesControlBlock
Initialized when the page source is connected.
void ConnectModel(ROOT::RNTupleModel &model, bool allowFieldSubstitutions)
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.
RNTupleReader * GetDisplayReader()
Experimental::Detail::RNTupleMetrics fMetrics
void EnableMetrics()
Enable performance measurements (decompression time, bytes read from storage, etc....
Representation of an RNTuple data set in a ROOT file.
const_iterator begin() const
const_iterator end() const
void SetAllowFieldSubstitutions(RFieldZero &fieldZero, bool val)
ROOT::RFieldZero & GetFieldZeroOfModel(RNTupleModel &model)
ROOT::DescriptorId_t CallFindClusterIdOn(const ROOT::RNTupleDescriptor &desc, ROOT::NTupleSize_t entryIdx)
void CallConnectPageSourceOnField(RFieldBase &, ROOT::Internal::RPageSource &)
RProjectedFields & GetProjectedFieldsOfModel(RNTupleModel &model)
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
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()