Esempio n. 1
0
def main():
    plot_info = getPlotArgs()
    canvas = ROOT.TCanvas("canvas", "canvas", 800, 600)
    hist = plotter.getHistFromFile(plot_info)
    plotter.setHistAttributes(hist, plot_info, ROOT.kRed+4, ROOT.kOrange-8)
    if type(hist) == "<class '__main__.TH2F'>":
        hist_opts = "colz"
    else:
        hist_opts = "hist"
    plotter.makePlot(hist, hist_opts, plot_info)
Esempio n. 2
0
def main():
    weight_plot_info = getWeightArgs()
    weights = {"f_{T1} = 7.5e-12", "f_{T1} = 1.5e-12", "f_{T1} = 5e-13"}
    plotSameCanvas = True

    hist_opts = "hist"
    hist_stack = rt.THStack()
    
    cols = [rt.kOrange-8, rt.kBlue-4, rt.kBlue+8]

    i = 0
    for weight in weights:
        weight_plot_info["folder"] = weight
        print cols[i]
        if plotSameCanvas: 
            plots.addHistToStack(hist_stack, weight_plot_info, hist_opts, 
                                 cols[i], 0)          
        else:
            hist = plots.getHistFromFile(weight_plot_info)
            plots.setHistAttributes(hist, weight_plot_info, rt.kYellow-i, 
                                    rt.kYellow+i)
            plot_info["output_file"] = "~/public_html/test/test%s.pdf" % i
            plots.makePlot(hist, hist_opts, plot_info) 
        i += 1
    if plotSameCanvas:
        plots.makePlot(hist_stack, "hist nostack", plot_info)
Esempio n. 3
0
def getPlotArgs():
    parser = plotter.getBasicParser()
    parser.add_argument("-n", "--file_name", type=str, required=True,
                        help="Name of root file where plots are stored")
    parser.add_argument("-f", "--folder", type=str, required=True,
                        help="""Base folder in root file where plot is stored 
                              (usually weight name)""")
    return vars(parser.parse_args())
Esempio n. 4
0
def getSignalArgs():
    parser = plotter.getBasicParser()
    parser.add_argument("--comb_file", required=True, help="Signal+bkgd")
    parser.add_argument("--bkgd_file", required=True, help="Signal+bkgd")
    parser.add_argument("--comb_wgt", required=True, help="comb_wgt")
    parser.add_argument("--bkgd_wgt", required=True, help="bkgd_wgt")
    parser.add_argument("--compare_file", required=False, help="bkgd_wgt")
    parser.add_argument("--compare_wgt", required=False, help="bkgd_wgt")
    # subparsers = parser.add_subparsers()
    # compare = subparsers.add_parser("compare", help="for weights")
    # compare.add_argument("--compare_file", required=True, help="compare file")

    return vars(parser.parse_args())
Esempio n. 5
0
def getSignal(signal_info, plot_info):
    plot_info["folder"] = signal_info["bkgd_wgt"]
    plot_info["file_name"] = signal_info["bkgd_file"]
    bkgd_hist = plotter.getHistFromFile(plot_info)
    plotter.setHistAttributes(bkgd_hist, plot_info, ROOT.kOrange - 8, 0)

    plot_info["folder"] = signal_info["comb_wgt"]
    plot_info["file_name"] = signal_info["comb_file"]
    combined_hist = plotter.getHistFromFile(plot_info)
    plotter.setHistAttributes(combined_hist, plot_info, ROOT.kOrange - 8, 0)

    combined_hist.Add(bkgd_hist, -1.0)
    return combined_hist
Esempio n. 6
0
def main():
    plot_info = getSignalArgs()

    signal_info = {
        "comb_file": plot_info.pop("comb_file"),
        "bkgd_file": plot_info.pop("bkgd_file"),
        "bkgd_wgt": plot_info.pop("bkgd_wgt"),
        "comb_wgt": plot_info.pop("comb_wgt"),
    }
    plot_info["folder"] = ""
    signal_hist = getSignal(signal_info, plot_info)
    if "compare_file" in plot_info and "compare_wgt" in plot_info:
        plot_info["file_name"] = plot_info["compare_file"]
        plot_info["folder"] = plot_info["compare_wgt"]
        hist_stack = ROOT.THStack()
        hist_stack.Add(signal_hist)
        plotter.addHistToStack(hist_stack, plot_info, "hist", ROOT.kBlue - 8, 0)
        plotter.makePlot(hist_stack, "hist nostack", plot_info)
    else:
        plotter.makePlot(signal_hist, "hist", plot_info)
Esempio n. 7
0
def getWeightArgs():
    parser = plots.getBasicParser()
    return vars(parser.parse_args())