else:
    regions = [ cr + '_L' for cr in analysis.cr_regions ] + \
        [ cr + '_H' for cr in analysis.cr_regions ] + \
        [ vr + '_L' for vr in analysis.vr_regions ] + \
        [ vr + '_H' for vr in analysis.vr_regions ] 

set_atlas_style()
set_palette()

for region in regions:

    selection = getattr(regions_, region)

    total_bkg = 0
    for bkg in backgrounds:
        total_bkg += get_events(bkg, selection=selection, lumi='data').mean

    gl_min = 1146
    gl_max = 2050
    n1_min = 147
    n1_max = 2050

    gl_bins = (gl_max - gl_min) / 25
    n1_bins = (n1_max - n1_min) / 25

    hmap = ROOT.TH2F('hmap', 'hmap', gl_bins, gl_min, gl_max, n1_bins, n1_min, n1_max)
    hmap.SetDirectory(0)
    ROOT.SetOwnership(hmap, False)

    largest_cont = 0
    for iregion, region in enumerate(regions):

        if sample == 'data' and region == 'SR':
            continue

        sel = getattr(regions_, region)

        histograms[0].GetXaxis().SetBinLabel(iregion + 1, region)

        print region
        print '-----'
        for idx, ver in enumerate(versions):
            evts = get_events(sample,
                              selection=sel,
                              version=ver,
                              scale=args.scale,
                              lumi='data')
            print ver, evts
            histograms[idx].SetBinContent(iregion + 1, evts.mean)

            set_style(histograms[idx], msize=1, lwidth=2, color=colors[idx])

    # Plot
    c = ROOT.TCanvas()

    cup = ROOT.TPad("u", "u", 0., 0.305, 0.99, 1)
    cdown = ROOT.TPad("d", "d", 0., 0.01, 0.99, 0.295)

    cup.SetLogy()
        hist.SetBinErrorOption(ROOT.TH1.kPoisson)

    for iregion, region in enumerate(regions):
        
        if sample == 'data' and region == 'SR':
            continue

        sel = getattr(regions_, region)
        
        
        histograms[0].GetXaxis().SetBinLabel(iregion+1, region)


        print region
        for idx, ver in enumerate(versions):
            evts = get_events(sample, selection=sel, version=ver, scale=False)
            print ver, evts
            histograms[idx].SetBinContent(iregion+1, evts.mean)

            set_style(histograms[idx], msize=1, lwidth=2, color=colors[idx])


    # Plot
    c = ROOT.TCanvas()

    cup   = ROOT.TPad("u", "u", 0., 0.305, 0.99, 1)
    cdown = ROOT.TPad("d", "d", 0., 0.01, 0.99, 0.295)

    cup.SetLogy()
        
    cup.SetFillColor(0);
Exemple #4
0
args = parser.parse_args()

backgrounds = analysis.backgrounds

regions = args.regions.split(',')

set_atlas_style()
set_palette()

for region in regions:

    selection = getattr(regions_, region)

    total_bkg = 0
    for bkg in backgrounds:
        total_bkg += get_events(bkg, selection=selection, lumi='data').mean

    gl_min = 1300
    gl_max = 2500
    n1_min = 147
    n1_max = 2500

    gl_bins = (gl_max - gl_min) / 30
    n1_bins = (n1_max - n1_min) / 30

    hmap = ROOT.TH2F('hmap', 'hmap', gl_bins, gl_min, gl_max, n1_bins, n1_min,
                     n1_max)
    hmap.SetDirectory(0)
    ROOT.SetOwnership(hmap, False)

    largest_cont = 0
ROOT.SetOwnership(h_sel_srl200, False)
ROOT.SetOwnership(h_sel_srl300, False)
ROOT.SetOwnership(h_sel_srh, False)

for (m3, mu), (mgl, mn1) in sorted(mg_gg_grid.iteritems()):

    name = 'GGM_GG_bhmix_%i_%i' % (m3, mu)

    # total events
    ds = get_sample_datasets(name)[0]
    total_events = get_sumw(ds)

    if total_events == 0:
        continue

    srl200_events_scaled = get_events(name, selection=SRL200, lumi='data').mean
    srl300_events_scaled = get_events(name, selection=SRL300, lumi='data').mean
    srh_events_scaled = get_events(name, selection=SRH, lumi='data').mean

    h_sel_srl200.Fill(mgl, mn1, round(srl200_events_scaled, 2))
    h_sel_srl300.Fill(mgl, mn1, round(srl300_events_scaled, 2))
    h_sel_srh.Fill(mgl, mn1, round(srh_events_scaled, 2))

    srl200_events = get_events(name, selection=SRL200, scale=False).mean
    srl300_events = get_events(name, selection=SRL300, scale=False).mean
    srh_events = get_events(name, selection=SRH, scale=False).mean

    ## acc x eff
    srl200_acceff = round(srl200_events / total_events, 2)
    srl300_acceff = round(srl300_events / total_events, 2)
    srh_acceff = round(srh_events / total_events, 2)

for (m3, mu) in sorted(mass_dict.iterkeys()):

    mgl, mn1 = mass_dict[(int(m3), int(mu))]

    name = 'GGM_M3_mu_%i_%i' % (m3, mu)

    # total events
    ds = get_sample_datasets(name)[0]
    total_events = get_sumw(ds)

    if total_events == 0:
        continue

    srl_events_scaled = get_events(name, selection=SR_L, lumi='data').mean
    srh_events_scaled = get_events(name, selection=SR_H, lumi='data').mean

    sril_events_scaled = get_events(name, selection=SRincl_L, lumi='data').mean
    srih_events_scaled = get_events(name, selection=SRincl_H, lumi='data').mean

    h_sel_srl.Fill(mgl, mn1, round(srl_events_scaled, 2))
    h_sel_srh.Fill(mgl, mn1, round(srh_events_scaled, 2))

    h_sel_sril.Fill(mgl, mn1, round(sril_events_scaled, 2))
    h_sel_srih.Fill(mgl, mn1, round(srih_events_scaled, 2))

    srl_events = get_events(name, selection=SR_L, scale=False).mean
    srh_events = get_events(name, selection=SR_H, scale=False).mean

    sril_events = get_events(name, selection=SRincl_L, scale=False).mean