Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNTuple.hxx
Go to the documentation of this file.
1/// \file ROOT/RNTuple.hxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2018-10-04
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOT7_RNTuple
17#define ROOT7_RNTuple
18
19#include <ROOT/RConfig.hxx> // for R__unlikely
20#include <ROOT/RError.hxx>
21#include <ROOT/RMiniFile.hxx>
23#include <ROOT/RNTupleModel.hxx>
25#include <ROOT/RNTupleUtil.hxx>
26#include <ROOT/RNTupleView.hxx>
27#include <ROOT/RPageStorage.hxx>
28#include <ROOT/RSpan.hxx>
29#include <ROOT/RStringView.hxx>
30
31#include <TClassRef.h>
32
33#include <iterator>
34#include <memory>
35#include <sstream>
36#include <utility>
37
38class TFile;
39
40namespace ROOT {
41namespace Experimental {
42
43class REntry;
44class RNTuple;
45class RNTupleModel;
46
47namespace Detail {
48class RPageSink;
49class RPageSource;
50}
51
52namespace Internal {
53struct RNTupleTester; // friend of RNTuple
54}
55
56/**
57 * Listing of the different options that can be printed by RNTupleReader::GetInfo()
58 */
59enum class ENTupleInfo {
60 kSummary, // The ntuple name, description, number of entries
61 kStorageDetails, // size on storage, page sizes, compression factor, etc.
62 kMetrics, // internals performance counters, requires that EnableMetrics() was called
63};
64
65#ifdef R__USE_IMT
66class TTaskGroup;
68private:
69 std::unique_ptr<TTaskGroup> fTaskGroup;
70public:
72 ~RNTupleImtTaskScheduler() override = default;
73 void Reset() final;
74 void AddTask(const std::function<void(void)> &taskFunc) final;
75 void Wait() final;
76};
77#endif
78
79// clang-format off
80/**
81\class ROOT::Experimental::RNTupleReader
82\ingroup NTuple
83\brief An RNTuple that is used to read data from storage
84
85An input ntuple provides data from storage as C++ objects. The ntuple model can be created from the data on storage
86or it can be imposed by the user. The latter case allows users to read into a specialized ntuple model that covers
87only a subset of the fields in the ntuple. The ntuple model is used when reading complete entries.
88Individual fields can be read as well by instantiating a tree view.
89
90~~~ {.cpp}
91#include <ROOT/RNTuple.hxx>
92using ROOT::Experimental::RNTupleReader;
93
94#include <iostream>
95
96auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
97std::cout << "myNTuple has " << ntuple->GetNEntries() << " entries\n";
98~~~
99*/
100// clang-format on
102private:
103 /// Set as the page source's scheduler for parallel page decompression if IMT is on
104 /// Needs to be destructed after the pages source is destructed (an thus be declared before)
105 std::unique_ptr<Detail::RPageStorage::RTaskScheduler> fUnzipTasks;
106
107 std::unique_ptr<Detail::RPageSource> fSource;
108 /// Needs to be destructed before fSource
109 std::unique_ptr<RNTupleModel> fModel;
110 /// We use a dedicated on-demand reader for Show() and Scan(). Printing data uses all the fields
111 /// from the full model even if the analysis code uses only a subset of fields. The display reader
112 /// is a clone of the original reader.
113 std::unique_ptr<RNTupleReader> fDisplayReader;
114 /// The ntuple descriptor in the page source is protected by a read-write lock. We don't expose that to the
115 /// users of RNTupleReader::GetDescriptor(). Instead, if descriptor information is needed, we clone the
116 /// descriptor. Using the descriptor's generation number, we know if the cached descriptor is stale.
117 /// Retrieving descriptor data from an RNTupleReader is supposed to be for testing and information purposes,
118 /// not on a hot code path.
119 std::unique_ptr<RNTupleDescriptor> fCachedDescriptor;
121
122 void ConnectModel(const RNTupleModel &model);
123 RNTupleReader *GetDisplayReader();
124 void InitPageSource();
125
126public:
127 // Browse through the entries
128 class RIterator {
129 private:
131 public:
133 using iterator_category = std::forward_iterator_tag;
138
139 RIterator() = default;
140 explicit RIterator(NTupleSize_t index) : fIndex(index) {}
141 ~RIterator() = default;
142
143 iterator operator++(int) /* postfix */ { auto r = *this; fIndex++; return r; }
144 iterator& operator++() /* prefix */ { ++fIndex; return *this; }
145 reference operator* () { return fIndex; }
146 pointer operator->() { return &fIndex; }
147 bool operator==(const iterator& rh) const { return fIndex == rh.fIndex; }
148 bool operator!=(const iterator& rh) const { return fIndex != rh.fIndex; }
149 };
150
151 /// Used to specify the underlying RNTuples in OpenFriends()
152 struct ROpenSpec {
153 std::string fNTupleName;
154 std::string fStorage;
156
157 ROpenSpec() = default;
158 ROpenSpec(std::string_view n, std::string_view s) : fNTupleName(n), fStorage(s) {}
159 };
160
161 /// Throws an exception if the model is null.
162 static std::unique_ptr<RNTupleReader> Open(std::unique_ptr<RNTupleModel> model,
163 std::string_view ntupleName,
164 std::string_view storage,
165 const RNTupleReadOptions &options = RNTupleReadOptions());
166 /// Open an RNTuple for reading.
167 ///
168 /// Throws an RException if there is no RNTuple with the given name.
169 ///
170 /// **Example: open an RNTuple and print the number of entries**
171 /// ~~~ {.cpp}
172 /// #include <ROOT/RNTuple.hxx>
173 /// using ROOT::Experimental::RNTupleReader;
174 ///
175 /// #include <iostream>
176 ///
177 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
178 /// std::cout << "myNTuple has " << ntuple->GetNEntries() << " entries\n";
179 /// ~~~
180 static std::unique_ptr<RNTupleReader> Open(std::string_view ntupleName,
181 std::string_view storage,
182 const RNTupleReadOptions &options = RNTupleReadOptions());
183 static std::unique_ptr<RNTupleReader>
184 Open(RNTuple *ntuple, const RNTupleReadOptions &options = RNTupleReadOptions());
185 /// Open RNTuples as one virtual, horizontally combined ntuple. The underlying RNTuples must
186 /// have an identical number of entries. Fields in the combined RNTuple are named with the ntuple name
187 /// as a prefix, e.g. myNTuple1.px and myNTuple2.pt (see tutorial ntpl006_friends)
188 static std::unique_ptr<RNTupleReader> OpenFriends(std::span<ROpenSpec> ntuples);
189
190 /// The user imposes an ntuple model, which must be compatible with the model found in the data on
191 /// storage.
192 ///
193 /// Throws an exception if the model or the source is null.
194 RNTupleReader(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSource> source);
195 /// The model is generated from the ntuple metadata on storage
196 ///
197 /// Throws an exception if the source is null.
198 explicit RNTupleReader(std::unique_ptr<Detail::RPageSource> source);
199 std::unique_ptr<RNTupleReader> Clone() { return std::make_unique<RNTupleReader>(fSource->Clone()); }
201
202 RNTupleModel *GetModel();
203 NTupleSize_t GetNEntries() const { return fSource->GetNEntries(); }
204
205 /// Returns a cached copy of the page source descriptor. The returned pointer remains valid until the next call
206 /// to LoadEntry or to any of the views returned from the reader.
207 const RNTupleDescriptor *GetDescriptor();
208
209 /// Prints a detailed summary of the ntuple, including a list of fields.
210 ///
211 /// **Example: print summary information to stdout**
212 /// ~~~ {.cpp}
213 /// #include <ROOT/RNTuple.hxx>
214 /// using ROOT::Experimental::ENTupleInfo;
215 /// using ROOT::Experimental::RNTupleReader;
216 ///
217 /// #include <iostream>
218 ///
219 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
220 /// ntuple->PrintInfo();
221 /// // or, equivalently:
222 /// ntuple->PrintInfo(ENTupleInfo::kSummary, std::cout);
223 /// ~~~
224 /// **Example: print detailed column storage data to stderr**
225 /// ~~~ {.cpp}
226 /// #include <ROOT/RNTuple.hxx>
227 /// using ROOT::Experimental::ENTupleInfo;
228 /// using ROOT::Experimental::RNTupleReader;
229 ///
230 /// #include <iostream>
231 ///
232 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
233 /// ntuple->PrintInfo(ENTupleInfo::kStorageDetails, std::cerr);
234 /// ~~~
235 ///
236 /// For use of ENTupleInfo::kMetrics, see #EnableMetrics.
237 void PrintInfo(const ENTupleInfo what = ENTupleInfo::kSummary, std::ostream &output = std::cout);
238
239 /// Shows the values of the i-th entry/row, starting with 0 for the first entry. By default,
240 /// prints the output in JSON format.
241 /// Uses the visitor pattern to traverse through each field of the given entry.
242 void Show(NTupleSize_t index, std::ostream &output = std::cout);
243
244 /// Analogous to Fill(), fills the default entry of the model. Returns false at the end of the ntuple.
245 /// On I/O errors, raises an exception.
247 // TODO(jblomer): can be templated depending on the factory method / constructor
248 if (R__unlikely(!fModel)) {
249 fModel = fSource->GetSharedDescriptorGuard()->GenerateModel();
250 ConnectModel(*fModel);
251 }
252 LoadEntry(index, *fModel->GetDefaultEntry());
253 }
254 /// Fills a user provided entry after checking that the entry has been instantiated from the ntuple model
256 for (auto& value : entry) {
257 value.Read(index);
258 }
259 }
260
261 /// Returns an iterator over the entry indices of the RNTuple.
262 ///
263 /// **Example: iterate over all entries and print each entry in JSON format**
264 /// ~~~ {.cpp}
265 /// #include <ROOT/RNTuple.hxx>
266 /// using ROOT::Experimental::ENTupleShowFormat;
267 /// using ROOT::Experimental::RNTupleReader;
268 ///
269 /// #include <iostream>
270 ///
271 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
272 /// for (auto i : ntuple->GetEntryRange()) {
273 /// ntuple->Show(i);
274 /// }
275 /// ~~~
277
278 /// Provides access to an individual field that can contain either a scalar value or a collection, e.g.
279 /// GetView<double>("particles.pt") or GetView<std::vector<double>>("particle"). It can as well be the index
280 /// field of a collection itself, like GetView<NTupleSize_t>("particle").
281 ///
282 /// Raises an exception if there is no field with the given name.
283 ///
284 /// **Example: iterate over a field named "pt" of type `float`**
285 /// ~~~ {.cpp}
286 /// #include <ROOT/RNTuple.hxx>
287 /// using ROOT::Experimental::RNTupleReader;
288 ///
289 /// #include <iostream>
290 ///
291 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
292 /// auto pt = ntuple->GetView<float>("pt");
293 ///
294 /// for (auto i : ntuple->GetEntryRange()) {
295 /// std::cout << i << ": " << pt(i) << "\n";
296 /// }
297 /// ~~~
298 template <typename T>
299 RNTupleView<T> GetView(std::string_view fieldName) {
300 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
301 if (fieldId == kInvalidDescriptorId) {
302 throw RException(R__FAIL("no field named '" + std::string(fieldName) + "' in RNTuple '" +
303 fSource->GetSharedDescriptorGuard()->GetName() + "'"));
304 }
305 return RNTupleView<T>(fieldId, fSource.get());
306 }
307
308 /// Raises an exception if:
309 /// * there is no field with the given name or,
310 /// * the field is not a collection
311 RNTupleViewCollection GetViewCollection(std::string_view fieldName) {
312 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
313 if (fieldId == kInvalidDescriptorId) {
314 throw RException(R__FAIL("no field named '" + std::string(fieldName) + "' in RNTuple '" +
315 fSource->GetSharedDescriptorGuard()->GetName() + "'"));
316 }
317 return RNTupleViewCollection(fieldId, fSource.get());
318 }
319
320 RIterator begin() { return RIterator(0); }
321 RIterator end() { return RIterator(GetNEntries()); }
322
323 /// Enable performance measurements (decompression time, bytes read from storage, etc.)
324 ///
325 /// **Example: inspect the reader metrics after loading every entry**
326 /// ~~~ {.cpp}
327 /// #include <ROOT/RNTuple.hxx>
328 /// using ROOT::Experimental::ENTupleInfo;
329 /// using ROOT::Experimental::RNTupleReader;
330 ///
331 /// #include <iostream>
332 ///
333 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
334 /// // metrics must be turned on beforehand
335 /// ntuple->EnableMetrics();
336 ///
337 /// for (auto i : ntuple->GetEntryRange()) {
338 /// ntuple->LoadEntry(i);
339 /// }
340 /// ntuple->PrintInfo(ENTupleInfo::kMetrics);
341 /// ~~~
342 void EnableMetrics() { fMetrics.Enable(); }
343 const Detail::RNTupleMetrics &GetMetrics() const { return fMetrics; }
344};
345
346// clang-format off
347/**
348\class ROOT::Experimental::RNTupleWriter
349\ingroup NTuple
350\brief An RNTuple that gets filled with entries (data) and writes them to storage
351
352An output ntuple can be filled with entries. The caller has to make sure that the data that gets filled into an ntuple
353is not modified for the time of the Fill() call. The fill call serializes the C++ object into the column format and
354writes data into the corresponding column page buffers. Writing of the buffers to storage is deferred and can be
355triggered by Flush() or by destructing the ntuple. On I/O errors, an exception is thrown.
356*/
357// clang-format on
360
361private:
362 /// The page sink's parallel page compression scheduler if IMT is on.
363 /// Needs to be destructed after the page sink is destructed and so declared before.
364 std::unique_ptr<Detail::RPageStorage::RTaskScheduler> fZipTasks;
365 std::unique_ptr<Detail::RPageSink> fSink;
366 /// Needs to be destructed before fSink
367 std::unique_ptr<RNTupleModel> fModel;
369 NTupleSize_t fLastCommitted = 0;
370 NTupleSize_t fLastCommittedClusterGroup = 0;
371 NTupleSize_t fNEntries = 0;
372 /// Keeps track of the number of bytes written into the current cluster
373 std::size_t fUnzippedClusterSize = 0;
374 /// The total number of bytes written to storage (i.e., after compression)
375 std::uint64_t fNBytesCommitted = 0;
376 /// The total number of bytes filled into all the so far committed clusters,
377 /// i.e. the uncompressed size of the written clusters
378 std::uint64_t fNBytesFilled = 0;
379 /// Limit for committing cluster no matter the other tunables
381 /// Estimator of uncompressed cluster size, taking into account the estimated compression ratio
383
384 // Helper function that is called from CommitCluster() when necessary
385 void CommitClusterGroup();
386
387public:
388 /// Throws an exception if the model is null.
389 static std::unique_ptr<RNTupleWriter> Recreate(std::unique_ptr<RNTupleModel> model,
390 std::string_view ntupleName,
391 std::string_view storage,
392 const RNTupleWriteOptions &options = RNTupleWriteOptions());
393 /// Throws an exception if the model is null.
394 static std::unique_ptr<RNTupleWriter> Append(std::unique_ptr<RNTupleModel> model,
395 std::string_view ntupleName,
396 TFile &file,
397 const RNTupleWriteOptions &options = RNTupleWriteOptions());
398 /// Throws an exception if the model or the sink is null.
399 RNTupleWriter(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSink> sink);
400 RNTupleWriter(const RNTupleWriter&) = delete;
403
404 /// The simplest user interface if the default entry that comes with the ntuple model is used.
405 /// \return The number of uncompressed bytes written.
406 std::size_t Fill() { return Fill(*fModel->GetDefaultEntry()); }
407 /// Multiple entries can have been instantiated from the ntuple model. This method will perform
408 /// a light check whether the entry comes from the ntuple's own model.
409 /// \return The number of uncompressed bytes written.
410 std::size_t Fill(REntry &entry) {
411 if (R__unlikely(entry.GetModelId() != fModel->GetModelId()))
412 throw RException(R__FAIL("mismatch between entry and model"));
413
414 std::size_t bytesWritten = 0;
415 for (auto& value : entry) {
416 bytesWritten += value.Append();
417 }
418 fUnzippedClusterSize += bytesWritten;
419 fNEntries++;
420 if ((fUnzippedClusterSize >= fMaxUnzippedClusterSize) || (fUnzippedClusterSize >= fUnzippedClusterSizeEst))
421 CommitCluster();
422 return bytesWritten;
423 }
424 /// Ensure that the data from the so far seen Fill calls has been written to storage
425 void CommitCluster(bool commitClusterGroup = false);
426
427 std::unique_ptr<REntry> CreateEntry() { return fModel->CreateEntry(); }
428
429 void EnableMetrics() { fMetrics.Enable(); }
430 const Detail::RNTupleMetrics &GetMetrics() const { return fMetrics; }
431
432 const RNTupleModel *GetModel() const { return fModel.get(); }
433
434 /// Get a `RNTupleModel::RUpdater` that provides limited support for incremental updates to the underlying
435 /// model, e.g. addition of new fields.
436 ///
437 /// **Example: add a new field after the model has been used to construct a `RNTupleWriter` object**
438 /// ~~~ {.cpp}
439 /// #include <ROOT/RNTuple.hxx>
440 /// using ROOT::Experimental::RNTupleModel;
441 /// using ROOT::Experimental::RNTupleWriter;
442 ///
443 /// auto model = RNTupleModel::Create();
444 /// auto fldFloat = model->MakeField<float>("fldFloat");
445 /// auto writer = RNTupleWriter::Recreate(std::move(model), "myNTuple", "some/file.root");
446 /// auto updater = writer->CreateModelUpdater();
447 /// updater->BeginUpdate();
448 /// updater->AddField(std::make_unique<RField<float>>("pt"));
449 /// updater->CommitUpdate();
450 ///
451 /// // ...
452 /// ~~~
453 std::unique_ptr<RNTupleModel::RUpdater> CreateModelUpdater()
454 {
455 return std::unique_ptr<RNTupleModel::RUpdater>(new RNTupleModel::RUpdater(*this));
456 }
457};
458
459// clang-format off
460/**
461\class ROOT::Experimental::RCollectionNTuple
462\ingroup NTuple
463\brief A virtual ntuple used for writing untyped collections that can be used to some extent like an RNTupleWriter
464*
465* This class is between a field and a ntuple. It carries the offset column for the collection and the default entry
466* taken from the collection model. It does not, however, own an ntuple model because the collection model has been
467* merged into the larger ntuple model.
468*/
469// clang-format on
471private:
473 std::unique_ptr<REntry> fDefaultEntry;
474public:
475 explicit RCollectionNTupleWriter(std::unique_ptr<REntry> defaultEntry);
479
480 void Fill() { Fill(fDefaultEntry.get()); }
481 void Fill(REntry *entry) {
482 for (auto &value : *entry) {
483 value.Append();
484 }
485 fOffset++;
486 }
487
488 ClusterSize_t *GetOffsetPtr() { return &fOffset; }
489};
490
491// clang-format off
492/**
493\class ROOT::Experimental::RNTuple
494\ingroup NTuple
495\brief Representation of an RNTuple data set in a ROOT file
496
497This class provides an API entry point to an RNTuple stored in a ROOT file. Its main purpose is to
498construct a page source for an RNTuple, which in turn can be used to read an RNTuple with an RDF or
499an RNTupleReader.
500
501For instance, for an RNTuple called "Events" in a ROOT file, usage can be
502~~~ {.cpp}
503auto f = TFile::Open("data.root");
504auto ntpl = f->Get<ROOT::Experimental::RNTuple>("Events");
505
506auto reader = RNTupleReader::Open(ntpl);
507or
508auto pageSource = ntpl->MakePageSource();
509~~~
510*/
511// clang-format on
514 friend struct ROOT::Experimental::Internal::RNTupleTester;
515
516private:
517 // Only add transient members. The on-disk layout must be identical to RFileNTupleAnchor
518
519 TFile *fFile = nullptr; ///<! The file from which the ntuple was streamed, registered in the custom streamer
520
521 // Conversion between low-level anchor and RNTuple UI class
522 explicit RNTuple(const Internal::RFileNTupleAnchor &a) : Internal::RFileNTupleAnchor(a) {}
523 Internal::RFileNTupleAnchor GetAnchor() const { return *this; }
524
525public:
526 RNTuple() = default;
527 ~RNTuple() = default;
528
529 /// Create a page source from the RNTuple object. Requires the RNTuple object to be streamed from a file.
530 /// If fFile is not set, an exception is thrown.
531 std::unique_ptr<Detail::RPageSource> MakePageSource(const RNTupleReadOptions &options = RNTupleReadOptions());
532
533 /// RNTuple implements the hadd MergeFile interface
534 /// Merge this NTuple with the input list entries
535 Long64_t Merge(TCollection *input, TFileMergeInfo *mergeInfo);
536
537 // The version must match the RFileNTupleAnchor version in the LinkDef.h
539};
540
541} // namespace Experimental
542} // namespace ROOT
543
544#endif
#define R__unlikely(expr)
Definition RConfig.hxx:586
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
Definition RError.hxx:303
#define a(i)
Definition RSha256.hxx:99
long long Long64_t
Definition RtypesCore.h:80
#define ClassDefNV(name, id)
Definition Rtypes.h:345
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
TTime operator*(const TTime &t1, const TTime &t2)
Definition TTime.h:85
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.
Write RNTuple data blocks in a TFile or a bare file container.
RCollectionNTupleWriter(const RCollectionNTupleWriter &)=delete
RCollectionNTupleWriter & operator=(const RCollectionNTupleWriter &)=delete
std::unique_ptr< REntry > fDefaultEntry
Definition RNTuple.hxx:473
The REntry is a collection of values in an ntuple corresponding to a complete row in the data set.
Definition REntry.hxx:42
std::uint64_t GetModelId() const
Definition REntry.hxx:102
Base class for all ROOT issued exceptions.
Definition RError.hxx:78
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.
Definition RNTuple.cxx:49
std::unique_ptr< TTaskGroup > fTaskGroup
Definition RNTuple.hxx:69
void AddTask(const std::function< void(void)> &taskFunc) final
Take a callable that represents a task.
Definition RNTuple.cxx:54
void Wait() final
Blocks until all scheduled tasks finished.
Definition RNTuple.cxx:59
A model is usually immutable after passing it to an RNTupleWriter.
The RNTupleModel encapulates the schema of an ntuple.
Common user-tunable settings for reading ntuples.
bool operator!=(const iterator &rh) const
Definition RNTuple.hxx:148
bool operator==(const iterator &rh) const
Definition RNTuple.hxx:147
std::forward_iterator_tag iterator_category
Definition RNTuple.hxx:133
An RNTuple that is used to read data from storage.
Definition RNTuple.hxx:101
std::unique_ptr< RNTupleReader > Clone()
Definition RNTuple.hxx:199
Detail::RNTupleMetrics fMetrics
Definition RNTuple.hxx:120
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...
Definition RNTuple.hxx:105
std::unique_ptr< RNTupleReader > fDisplayReader
We use a dedicated on-demand reader for Show() and Scan().
Definition RNTuple.hxx:113
void EnableMetrics()
Enable performance measurements (decompression time, bytes read from storage, etc....
Definition RNTuple.hxx:342
const Detail::RNTupleMetrics & GetMetrics() const
Definition RNTuple.hxx:343
RNTupleView< T > GetView(std::string_view fieldName)
Provides access to an individual field that can contain either a scalar value or a collection,...
Definition RNTuple.hxx:299
NTupleSize_t GetNEntries() const
Definition RNTuple.hxx:203
std::unique_ptr< RNTupleDescriptor > fCachedDescriptor
The ntuple descriptor in the page source is protected by a read-write lock.
Definition RNTuple.hxx:119
std::unique_ptr< Detail::RPageSource > fSource
Definition RNTuple.hxx:107
RNTupleGlobalRange GetEntryRange()
Returns an iterator over the entry indices of the RNTuple.
Definition RNTuple.hxx:276
RNTupleViewCollection GetViewCollection(std::string_view fieldName)
Raises an exception if:
Definition RNTuple.hxx:311
void LoadEntry(NTupleSize_t index)
Analogous to Fill(), fills the default entry of the model.
Definition RNTuple.hxx:246
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSource.
Definition RNTuple.hxx:109
void LoadEntry(NTupleSize_t index, REntry &entry)
Fills a user provided entry after checking that the entry has been instantiated from the ntuple model...
Definition RNTuple.hxx:255
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.
Definition RNTuple.hxx:358
NTupleSize_t fUnzippedClusterSizeEst
Estimator of uncompressed cluster size, taking into account the estimated compression ratio.
Definition RNTuple.hxx:382
std::size_t fMaxUnzippedClusterSize
Limit for committing cluster no matter the other tunables.
Definition RNTuple.hxx:380
std::unique_ptr< RNTupleModel::RUpdater > CreateModelUpdater()
Get a RNTupleModel::RUpdater that provides limited support for incremental updates to the underlying ...
Definition RNTuple.hxx:453
const Detail::RNTupleMetrics & GetMetrics() const
Definition RNTuple.hxx:430
std::size_t Fill()
The simplest user interface if the default entry that comes with the ntuple model is used.
Definition RNTuple.hxx:406
std::unique_ptr< REntry > CreateEntry()
Definition RNTuple.hxx:427
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSink.
Definition RNTuple.hxx:367
RNTupleWriter(const RNTupleWriter &)=delete
Detail::RNTupleMetrics fMetrics
Definition RNTuple.hxx:368
std::size_t Fill(REntry &entry)
Multiple entries can have been instantiated from the ntuple model.
Definition RNTuple.hxx:410
RNTupleWriter & operator=(const RNTupleWriter &)=delete
std::unique_ptr< Detail::RPageSink > fSink
Definition RNTuple.hxx:365
const RNTupleModel * GetModel() const
Definition RNTuple.hxx:432
std::unique_ptr< Detail::RPageStorage::RTaskScheduler > fZipTasks
The page sink's parallel page compression scheduler if IMT is on.
Definition RNTuple.hxx:364
Representation of an RNTuple data set in a ROOT file.
Definition RNTuple.hxx:512
Internal::RFileNTupleAnchor GetAnchor() const
Definition RNTuple.hxx:523
RNTuple(const Internal::RFileNTupleAnchor &a)
Definition RNTuple.hxx:522
Collection abstract base class.
Definition TCollection.h:65
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
const Int_t n
Definition legend1.C:16
ENTupleInfo
Listing of the different options that can be printed by RNTupleReader::GetInfo()
Definition RNTuple.hxx:59
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr NTupleSize_t kInvalidNTupleIndex
constexpr DescriptorId_t kInvalidDescriptorId
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Definition file.py:1
static const char * what
Definition stlLoader.cc:6
Entry point for an RNTuple in a ROOT file.
Definition RMiniFile.hxx:65
Wrap the integer in a struct in order to avoid template specialization clash with std::uint32_t.
Used to specify the underlying RNTuples in OpenFriends()
Definition RNTuple.hxx:152
ROpenSpec(std::string_view n, std::string_view s)
Definition RNTuple.hxx:158
static void output()