Logo ROOT  
Reference Guide
RNTupleOptions.hxx
Go to the documentation of this file.
1/// \file ROOT/RNTupleOptions.hxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2019-08-25
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_RNTupleOptions
17#define ROOT7_RNTupleOptions
18
19#include <Compression.h>
20#include <ROOT/RNTupleUtil.hxx>
21
22#include <memory>
23
24namespace ROOT {
25namespace Experimental {
26
27// clang-format off
28/**
29\class ROOT::Experimental::ENTupleContainerFormat
30\ingroup NTuple
31\brief Describes the options for wrapping RNTuple data in files
32*/
33// clang-format on
35 kTFile, // ROOT TFile
36 kBare, // A thin envelope supporting a single RNTuple only
37};
38
39
40// clang-format off
41/**
42\class ROOT::Experimental::RNTupleWriteOptions
43\ingroup NTuple
44\brief Common user-tunable settings for storing ntuples
45
46All page sink classes need to support the common options.
47*/
48// clang-format on
52 /// Approximation of the target compressed cluster size
53 std::size_t fApproxZippedClusterSize = 50 * 1000 * 1000;
54 /// Memory limit for committing a cluster: with very high compression ratio, we need a limit
55 /// on how large the I/O buffer can grow during writing.
56 std::size_t fMaxUnzippedClusterSize = 512 * 1024 * 1024;
57 /// Should be just large enough so that the compression ratio does not benefit much more from larger pages.
58 /// Unless the cluster is too small to contain a sufficiently large page, pages are
59 /// fApproxUnzippedPageSize in size and tail pages (the last page in a cluster) is between
60 /// fApproxUnzippedPageSize/2 and fApproxUnzippedPageSize * 1.5 in size.
61 std::size_t fApproxUnzippedPageSize = 64 * 1024;
62 bool fUseBufferedWrite = true;
63
64public:
65 virtual ~RNTupleWriteOptions() = default;
66 virtual std::unique_ptr<RNTupleWriteOptions> Clone() const;
67
68 int GetCompression() const { return fCompression; }
69 void SetCompression(int val) { fCompression = val; }
70 void SetCompression(RCompressionSetting::EAlgorithm algorithm, int compressionLevel) {
71 fCompression = CompressionSettings(algorithm, compressionLevel);
72 }
73
76
78 void SetApproxZippedClusterSize(std::size_t val);
79
80 std::size_t GetMaxUnzippedClusterSize() const { return fMaxUnzippedClusterSize; }
81 void SetMaxUnzippedClusterSize(std::size_t val);
82
83 std::size_t GetApproxUnzippedPageSize() const { return fApproxUnzippedPageSize; }
84 void SetApproxUnzippedPageSize(std::size_t val);
85
86 bool GetUseBufferedWrite() const { return fUseBufferedWrite; }
87 void SetUseBufferedWrite(bool val) { fUseBufferedWrite = val; }
88};
89
90// clang-format off
91/**
92\class ROOT::Experimental::RNTupleWriteOptionsDaos
93\ingroup NTuple
94\brief DAOS-specific user-tunable settings for storing ntuples
95*/
96// clang-format on
98 std::string fObjectClass{"SX"};
99
100public:
101 virtual ~RNTupleWriteOptionsDaos() = default;
102 std::unique_ptr<RNTupleWriteOptions> Clone() const override
103 { return std::make_unique<RNTupleWriteOptionsDaos>(*this); }
104
105 const std::string &GetObjectClass() const { return fObjectClass; }
106 /// Set the object class used to generate OIDs that relate to user data. Any
107 /// `OC_xxx` constant defined in `daos_obj_class.h` may be used here without
108 /// the OC_ prefix.
109 void SetObjectClass(const std::string &val) { fObjectClass = val; }
110};
111
112// clang-format off
113/**
114\class ROOT::Experimental::RNTupleReadOptions
115\ingroup NTuple
116\brief Common user-tunable settings for reading ntuples
117
118All page source classes need to support the common options.
119*/
120// clang-format on
122public:
127 };
128
129private:
131 unsigned int fClusterBunchSize = 1;
132
133public:
136 unsigned int GetClusterBunchSize() const { return fClusterBunchSize; }
137 void SetClusterBunchSize(unsigned int val) { fClusterBunchSize = val; }
138};
139
140} // namespace Experimental
141} // namespace ROOT
142
143#endif
@ kDefault
Definition: TSystem.h:229
Common user-tunable settings for reading ntuples.
void SetClusterBunchSize(unsigned int val)
DAOS-specific user-tunable settings for storing ntuples.
const std::string & GetObjectClass() const
void SetObjectClass(const std::string &val)
Set the object class used to generate OIDs that relate to user data.
std::unique_ptr< RNTupleWriteOptions > Clone() const override
Common user-tunable settings for storing ntuples.
void SetContainerFormat(ENTupleContainerFormat val)
void SetApproxZippedClusterSize(std::size_t val)
virtual std::unique_ptr< RNTupleWriteOptions > Clone() const
std::size_t fApproxZippedClusterSize
Approximation of the target compressed cluster size.
std::size_t fMaxUnzippedClusterSize
Memory limit for committing a cluster: with very high compression ratio, we need a limit on how large...
std::size_t fApproxUnzippedPageSize
Should be just large enough so that the compression ratio does not benefit much more from larger page...
void SetApproxUnzippedPageSize(std::size_t val)
ENTupleContainerFormat GetContainerFormat() const
void SetCompression(RCompressionSetting::EAlgorithm algorithm, int compressionLevel)
void SetMaxUnzippedClusterSize(std::size_t val)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
int CompressionSettings(RCompressionSetting::EAlgorithm algorithm, int compressionLevel)
@ kUseAnalysis
Use the default analysis setting; fast reading but poor compression ratio.
Definition: Compression.h:52