21 '''Recursive function to find all contents in a given ROOT file''' 22 keys = in_tfile.GetDirectory(full_path).GetListOfKeys()
25 classname = key.GetClassName()
26 if 'TDirectory' in classname:
31 if options.name
and name != options.name:
continue 32 full_name =
'/'.
join([full_path,name])
33 obj = in_tfile.Get(full_name)
36 simple_name = full_name[2:]
37 print "%s" % simple_name,
38 for arg
in [x[2:]
for x
in sys.argv
if x.startswith(
"--")]:
39 if "classname" == arg:
40 print "%s" % classname,
41 if obj.InheritsFrom(
'TH1'):
43 print " %i" % obj.GetEntries(),
45 if obj.InheritsFrom(
'TH2'):
48 for j
in reversed(range(obj.GetNbinsY())):
50 print " %s" %
' '.
join(
51 [
str(obj.GetBinContent(i+1, j+1))
for i
in range(obj.GetNbinsX())]),
53 print " %s" %
' '.
join(
54 [
str(obj.GetBinContent(i+1))
for i
in range(obj.GetNbinsX())]),
56 if obj.InheritsFrom(
'TH2'):
57 for j
in reversed(range(obj.GetNbinsY())):
59 print " %s" %
' '.
join(
60 [
str(obj.GetBinError(i+1, j+1))
for i
in range(obj.GetNbinsX())]),
62 print " %s" %
' '.
join(
63 [
str(obj.GetBinError(i+1))
for i
in range(obj.GetNbinsX())]),
64 if "bincenter" == arg:
65 print " %s" %
' '.
join(
66 [
str(obj.GetBinCenter(i+1))
for i
in range(obj.GetNbinsX())]),
68 print " %i" % obj.GetMaximum(),
70 print " %i" % obj.GetMinimum(),
72 print " %i" % obj.GetBinContent(obj.GetNbinsX()),
73 if "underflow" == arg:
74 print " %i" % obj.GetBinContent(0),
75 if obj.InheritsFrom(
'TGraph'):
77 x, y = Double(0), Double(0)
80 for i
in range(obj.GetN()):
82 xvals.append(copy.copy(x))
83 yvals.append(copy.copy(y))
84 for point
in zip(xvals,yvals):
85 print " (%d, %d)" % point,
def recurse_thru_file(in_tfile, options, full_path='/')
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
static std::string join(char **cmd)