37namespace Experimental {
75 void AddTask(const std::function<
void(
void)> &taskFunc) final;
106 std::unique_ptr<Detail::RPageStorage::RTaskScheduler>
fUnzipTasks;
119 void InitPageSource();
153 ROpenSpec(std::string_view
n, std::string_view s) : fNTupleName(
n), fStorage(s) {}
157 static std::unique_ptr<RNTupleReader> Open(std::unique_ptr<RNTupleModel> model,
158 std::string_view ntupleName,
159 std::string_view storage,
175 static std::unique_ptr<RNTupleReader> Open(std::string_view ntupleName,
176 std::string_view storage,
181 static std::unique_ptr<RNTupleReader> OpenFriends(std::span<ROpenSpec> ntuples);
187 RNTupleReader(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSource> source);
191 explicit RNTupleReader(std::unique_ptr<Detail::RPageSource> source);
192 std::unique_ptr<RNTupleReader>
Clone() {
return std::make_unique<RNTupleReader>(fSource->Clone()); }
233 std::ostream &
output = std::cout);
240 fModel = fSource->GetDescriptor().GenerateModel();
241 ConnectModel(*fModel);
243 LoadEntry(index, *fModel->GetDefaultEntry());
247 for (
auto& value : entry) {
248 value.GetField()->Read(index, &value);
289 template <
typename T>
291 auto fieldId = fSource->GetDescriptor().FindFieldId(fieldName);
293 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '"
294 + fSource->GetDescriptor().GetName() +
"'"
304 auto fieldId = fSource->GetDescriptor().FindFieldId(fieldName);
306 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '"
307 + fSource->GetDescriptor().GetName() +
"'"
355 std::unique_ptr<Detail::RPageStorage::RTaskScheduler>
fZipTasks;
356 std::unique_ptr<Detail::RPageSink>
fSink;
363 std::size_t fUnzippedClusterSize = 0;
365 std::uint64_t fNBytesCommitted = 0;
368 std::uint64_t fNBytesFilled = 0;
376 static std::unique_ptr<RNTupleWriter> Recreate(std::unique_ptr<RNTupleModel> model,
377 std::string_view ntupleName,
378 std::string_view storage,
381 static std::unique_ptr<RNTupleWriter> Append(std::unique_ptr<RNTupleModel> model,
382 std::string_view ntupleName,
386 RNTupleWriter(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSink> sink);
396 for (
auto& value : entry) {
397 fUnzippedClusterSize += value.GetField()->Append(value);
400 if ((fUnzippedClusterSize >= fMaxUnzippedClusterSize) || (fUnzippedClusterSize >= fUnzippedClusterSizeEst))
404 void CommitCluster();
406 std::unique_ptr<REntry>
CreateEntry() {
return fModel->CreateEntry(); }
435 for (
auto &value : *entry) {
436 value.GetField()->Append(value);
#define R__unlikely(expr)
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
TTime operator*(const TTime &t1, const TTime &t2)
A collection of Counter objects with a name, a unit, and a description.
The interface of a task scheduler to schedule page (de)compression tasks.
RCollectionNTupleWriter(const RCollectionNTupleWriter &)=delete
ClusterSize_t * GetOffsetPtr()
~RCollectionNTupleWriter()=default
RCollectionNTupleWriter & operator=(const RCollectionNTupleWriter &)=delete
std::unique_ptr< REntry > fDefaultEntry
The REntry is a collection of values in an ntuple corresponding to a complete row in the data set.
Base class for all ROOT issued exceptions.
The on-storage meta-data of an ntuple.
Used to loop over indexes (entries or collections) between start and end.
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.
RNTupleImtTaskScheduler()
virtual ~RNTupleImtTaskScheduler()=default
void Wait() final
Blocks until all scheduled tasks finished.
The RNTupleModel encapulates the schema of an ntuple.
Common user-tunable settings for reading ntuples.
NTupleSize_t difference_type
bool operator!=(const iterator &rh) const
bool operator==(const iterator &rh) const
RIterator(NTupleSize_t index)
std::forward_iterator_tag iterator_category
An RNTuple that is used to read data from storage.
std::unique_ptr< RNTupleReader > Clone()
Detail::RNTupleMetrics fMetrics
std::unique_ptr< Detail::RPageStorage::RTaskScheduler > fUnzipTasks
Set as the page source's scheduler for parallel page decompression if IMT is on Needs to be destructe...
std::unique_ptr< RNTupleReader > fDisplayReader
We use a dedicated on-demand reader for Show() and Scan().
void EnableMetrics()
Enable performance measurements (decompression time, bytes read from storage, etc....
const Detail::RNTupleMetrics & GetMetrics() const
const RNTupleDescriptor & GetDescriptor() const
RNTupleView< T > GetView(std::string_view fieldName)
Provides access to an individual field that can contain either a scalar value or a collection,...
NTupleSize_t GetNEntries() const
std::unique_ptr< Detail::RPageSource > fSource
RNTupleGlobalRange GetEntryRange()
Returns an iterator over the entry indices of the RNTuple.
RNTupleViewCollection GetViewCollection(std::string_view fieldName)
Raises an exception if:
void LoadEntry(NTupleSize_t index)
Analogous to Fill(), fills the default entry of the model.
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSource.
void LoadEntry(NTupleSize_t index, REntry &entry)
Fills a user provided entry after checking that the entry has been instantiated from the ntuple model...
A view for a collection, that can itself generate new ntuple views for its nested fields.
An RNTupleView provides read-only access to a single field of the ntuple.
Common user-tunable settings for storing ntuples.
An RNTuple that gets filled with entries (data) and writes them to storage.
NTupleSize_t fUnzippedClusterSizeEst
Estimator of uncompressed cluster size, taking into account the estimated compression ratio.
std::size_t fMaxUnzippedClusterSize
Limit for committing cluster no matter the other tunables.
const Detail::RNTupleMetrics & GetMetrics() const
std::unique_ptr< REntry > CreateEntry()
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSink.
RNTupleWriter(const RNTupleWriter &)=delete
Detail::RNTupleMetrics fMetrics
RNTupleWriter & operator=(const RNTupleWriter &)=delete
std::unique_ptr< Detail::RPageSink > fSink
void Fill()
The simplest user interface if the default entry that comes with the ntuple model is used.
std::unique_ptr< Detail::RPageStorage::RTaskScheduler > fZipTasks
The page sink's parallel page compression scheduler if IMT is on.
void Fill(REntry &entry)
Multiple entries can have been instantiated from the tnuple model.
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.
constexpr NTupleSize_t kInvalidNTupleIndex
ENTupleShowFormat
Listing of the different entry output formats of RNTupleReader::Show()
constexpr DescriptorId_t kInvalidDescriptorId
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...
Used to specify the underlying RNTuples in OpenFriends()
RNTupleReadOptions fOptions
ROpenSpec(std::string_view n, std::string_view s)
static void output(int code)