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

Functions

def main
 

Variables

tuple parser = argparse.ArgumentParser()
 

Function Documentation

def eff_ratio.main (   args)

Definition at line 5 of file eff_ratio.py.

5 
6 def main(args):
7  base_histos = [util.get_tobject(args, r) for r in args.base_histos]
8  util.validate_hists(args.base_histos, base_histos)
9  base_histos = [util.resize_histo(args, util.get_tobject(args, r)) for r in args.base_histos]
10 
11  cut_histos = [util.get_tobject(args, r) for r in args.cut_histos]
12  util.validate_hists(args.cut_histos, cut_histos)
13  cut_histos = [util.resize_histo(args, util.get_tobject(args, r)) for r in args.cut_histos]
14 
15  canvas = ROOT.TCanvas("canvas", "Canvas", 250,100,700,500)
16 
17  all_histos = []
18  for i, (base_histo,cut_histo) in enumerate(zip(base_histos,cut_histos)):
19  ratio = cut_histo.Clone()
20  ratio.Divide(base_histo)
21  ratio.SetLineColor(util.fillcolors(i))
22  ratio.SetLineWidth(2)
23  if i == 0:
24  util.style(args, canvas, ratio)
25  ratio.Draw("PE")
26  else:
27  ratio.Draw("PE SAME")
28  all_histos.append(ratio)
29 
30  if args.names:
31  name = args.names[i]
32  ratio.SetTitle(name)
33 
34  legend = ROOT.gPad.BuildLegend(*(args.legend_position + [""]))
35  if args.title is not None:
36  all_histos[0].SetTitle(args.title)
37  canvas.Update()
38 
39  util.wait(args)
40  util.write(args, canvas)
def main
Definition: eff_ratio.py:5
def validate_hists
Definition: util.py:352
def get_tobject
Definition: util.py:47
def style
Definition: util.py:237
def write
Definition: util.py:23
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
def wait
Definition: util.py:19
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
def fillcolors
Definition: util.py:272
def resize_histo
Definition: util.py:118

Variable Documentation

tuple eff_ratio.parser = argparse.ArgumentParser()

Definition at line 42 of file eff_ratio.py.