65 import optparse
66 parser = optparse.OptionParser(description=__doc__,
67 usage='%prog [Options] file [path]')
68
69 parser.add_option('-t', '--total', action='store_true',
70 help='Print total number of histograms and bins')
71
72 parser.add_option('-b', '--bins', action='store_true',
73 help='Sort by number of bins')
74
75 parser.add_option('-n', '--byName', action='store_true',
76 help='Show histograms [default]')
77
78 parser.add_option('-a', '--byAlg', action='store_true',
79 help='Show total histograms per algorithm')
80
81 parser.add_option('-f', '--filled', action='store_true',
82 help='Show number of filled bins instead of total bins')
83
84 parser.add_option('-l', '--labeled', action='store_true',
85 help='Only show histograms with text labels')
86
87 parser.add_option('-m', '--misslabel', action='store_true',
88 help='Only show labeled histograms with at least one unlabeled bin')
89
90 parser.add_option('-e', '--empty', action='store_true',
91 help='Only show histograms with zero entries')
92
93 global opts
94 (opts, args) = parser.parse_args()
95
96 if len(args)==1:
97 path = '/'
98 elif len(args)==2:
99 path = args[1]
100 else:
101 parser.print_help()
102 return 1
103
104 hists = list(args[0],path)
105 if opts.bins: sortKey = lambda x : x[1][1]
106 else: sortKey = None
107
108 if not opts.byAlg: opts.byName = True
109
110 if opts.byName is True:
111 for h,v in sorted(hists.items(), key=sortKey):
112 print(
'%-80s %10s %10s' % (h,v[0],v[1]))
113
114 if opts.byAlg is True:
115 algs = byAlg(hists)
116 for h,v in sorted(algs.items(), key=sortKey):
117 print(
'%-80s %10s %10s' % (h,v[0],v[1]))
118
119 if opts.total:
121 print(
"Total histograms: %15s" % len(hists))
122 print(
"Total %sbins: %15s" % (
"filled " if opts.filled
else "", sum([h[1]
for h
in hists.values()])))
123
124
void print(char *figname, TCanvas *c1)