|
|
|||
File indexing completed on 2026-05-06 08:52:38
0001 /// \file ROOT/RNTuple.hxx 0002 /// \ingroup NTuple 0003 /// \author Jakob Blomer <jblomer@cern.ch> 0004 /// \date 2023-09-19 0005 0006 /************************************************************************* 0007 * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. * 0008 * All rights reserved. * 0009 * * 0010 * For the licensing terms see $ROOTSYS/LICENSE. * 0011 * For the list of contributors see $ROOTSYS/README/CREDITS. * 0012 *************************************************************************/ 0013 0014 #ifndef ROOT_RNTuple 0015 #define ROOT_RNTuple 0016 0017 #include <Rtypes.h> 0018 0019 #include <cstdint> 0020 0021 class TCollection; 0022 class TFile; 0023 class TFileMergeInfo; 0024 0025 namespace ROOT { 0026 0027 class RNTuple; 0028 0029 namespace Internal { 0030 class RPageSourceFile; 0031 class RNTupleFileWriter; 0032 0033 RNTuple CreateAnchor(std::uint16_t versionEpoch, std::uint16_t versionMajor, std::uint16_t versionMinor, 0034 std::uint16_t versionPatch, std::uint64_t seekHeader, std::uint64_t nbytesHeader, 0035 std::uint64_t lenHeader, std::uint64_t seekFooter, std::uint64_t nbytesFooter, 0036 std::uint64_t lenFooter, std::uint64_t maxKeySize); 0037 0038 } // namespace Internal 0039 0040 // clang-format off 0041 /** 0042 \class ROOT::RNTuple 0043 \ingroup NTuple 0044 \brief Representation of an RNTuple data set in a ROOT file 0045 0046 \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. 0047 0048 The class points to the header and footer keys, which in turn have the references to the pages (via page lists). 0049 Only the RNTuple key will be listed in the list of keys. Like TBaskets, the pages are "invisible" keys. 0050 Byte offset references in the RNTuple header and footer reference directly the data part of page records, 0051 skipping the TFile key part. 0052 0053 In the list of keys, this object appears as "ROOT::RNTuple". 0054 It is the user-facing representation of an RNTuple data set in a ROOT file and 0055 it provides an API entry point to an RNTuple stored in a ROOT file. Its main purpose is to 0056 construct a page source for an RNTuple, which in turn can be used to read an RNTuple with an RDF or 0057 an RNTupleReader. 0058 0059 For instance, for an RNTuple called "Events" in a ROOT file, usage can be 0060 ~~~ {.cpp} 0061 auto f = TFile::Open("data.root"); 0062 auto ntpl = f->Get<ROOT::RNTuple>("Events"); 0063 auto reader = RNTupleReader::Open(ntpl); 0064 ~~~ 0065 */ 0066 // clang-format on 0067 class RNTuple final { 0068 friend class Internal::RNTupleFileWriter; 0069 friend class Internal::RPageSourceFile; 0070 0071 friend ROOT::RNTuple 0072 Internal::CreateAnchor(std::uint16_t versionEpoch, std::uint16_t versionMajor, std::uint16_t versionMinor, 0073 std::uint16_t versionPatch, std::uint64_t seekHeader, std::uint64_t nbytesHeader, 0074 std::uint64_t lenHeader, std::uint64_t seekFooter, std::uint64_t nbytesFooter, 0075 std::uint64_t lenFooter, std::uint64_t maxKeySize); 0076 0077 public: 0078 static constexpr std::uint16_t kVersionEpoch = 1; 0079 static constexpr std::uint16_t kVersionMajor = 0; 0080 static constexpr std::uint16_t kVersionMinor = 1; 0081 static constexpr std::uint16_t kVersionPatch = 0; 0082 0083 private: 0084 /// Version of the RNTuple binary format that the writer supports (see specification). 0085 /// Changing the epoch indicates backward-incompatible changes 0086 std::uint16_t fVersionEpoch = kVersionEpoch; 0087 /// Changing the major version indicates forward incompatible changes; such changes should correspond to a new 0088 /// bit in the feature flag of the RNTuple header. 0089 /// For the pre-release epoch 0, indicates the release candidate number 0090 std::uint16_t fVersionMajor = kVersionMajor; 0091 /// Changing the minor version indicates new optional fields added to the RNTuple metadata 0092 std::uint16_t fVersionMinor = kVersionMinor; 0093 /// Changing the patch version indicates new backported features from newer binary format versions 0094 std::uint16_t fVersionPatch = kVersionPatch; 0095 /// The file offset of the header excluding the TKey part 0096 std::uint64_t fSeekHeader = 0; 0097 /// The size of the compressed ntuple header 0098 std::uint64_t fNBytesHeader = 0; 0099 /// The size of the uncompressed ntuple header 0100 std::uint64_t fLenHeader = 0; 0101 /// The file offset of the footer excluding the TKey part 0102 std::uint64_t fSeekFooter = 0; 0103 /// The size of the compressed ntuple footer 0104 std::uint64_t fNBytesFooter = 0; 0105 /// The size of the uncompressed ntuple footer 0106 std::uint64_t fLenFooter = 0; 0107 /// The maximum size for a TKey payload. Payloads bigger than this size will be written as multiple blobs. 0108 std::uint64_t fMaxKeySize = 0; 0109 0110 TFile *fFile = nullptr; ///<! The file from which the ntuple was streamed, registered in the custom streamer 0111 0112 public: 0113 RNTuple() = default; 0114 ~RNTuple() = default; 0115 0116 std::uint16_t GetVersionEpoch() const { return fVersionEpoch; } 0117 std::uint16_t GetVersionMajor() const { return fVersionMajor; } 0118 std::uint16_t GetVersionMinor() const { return fVersionMinor; } 0119 std::uint16_t GetVersionPatch() const { return fVersionPatch; } 0120 0121 std::uint64_t GetSeekHeader() const { return fSeekHeader; } 0122 std::uint64_t GetNBytesHeader() const { return fNBytesHeader; } 0123 std::uint64_t GetLenHeader() const { return fLenHeader; } 0124 0125 std::uint64_t GetSeekFooter() const { return fSeekFooter; } 0126 std::uint64_t GetNBytesFooter() const { return fNBytesFooter; } 0127 std::uint64_t GetLenFooter() const { return fLenFooter; } 0128 std::uint64_t GetMaxKeySize() const { return fMaxKeySize; } 0129 0130 /// RNTuple implements the hadd MergeFile interface 0131 /// Merge this NTuple with the input list entries 0132 Long64_t Merge(TCollection *input, TFileMergeInfo *mergeInfo); 0133 0134 /// NOTE: if you change this version you also need to update RTFNTuple::fClassVersion in RMiniFile.cxx 0135 ClassDefNV(RNTuple, 2); 0136 }; // class RNTuple 0137 0138 } // namespace ROOT 0139 0140 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|