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
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2023-09-19
5
6/*************************************************************************
7 * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. *
8 * All rights reserved. *
9 * *
10 * For the licensing terms see $ROOTSYS/LICENSE. *
11 * For the list of contributors see $ROOTSYS/README/CREDITS. *
12 *************************************************************************/
13
14#ifndef ROOT_RNTuple
15#define ROOT_RNTuple
16
17#include <Rtypes.h>
18
19#include <cstdint>
20
21class TCollection;
22class TFile;
23class TFileMergeInfo;
24
25namespace ROOT {
26
27class RNTuple;
28
29namespace Internal {
30class RPageSourceFile;
31class RNTupleFileWriter;
32
33RNTuple CreateAnchor(std::uint16_t versionEpoch, std::uint16_t versionMajor, std::uint16_t versionMinor,
34 std::uint16_t versionPatch, std::uint64_t seekHeader, std::uint64_t nbytesHeader,
35 std::uint64_t lenHeader, std::uint64_t seekFooter, std::uint64_t nbytesFooter,
36 std::uint64_t lenFooter, std::uint64_t maxKeySize);
37
38} // namespace Internal
39
40// clang-format off
41/**
42\class ROOT::RNTuple
43\ingroup NTuple
44\brief Representation of an RNTuple data set in a ROOT file
45
46\note This is the documentation for the RNTuple anchor class. For a generic introduction to RNTuple, see \ref NTuple "the RNTuple Introduction". For reading RNTuples, see RNTupleReader. For writing RNTuples, see RNTupleWriter.
47For exploring the contents of an RNTuple, use ROOT::RDataFrame. See \ref rosetta-stone for examples how to draw and scan the contents.
48
49The class points to the header and footer keys, which in turn have the references to the pages (via page lists).
50Only the RNTuple key will be listed in the list of keys. Like TBaskets, the pages are "invisible" keys.
51Byte offset references in the RNTuple header and footer reference directly the data part of page records,
52skipping the TFile key part.
53
54In the list of keys, this object appears as "ROOT::RNTuple".
55It is the user-facing representation of an RNTuple data set in a ROOT file and
56it provides an API entry point to an RNTuple stored in a ROOT file. Its main purpose is to
57construct a page source for an RNTuple, which in turn can be used to read an RNTuple with an RDF or
58an RNTupleReader.
59
60For instance, for an RNTuple called "Events" in a ROOT file, usage can be
61~~~ {.cpp}
62auto f = TFile::Open("data.root");
63auto ntpl = f->Get<ROOT::RNTuple>("Events");
64auto reader = RNTupleReader::Open(ntpl);
65~~~
66*/
67// clang-format on
71
72 friend ROOT::RNTuple
73 Internal::CreateAnchor(std::uint16_t versionEpoch, std::uint16_t versionMajor, std::uint16_t versionMinor,
74 std::uint16_t versionPatch, std::uint64_t seekHeader, std::uint64_t nbytesHeader,
75 std::uint64_t lenHeader, std::uint64_t seekFooter, std::uint64_t nbytesFooter,
76 std::uint64_t lenFooter, std::uint64_t maxKeySize);
77
78public:
79 static constexpr std::uint16_t kVersionEpoch = 1;
80 static constexpr std::uint16_t kVersionMajor = 0;
81 static constexpr std::uint16_t kVersionMinor = 1;
82 static constexpr std::uint16_t kVersionPatch = 2;
83
84private:
85 /// Version of the RNTuple binary format that the writer supports (see specification).
86 /// Changing the epoch indicates backward-incompatible changes
88 /// Changing the major version indicates forward incompatible changes; such changes should correspond to a new
89 /// bit in the feature flag of the RNTuple header.
90 /// For the pre-release epoch 0, indicates the release candidate number
92 /// Changing the minor version indicates new optional fields added to the RNTuple metadata
94 /// Changing the patch version indicates clarifications or new backported features from newer binary format versions
96 /// The file offset of the header excluding the TKey part
97 std::uint64_t fSeekHeader = 0;
98 /// The size of the compressed ntuple header
99 std::uint64_t fNBytesHeader = 0;
100 /// The size of the uncompressed ntuple header
101 std::uint64_t fLenHeader = 0;
102 /// The file offset of the footer excluding the TKey part
103 std::uint64_t fSeekFooter = 0;
104 /// The size of the compressed ntuple footer
105 std::uint64_t fNBytesFooter = 0;
106 /// The size of the uncompressed ntuple footer
107 std::uint64_t fLenFooter = 0;
108 /// The maximum size for a TKey payload. Payloads bigger than this size will be written as multiple blobs.
109 std::uint64_t fMaxKeySize = 0;
110
111 TFile *fFile = nullptr; ///<! The file from which the ntuple was streamed, registered in the custom streamer
112
113public:
114 RNTuple() = default;
115 ~RNTuple() = default;
116
117 std::uint16_t GetVersionEpoch() const { return fVersionEpoch; }
118 std::uint16_t GetVersionMajor() const { return fVersionMajor; }
119 std::uint16_t GetVersionMinor() const { return fVersionMinor; }
120 std::uint16_t GetVersionPatch() const { return fVersionPatch; }
121
122 std::uint64_t GetSeekHeader() const { return fSeekHeader; }
123 std::uint64_t GetNBytesHeader() const { return fNBytesHeader; }
124 std::uint64_t GetLenHeader() const { return fLenHeader; }
125
126 std::uint64_t GetSeekFooter() const { return fSeekFooter; }
127 std::uint64_t GetNBytesFooter() const { return fNBytesFooter; }
128 std::uint64_t GetLenFooter() const { return fLenFooter; }
129 std::uint64_t GetMaxKeySize() const { return fMaxKeySize; }
130
131 /// RNTuple implements the hadd MergeFile interface
132 /// Merge this NTuple with the input list entries
134
135 /// NOTE: if you change this version you also need to update RTFNTuple::fClassVersion in RMiniFile.cxx
137}; // class RNTuple
138
139} // namespace ROOT
140
141#endif
#define ClassDefNV(name, id)
Definition Rtypes.h:352
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Write RNTuple data blocks in a TFile or a bare file container.
Storage provider that reads ntuple pages from a file.
Representation of an RNTuple data set in a ROOT file.
Definition RNTuple.hxx:68
Long64_t Merge(TCollection *input, TFileMergeInfo *mergeInfo)
RNTuple implements the hadd MergeFile interface Merge this NTuple with the input list entries.
std::uint64_t fSeekFooter
The file offset of the footer excluding the TKey part.
Definition RNTuple.hxx:103
std::uint64_t fNBytesFooter
The size of the compressed ntuple footer.
Definition RNTuple.hxx:105
std::uint64_t GetLenFooter() const
Definition RNTuple.hxx:128
static constexpr std::uint16_t kVersionPatch
Definition RNTuple.hxx:82
std::uint64_t GetSeekHeader() const
Definition RNTuple.hxx:122
std::uint16_t fVersionMinor
Changing the minor version indicates new optional fields added to the RNTuple metadata.
Definition RNTuple.hxx:93
static constexpr std::uint16_t kVersionMajor
Definition RNTuple.hxx:80
RNTuple()=default
std::uint16_t GetVersionMajor() const
Definition RNTuple.hxx:118
std::uint64_t fSeekHeader
The file offset of the header excluding the TKey part.
Definition RNTuple.hxx:97
std::uint64_t GetNBytesFooter() const
Definition RNTuple.hxx:127
static constexpr std::uint16_t kVersionEpoch
Definition RNTuple.hxx:79
std::uint64_t GetNBytesHeader() const
Definition RNTuple.hxx:123
std::uint64_t fMaxKeySize
The maximum size for a TKey payload. Payloads bigger than this size will be written as multiple blobs...
Definition RNTuple.hxx:109
~RNTuple()=default
std::uint16_t GetVersionMinor() const
Definition RNTuple.hxx:119
std::uint64_t fNBytesHeader
The size of the compressed ntuple header.
Definition RNTuple.hxx:99
std::uint64_t fLenHeader
The size of the uncompressed ntuple header.
Definition RNTuple.hxx:101
std::uint16_t GetVersionPatch() const
Definition RNTuple.hxx:120
std::uint64_t fLenFooter
The size of the uncompressed ntuple footer.
Definition RNTuple.hxx:107
std::uint64_t GetMaxKeySize() const
Definition RNTuple.hxx:129
std::uint64_t GetLenHeader() const
Definition RNTuple.hxx:124
std::uint16_t fVersionPatch
Changing the patch version indicates clarifications or new backported features from newer binary form...
Definition RNTuple.hxx:95
TFile * fFile
! The file from which the ntuple was streamed, registered in the custom streamer
Definition RNTuple.hxx:111
std::uint16_t fVersionMajor
Changing the major version indicates forward incompatible changes; such changes should correspond to ...
Definition RNTuple.hxx:91
std::uint64_t GetSeekFooter() const
Definition RNTuple.hxx:126
static constexpr std::uint16_t kVersionMinor
Definition RNTuple.hxx:81
std::uint16_t fVersionEpoch
Version of the RNTuple binary format that the writer supports (see specification).
Definition RNTuple.hxx:87
std::uint16_t GetVersionEpoch() const
Definition RNTuple.hxx:117
Collection abstract base class.
Definition TCollection.h:65
A class to pass information from the TFileMerger to the objects being merged.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:130
RNTuple CreateAnchor(std::uint16_t versionEpoch, std::uint16_t versionMajor, std::uint16_t versionMinor, std::uint16_t versionPatch, std::uint64_t seekHeader, std::uint64_t nbytesHeader, std::uint64_t lenHeader, std::uint64_t seekFooter, std::uint64_t nbytesFooter, std::uint64_t lenFooter, std::uint64_t maxKeySize)
Definition RNTuple.cxx:52