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 2023-09-19
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-2023, 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 <Rtypes.h>
20
21#include <cstdint>
22
23class TCollection;
24class TFile;
25class TFileMergeInfo;
26
27namespace ROOT {
28namespace Experimental {
29
30namespace Internal {
31class RMiniFileReader;
32class RNTupleFileWriter;
33class RPageSourceFile;
34} // namespace Internal
35
36// clang-format off
37/**
38\class ROOT::Experimental::RNTuple
39\ingroup NTuple
40\brief Representation of an RNTuple data set in a ROOT file
41
42The class points to the header and footer keys, which in turn have the references to the pages (via page lists).
43Only the RNTuple key will be listed in the list of keys. Like TBaskets, the pages are "invisible" keys.
44Byte offset references in the RNTuple header and footer reference directly the data part of page records,
45skipping the TFile key part.
46
47In the list of keys, this object appears as "ROOT::Experimental::RNTuple".
48It is the user-facing representation of an RNTuple data set in a ROOT file and
49it provides an API entry point to an RNTuple stored in a ROOT file. Its main purpose is to
50construct a page source for an RNTuple, which in turn can be used to read an RNTuple with an RDF or
51an RNTupleReader.
52
53For instance, for an RNTuple called "Events" in a ROOT file, usage can be
54~~~ {.cpp}
55auto f = TFile::Open("data.root");
56auto ntpl = f->Get<ROOT::Experimental::RNTuple>("Events");
57auto reader = RNTupleReader::Open(ntpl);
58~~~
59*/
60// clang-format on
61class RNTuple final {
65
66public:
67 static constexpr std::uint16_t kVersionEpoch = 0;
68 static constexpr std::uint16_t kVersionMajor = 2;
69 static constexpr std::uint16_t kVersionMinor = 0;
70 static constexpr std::uint16_t kVersionPatch = 0;
71
72private:
73 /// Version of the RNTuple binary format that the writer supports (see specification).
74 /// Changing the epoch indicates backward-incompatible changes
76 /// Changing the major version indicates forward incompatible changes; such changes should correspond to a new
77 /// bit in the feature flag of the RNTuple header.
78 /// For the pre-release epoch 0, indicates the release candidate number
80 /// Changing the minor version indicates new optional fields added to the RNTuple meta-data
82 /// Changing the patch version indicates new backported features from newer binary format versions
84 /// The file offset of the header excluding the TKey part
85 std::uint64_t fSeekHeader = 0;
86 /// The size of the compressed ntuple header
87 std::uint64_t fNBytesHeader = 0;
88 /// The size of the uncompressed ntuple header
89 std::uint64_t fLenHeader = 0;
90 /// The file offset of the footer excluding the TKey part
91 std::uint64_t fSeekFooter = 0;
92 /// The size of the compressed ntuple footer
93 std::uint64_t fNBytesFooter = 0;
94 /// The size of the uncompressed ntuple footer
95 std::uint64_t fLenFooter = 0;
96 /// The xxhash3 checksum of the serialized other members of the struct (excluding byte count and class version).
97 /// This member can only be interpreted during streaming.
98 /// When adding new members to the class, this member must remain the last one.
99 std::uint64_t fChecksum = 0;
100
101 TFile *fFile = nullptr; ///<! The file from which the ntuple was streamed, registered in the custom streamer
102
103public:
104 RNTuple() = default;
105 ~RNTuple() = default;
106
107 std::uint16_t GetVersionEpoch() const { return fVersionEpoch; }
108 std::uint16_t GetVersionMajor() const { return fVersionMajor; }
109 std::uint16_t GetVersionMinor() const { return fVersionMinor; }
110 std::uint16_t GetVersionPatch() const { return fVersionPatch; }
111
112 std::uint64_t GetSeekHeader() const { return fSeekHeader; }
113 std::uint64_t GetNBytesHeader() const { return fNBytesHeader; }
114 std::uint64_t GetLenHeader() const { return fLenHeader; }
115
116 std::uint64_t GetSeekFooter() const { return fSeekFooter; }
117 std::uint64_t GetNBytesFooter() const { return fNBytesFooter; }
118 std::uint64_t GetLenFooter() const { return fLenFooter; }
119
120 std::uint64_t GetChecksum() const { return fChecksum; }
121
122 /// RNTuple implements the hadd MergeFile interface
123 /// Merge this NTuple with the input list entries
125
127}; // class RNTuple
128
129} // namespace Experimental
130} // namespace ROOT
131
132#endif
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
Read RNTuple data blocks from a TFile container, provided by a RRawFile.
Definition RMiniFile.hxx:54
Write RNTuple data blocks in a TFile or a bare file container.
Definition RMiniFile.hxx:93
Storage provider that reads ntuple pages from a file.
Representation of an RNTuple data set in a ROOT file.
Definition RNTuple.hxx:61
std::uint16_t fVersionMajor
Changing the major version indicates forward incompatible changes; such changes should correspond to ...
Definition RNTuple.hxx:79
std::uint64_t fChecksum
The xxhash3 checksum of the serialized other members of the struct (excluding byte count and class ve...
Definition RNTuple.hxx:99
std::uint64_t fSeekFooter
The file offset of the footer excluding the TKey part.
Definition RNTuple.hxx:91
std::uint64_t GetLenFooter() const
Definition RNTuple.hxx:118
Long64_t Merge(TCollection *input, TFileMergeInfo *mergeInfo)
RNTuple implements the hadd MergeFile interface Merge this NTuple with the input list entries.
static constexpr std::uint16_t kVersionEpoch
Definition RNTuple.hxx:67
std::uint64_t GetNBytesHeader() const
Definition RNTuple.hxx:113
std::uint64_t GetChecksum() const
Definition RNTuple.hxx:120
std::uint64_t GetLenHeader() const
Definition RNTuple.hxx:114
std::uint16_t fVersionMinor
Changing the minor version indicates new optional fields added to the RNTuple meta-data.
Definition RNTuple.hxx:81
static constexpr std::uint16_t kVersionPatch
Definition RNTuple.hxx:70
std::uint16_t fVersionEpoch
Version of the RNTuple binary format that the writer supports (see specification).
Definition RNTuple.hxx:75
std::uint16_t GetVersionEpoch() const
Definition RNTuple.hxx:107
std::uint64_t fNBytesFooter
The size of the compressed ntuple footer.
Definition RNTuple.hxx:93
std::uint64_t fLenFooter
The size of the uncompressed ntuple footer.
Definition RNTuple.hxx:95
std::uint64_t GetNBytesFooter() const
Definition RNTuple.hxx:117
TFile * fFile
! The file from which the ntuple was streamed, registered in the custom streamer
Definition RNTuple.hxx:101
std::uint64_t GetSeekHeader() const
Definition RNTuple.hxx:112
std::uint64_t fLenHeader
The size of the uncompressed ntuple header.
Definition RNTuple.hxx:89
std::uint64_t fNBytesHeader
The size of the compressed ntuple header.
Definition RNTuple.hxx:87
std::uint16_t GetVersionMinor() const
Definition RNTuple.hxx:109
std::uint16_t fVersionPatch
Changing the patch version indicates new backported features from newer binary format versions.
Definition RNTuple.hxx:83
std::uint16_t GetVersionMajor() const
Definition RNTuple.hxx:108
std::uint16_t GetVersionPatch() const
Definition RNTuple.hxx:110
std::uint64_t GetSeekFooter() const
Definition RNTuple.hxx:116
static constexpr std::uint16_t kVersionMajor
Definition RNTuple.hxx:68
static constexpr std::uint16_t kVersionMinor
Definition RNTuple.hxx:69
std::uint64_t fSeekHeader
The file offset of the header excluding the TKey part.
Definition RNTuple.hxx:85
Collection abstract base class.
Definition TCollection.h:65
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...