Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-22 08:52:53

0001 // Author: Guilherme Amadio, Enrico Guiraud, Danilo Piparo CERN  2/2018
0002 
0003 /*************************************************************************
0004  * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOT_RSNAPSHOTOPTIONS
0012 #define ROOT_RSNAPSHOTOPTIONS
0013 
0014 #include <Compression.h>
0015 #include <optional>
0016 #include <string_view>
0017 #include <string>
0018 
0019 namespace ROOT {
0020 
0021 namespace RDF {
0022 enum class ESnapshotOutputFormat {
0023    kDefault,
0024    kTTree,
0025    kRNTuple
0026 };
0027 
0028 /// A collection of options to steer the creation of the dataset on file
0029 struct RSnapshotOptions {
0030    using ECAlgo = ROOT::RCompressionSetting::EAlgorithm::EValues;
0031    RSnapshotOptions() = default;
0032    RSnapshotOptions(const RSnapshotOptions &) = default;
0033    RSnapshotOptions(RSnapshotOptions &&) = default;
0034    RSnapshotOptions(std::string_view mode, ECAlgo comprAlgo, int comprLevel, int autoFlush, int splitLevel, bool lazy,
0035                     bool overwriteIfExists = false, bool vector2RVec = true, int basketSize = -1,
0036                     ESnapshotOutputFormat outputFormat = ESnapshotOutputFormat::kDefault)
0037       : fMode(mode),
0038         fCompressionAlgorithm(comprAlgo),
0039         fCompressionLevel{comprLevel},
0040         fAutoFlush(autoFlush),
0041         fSplitLevel(splitLevel),
0042         fLazy(lazy),
0043         fOverwriteIfExists(overwriteIfExists),
0044         fVector2RVec(vector2RVec),
0045         fBasketSize(basketSize),
0046         fOutputFormat(outputFormat)
0047    {
0048    }
0049    std::string fMode = "RECREATE"; ///< Mode of creation of output file
0050    ECAlgo fCompressionAlgorithm =
0051       ROOT::RCompressionSetting::EAlgorithm::kZLIB; ///< Compression algorithm of output file
0052    int fCompressionLevel = 1;                       ///< Compression level of output file
0053    int fAutoFlush = 0;                              ///< AutoFlush value for output tree
0054    int fSplitLevel = 99;                            ///< Split level of output tree
0055    bool fLazy = false;                              ///< Do not start the event loop when Snapshot is called
0056    bool fOverwriteIfExists = false;  ///< If fMode is "UPDATE", overwrite object in output file if it already exists
0057    bool fVector2RVec = true;         ///< If set to true will convert std::vector columns to RVec when saving to disk
0058    int fBasketSize = -1;             ///< Set a custom basket size option. For more details, see
0059                                      ///< https://root.cern/manual/trees/#baskets-clusters-and-the-tree-header
0060    ESnapshotOutputFormat fOutputFormat = ESnapshotOutputFormat::kDefault; ///< Which data format to write to
0061 };
0062 } // namespace RDF
0063 } // namespace ROOT
0064 
0065 #endif