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());
56 fMetrics.ObserveMetrics(fSource->GetMetrics());
60 std::unique_ptr<ROOT::Experimental::Internal::RPageSource> source)
61 : fSource(std::move(source)), fModel(std::move(model)), fMetrics(
"RNTupleReader")
64 if (!
fModel->GetProjectedFields().IsEmpty()) {
65 throw RException(
R__FAIL(
"model has projected fields, which is incompatible with providing a read model"));
73 : fSource(std::move(source)), fModel(nullptr), fMetrics(
"RNTupleReader")
80std::unique_ptr<ROOT::Experimental::RNTupleReader>
84 return std::unique_ptr<RNTupleReader>(
88std::unique_ptr<ROOT::Experimental::RNTupleReader>
92 return std::unique_ptr<RNTupleReader>(
96std::unique_ptr<ROOT::Experimental::RNTupleReader>
99 return std::unique_ptr<RNTupleReader>(
103std::unique_ptr<ROOT::Experimental::RNTupleReader>
107 return std::unique_ptr<RNTupleReader>(
111std::unique_ptr<ROOT::Experimental::RNTupleReader>
114 std::vector<std::unique_ptr<Internal::RPageSource>> sources;
115 for (
const auto &
n : ntuples) {
118 return std::unique_ptr<RNTupleReader>(
119 new RNTupleReader(std::make_unique<Internal::RPageSourceFriends>(
"_friends", sources)));
125 fModel = fSource->GetSharedDescriptorGuard()->CreateModel();
126 ConnectModel(*fModel);
135 char frameSymbol =
'*';
146 std::unique_ptr<RNTupleModel> fullModel;
148 auto descriptorGuard = fSource->GetSharedDescriptorGuard();
149 name = descriptorGuard->GetName();
150 fullModel = descriptorGuard->CreateModel();
153 for (
int i = 0; i < (
width / 2 +
width % 2 - 4); ++i)
156 for (
int i = 0; i < (
width / 2 - 4); ++i)
163 << frameSymbol << std::endl;
171 fullModel->GetFieldZero().AcceptVisitor(prepVisitor);
178 for (
int i = 0; i <
width; ++i)
181 fullModel->GetFieldZero().AcceptVisitor(printVisitor);
182 for (
int i = 0; i <
width; ++i)
198 fDisplayReader = Clone();
199 return fDisplayReader.get();
204 auto reader = GetDisplayReader();
205 const auto &entry = reader->GetModel().GetDefaultEntry();
207 reader->LoadEntry(
index);
209 for (
auto iValue = entry.begin(); iValue != entry.end();) {
212 iValue->GetField().AcceptVisitor(visitor);
214 if (++iValue == entry.end()) {
221 output <<
"}" << std::endl;
226 auto descriptorGuard = fSource->GetSharedDescriptorGuard();
227 if (!fCachedDescriptor || fCachedDescriptor->GetGeneration() != descriptorGuard->GetGeneration())
228 fCachedDescriptor = descriptorGuard->
Clone();
229 return *fCachedDescriptor;
234 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
236 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '" +
237 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...
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.
void SetOnDiskId(DescriptorId_t id)
The on-storage meta-data of an ntuple.
std::unique_ptr< RNTupleDescriptor > Clone() const
The RNTupleModel encapulates the schema of an ntuple.
RFieldZero & GetFieldZero()
Non-const access to the root field is used to commit clusters during writing and to set the on-disk f...
Common user-tunable settings for reading ntuples.
An RNTuple that is used to read data from storage.
static std::unique_ptr< RNTupleReader > OpenFriends(std::span< ROpenSpec > ntuples)
Open RNTuples as one virtual, horizontally combined ntuple.
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 RNTupleDescriptor & GetDescriptor()
Returns a cached copy of the page source descriptor.
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 PrintInfo(const ENTupleInfo what=ENTupleInfo::kSummary, std::ostream &output=std::cout)
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)
Representation of an RNTuple data set in a ROOT file.
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.
void CallConnectPageSourceOnField(RFieldBase &, RPageSource &)
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.