From 77990674f444986846d7b44994245dc6f73b11eb Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Sun, 28 Sep 2025 12:28:02 +0200 Subject: [PATCH 1/4] [nfc][tree] improve scan redirect docu --- tree/tree/src/TTree.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tree/tree/src/TTree.cxx b/tree/tree/src/TTree.cxx index b1edc439bf21f..986d786a11045 100644 --- a/tree/tree/src/TTree.cxx +++ b/tree/tree/src/TTree.cxx @@ -90,7 +90,7 @@ It is strongly recommended to persistify those as objects rather than lists of l name of the leaf, but have no effect.) If no type is given, the type of the variable is assumed to be the same as the previous variable. If the first variable does not have a type, it is - assumed of type F by default. The list of currently supported + assumed of type `F` by default. The list of currently supported types is given below: - `C` : a character string terminated by the 0 character - `B` : an 8 bit integer (`Char_t`); Mostly signed, might be unsigned in special platforms or depending on compiler flags, thus do not use std::int8_t as underlying variable since they are not equivalent; Treated as a character when in an array. @@ -1968,7 +1968,7 @@ Int_t TTree::Branch(const char* foldername, Int_t bufsize /* = 32000 */, Int_t s /// The variable type may be 0,1 or 2 characters. If no type is given, /// the type of the variable is assumed to be the same as the previous /// variable. If the first variable does not have a type, it is assumed -/// of type F by default. The list of currently supported types is given below: +/// of type `F` by default. The list of currently supported types is given below: /// - `C` : a character string terminated by the 0 character /// - `B` : an 8 bit integer (`Char_t`); Mostly signed, might be unsigned in special platforms or depending on compiler flags, thus do not use std::int8_t as underlying variable since they are not equivalent; Treated as a character when in an array. /// - `b` : an 8 bit unsigned integer (`UChar_t`) @@ -8264,7 +8264,7 @@ void TTree::ResetBranchAddresses() /// \param firstentry first entry to scan /// \param nentries total number of entries to scan (starting from firstentry). Defaults to all entries. /// \note see TTree::SetScanField to control how many lines are printed between pagination breaks (Use 0 to disable pagination) -/// \see TTreePlayer::Scan +/// \see TTreePlayer::Scan, TTreePlayer::SetScanFileName, TTreePlayer::SetScanRedirect Long64_t TTree::Scan(const char* varexp, const char* selection, Option_t* option, Long64_t nentries, Long64_t firstentry) { From 1e389de942fb5f93afe1ff10d503e06aadb76aec Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Sun, 28 Sep 2025 12:33:49 +0200 Subject: [PATCH 2/4] [nfc] fix wrong link in doxygen --- tree/tree/inc/TTree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tree/tree/inc/TTree.h b/tree/tree/inc/TTree.h index a995ece8afb51..b83ae18642cbe 100644 --- a/tree/tree/inc/TTree.h +++ b/tree/tree/inc/TTree.h @@ -725,7 +725,7 @@ class TTree : public TNamed, public TAttLine, public TAttFill, public TAttMarker * \brief Sets the default maximum number of lines to be shown before `` when calling Scan(). * \param n the maximum number of lines. Default=50, if 0, all entries of the Tree are shown * and there is no need to press `` or `q` to exit the function. - * \see TTreePlayer::Scan for more details on how to redirect the output to an ASCII file + * \note See TTreePlayer::Scan for more details on how to redirect the output to an ASCII file */ virtual void SetScanField(Int_t n = 50) { fScanField = n; } // *MENU* void SetTargetMemoryRatio(Float_t ratio) { fTargetMemoryRatio = ratio; } From ae91c694f20095cdc5a3258c6474ebae42945ee7 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Sun, 28 Sep 2025 13:03:41 +0200 Subject: [PATCH 3/4] [nfc] mention how to scan tree to file from script --- tree/treeplayer/src/TTreePlayer.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tree/treeplayer/src/TTreePlayer.cxx b/tree/treeplayer/src/TTreePlayer.cxx index 814f0e4ea3bb0..154fc3966be7d 100644 --- a/tree/treeplayer/src/TTreePlayer.cxx +++ b/tree/treeplayer/src/TTreePlayer.cxx @@ -2382,7 +2382,17 @@ void TTreePlayer::RecursiveRemove(TObject *obj) /// tree->Scan("*"); /// .> /// ~~~ -/// will create a file tree.log +/// will create a file `tree.log` +/// ### From a script +/// One could use TSystem::RedirectOutput, but it's cleaner to call: +/// ~~~{.cpp} +/// /// tree->SetScanField(0); +/// auto logname = TString(tree->GetName())+".log"; +/// auto player = static_cast(tree->GetPlayer()); +/// player->SetScanFileName(logname); +/// player->SetScanRedirect(true); +/// tree->Scan(); +/// ~~~ /// /// Arrays (within an entry) are printed in their linear forms. /// If several arrays with multiple dimensions are printed together, From 5b6aee9eff7d3617f742ea7007fecd355e6a784f Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Sun, 28 Sep 2025 13:05:34 +0200 Subject: [PATCH 4/4] [nfc][tree] document SetScanRedirect functions --- tree/treeplayer/inc/TTreePlayer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tree/treeplayer/inc/TTreePlayer.h b/tree/treeplayer/inc/TTreePlayer.h index d8aa5f7b389d0..0e9513c20e8ea 100644 --- a/tree/treeplayer/inc/TTreePlayer.h +++ b/tree/treeplayer/inc/TTreePlayer.h @@ -119,8 +119,8 @@ class TTreePlayer : public TVirtualTreePlayer { TSQLResult *Query(const char *varexp, const char *selection, Option_t *option ,Long64_t nentries, Long64_t firstentry) override; void SetEstimate(Long64_t n) override; - void SetScanRedirect(bool on=false) {fScanRedirect = on;} - void SetScanFileName(const char *name) {fScanFileName=name;} + void SetScanRedirect(bool on=false) {fScanRedirect = on;} ///< Redirect Scan output to a text file + void SetScanFileName(const char *name) {fScanFileName=name;} ///< Set name of text file where Scan output will be dumped, if `SetScanRedirect(true)` was called void SetTree(TTree *t) override {fTree = t;} void StartViewer(Int_t ww, Int_t wh) override; Int_t UnbinnedFit(const char *formula ,const char *varexp, const char *selection,Option_t *option