22 '''Recursive function to find all contents in a given ROOT file''' 23 keys = in_tfile.GetDirectory(full_path).GetListOfKeys()
26 classname = key.GetClassName()
27 if 'TDirectory' in classname:
32 if options.name
and name != options.name:
continue 33 full_name =
'/'.
join([full_path,name])
34 obj = in_tfile.Get(full_name)
37 simple_name = full_name[2:]
38 print(
"%s" % simple_name, end=
' ')
39 for arg
in [x[2:]
for x
in sys.argv
if x.startswith(
"--")]:
40 if "classname" == arg:
41 print(
"%s" % classname, end=
' ')
42 if obj.InheritsFrom(
'TH1'):
44 print(
" %i" % obj.GetEntries(), end=
' ')
46 if obj.InheritsFrom(
'TH2'):
49 for j
in reversed(range(obj.GetNbinsY())):
52 [
str(obj.GetBinContent(i+1, j+1))
for i
in range(obj.GetNbinsX())]), end=
' ')
55 [
str(obj.GetBinContent(i+1))
for i
in range(obj.GetNbinsX())]), end=
' ')
57 if obj.InheritsFrom(
'TH2'):
58 for j
in reversed(range(obj.GetNbinsY())):
61 [
str(obj.GetBinError(i+1, j+1))
for i
in range(obj.GetNbinsX())]), end=
' ')
64 [
str(obj.GetBinError(i+1))
for i
in range(obj.GetNbinsX())]), end=
' ')
65 if "bincenter" == arg:
67 [
str(obj.GetBinCenter(i+1))
for i
in range(obj.GetNbinsX())]), end=
' ')
69 print(
" %i" % obj.GetMaximum(), end=
' ')
71 print(
" %i" % obj.GetMinimum(), end=
' ')
73 print(
" %i" % obj.GetBinContent(obj.GetNbinsX()), end=
' ')
74 if "underflow" == arg:
75 print(
" %i" % obj.GetBinContent(0), end=
' ')
76 if obj.InheritsFrom(
'TGraph'):
78 x, y = Double(0), Double(0)
81 for i
in range(obj.GetN()):
83 xvals.append(copy.copy(x))
84 yvals.append(copy.copy(y))
85 for point
in zip(xvals,yvals):
86 print(
" (%d, %d)" % point, end=
' ')
def recurse_thru_file(in_tfile, options, full_path='/')
S & print(S &os, JobReport::InputFile const &f)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
static std::string join(char **cmd)