Logo ROOT  
Reference Guide
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/**
66 * Listing of the different entry output formats of RNTupleReader::Show()
67 */
69 kCurrentModelJSON, // prints a single entry/row with the current active model in JSON format.
70 kCompleteJSON, // prints a single entry/row with all the fields in JSON format.
71};
72
73
74#ifdef R__USE_IMT
75class TTaskGroup;
77private:
78 std::unique_ptr<TTaskGroup> fTaskGroup;
79public:
81 ~RNTupleImtTaskScheduler() override = default;
82 void Reset() final;
83 void AddTask(const std::function<void(void)> &taskFunc) final;
84 void Wait() final;
85};
86#endif
87
88// clang-format off
89/**
90\class ROOT::Experimental::RNTupleReader
91\ingroup NTuple
92\brief An RNTuple that is used to read data from storage
93
94An input ntuple provides data from storage as C++ objects. The ntuple model can be created from the data on storage
95or it can be imposed by the user. The latter case allows users to read into a specialized ntuple model that covers
96only a subset of the fields in the ntuple. The ntuple model is used when reading complete entries.
97Individual fields can be read as well by instantiating a tree view.
98
99~~~ {.cpp}
100#include <ROOT/RNTuple.hxx>
101using ROOT::Experimental::RNTupleReader;
102
103#include <iostream>
104
105auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
106std::cout << "myNTuple has " << ntuple->GetNEntries() << " entries\n";
107~~~
108*/
109// clang-format on
111private:
112 /// Set as the page source's scheduler for parallel page decompression if IMT is on
113 /// Needs to be destructed after the pages source is destructed (an thus be declared before)
114 std::unique_ptr<Detail::RPageStorage::RTaskScheduler> fUnzipTasks;
115
116 std::unique_ptr<Detail::RPageSource> fSource;
117 /// Needs to be destructed before fSource
118 std::unique_ptr<RNTupleModel> fModel;
119 /// We use a dedicated on-demand reader for Show() and Scan(). Printing data uses all the fields
120 /// from the full model even if the analysis code uses only a subset of fields. The display reader
121 /// is a clone of the original reader.
122 std::unique_ptr<RNTupleReader> fDisplayReader;
123 /// The ntuple descriptor in the page source is protected by a read-write lock. We don't expose that to the
124 /// users of RNTupleReader::GetDescriptor(). Instead, if descriptor information is needed, we clone the
125 /// descriptor. Using the descriptor's generation number, we know if the cached descriptor is stale.
126 /// Retrieving descriptor data from an RNTupleReader is supposed to be for testing and information purposes,
127 /// not on a hot code path.
128 std::unique_ptr<RNTupleDescriptor> fCachedDescriptor;
130
131 void ConnectModel(const RNTupleModel &model);
132 RNTupleReader *GetDisplayReader();
133 void InitPageSource();
134
135public:
136 // Browse through the entries
137 class RIterator {
138 private:
140 public:
142 using iterator_category = std::forward_iterator_tag;
147
148 RIterator() = default;
149 explicit RIterator(NTupleSize_t index) : fIndex(index) {}
150 ~RIterator() = default;
151
152 iterator operator++(int) /* postfix */ { auto r = *this; fIndex++; return r; }
153 iterator& operator++() /* prefix */ { ++fIndex; return *this; }
154 reference operator* () { return fIndex; }
155 pointer operator->() { return &fIndex; }
156 bool operator==(const iterator& rh) const { return fIndex == rh.fIndex; }
157 bool operator!=(const iterator& rh) const { return fIndex != rh.fIndex; }
158 };
159
160 /// Used to specify the underlying RNTuples in OpenFriends()
161 struct ROpenSpec {
162 std::string fNTupleName;
163 std::string fStorage;
165
166 ROpenSpec() = default;
167 ROpenSpec(std::string_view n, std::string_view s) : fNTupleName(n), fStorage(s) {}
168 };
169
170 /// Throws an exception if the model is null.
171 static std::unique_ptr<RNTupleReader> Open(std::unique_ptr<RNTupleModel> model,
172 std::string_view ntupleName,
173 std::string_view storage,
174 const RNTupleReadOptions &options = RNTupleReadOptions());
175 /// Open an RNTuple for reading.
176 ///
177 /// Throws an RException if there is no RNTuple with the given name.
178 ///
179 /// **Example: open an RNTuple and print the number of entries**
180 /// ~~~ {.cpp}
181 /// #include <ROOT/RNTuple.hxx>
182 /// using ROOT::Experimental::RNTupleReader;
183 ///
184 /// #include <iostream>
185 ///
186 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
187 /// std::cout << "myNTuple has " << ntuple->GetNEntries() << " entries\n";
188 /// ~~~
189 static std::unique_ptr<RNTupleReader> Open(std::string_view ntupleName,
190 std::string_view storage,
191 const RNTupleReadOptions &options = RNTupleReadOptions());
192 static std::unique_ptr<RNTupleReader>
193 Open(RNTuple *ntuple, const RNTupleReadOptions &options = RNTupleReadOptions());
194 /// Open RNTuples as one virtual, horizontally combined ntuple. The underlying RNTuples must
195 /// have an identical number of entries. Fields in the combined RNTuple are named with the ntuple name
196 /// as a prefix, e.g. myNTuple1.px and myNTuple2.pt (see tutorial ntpl006_friends)
197 static std::unique_ptr<RNTupleReader> OpenFriends(std::span<ROpenSpec> ntuples);
198
199 /// The user imposes an ntuple model, which must be compatible with the model found in the data on
200 /// storage.
201 ///
202 /// Throws an exception if the model or the source is null.
203 RNTupleReader(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSource> source);
204 /// The model is generated from the ntuple metadata on storage
205 ///
206 /// Throws an exception if the source is null.
207 explicit RNTupleReader(std::unique_ptr<Detail::RPageSource> source);
208 std::unique_ptr<RNTupleReader> Clone() { return std::make_unique<RNTupleReader>(fSource->Clone()); }
210
211 RNTupleModel *GetModel();
212 NTupleSize_t GetNEntries() const { return fSource->GetNEntries(); }
213
214 /// Returns a cached copy of the page source descriptor. The returned pointer remains valid until the next call
215 /// to LoadEntry or to any of the views returned from the reader.
216 const RNTupleDescriptor *GetDescriptor();
217
218 /// Prints a detailed summary of the ntuple, including a list of fields.
219 ///
220 /// **Example: print summary information to stdout**
221 /// ~~~ {.cpp}
222 /// #include <ROOT/RNTuple.hxx>
223 /// using ROOT::Experimental::ENTupleInfo;
224 /// using ROOT::Experimental::RNTupleReader;
225 ///
226 /// #include <iostream>
227 ///
228 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
229 /// ntuple->PrintInfo();
230 /// // or, equivalently:
231 /// ntuple->PrintInfo(ENTupleInfo::kSummary, std::cout);
232 /// ~~~
233 /// **Example: print detailed column storage data to stderr**
234 /// ~~~ {.cpp}
235 /// #include <ROOT/RNTuple.hxx>
236 /// using ROOT::Experimental::ENTupleInfo;
237 /// using ROOT::Experimental::RNTupleReader;
238 ///
239 /// #include <iostream>
240 ///
241 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
242 /// ntuple->PrintInfo(ENTupleInfo::kStorageDetails, std::cerr);
243 /// ~~~
244 ///
245 /// For use of ENTupleInfo::kMetrics, see #EnableMetrics.
246 void PrintInfo(const ENTupleInfo what = ENTupleInfo::kSummary, std::ostream &output = std::cout);
247
248 /// Shows the values of the i-th entry/row, starting with 0 for the first entry. By default,
249 /// prints the output in JSON format.
250 /// Uses the visitor pattern to traverse through each field of the given entry.
252 std::ostream &output = std::cout);
253
254 /// Analogous to Fill(), fills the default entry of the model. Returns false at the end of the ntuple.
255 /// On I/O errors, raises an exception.
257 // TODO(jblomer): can be templated depending on the factory method / constructor
258 if (R__unlikely(!fModel)) {
259 fModel = fSource->GetSharedDescriptorGuard()->GenerateModel();
260 ConnectModel(*fModel);
261 }
262 LoadEntry(index, *fModel->GetDefaultEntry());
263 }
264 /// Fills a user provided entry after checking that the entry has been instantiated from the ntuple model
266 for (auto& value : entry) {
267 value.GetField()->Read(index, &value);
268 }
269 }
270
271 /// Returns an iterator over the entry indices of the RNTuple.
272 ///
273 /// **Example: iterate over all entries and print each entry in JSON format**
274 /// ~~~ {.cpp}
275 /// #include <ROOT/RNTuple.hxx>
276 /// using ROOT::Experimental::ENTupleShowFormat;
277 /// using ROOT::Experimental::RNTupleReader;
278 ///
279 /// #include <iostream>
280 ///
281 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
282 /// for (auto i : ntuple->GetEntryRange()) {
283 /// ntuple->Show(i, ENTupleShowFormat::kCompleteJSON);
284 /// }
285 /// ~~~
287
288 /// Provides access to an individual field that can contain either a scalar value or a collection, e.g.
289 /// GetView<double>("particles.pt") or GetView<std::vector<double>>("particle"). It can as well be the index
290 /// field of a collection itself, like GetView<NTupleSize_t>("particle").
291 ///
292 /// Raises an exception if there is no field with the given name.
293 ///
294 /// **Example: iterate over a field named "pt" of type `float`**
295 /// ~~~ {.cpp}
296 /// #include <ROOT/RNTuple.hxx>
297 /// using ROOT::Experimental::RNTupleReader;
298 ///
299 /// #include <iostream>
300 ///
301 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
302 /// auto pt = ntuple->GetView<float>("pt");
303 ///
304 /// for (auto i : ntuple->GetEntryRange()) {
305 /// std::cout << i << ": " << pt(i) << "\n";
306 /// }
307 /// ~~~
308 template <typename T>
310 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
311 if (fieldId == kInvalidDescriptorId) {
312 throw RException(R__FAIL("no field named '" + std::string(fieldName) + "' in RNTuple '" +
313 fSource->GetSharedDescriptorGuard()->GetName() + "'"));
314 }
315 return RNTupleView<T>(fieldId, fSource.get());
316 }
317
318 /// Raises an exception if:
319 /// * there is no field with the given name or,
320 /// * the field is not a collection
322 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
323 if (fieldId == kInvalidDescriptorId) {
324 throw RException(R__FAIL("no field named '" + std::string(fieldName) + "' in RNTuple '" +
325 fSource->GetSharedDescriptorGuard()->GetName() + "'"));
326 }
327 return RNTupleViewCollection(fieldId, fSource.get());
328 }
329
330 RIterator begin() { return RIterator(0); }
331 RIterator end() { return RIterator(GetNEntries()); }
332
333 /// Enable performance measurements (decompression time, bytes read from storage, etc.)
334 ///
335 /// **Example: inspect the reader metrics after loading every entry**
336 /// ~~~ {.cpp}
337 /// #include <ROOT/RNTuple.hxx>
338 /// using ROOT::Experimental::ENTupleInfo;
339 /// using ROOT::Experimental::RNTupleReader;
340 ///
341 /// #include <iostream>
342 ///
343 /// auto ntuple = RNTupleReader::Open("myNTuple", "some/file.root");
344 /// // metrics must be turned on beforehand
345 /// ntuple->EnableMetrics();
346 ///
347 /// for (auto i : ntuple->GetEntryRange()) {
348 /// ntuple->LoadEntry(i);
349 /// }
350 /// ntuple->PrintInfo(ENTupleInfo::kMetrics);
351 /// ~~~
352 void EnableMetrics() { fMetrics.Enable(); }
353 const Detail::RNTupleMetrics &GetMetrics() const { return fMetrics; }
354};
355
356// clang-format off
357/**
358\class ROOT::Experimental::RNTupleWriter
359\ingroup NTuple
360\brief An RNTuple that gets filled with entries (data) and writes them to storage
361
362An output ntuple can be filled with entries. The caller has to make sure that the data that gets filled into an ntuple
363is not modified for the time of the Fill() call. The fill call serializes the C++ object into the column format and
364writes data into the corresponding column page buffers. Writing of the buffers to storage is deferred and can be
365triggered by Flush() or by destructing the ntuple. On I/O errors, an exception is thrown.
366*/
367// clang-format on
369private:
370 /// The page sink's parallel page compression scheduler if IMT is on.
371 /// Needs to be destructed after the page sink is destructed and so declared before.
372 std::unique_ptr<Detail::RPageStorage::RTaskScheduler> fZipTasks;
373 std::unique_ptr<Detail::RPageSink> fSink;
374 /// Needs to be destructed before fSink
375 std::unique_ptr<RNTupleModel> fModel;
377 NTupleSize_t fLastCommitted = 0;
378 NTupleSize_t fLastCommittedClusterGroup = 0;
379 NTupleSize_t fNEntries = 0;
380 /// Keeps track of the number of bytes written into the current cluster
381 std::size_t fUnzippedClusterSize = 0;
382 /// The total number of bytes written to storage (i.e., after compression)
383 std::uint64_t fNBytesCommitted = 0;
384 /// The total number of bytes filled into all the so far committed clusters,
385 /// i.e. the uncompressed size of the written clusters
386 std::uint64_t fNBytesFilled = 0;
387 /// Limit for committing cluster no matter the other tunables
389 /// Estimator of uncompressed cluster size, taking into account the estimated compression ratio
391
392 // Helper function that is called from CommitCluster() when necessary
393 void CommitClusterGroup();
394
395public:
396 /// Throws an exception if the model is null.
397 static std::unique_ptr<RNTupleWriter> Recreate(std::unique_ptr<RNTupleModel> model,
398 std::string_view ntupleName,
399 std::string_view storage,
400 const RNTupleWriteOptions &options = RNTupleWriteOptions());
401 /// Throws an exception if the model is null.
402 static std::unique_ptr<RNTupleWriter> Append(std::unique_ptr<RNTupleModel> model,
403 std::string_view ntupleName,
404 TFile &file,
405 const RNTupleWriteOptions &options = RNTupleWriteOptions());
406 /// Throws an exception if the model or the sink is null.
407 RNTupleWriter(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSink> sink);
408 RNTupleWriter(const RNTupleWriter&) = delete;
411
412 /// The simplest user interface if the default entry that comes with the ntuple model is used
413 void Fill() { Fill(*fModel->GetDefaultEntry()); }
414 /// Multiple entries can have been instantiated from the ntuple model. This method will perform
415 /// a light check whether the entry comes from the ntuple's own model
416 void Fill(REntry &entry) {
417 if (R__unlikely(entry.GetModelId() != fModel->GetModelId()))
418 throw RException(R__FAIL("mismatch between entry and model"));
419
420 for (auto& value : entry) {
421 fUnzippedClusterSize += value.GetField()->Append(value);
422 }
423 fNEntries++;
424 if ((fUnzippedClusterSize >= fMaxUnzippedClusterSize) || (fUnzippedClusterSize >= fUnzippedClusterSizeEst))
425 CommitCluster();
426 }
427 /// Ensure that the data from the so far seen Fill calls has been written to storage
428 void CommitCluster(bool commitClusterGroup = false);
429
430 std::unique_ptr<REntry> CreateEntry() { return fModel->CreateEntry(); }
431
432 void EnableMetrics() { fMetrics.Enable(); }
433 const Detail::RNTupleMetrics &GetMetrics() const { return fMetrics; }
434
435 const RNTupleModel *GetModel() const { return fModel.get(); }
436};
437
438// clang-format off
439/**
440\class ROOT::Experimental::RCollectionNTuple
441\ingroup NTuple
442\brief A virtual ntuple used for writing untyped collections that can be used to some extent like an RNTupleWriter
443*
444* This class is between a field and a ntuple. It carries the offset column for the collection and the default entry
445* taken from the collection model. It does not, however, own an ntuple model because the collection model has been
446* merged into the larger ntuple model.
447*/
448// clang-format on
450private:
452 std::unique_ptr<REntry> fDefaultEntry;
453public:
454 explicit RCollectionNTupleWriter(std::unique_ptr<REntry> defaultEntry);
458
459 void Fill() { Fill(fDefaultEntry.get()); }
460 void Fill(REntry *entry) {
461 for (auto &value : *entry) {
462 value.GetField()->Append(value);
463 }
464 fOffset++;
465 }
466
467 ClusterSize_t *GetOffsetPtr() { return &fOffset; }
468};
469
470// clang-format off
471/**
472\class ROOT::Experimental::RNTuple
473\ingroup NTuple
474\brief Representation of an RNTuple data set in a ROOT file
475
476This class provides an API entry point to an RNTuple stored in a ROOT file. Its main purpose is to
477construct a page source for an RNTuple, which in turn can be used to read an RNTuple with an RDF or
478an RNTupleReader.
479
480For instance, for an RNTuple called "Events" in a ROOT file, usage can be
481~~~ {.cpp}
482auto f = TFile::Open("data.root");
483auto ntpl = f->Get<ROOT::Experimental::RNTuple>("Events");
484
485auto reader = RNTupleReader::Open(ntpl);
486or
487auto pageSource = ntpl->MakePageSource();
488~~~
489*/
490// clang-format on
493 friend struct ROOT::Experimental::Internal::RNTupleTester;
494
495private:
496 // Only add transient members. The on-disk layout must be identical to RFileNTupleAnchor
497
498 TFile *fFile = nullptr; ///<! The file from which the ntuple was streamed, registered in the custom streamer
499
500 // Conversion between low-level anchor and RNTuple UI class
501 explicit RNTuple(const Internal::RFileNTupleAnchor &a) : Internal::RFileNTupleAnchor(a) {}
502 Internal::RFileNTupleAnchor GetAnchor() const { return *this; }
503
504public:
505 RNTuple() = default;
506 ~RNTuple() = default;
507
508 /// Create a page source from the RNTuple object. Requires the RNTuple object to be streamed from a file.
509 /// If fFile is not set, an exception is thrown.
510 std::unique_ptr<Detail::RPageSource> MakePageSource(const RNTupleReadOptions &options = RNTupleReadOptions());
511
512 /// RNTuple implements the hadd MergeFile interface
513 /// Merge this NTuple with the input list entries
514 Long64_t Merge(TCollection *input, TFileMergeInfo *mergeInfo);
515
516 // The version must match the RFileNTupleAnchor version in the LinkDef.h
518};
519
520} // namespace Experimental
521} // namespace ROOT
522
523#endif
#define R__unlikely(expr)
Definition: RConfig.hxx:595
#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:291
long long Long64_t
Definition: RtypesCore.h:80
#define ClassDefNV(name, id)
Definition: Rtypes.h:343
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
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
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.
Definition: RMiniFile.hxx:136
RCollectionNTupleWriter(const RCollectionNTupleWriter &)=delete
RCollectionNTupleWriter & operator=(const RCollectionNTupleWriter &)=delete
std::unique_ptr< REntry > fDefaultEntry
Definition: RNTuple.hxx:452
The REntry is a collection of values in an ntuple corresponding to a complete row in the data set.
Definition: REntry.hxx:43
std::uint64_t GetModelId() const
Definition: REntry.hxx:108
Base class for all ROOT issued exceptions.
Definition: RError.hxx:114
The on-storage meta-data of an ntuple.
Used to loop over indexes (entries or collections) between start and end.
Definition: RNTupleView.hxx:40
void Reset() final
Start a new set of tasks.
Definition: RNTuple.cxx:50
std::unique_ptr< TTaskGroup > fTaskGroup
Definition: RNTuple.hxx:78
void AddTask(const std::function< void(void)> &taskFunc) final
Take a callable that represents a task.
Definition: RNTuple.cxx:56
void Wait() final
Blocks until all scheduled tasks finished.
Definition: RNTuple.cxx:62
The RNTupleModel encapulates the schema of an ntuple.
Common user-tunable settings for reading ntuples.
bool operator!=(const iterator &rh) const
Definition: RNTuple.hxx:157
bool operator==(const iterator &rh) const
Definition: RNTuple.hxx:156
std::forward_iterator_tag iterator_category
Definition: RNTuple.hxx:142
An RNTuple that is used to read data from storage.
Definition: RNTuple.hxx:110
std::unique_ptr< RNTupleReader > Clone()
Definition: RNTuple.hxx:208
Detail::RNTupleMetrics fMetrics
Definition: RNTuple.hxx:129
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:114
std::unique_ptr< RNTupleReader > fDisplayReader
We use a dedicated on-demand reader for Show() and Scan().
Definition: RNTuple.hxx:122
void EnableMetrics()
Enable performance measurements (decompression time, bytes read from storage, etc....
Definition: RNTuple.hxx:352
const Detail::RNTupleMetrics & GetMetrics() const
Definition: RNTuple.hxx:353
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:309
NTupleSize_t GetNEntries() const
Definition: RNTuple.hxx:212
std::unique_ptr< RNTupleDescriptor > fCachedDescriptor
The ntuple descriptor in the page source is protected by a read-write lock.
Definition: RNTuple.hxx:128
std::unique_ptr< Detail::RPageSource > fSource
Definition: RNTuple.hxx:116
RNTupleGlobalRange GetEntryRange()
Returns an iterator over the entry indices of the RNTuple.
Definition: RNTuple.hxx:286
RNTupleViewCollection GetViewCollection(std::string_view fieldName)
Raises an exception if:
Definition: RNTuple.hxx:321
void LoadEntry(NTupleSize_t index)
Analogous to Fill(), fills the default entry of the model.
Definition: RNTuple.hxx:256
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSource.
Definition: RNTuple.hxx:118
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:265
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:368
NTupleSize_t fUnzippedClusterSizeEst
Estimator of uncompressed cluster size, taking into account the estimated compression ratio.
Definition: RNTuple.hxx:390
std::size_t fMaxUnzippedClusterSize
Limit for committing cluster no matter the other tunables.
Definition: RNTuple.hxx:388
const Detail::RNTupleMetrics & GetMetrics() const
Definition: RNTuple.hxx:433
std::unique_ptr< REntry > CreateEntry()
Definition: RNTuple.hxx:430
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSink.
Definition: RNTuple.hxx:375
RNTupleWriter(const RNTupleWriter &)=delete
Detail::RNTupleMetrics fMetrics
Definition: RNTuple.hxx:376
RNTupleWriter & operator=(const RNTupleWriter &)=delete
std::unique_ptr< Detail::RPageSink > fSink
Definition: RNTuple.hxx:373
void Fill()
The simplest user interface if the default entry that comes with the ntuple model is used.
Definition: RNTuple.hxx:413
const RNTupleModel * GetModel() const
Definition: RNTuple.hxx:435
std::unique_ptr< Detail::RPageStorage::RTaskScheduler > fZipTasks
The page sink's parallel page compression scheduler if IMT is on.
Definition: RNTuple.hxx:372
void Fill(REntry &entry)
Multiple entries can have been instantiated from the ntuple model.
Definition: RNTuple.hxx:416
Representation of an RNTuple data set in a ROOT file.
Definition: RNTuple.hxx:491
Internal::RFileNTupleAnchor GetAnchor() const
Definition: RNTuple.hxx:502
RNTuple(const Internal::RFileNTupleAnchor &a)
Definition: RNTuple.hxx:501
Collection abstract base class.
Definition: TCollection.h:65
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
const Int_t n
Definition: legend1.C:16
basic_string_view< char > string_view
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.
Definition: RNTupleUtil.hxx:47
constexpr NTupleSize_t kInvalidNTupleIndex
Definition: RNTupleUtil.hxx:48
REveVectorT< TT > operator*(const REveVectorT< TT > &a, TT b)
Definition: REveVector.hxx:218
ENTupleShowFormat
Listing of the different entry output formats of RNTupleReader::Show()
Definition: RNTuple.hxx:68
constexpr DescriptorId_t kInvalidDescriptorId
Definition: RNTupleUtil.hxx:84
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:167
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
static constexpr double s
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 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...
Definition: RNTupleUtil.hxx:50
Used to specify the underlying RNTuples in OpenFriends()
Definition: RNTuple.hxx:161
ROpenSpec(std::string_view n, std::string_view s)
Definition: RNTuple.hxx:167
TArc a
Definition: textangle.C:12
static void output()