diff --git a/tree/ntuple/CMakeLists.txt b/tree/ntuple/CMakeLists.txt index 9d867cb558562..62f171ff39637 100644 --- a/tree/ntuple/CMakeLists.txt +++ b/tree/ntuple/CMakeLists.txt @@ -31,12 +31,14 @@ HEADERS ROOT/RNTupleMerger.hxx ROOT/RNTupleMetrics.hxx ROOT/RNTupleModel.hxx - ROOT/RNTupleOptions.hxx ROOT/RNTupleParallelWriter.hxx + ROOT/RNTupleReadOptions.hxx ROOT/RNTupleReader.hxx ROOT/RNTupleSerialize.hxx ROOT/RNTupleUtil.hxx ROOT/RNTupleView.hxx + ROOT/RNTupleWriteOptions.hxx + ROOT/RNTupleWriteOptionsDaos.hxx ROOT/RNTupleWriter.hxx ROOT/RNTupleZip.hxx ROOT/RPage.hxx @@ -62,11 +64,11 @@ SOURCES v7/src/RNTupleMerger.cxx v7/src/RNTupleMetrics.cxx v7/src/RNTupleModel.cxx - v7/src/RNTupleOptions.cxx v7/src/RNTupleParallelWriter.cxx v7/src/RNTupleReader.cxx v7/src/RNTupleSerialize.cxx v7/src/RNTupleUtil.cxx + v7/src/RNTupleWriteOptions.cxx v7/src/RNTupleWriter.cxx v7/src/RPage.cxx v7/src/RPageAllocator.cxx diff --git a/tree/ntuple/v7/inc/ROOT/RMiniFile.hxx b/tree/ntuple/v7/inc/ROOT/RMiniFile.hxx index c29d055ba3b6e..e731a81f68e86 100644 --- a/tree/ntuple/v7/inc/ROOT/RMiniFile.hxx +++ b/tree/ntuple/v7/inc/ROOT/RMiniFile.hxx @@ -18,7 +18,6 @@ #include #include -#include #include #include diff --git a/tree/ntuple/v7/inc/ROOT/RNTupleParallelWriter.hxx b/tree/ntuple/v7/inc/ROOT/RNTupleParallelWriter.hxx index 4f8e1251cb258..b8864b5df2824 100644 --- a/tree/ntuple/v7/inc/ROOT/RNTupleParallelWriter.hxx +++ b/tree/ntuple/v7/inc/ROOT/RNTupleParallelWriter.hxx @@ -17,7 +17,7 @@ #define ROOT7_RNTupleParallelWriter #include -#include +#include #include #include diff --git a/tree/ntuple/v7/inc/ROOT/RNTupleReadOptions.hxx b/tree/ntuple/v7/inc/ROOT/RNTupleReadOptions.hxx new file mode 100644 index 0000000000000..84a4dcafbe7c0 --- /dev/null +++ b/tree/ntuple/v7/inc/ROOT/RNTupleReadOptions.hxx @@ -0,0 +1,53 @@ +/// \file ROOT/RNTupleReadOptions.hxx +/// \ingroup NTuple ROOT7 +/// \author Jakob Blomer +/// \date 2024-02-22 +/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback +/// is welcome! + +/************************************************************************* + * Copyright (C) 1995-2024, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT7_RNTupleReadOptions +#define ROOT7_RNTupleReadOptions + +namespace ROOT { +namespace Experimental { + +// clang-format off +/** +\class ROOT::Experimental::RNTupleReadOptions +\ingroup NTuple +\brief Common user-tunable settings for reading ntuples + +All page source classes need to support the common options. +*/ +// clang-format on +class RNTupleReadOptions { +public: + enum EClusterCache { + kOff, + kOn, + kDefault = kOn, + }; + +private: + EClusterCache fClusterCache = EClusterCache::kDefault; + unsigned int fClusterBunchSize = 1; + +public: + EClusterCache GetClusterCache() const { return fClusterCache; } + void SetClusterCache(EClusterCache val) { fClusterCache = val; } + unsigned int GetClusterBunchSize() const { return fClusterBunchSize; } + void SetClusterBunchSize(unsigned int val) { fClusterBunchSize = val; } +}; + +} // namespace Experimental +} // namespace ROOT + +#endif diff --git a/tree/ntuple/v7/inc/ROOT/RNTupleReader.hxx b/tree/ntuple/v7/inc/ROOT/RNTupleReader.hxx index 556d5aba99ff1..69b8c5c01d268 100644 --- a/tree/ntuple/v7/inc/ROOT/RNTupleReader.hxx +++ b/tree/ntuple/v7/inc/ROOT/RNTupleReader.hxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tree/ntuple/v7/inc/ROOT/RNTupleOptions.hxx b/tree/ntuple/v7/inc/ROOT/RNTupleWriteOptions.hxx similarity index 60% rename from tree/ntuple/v7/inc/ROOT/RNTupleOptions.hxx rename to tree/ntuple/v7/inc/ROOT/RNTupleWriteOptions.hxx index 37c945d08a76e..c27e6805d9686 100644 --- a/tree/ntuple/v7/inc/ROOT/RNTupleOptions.hxx +++ b/tree/ntuple/v7/inc/ROOT/RNTupleWriteOptions.hxx @@ -1,7 +1,7 @@ -/// \file ROOT/RNTupleOptions.hxx +/// \file ROOT/RNTupleWriteOptions.hxx /// \ingroup NTuple ROOT7 /// \author Jakob Blomer -/// \date 2019-08-25 +/// \date 2024-02-22 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback /// is welcome! @@ -13,12 +13,13 @@ * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ -#ifndef ROOT7_RNTupleOptions -#define ROOT7_RNTupleOptions +#ifndef ROOT7_RNTupleWriteOptions +#define ROOT7_RNTupleWriteOptions #include -#include +#include +#include #include namespace ROOT { @@ -62,7 +63,8 @@ public: int GetCompression() const { return fCompression; } void SetCompression(int val) { fCompression = val; } - void SetCompression(RCompressionSetting::EAlgorithm::EValues algorithm, int compressionLevel) { + void SetCompression(RCompressionSetting::EAlgorithm::EValues algorithm, int compressionLevel) + { fCompression = CompressionSettings(algorithm, compressionLevel); } @@ -82,67 +84,7 @@ public: void SetHasSmallClusters(bool val) { fHasSmallClusters = val; } }; -// clang-format off -/** -\class ROOT::Experimental::RNTupleWriteOptionsDaos -\ingroup NTuple -\brief DAOS-specific user-tunable settings for storing ntuples -*/ -// clang-format on -class RNTupleWriteOptionsDaos : public RNTupleWriteOptions { - std::string fObjectClass{"SX"}; - /// The maximum cage size is set to the equivalent of 16 uncompressed pages - 1MiB by default. Empirically, such a - /// cage size yields acceptable results in throughput and page granularity for most use cases. A `fMaxCageSize` of 0 - /// disables the caging mechanism. - uint32_t fMaxCageSize = 16 * RNTupleWriteOptions::fApproxUnzippedPageSize; - -public: - ~RNTupleWriteOptionsDaos() override = default; - std::unique_ptr Clone() const override - { return std::make_unique(*this); } - - const std::string &GetObjectClass() const { return fObjectClass; } - /// Set the object class used to generate OIDs that relate to user data. Any - /// `OC_xxx` constant defined in `daos_obj_class.h` may be used here without - /// the OC_ prefix. - void SetObjectClass(const std::string &val) { fObjectClass = val; } - - uint32_t GetMaxCageSize() const { return fMaxCageSize; } - /// Set the upper bound for page concatenation into cages, in bytes. It is assumed - /// that cage size will be no smaller than the approximate uncompressed page size. - /// To disable page concatenation, set this value to 0. - void SetMaxCageSize(uint32_t cageSz) { fMaxCageSize = cageSz; } -}; - -// clang-format off -/** -\class ROOT::Experimental::RNTupleReadOptions -\ingroup NTuple -\brief Common user-tunable settings for reading ntuples - -All page source classes need to support the common options. -*/ -// clang-format on -class RNTupleReadOptions { -public: - enum EClusterCache { - kOff, - kOn, - kDefault = kOn, - }; - -private: - EClusterCache fClusterCache = EClusterCache::kDefault; - unsigned int fClusterBunchSize = 1; - -public: - EClusterCache GetClusterCache() const { return fClusterCache; } - void SetClusterCache(EClusterCache val) { fClusterCache = val; } - unsigned int GetClusterBunchSize() const { return fClusterBunchSize; } - void SetClusterBunchSize(unsigned int val) { fClusterBunchSize = val; } -}; - } // namespace Experimental } // namespace ROOT -#endif +#endif // ROOT7_RNTupleWriteOptions diff --git a/tree/ntuple/v7/inc/ROOT/RNTupleWriteOptionsDaos.hxx b/tree/ntuple/v7/inc/ROOT/RNTupleWriteOptionsDaos.hxx new file mode 100644 index 0000000000000..57c61b15f6e2f --- /dev/null +++ b/tree/ntuple/v7/inc/ROOT/RNTupleWriteOptionsDaos.hxx @@ -0,0 +1,66 @@ +/// \file ROOT/RNTupleWriteOptionsDaos.hxx +/// \ingroup NTuple ROOT7 +/// \author Jakob Blomer +/// \date 2024-02-22 +/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback +/// is welcome! + +/************************************************************************* + * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT7_RNTupleWriteOptionsDaos +#define ROOT7_RNTupleWriteOptionsDaos + +#include + +#include +#include +#include +#include + +namespace ROOT { +namespace Experimental { + +// clang-format off +/** +\class ROOT::Experimental::RNTupleWriteOptionsDaos +\ingroup NTuple +\brief DAOS-specific user-tunable settings for storing ntuples +*/ +// clang-format on +class RNTupleWriteOptionsDaos : public RNTupleWriteOptions { + std::string fObjectClass{"SX"}; + /// The maximum cage size is set to the equivalent of 16 uncompressed pages - 1MiB by default. Empirically, such a + /// cage size yields acceptable results in throughput and page granularity for most use cases. A `fMaxCageSize` of 0 + /// disables the caging mechanism. + uint32_t fMaxCageSize = 16 * RNTupleWriteOptions::fApproxUnzippedPageSize; + +public: + ~RNTupleWriteOptionsDaos() override = default; + std::unique_ptr Clone() const override + { + return std::make_unique(*this); + } + + const std::string &GetObjectClass() const { return fObjectClass; } + /// Set the object class used to generate OIDs that relate to user data. Any + /// `OC_xxx` constant defined in `daos_obj_class.h` may be used here without + /// the OC_ prefix. + void SetObjectClass(const std::string &val) { fObjectClass = val; } + + uint32_t GetMaxCageSize() const { return fMaxCageSize; } + /// Set the upper bound for page concatenation into cages, in bytes. It is assumed + /// that cage size will be no smaller than the approximate uncompressed page size. + /// To disable page concatenation, set this value to 0. + void SetMaxCageSize(uint32_t cageSz) { fMaxCageSize = cageSz; } +}; + +} // namespace Experimental +} // namespace ROOT + +#endif // ROOT7_RNTupleWriteOptionsDaos diff --git a/tree/ntuple/v7/inc/ROOT/RPageStorage.hxx b/tree/ntuple/v7/inc/ROOT/RPageStorage.hxx index d747dbb3e5405..2bee22bf96ea2 100644 --- a/tree/ntuple/v7/inc/ROOT/RPageStorage.hxx +++ b/tree/ntuple/v7/inc/ROOT/RPageStorage.hxx @@ -19,7 +19,8 @@ #include #include #include -#include +#include +#include #include #include #include diff --git a/tree/ntuple/v7/src/RNTupleFillContext.cxx b/tree/ntuple/v7/src/RNTupleFillContext.cxx index 6ca7e2783fd8e..11d89be517d76 100644 --- a/tree/ntuple/v7/src/RNTupleFillContext.cxx +++ b/tree/ntuple/v7/src/RNTupleFillContext.cxx @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include diff --git a/tree/ntuple/v7/src/RNTupleOptions.cxx b/tree/ntuple/v7/src/RNTupleWriteOptions.cxx similarity index 89% rename from tree/ntuple/v7/src/RNTupleOptions.cxx rename to tree/ntuple/v7/src/RNTupleWriteOptions.cxx index ce441e8e3cc8d..c3b77493174ae 100644 --- a/tree/ntuple/v7/src/RNTupleOptions.cxx +++ b/tree/ntuple/v7/src/RNTupleWriteOptions.cxx @@ -1,12 +1,12 @@ -/// \file RNTupleOptions.cxx +/// \file RNTupleWriteOptions.cxx /// \ingroup NTuple ROOT7 /// \author Jakob Blomer -/// \date 2021-07-28 +/// \date 2024-02-22 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback /// is welcome! /************************************************************************* - * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. * + * Copyright (C) 1995-2024, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * @@ -14,7 +14,7 @@ *************************************************************************/ #include -#include +#include #include @@ -41,8 +41,7 @@ void EnsureValidTunables(std::size_t zippedClusterSize, std::size_t unzippedClus } // anonymous namespace -std::unique_ptr -ROOT::Experimental::RNTupleWriteOptions::Clone() const +std::unique_ptr ROOT::Experimental::RNTupleWriteOptions::Clone() const { return std::make_unique(*this); } diff --git a/tree/ntuple/v7/src/RNTupleWriter.cxx b/tree/ntuple/v7/src/RNTupleWriter.cxx index 48840ef81c656..e703495b36364 100644 --- a/tree/ntuple/v7/src/RNTupleWriter.cxx +++ b/tree/ntuple/v7/src/RNTupleWriter.cxx @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tree/ntuple/v7/src/RPageSinkBuf.cxx b/tree/ntuple/v7/src/RPageSinkBuf.cxx index 86b467fcfcbea..f41d1f5506d32 100644 --- a/tree/ntuple/v7/src/RPageSinkBuf.cxx +++ b/tree/ntuple/v7/src/RPageSinkBuf.cxx @@ -15,8 +15,8 @@ * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ -#include #include +#include #include #include diff --git a/tree/ntuple/v7/src/RPageSourceFriends.cxx b/tree/ntuple/v7/src/RPageSourceFriends.cxx index 47ba8342ed309..b46cf3199c552 100644 --- a/tree/ntuple/v7/src/RPageSourceFriends.cxx +++ b/tree/ntuple/v7/src/RPageSourceFriends.cxx @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include diff --git a/tree/ntuple/v7/src/RPageStorageDaos.cxx b/tree/ntuple/v7/src/RPageStorageDaos.cxx index 80b89076551ff..00a44f304b6e0 100644 --- a/tree/ntuple/v7/src/RPageStorageDaos.cxx +++ b/tree/ntuple/v7/src/RPageStorageDaos.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/tree/ntuple/v7/test/ntuple_cluster.cxx b/tree/ntuple/v7/test/ntuple_cluster.cxx index 66d5fd9362bad..bdd2ac1e56f02 100644 --- a/tree/ntuple/v7/test/ntuple_cluster.cxx +++ b/tree/ntuple/v7/test/ntuple_cluster.cxx @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tree/ntuple/v7/test/ntuple_endian.cxx b/tree/ntuple/v7/test/ntuple_endian.cxx index 2ee92f76faa28..4ee0ca6460b7a 100644 --- a/tree/ntuple/v7/test/ntuple_endian.cxx +++ b/tree/ntuple/v7/test/ntuple_endian.cxx @@ -8,7 +8,8 @@ #include #include #include -#include +#include +#include #include #include #include diff --git a/tree/ntuple/v7/test/ntuple_test.hxx b/tree/ntuple/v7/test/ntuple_test.hxx index 90ea0a1712d7e..d6c2307a1a45f 100644 --- a/tree/ntuple/v7/test/ntuple_test.hxx +++ b/tree/ntuple/v7/test/ntuple_test.hxx @@ -10,10 +10,12 @@ #include #include #include -#include +#include #include #include #include +#include +#include #include #include #include diff --git a/tree/ntupleutil/v7/inc/ROOT/RNTupleImporter.hxx b/tree/ntupleutil/v7/inc/ROOT/RNTupleImporter.hxx index 3efa0dab1276f..0107a33bc15c6 100644 --- a/tree/ntupleutil/v7/inc/ROOT/RNTupleImporter.hxx +++ b/tree/ntupleutil/v7/inc/ROOT/RNTupleImporter.hxx @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include diff --git a/tree/ntupleutil/v7/src/RNTupleImporter.cxx b/tree/ntupleutil/v7/src/RNTupleImporter.cxx index e643ef39aba19..71a0e60720d9e 100644 --- a/tree/ntupleutil/v7/src/RNTupleImporter.cxx +++ b/tree/ntupleutil/v7/src/RNTupleImporter.cxx @@ -16,8 +16,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/tree/ntupleutil/v7/test/ntuple_inspector.cxx b/tree/ntupleutil/v7/test/ntuple_inspector.cxx index 39fe6f2769f43..3b8f73e4f4ea0 100644 --- a/tree/ntupleutil/v7/test/ntuple_inspector.cxx +++ b/tree/ntupleutil/v7/test/ntuple_inspector.cxx @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/tree/ntupleutil/v7/test/ntupleutil_test.hxx b/tree/ntupleutil/v7/test/ntupleutil_test.hxx index e1423436c90c4..0685d8f5576fb 100644 --- a/tree/ntupleutil/v7/test/ntupleutil_test.hxx +++ b/tree/ntupleutil/v7/test/ntupleutil_test.hxx @@ -5,8 +5,9 @@ #include #include -#include +#include #include +#include #include /** diff --git a/tutorials/v7/ntuple/ntpl005_introspection.C b/tutorials/v7/ntuple/ntpl005_introspection.C index 87e2c3a4c19d7..6f5f698c50c84 100644 --- a/tutorials/v7/ntuple/ntpl005_introspection.C +++ b/tutorials/v7/ntuple/ntpl005_introspection.C @@ -15,8 +15,8 @@ // Do not use for real data! #include -#include #include +#include #include #include diff --git a/tutorials/v7/ntuple/ntpl011_global_temperatures.C b/tutorials/v7/ntuple/ntpl011_global_temperatures.C index dde2b6fe70d3e..0e2d29998dea9 100644 --- a/tutorials/v7/ntuple/ntpl011_global_temperatures.C +++ b/tutorials/v7/ntuple/ntpl011_global_temperatures.C @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -88,9 +87,7 @@ void Ingest() // Hand-over the data model to a newly created ntuple of name "globalTempData", stored in kNTupleFileName. // In return, get a unique pointer to a fillable ntuple (first compress the file). - RNTupleWriteOptions options; - options.SetCompression(ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose); - auto ntuple = RNTupleWriter::Recreate(std::move(model), "GlobalTempData", kNTupleFileName, options); + auto ntuple = RNTupleWriter::Recreate(std::move(model), "GlobalTempData", kNTupleFileName); auto file = RRawFile::Create(kRawDataUrl); std::string record;