7 hists = [[
util.get_tobject(args, h.lstrip(
"-"))
for h
in hlist]
for hlist
in args.hstack]
11 canvas = ROOT.TCanvas(
"canvas",
"Canvas", 250,100,700,500)
12 hstack = ROOT.THStack()
14 for i, (hlist,hnames)
in enumerate(
zip(hists, args.hstack)):
17 for hadd,hname
in zip(hlist[1:],hnames[1:]):
20 if hname.startswith(
"-"):
25 if args.area_normalize
and h.Integral() > 1e-4: h.Scale(1. / h.Integral())
34 if args.nevent_in_legend:
35 name +=
" (%i)" % int(h.Integral())
39 drawstr =
"HIST" if args.stack
else "NOSTACK HIST"
42 if args.legend_position: legend = ROOT.gPad.BuildLegend(*(args.legend_position + [
""]))
52 if __name__ ==
"__main__":
53 parser = argparse.ArgumentParser()
58 parser.add_argument(
"-ly",
"--logy", action=
"store_true")
59 parser.add_argument(
"-hs",
"--hstack", required=
True, type=util.histo_list)
60 parser.add_argument(
"-s",
"--stack", action=
"store_true")
61 parser.add_argument(
"-n",
"--names", default=
None, type=util.comma_separated)
62 parser.add_argument(
"-a",
"--area_normalize", action=
"store_true")
63 parser.add_argument(
"--nevent_in_legend", action=
"store_true")
64 parser.add_argument(
"-lp",
"--legend_position", default=
None, type=util.legend_position)
65 main(parser.parse_args())
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.