TTree scan函数的基本用法

TTree scan函数原型

Long64_t Scan(const char* varexp = "", const char* selection = "", Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0)
description:
Loop over tree entries and print entries passing selection.
If varexp is 0 (or "") then print only first 8 columns.
If varexp = "*" print all columns.
Otherwise a columns selection can be made using "var1:var2:var3".
See TTreePlayer::Scan for more information

TTree scan函数格式化输出

示例代码:

tree->Scan("a:b:"c,"","colsize=30 precision=3 col=::20.10:#x:5ld");

格式化输出控制参数:

  • lenmax=dd,控制每次打印输出最多的元素的个数,默认情况下dd是0,所有的元素都被打印出来。
  • colsize=ss,输出的每一列的长度大小,默认是9。
  • precision=pp,指定格式化打印输出的精度。
  • col=xxx,限定每一列输出的格式,格式化字符的格式和printf一致。

参考:https://root.cern/root/html602/TTree.html#TTree:Scan

版权声明:著作权归作者所有。

thumb_up 0 | star_outline 0 | textsms 0