33 fieldZero.SetOnDiskId(fieldZeroId);
36 for (
auto &field : fieldZero.GetSubFields()) {
40 field->SetOnDiskId(
fSource->GetSharedDescriptorGuard()->FindFieldId(field->GetFieldName(), fieldZeroId));
51 fUnzipTasks = std::make_unique<Internal::RNTupleImtTaskScheduler>();
52 fSource->SetTaskScheduler(fUnzipTasks.get());
55 fMetrics.ObserveMetrics(fSource->GetMetrics());
62 std::unique_ptr<ROOT::Experimental::Internal::RPageSource> source,
64 : fSource(std::move(source)), fModel(std::move(model)), fMetrics(
"RNTupleReader")
68 if (!projectedFields.IsEmpty()) {
69 throw RException(
R__FAIL(
"model has projected fields, which is incompatible with providing a read model"));
78 : fSource(std::move(source)), fModel(nullptr), fMetrics(
"RNTupleReader")
85std::unique_ptr<ROOT::Experimental::RNTupleReader>
89 return std::unique_ptr<RNTupleReader>(
93std::unique_ptr<ROOT::Experimental::RNTupleReader>
97 return std::unique_ptr<RNTupleReader>(
101std::unique_ptr<ROOT::Experimental::RNTupleReader>
104 return std::unique_ptr<RNTupleReader>(
108std::unique_ptr<ROOT::Experimental::RNTupleReader>
112 return std::unique_ptr<RNTupleReader>(
116std::unique_ptr<ROOT::Experimental::RNTupleReader>
119 std::vector<std::unique_ptr<Internal::RPageSource>> sources;
120 sources.reserve(ntuples.size());
121 for (
const auto &
n : ntuples) {
124 return std::unique_ptr<RNTupleReader>(
125 new RNTupleReader(std::make_unique<Internal::RPageSourceFriends>(
"_friends", sources), options));
131 fModel = fSource->GetSharedDescriptorGuard()->CreateModel();
132 ConnectModel(*fModel);
141 char frameSymbol =
'*';
152 std::unique_ptr<RNTupleModel> fullModel;
154 auto descriptorGuard = fSource->GetSharedDescriptorGuard();
155 name = descriptorGuard->GetName();
156 fullModel = descriptorGuard->CreateModel();
159 for (
int i = 0; i < (
width / 2 +
width % 2 - 4); ++i)
162 for (
int i = 0; i < (
width / 2 - 4); ++i)
169 << frameSymbol <<
"\n";
177 fullModel->GetConstFieldZero().AcceptVisitor(prepVisitor);
184 for (
int i = 0; i <
width; ++i)
187 fullModel->GetConstFieldZero().AcceptVisitor(printVisitor);
188 for (
int i = 0; i <
width; ++i)
204 fDisplayReader = Clone();
205 return fDisplayReader.get();
210 auto reader = GetDisplayReader();
211 const auto &entry = reader->GetModel().GetDefaultEntry();
213 reader->LoadEntry(
index);
215 for (
auto iValue = entry.begin(); iValue != entry.end();) {
218 iValue->GetField().AcceptVisitor(visitor);
220 if (++iValue == entry.end()) {
227 output <<
"}" << std::endl;
232 auto descriptorGuard = fSource->GetSharedDescriptorGuard();
233 if (!fCachedDescriptor || fCachedDescriptor->GetGeneration() != descriptorGuard->GetGeneration())
234 fCachedDescriptor = descriptorGuard->
Clone();
235 return *fCachedDescriptor;
240 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
242 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '" +
243 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...
#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
static std::unique_ptr< RPageSourceFile > CreateFromAnchor(const RNTuple &anchor, const RNTupleReadOptions &options=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 RNTupleReadOptions &options=RNTupleReadOptions())
Guess the concrete derived page source from the file name (location)
Base class for all ROOT issued exceptions.
The on-storage meta-data of an ntuple.
std::unique_ptr< RNTupleDescriptor > Clone() const
The RNTupleModel encapulates the schema of an ntuple.
Common user-tunable settings for reading ntuples.
bool HasMetricsEnabled() const
An RNTuple that is used to read data from storage.
RNTupleReader * GetDisplayReader()
DescriptorId_t RetrieveFieldId(std::string_view fieldName) const
void Show(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(std::unique_ptr< RNTupleModel > model, std::unique_ptr< Internal::RPageSource > source, const RNTupleReadOptions &options)
const RNTupleDescriptor & GetDescriptor()
Returns a cached copy of the page source descriptor.
static std::unique_ptr< RNTupleReader > OpenFriends(std::span< RNTupleOpenSpec > ntuples, const RNTupleReadOptions &options=RNTupleReadOptions())
Open RNTuples as one virtual, horizontally combined ntuple.
std::unique_ptr< Internal::RPageSource > fSource
const RNTupleModel & GetModel()
static std::unique_ptr< RNTupleReader > Open(std::string_view ntupleName, std::string_view storage, const RNTupleReadOptions &options=RNTupleReadOptions())
Open an RNTuple for reading.
void InitPageSource(bool enableMetrics)
void PrintInfo(const ENTupleInfo what=ENTupleInfo::kSummary, std::ostream &output=std::cout) const
Prints a detailed summary of the ntuple, including a list of fields.
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSource.
void ConnectModel(RNTupleModel &model)
Visitor used for a pre-processing run to collect information needed by another visitor class.
unsigned int GetDeepestLevel() const
unsigned int GetNumFields() const
Contains settings for printing and prints a summary of an RField instance.
void SetDeepestLevel(int d)
void SetFrameSymbol(char s)
Renders a JSON value corresponding to the field.
Representation of an RNTuple data set in a ROOT file.
RProjectedFields & GetProjectedFieldsOfModel(RNTupleModel &model)
void CallConnectPageSourceOnField(RFieldBase &, RPageSource &)
RFieldZero & GetFieldZeroOfModel(RNTupleModel &model)
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.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr DescriptorId_t kInvalidDescriptorId
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.