Exemplo n.º 1
0
def merge_hists(hists, name):
    outh = Histogram()
    ROOT.gROOT.cd()
    merged_hist = hists[0].hist.Clone(name)
    for hist in hists[1:]:
        merged_hist.Add(hist.hist)
    outh.setHist(merged_hist)
    return outh
Exemplo n.º 2
0
def merge_hists(hists, name):
    outh = Histogram()
    ROOT.gROOT.cd()
    merged_hist = hists[0].hist.Clone(name)
    for hist in hists[1:]:
        merged_hist.Add(hist.hist)
    outh.setHist(merged_hist)
    return outh
Exemplo n.º 3
0
def merge_hists_g(hists_d, merge_groups=g_merge_cmd):
    out_d = dict()
    for merge_name, items in merge_groups.items():
        hist = hists_d[items[0]].hist.Clone()
        for item in items[1:]:
            hist.Add(hists_d[item].hist)

        out_d[merge_name] = Histogram()
        out_d[merge_name].setHist(hist, sample_name=hists_d[items[0]].sample_name, var=hists_d[items[0]].var, cut=hists_d[items[0]].cut)
        integral, err = out_d[merge_name].calc_int_err()
        out_d[merge_name].pretty_name = "%s : %.0f #pm %0.f" % (merge_name, integral, err)
    return out_d
Exemplo n.º 4
0
def merge_hists_g(hists_d, merge_groups=g_merge_cmd):
    out_d = dict()
    for merge_name, items in merge_groups.items():
        hist = hists_d[items[0]].hist.Clone()
        for item in items[1:]:
            hist.Add(hists_d[item].hist)

        out_d[merge_name] = Histogram()
        out_d[merge_name].setHist(hist,
                                  sample_name=hists_d[items[0]].sample_name,
                                  var=hists_d[items[0]].var,
                                  cut=hists_d[items[0]].cut)
        integral, err = out_d[merge_name].calc_int_err()
        out_d[merge_name].pretty_name = "%s : %.0f #pm %0.f" % (merge_name,
                                                                integral, err)
    return out_d