Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 09:08:34

0001 /// \file ROOT/RNTupleReadOptions.hxx
0002 /// \ingroup NTuple
0003 /// \author Jakob Blomer <jblomer@cern.ch>
0004 /// \date 2024-02-22
0005 
0006 /*************************************************************************
0007  * Copyright (C) 1995-2024, 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_RNTupleReadOptions
0015 #define ROOT_RNTupleReadOptions
0016 
0017 namespace ROOT {
0018 
0019 class RNTupleReadOptions;
0020 
0021 namespace Internal {
0022 
0023 class RNTupleReadOptionsManip final {
0024 public:
0025    static unsigned int GetClusterBunchSize(const RNTupleReadOptions &options);
0026    static void SetClusterBunchSize(RNTupleReadOptions &options, unsigned int val);
0027 };
0028 
0029 } // namespace Internal
0030 
0031 // clang-format off
0032 /**
0033 \class ROOT::RNTupleReadOptions
0034 \ingroup NTuple
0035 \brief Common user-tunable settings for reading RNTuples
0036 
0037 All page source classes need to support the common options.
0038 
0039 <table>
0040 <tr>
0041 <th>Option name</th>
0042 <th>Type</th>
0043 <th>Default</th>
0044 <th>Description</th>
0045 </tr>
0046 
0047 <tr>
0048 <td>`ClusterCache`</td>
0049 <td>EClusterCache</td>
0050 <td>EClusterCache::kDefault</td>
0051 <td>
0052 Controls if the prefetcher (including the prefetcher thread) is used
0053 </td>
0054 </tr>
0055 
0056 <tr>
0057 <td>`UseImplicitMT`</td>
0058 <td>EImplicitMT</td>
0059 <td>EImplicitMT::kDefault</td>
0060 <td>
0061 Allows to disable parallel page compression and decompression even if ROOT uses implicit MT.
0062 This is useful, e.g., in the context of RDataFrame where the threads are fully managed by RDataFrame.
0063 </td>
0064 </tr>
0065 
0066 <tr>
0067 <td>`EnableMetrics`</td>
0068 <td>`bool`</td>
0069 <td>`false`</td>
0070 <td>
0071 If `true`, the RNTupleReader will track metrics straight from its construction, as
0072 if calling RNTupleReader::EnableMetrics() before having created the object.
0073 </td>
0074 </tr>
0075 </table>
0076 */
0077 // clang-format on
0078 class RNTupleReadOptions {
0079    friend class Internal::RNTupleReadOptionsManip;
0080 
0081 public:
0082    enum class EClusterCache {
0083       kOff,
0084       kOn,
0085       kDefault = kOn,
0086    };
0087 
0088    enum class EImplicitMT {
0089       kOff,
0090       kDefault,
0091    };
0092 
0093 private:
0094    EClusterCache fClusterCache = EClusterCache::kDefault;
0095    /// The number of cluster to be prefetched in a single batch; this option is transitional and will be replaced
0096    /// by an option that allows to control the amount of memory that the prefetcher uses.
0097    unsigned int fClusterBunchSize = 1;
0098    EImplicitMT fUseImplicitMT = EImplicitMT::kDefault;
0099    bool fEnableMetrics = false;
0100 
0101 public:
0102    EClusterCache GetClusterCache() const { return fClusterCache; }
0103    void SetClusterCache(EClusterCache val) { fClusterCache = val; }
0104 
0105    EImplicitMT GetUseImplicitMT() const { return fUseImplicitMT; }
0106    void SetUseImplicitMT(EImplicitMT val) { fUseImplicitMT = val; }
0107 
0108    bool GetEnableMetrics() const { return fEnableMetrics; }
0109    void SetEnableMetrics(bool val) { fEnableMetrics = val; }
0110 }; // class RNTupleReadOptions
0111 
0112 namespace Internal {
0113 
0114 inline unsigned int RNTupleReadOptionsManip::GetClusterBunchSize(const RNTupleReadOptions &options)
0115 {
0116    return options.fClusterBunchSize;
0117 }
0118 
0119 inline void RNTupleReadOptionsManip::SetClusterBunchSize(RNTupleReadOptions &options, unsigned int val)
0120 {
0121    options.fClusterBunchSize = val;
0122 }
0123 
0124 } // namespace Internal
0125 } // namespace ROOT
0126 
0127 #endif