From 55ef0f34612c9fc78f1a1868597976a04228cce7 Mon Sep 17 00:00:00 2001 From: Philippe Canal <pcanal@fnal.gov> Date: Mon, 1 Mar 2021 14:04:30 -0600 Subject: [PATCH] [NFC] Improve documentation (TTreeCloner, TBufferMerger, TFileMerger) --- io/io/inc/ROOT/TBufferMerger.hxx | 2 +- io/io/src/TBufferMerger.cxx | 3 +++ io/io/src/TFileMerger.cxx | 9 +++++++++ tree/tree/src/TTreeCloner.cxx | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/io/io/inc/ROOT/TBufferMerger.hxx b/io/io/inc/ROOT/TBufferMerger.hxx index bbd3068656a..dc0672d4e27 100644 --- a/io/io/inc/ROOT/TBufferMerger.hxx +++ b/io/io/inc/ROOT/TBufferMerger.hxx @@ -99,7 +99,7 @@ public: */ void SetMergeOptions(const TString& options); - /** Indicates that the file will not contain any TTree objects + /** Indicates that any TTree objects in the file should be skipped * and thus that steps that are specific to TTree can be skipped */ void SetNotrees(Bool_t notrees=kFALSE) { diff --git a/io/io/src/TBufferMerger.cxx b/io/io/src/TBufferMerger.cxx index 7575e45f85d..74882f67669 100644 --- a/io/io/src/TBufferMerger.cxx +++ b/io/io/src/TBufferMerger.cxx @@ -50,6 +50,9 @@ TBufferMerger::~TBufferMerger() if (!fQueue.empty()) Merge(); + // Since we support purely incremental merging, Merge does not write the target objects + // that are attached to the file (TTree and histograms) and thus we need to write them + // now. if (TFile *out = fMerger.GetOutputFile()) out->Write("",TObject::kOverwrite); } diff --git a/io/io/src/TFileMerger.cxx b/io/io/src/TFileMerger.cxx index a7e5be06aae..d95ba8172a9 100644 --- a/io/io/src/TFileMerger.cxx +++ b/io/io/src/TFileMerger.cxx @@ -930,9 +930,18 @@ Bool_t TFileMerger::PartialMerge(Int_t in_type) } else { // Close or write is required so the file is complete. if (in_type & kIncremental) { + // In the case of 'kDelayWrite' the caller want to avoid having to + // write the output objects once for every input file and instead + // write it only once at the end of the process. if (!(in_type & kDelayWrite)) fOutputFile->Write("",TObject::kOverwrite); } else { + // If in_type is not incremental but type is incremental we are now in + // the case where the user "explicitly" request a non-incremental merge + // but we still have internally an incremental merge. Because the user + // did not request the incremental merge they also probably do not to a + // final Write of the file and thus not doing the write here would lead + // to data loss ... if (type & kIncremental) fOutputFile->Write("",TObject::kOverwrite); gROOT->GetListOfFiles()->Remove(fOutputFile); diff --git a/tree/tree/src/TTreeCloner.cxx b/tree/tree/src/TTreeCloner.cxx index a98260612af..974c040fd83 100644 --- a/tree/tree/src/TTreeCloner.cxx +++ b/tree/tree/src/TTreeCloner.cxx @@ -110,7 +110,7 @@ TTreeCloner::TTreeCloner(TTree *from, TTree *to, Option_t *method, UInt_t option //////////////////////////////////////////////////////////////////////////////// /// Constructor. In place cloning. //// This object would transfer the data from -/// 'from' the original location to 'to' the new directory +/// 'from' the original location to 'newdirectory' the new directory /// using the sorting method indicated in method. /// It updates the 'from' TTree with the new information. /// See TTreeCloner::TTreeCloner(TTree *from, TTree *to, Option_t *method, UInt_t options) -- GitLab