36#include <unordered_map>
49 fTaskGroup->Run(taskFunc);
64 std::unordered_map<const Detail::RFieldBase *, DescriptorId_t> fieldPtr2Id;
65 fieldPtr2Id[model.
GetFieldZero()] = fSource->GetDescriptor().GetFieldZeroId();
67 auto parentId = fieldPtr2Id[field.GetParent()];
68 auto fieldId = fSource->GetDescriptor().FindFieldId(field.GetName(), parentId);
70 fieldPtr2Id[&field] = fieldId;
79 fUnzipTasks = std::make_unique<RNTupleImtTaskScheduler>();
80 fSource->SetTaskScheduler(fUnzipTasks.get());
84 fMetrics.ObserveMetrics(fSource->GetMetrics());
88 std::unique_ptr<ROOT::Experimental::RNTupleModel> model,
89 std::unique_ptr<ROOT::Experimental::Detail::RPageSource> source)
90 : fSource(std::move(source))
91 , fModel(std::move(model))
92 , fMetrics(
"RNTupleReader")
99 : fSource(std::move(source))
101 , fMetrics(
"RNTupleReader")
109 std::unique_ptr<RNTupleModel> model,
110 std::string_view ntupleName,
111 std::string_view storage,
118 std::string_view ntupleName,
119 std::string_view storage,
128 fModel = fSource->GetDescriptor().GenerateModel();
129 ConnectModel(*fModel);
137 char frameSymbol =
'*';
145 std::string
name = fSource->GetDescriptor().GetName();
148 for (
int i = 0; i < (
width/2 +
width%2 - 4); ++i)
151 for (
int i = 0; i < (
width/2 - 4); ++i)
164 auto fullModel = fSource->GetDescriptor().GenerateModel();
165 fullModel->GetFieldZero()->AcceptVisitor(prepVisitor);
172 for (
int i = 0; i <
width; ++i)
175 fullModel->GetFieldZero()->AcceptVisitor(printVisitor);
176 for (
int i = 0; i <
width; ++i)
182 fSource->GetDescriptor().PrintInfo(
output);
197 fDisplayReader = Clone();
198 return fDisplayReader.get();
208 entry = fModel->GetDefaultEntry();
212 reader = GetDisplayReader();
217 output <<
"{}" << std::endl;
223 for (
auto iValue = entry->
begin(); iValue != entry->
end(); ) {
226 iValue->GetField()->AcceptVisitor(visitor);
228 if (++iValue == entry->
end()) {
235 output <<
"}" << std::endl;
248 std::unique_ptr<ROOT::Experimental::RNTupleModel> model,
249 std::unique_ptr<ROOT::Experimental::Detail::RPageSink> sink)
250 : fSink(std::move(sink))
251 , fModel(std::move(model))
252 , fClusterSizeEntries(kDefaultClusterSizeEntries)
262 fSink->CommitDataset();
266 std::unique_ptr<RNTupleModel> model,
267 std::string_view ntupleName,
268 std::string_view storage,
275 std::unique_ptr<RNTupleModel> model,
276 std::string_view ntupleName,
280 auto sink = std::make_unique<Detail::RPageSinkFile>(ntupleName,
file, options);
281 return std::make_unique<RNTupleWriter>(std::move(model), std::move(sink));
287 if (fNEntries == fLastCommitted)
return;
288 for (
auto& field : *fModel->GetFieldZero()) {
290 field.CommitCluster();
292 fSink->CommitCluster(fNEntries);
293 fLastCommitted = fNEntries;
301 : fOffset(0), fDefaultEntry(std::move(defaultEntry))
include TDocParser_001 C image html pict1_TDocParser_001 png width
static void Connect(DescriptorId_t fieldId, RPageStorage &pageStorage, RFieldBase &field)
static std::unique_ptr< RPageSink > Create(std::string_view ntupleName, std::string_view location, const RNTupleWriteOptions &options=RNTupleWriteOptions())
Guess the concrete derived page source from the file name (location)
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)
RCollectionNTuple(std::unique_ptr< REntry > defaultEntry)
The REntry is a collection of values in an ntuple corresponding to a complete row in the data set.
void Reset() final
Start a new set of tasks.
std::unique_ptr< TTaskGroup > fTaskGroup
void AddTask(const std::function< void(void)> &taskFunc) final
Take a callable that represents a task.
void Wait() final
Blocks until all scheduled tasks finished.
The RNTupleModel encapulates the schema of an ntuple.
REntry * GetDefaultEntry()
RFieldZero * GetFieldZero() const
Common user-tunable settings for reading ntuples.
An RNTuple that is used to read data from storage.
RNTupleReader * GetDisplayReader()
static std::unique_ptr< RNTupleReader > Open(std::unique_ptr< RNTupleModel > model, std::string_view ntupleName, std::string_view storage, const RNTupleReadOptions &options=RNTupleReadOptions())
void ConnectModel(const RNTupleModel &model)
RNTupleReader(std::unique_ptr< RNTupleModel > model, std::unique_ptr< Detail::RPageSource > source)
The user imposes an ntuple model, which must be compatible with the model found in the data on storag...
RNTupleModel * GetModel()
void LoadEntry(NTupleSize_t index)
Analogous to Fill(), fills the default entry of the model.
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 Show(NTupleSize_t index, const ENTupleShowFormat format=ENTupleShowFormat::kCurrentModelJSON, std::ostream &output=std::cout)
Shows the values of the i-th entry/row, starting with 0 for the first entry.
Common user-tunable settings for storing ntuples.
void CommitCluster()
Ensure that the data from the so far seen Fill calls has been written to storage.
RNTupleWriter(std::unique_ptr< RNTupleModel > model, std::unique_ptr< Detail::RPageSink > sink)
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSink.
std::unique_ptr< Detail::RPageSink > fSink
static std::unique_ptr< RNTupleWriter > Recreate(std::unique_ptr< RNTupleModel > model, std::string_view ntupleName, std::string_view storage, const RNTupleWriteOptions &options=RNTupleWriteOptions())
static std::unique_ptr< RNTupleWriter > Append(std::unique_ptr< RNTupleModel > model, std::string_view ntupleName, TFile &file, const RNTupleWriteOptions &options=RNTupleWriteOptions())
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.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
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.
ENTupleShowFormat
Listing of the different entry output formats of RNTupleReader::Show()
constexpr DescriptorId_t kInvalidDescriptorId
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
static void output(int code)