From 971c5895e45738fd8630061ad288850f911e2309 Mon Sep 17 00:00:00 2001
From: Brian Bockelman <bbockelm@cse.unl.edu>
Date: Tue, 17 Oct 2017 23:12:42 -0500
Subject: [PATCH] Fix name alignment in TTree.h.

---
 io/io/inc/TFileMerger.h |  5 +++++
 main/src/hadd.cxx       | 19 +++++++++++++++++++
 tree/tree/inc/TTree.h   |  4 +++-
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/io/io/inc/TFileMerger.h b/io/io/inc/TFileMerger.h
index b2a59dd2d35..cfc8e6af812 100644
--- a/io/io/inc/TFileMerger.h
+++ b/io/io/inc/TFileMerger.h
@@ -22,6 +22,9 @@ class TList;
 class TFile;
 class TDirectory;
 
+namespace ROOT {
+class TIOFeatures;
+}  // namespace ROOT
 
 class TFileMerger : public TObject {
 private:
@@ -39,6 +42,7 @@ protected:
    Bool_t         fCompressionChange;///< True if the output and input have different compression level (default kFALSE)
    Int_t          fPrintLevel;       ///< How much information to print out at run time
    TString        fMergeOptions;     ///< Options (in string format) to be passed down to the Merge functions
+   ROOT::TIOFeatures *fIOFeatures{nullptr}; ///< IO features to use in the output file.
    TString        fMsgPrefix;        ///< Prefix to be used when printing informational message (default TFileMerger)
 
    Int_t          fMaxOpenedFiles;  ///< Maximum number of files opened at the same time by the TFileMerger
@@ -83,6 +87,7 @@ public:
    const char *GetMergeOptions() { return fMergeOptions; }
    void        SetMergeOptions(const TString &options) { fMergeOptions = options; }
    void        SetMergeOptions(const std::string_view &options) { fMergeOptions = options; }
+   void        SetIOFeatures(ROOT::TIOFeatures &features) { fIOFeatures = &features; }
    void        AddObjectNames(const char *name) {fObjectNames += name; fObjectNames += " ";}
    const char *GetObjectNames() const {return fObjectNames.Data();}
    void        ClearObjectNames() {fObjectNames.Clear();}
diff --git a/main/src/hadd.cxx b/main/src/hadd.cxx
index b068d81b582..21a417d61bd 100644
--- a/main/src/hadd.cxx
+++ b/main/src/hadd.cxx
@@ -71,6 +71,7 @@
  */
 
 #include "RConfig.h"
+#include "ROOT/TIOFeatures.hxx"
 #include <string>
 #include "TFile.h"
 #include "THashList.h"
@@ -120,6 +121,8 @@ int main( int argc, char **argv )
                    "   to request to use the system maximum." << std::endl;
       std::cout << "If the option -cachesize is used, hadd will resize (or disable if 0) the\n"
                    "   prefetching cache use to speed up I/O operations." << std::endl;
+      std::cout << "If the option -experimental-io-features is used (and an argument provided), then\n"
+                   "   the corresponding experimental feature will be enabled for output trees." << std::endl;
       std::cout << "When -the -f option is specified, one can also specify the compression level of\n"
                    "   the target file.  By default the compression level is 1." <<std::endl;
       std::cout << "If \"-fk\" is specified, the target file contain the baskets with the same\n"
@@ -144,6 +147,7 @@ int main( int argc, char **argv )
       return 1;
    }
 
+   ROOT::TIOFeatures features;
    Bool_t append = kFALSE;
    Bool_t force = kFALSE;
    Bool_t skip_errors = kFALSE;
@@ -271,6 +275,20 @@ int main( int argc, char **argv )
             }
          }
          ++ffirst;
+      } else if (!strcmp(argv[a], "-experimental-io-features")) {
+         if (a+1 >= argc) {
+            std::cerr << "Error: no IO feature was specified after -experimental-io-features; ignoring\n";
+         } else {
+            std::stringstream ss;
+            ss.str(argv[++a]);
+            ++ffirst;
+            std::string item;
+            while (std::getline(ss, item, ',')) {
+               if (!features.Set(item)) {
+                  std::cerr << "Ignoring unknown feature request: " << item << std::endl;
+               }
+            }
+         }
       } else if ( strcmp(argv[a],"-n") == 0 ) {
          if (a+1 >= argc) {
             std::cerr << "Error: no maximum number of opened was provided after -n.\n";
@@ -455,6 +473,7 @@ int main( int argc, char **argv )
       }
       merger.SetNotrees(noTrees);
       merger.SetMergeOptions(cacheSize);
+      merger.SetIOFeatures(features);
       Bool_t status;
       if (append)
          status = merger.PartialMerge(TFileMerger::kIncremental | TFileMerger::kAll);
diff --git a/tree/tree/inc/TTree.h b/tree/tree/inc/TTree.h
index fc18233465f..4c179c72c06 100644
--- a/tree/tree/inc/TTree.h
+++ b/tree/tree/inc/TTree.h
@@ -69,6 +69,8 @@ class TVirtualPerfStats;
 
 class TTree : public TNamed, public TAttLine, public TAttFill, public TAttMarker {
 
+   using TIOFeatures = ROOT::TIOFeatures;
+
 protected:
    Long64_t       fEntries;               ///<  Number of entries
 // NOTE: cannot use std::atomic for these counters as it cannot be serialized.
@@ -100,7 +102,7 @@ protected:
    Int_t          fDebug;                 ///<! Debug level
    Long64_t       fDebugMin;              ///<! First entry number to debug
    Long64_t       fDebugMax;              ///<! Last entry number to debug
-   ROOT::TIOFeatures fIOFeatures{0};      ///<! IO features to define for newly-written baskets and branches.
+   TIOFeatures    fIOFeatures{0};         ///<! IO features to define for newly-written baskets and branches.
    Int_t          fMakeClass;             ///<! not zero when processing code generated by MakeClass
    Int_t          fFileNumber;            ///<! current file number (if file extensions)
    TObject       *fNotify;                ///<! Object to be notified when loading a Tree
-- 
GitLab