36 if (
itr->second++ == 0)
42 const auto descGuard = fPtrControlBlock->fPageSource->GetSharedDescriptorGuard();
48 auto itr = fPtrControlBlock->fActiveClusters.find(
clusterId);
51 if (--(
itr->second) == 0) {
52 fPtrControlBlock->fActiveClusters.erase(
itr);
53 fPtrControlBlock->fPageSource->UnpinCluster(
clusterId);
62 const std::lock_guard<std::mutex>
_(fPtrControlBlock->fLock);
63 if (fPtrControlBlock->fPageSource) {
66 DeactivateEntry(fEntryNumber);
76 const std::lock_guard<std::mutex>
_(fPtrControlBlock->fLock);
77 if (fPtrControlBlock->fPageSource) {
78 DeactivateEntry(fEntryNumber);
85 fPtrControlBlock =
other.fPtrControlBlock;
86 SetEntryNumber(
other.fEntryNumber);
91 std::swap(fEntryNumber,
other.fEntryNumber);
92 std::swap(fPtrControlBlock,
other.fPtrControlBlock);
102 if (
other.fPtrControlBlock.get() != fPtrControlBlock.get()) {
104 fPtrControlBlock =
other.fPtrControlBlock;
106 SetEntryNumber(
other.fEntryNumber);
112 std::swap(fEntryNumber,
other.fEntryNumber);
113 std::swap(fPtrControlBlock,
other.fPtrControlBlock);
142 fUnzipTasks = std::make_unique<Experimental::Internal::RNTupleImtTaskScheduler>();
155 std::unique_ptr<ROOT::Internal::RPageSource>
source,
162 throw RException(
R__FAIL(
"model has projected fields, which is incompatible with providing a read model"));
171 : fSource(std::
move(
source)), fModel(nullptr), fMetrics(
"RNTupleReader")
178 const std::lock_guard<std::mutex>
_(fActiveEntriesControlBlock->fLock);
179 fActiveEntriesControlBlock->fPageSource =
nullptr;
186 return std::unique_ptr<RNTupleReader>(
193 return std::unique_ptr<RNTupleReader>(
197std::unique_ptr<ROOT::RNTupleReader>
200 return std::unique_ptr<RNTupleReader>(
208 return std::unique_ptr<RNTupleReader>(
212std::unique_ptr<ROOT::RNTupleReader>
217 auto reader = std::unique_ptr<RNTupleReader>(
223std::unique_ptr<ROOT::RNTupleReader>
227 auto reader = std::unique_ptr<RNTupleReader>(
236 fModel = fSource->GetSharedDescriptorGuard()->CreateModel(
238 ConnectModel(*fModel,
true );
245 return GetModel().CreateEntry();
265 std::unique_ptr<ROOT::RNTupleModel>
fullModel;
270 opts.SetCreateBare(
true);
273 opts.SetEmulateUnknownTypes(
true);
277 for (
int i = 0; i < (
width / 2 +
width % 2 - 4); ++i)
279 output <<
" NTUPLE ";
280 for (
int i = 0; i < (
width / 2 - 4); ++i)
302 for (
int i = 0; i <
width; ++i)
306 for (
int i = 0; i <
width; ++i)
321 if (!fDisplayReader) {
323 opts.SetEmulateUnknownTypes(
true);
324 auto fullModel = fSource->GetSharedDescriptorGuard()->CreateModel(
opts);
325 fDisplayReader = std::unique_ptr<RNTupleReader>(
328 return fDisplayReader.get();
333 auto reader = GetDisplayReader();
334 const auto &
entry =
reader->GetModel().GetDefaultEntry();
350 output <<
"}" << std::endl;
356 if (!fCachedDescriptor || fCachedDescriptor->GetGeneration() !=
descriptorGuard->GetGeneration())
358 return *fCachedDescriptor;
366 fSource->GetSharedDescriptorGuard()->GetName() +
"'"));
371std::unique_ptr<ROOT::Experimental::RNTupleAttrSetReader>
374 auto attrSets = GetDescriptor().GetAttrSetIterable();
380 auto attrSource = fSource->OpenWithDifferentAnchor({it->GetAnchorLocator(), it->GetAnchorLength()},
readOpts);
383 auto attrSetReader = std::unique_ptr<ROOT::Experimental::RNTupleAttrSetReader>(
#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)
Class used to read a RNTupleAttrSet in the context of a RNTupleReader.
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::unique_ptr< Experimental::RNTupleAttrSetReader > OpenAttributeSet(std::string_view attrSetName, const ROOT::RNTupleReadOptions &options={})
Looks for an attribute set with the given name and creates an RNTupleAttrSetReader for it,...
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()