log.info("Building views")
    data_views = data_views.data_views(args.files, args.pd)
    data_view = views.FunctorView(data_views[args.pd]['view'],
                                  lambda x: x.Rebin(2))

    mc_samples_to_stack = ['Zjets', 'QCDMu', 'Wjets', 'ttjets']
    # Build the MC stack
    mc_view = views.StackView(*[
        views.FunctorView(data_views[x]['view'], lambda x: x.Rebin(2))
        for x in mc_samples_to_stack
    ],
                              sort=True)

    # We just need to figure out the directory structure from any old file
    layout_filename = data_views.values()[0]['subsamples'].values(
    )[0]['filename']
    log.info("Getting file layout from %s", layout_filename)

    canvas = Canvas()

    plot_list = open(os.path.join(args.output, 'plot_list.txt'), 'w')

    with io.open(layout_filename, 'r') as layout_file:
        for path, subdirs, histos in layout_file.walk(class_pattern='TH1F'):
            for histo in histos:
                data_histo = data_view.Get(os.path.join(path, histo))
                mc_histo = mc_view.Get(os.path.join(path, histo))
                mc_histo.SetTitle("data events = %i" % data_histo.Integral())
                mc_histo.Draw()
                data_histo.Draw('same')
                mc_histo.SetMaximum(
    with open(args.meta) as meta_file:
        meta_info = json.load(meta_file)

    log.info("Building views")
    data_views = data_views.data_views(args.files, args.pd)
    data_view = views.FunctorView(data_views[args.pd]['view'],
                                  lambda x: x.Rebin(2))

    mc_samples_to_stack = ['Zjets', 'QCDMu', 'Wjets', 'ttjets']
    # Build the MC stack
    mc_view = views.StackView(*[
        views.FunctorView(data_views[x]['view'], lambda x: x.Rebin(2))
        for x in mc_samples_to_stack], sort=True)

    # We just need to figure out the directory structure from any old file
    layout_filename = data_views.values()[0]['subsamples'].values()[0]['filename']
    log.info("Getting file layout from %s", layout_filename)

    canvas = Canvas()

    plot_list = open(os.path.join(args.output, 'plot_list.txt'), 'w')

    with io.open(layout_filename, 'r') as layout_file:
        for path, subdirs, histos in layout_file.walk(class_pattern='TH1F'):
            for histo in histos:
                data_histo = data_view.Get(os.path.join(path, histo))
                mc_histo = mc_view.Get(os.path.join(path, histo))
                mc_histo.SetTitle("data events = %i" % data_histo.Integral())
                mc_histo.Draw()
                data_histo.Draw('same')
                mc_histo.SetMaximum(1.2*max(