All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
integrate_hist Namespace Reference

Functions

def main
 

Variables

tuple parser = argparse.ArgumentParser()
 

Function Documentation

def integrate_hist.main (   args)

Definition at line 6 of file integrate_hist.py.

6 
7 def main(args):
8  f = ROOT.TFile(args.input)
9  hist = f.Get(args.hist)
10  if args.range_hi is not None and args.range_lo is not None:
11  lo_bin = hist.GetXaxis().FindBin(args.range_lo)
12  hi_bin = hist.GetXaxis().FindBin(args.range_hi)
13  integral = hist.Integral(lo_bin, hi_bin)
14  else:
15  integral = hist.Integral()
16  if args.ratio:
17  if args.overflow:
18  total = sum([hist.GetBinContent(i) for i in range(hist.GetNbinsX()+2)])
19  else:
20  total = hist.Integral()
21  integral = integral / total
22  print integral

Variable Documentation

tuple integrate_hist.parser = argparse.ArgumentParser()

Definition at line 24 of file integrate_hist.py.