7 f = ROOT.TFile(args.input)
8 hist = f.Get(args.hist)
9 if args.range_hi
is not None and args.range_lo
is not None:
10 lo_bin = hist.GetXaxis().FindBin(args.range_lo)
11 hi_bin = hist.GetXaxis().FindBin(args.range_hi)
12 integral = hist.Integral(lo_bin, hi_bin)
14 integral = hist.Integral()
17 total = sum([hist.GetBinContent(i)
for i
in range(hist.GetNbinsX()+2)])
19 total = hist.Integral()
20 integral = integral / total
23 if __name__ ==
"__main__":
24 parser = argparse.ArgumentParser()
26 parser.add_argument(
"-rl",
"--range_lo", default=
None, type=float)
27 parser.add_argument(
"-rh",
"--range_hi", default=
None, type=float)
28 parser.add_argument(
"-hn",
"--hist", required=
True)
29 parser.add_argument(
"-r",
"--ratio", action=
"store_true")
30 parser.add_argument(
"-o",
"--overflow", action=
"store_true")
31 main(parser.parse_args())