Пример #1
0
        'mgluino': [r['m_gluino'] for r in summary],
        'mlsp': [r['m_lsp'] for r in summary],
        'ratio': [r['ratio'] for r in summary]
    }

    plotting.init_palette()

    c = plotting.init_canvas(args.x_dim, args.y_dim)
    labels = ['sig', 'signal', 'bkgd', 'ratio']
    zlabels = [
        'Significance in optimal cut', 'Exp. num. signal in optimal cut',
        'Exp. num. bkgd in optimal cut', 'Signal/Background'
    ]
    nSigs = [2, 3, 3, 2]
    for label, zlabel, nSig in zip(labels, zlabels, nSigs):
        h = plotting.init_hist(zlabel, args.g_min, args.g_max, args.l_min,
                               args.l_max, args.bin_size)
        plotting.fill_hist(h, plot_array, label, label == 'sig')
        plotting.draw_hist(h, nSig)
        plotting.draw_labels(args.lumi)
        plotting.draw_text(args.text_file)
        plotting.draw_line(args.g_min, args.l_min, args.g_max, args.l_max,
                           args.top_mass)
        savefilename = os.path.join(args.out_directory,
                                    '_'.join([args.output, label]))
        if args.do_run1:
            gr = plotting.get_run1(args.run1_excl, 1, 3, args.run1_color)
            gr.Draw("C")
            gr_1sigma = plotting.get_run1(args.run1_1sigma, 3, 1,
                                          args.run1_color)
            gr_1sigma.Draw("C")
            plotting.draw_run1_text(args.run1_color)
    did = p_did.search(filename).group(1)
    significances[did][i] = data[0]['significance_scaled']

# find the winning SR
import operator
winners = dict((i, 0) for i in range(1, args.numSRs+1))
for did, vals in significances.iteritems():
  winner = max(vals.iteritems(), key=operator.itemgetter(1))[0]
  winners[winner] += 1
  significances[did]['winner'] = winner

print winners

# do optimal signal regions
c = init_canvas()
h = plotting.init_hist("Optimal Signal Region", 200, 2500, 0, 2300, 100, 200)
for did, vals in significances.iteritems():
  winningSR = vals['winner']
  mgluino, mstop, mlsp = mdict[did]
  if mstop != 5000: continue
  set_bin(h, mgluino, mlsp, winningSR)

draw_hist(h)
draw_text(args)
fix_zaxis(h)
draw_line()

save_canvas(c, '{0}_optimalSR_grid_lumi{1}'.format(os.path.join(args.output_dir, args.output), args.lumi))

# now make a plot of the actual significances
c = init_canvas()
Пример #3
0
    c = plotting.init_canvas(args.x_dim, args.y_dim)
    labels = ['sig', 'signal', 'bkgd', 'ratio']
    zlabels = [
        'Significance in optimal cut',
        'Exp. num. signal in optimal cut',
        'Exp. num. bkgd in optimal cut',
        'Signal/Background',
    ]
    nSigs = [2, 3, 3, 2]
    for label, zlabel, nSig in zip(labels, zlabels, nSigs):
        h = plotting.init_hist(
            zlabel,
            args.g_min,
            args.g_max,
            args.l_min,
            args.l_max,
            args.x_bin_size,
            args.y_bin_size,
        )
        plotting.fill_hist(h, plot_array, label, label == 'sig')
        plotting.draw_hist(h, nSig)
        plotting.draw_labels(args.lumi)
        plotting.draw_text(args.text_file)
        plotting.draw_line(
            args.g_min, args.l_min, args.g_max, args.l_max, args.top_mass
        )
        savefilename = os.path.join(args.out_directory, '_'.join([args.output, label]))
        if args.do_run1:
            gr = plotting.get_run1(args.run1_excl, 1, 3, args.run1_color)
            gr.Draw("C")
        did = p_did.search(filename).group(1)
        significances[did][i] = data[0]['significance_scaled']

# find the winning SR
import operator
winners = dict((i, 0) for i in range(1, args.numSRs + 1))
for did, vals in significances.iteritems():
    winner = max(vals.iteritems(), key=operator.itemgetter(1))[0]
    winners[winner] += 1
    significances[did]['winner'] = winner

print winners

# do optimal signal regions
c = init_canvas()
h = plotting.init_hist("Optimal Signal Region", 200, 2500, 0, 2300, 100, 200)
for did, vals in significances.iteritems():
    winningSR = vals['winner']
    mgluino, mstop, mlsp = mdict[did]
    if mstop != 5000: continue
    set_bin(h, mgluino, mlsp, winningSR)

draw_hist(h)
draw_text(args)
fix_zaxis(h)
draw_line()

save_canvas(
    c, '{0}_optimalSR_grid_lumi{1}'.format(
        os.path.join(args.output_dir, args.output), args.lumi))
Пример #5
0
  plot_array={'sig':      [r['significance'] for r in summary],
              'signal':   [r['signal'] for r in summary],
              'bkgd':     [r['bkgd'] for r in summary],
              'mgluino':  [r['m_gluino'] for r in summary],
              'mlsp':     [r['m_lsp'] for r in summary],
              'ratio':    [r['ratio'] for r in summary]}

  plotting.init_palette()

  c = plotting.init_canvas(args.x_dim, args.y_dim)
  labels = ['sig','signal','bkgd', 'ratio']
  zlabels = ['Significance in optimal cut','Exp. num. signal in optimal cut','Exp. num. bkgd in optimal cut', 'Signal/Background']
  nSigs = [2, 3, 3, 2]
  for label,zlabel,nSig in zip(labels,zlabels,nSigs):
    h = plotting.init_hist(zlabel, args.g_min, args.g_max, args.l_min, args.l_max, args.x_bin_size, args.y_bin_size)
    plotting.fill_hist(h,plot_array,label, label=='sig')
    plotting.draw_hist(h, nSig)
    plotting.draw_labels(args.lumi)
    plotting.draw_text(args.text_file)
    plotting.draw_line(args.g_min, args.l_min, args.g_max, args.l_max, args.top_mass)
    savefilename = os.path.join(args.out_directory, '_'.join([args.output, label]))
    if args.do_run1:
      gr = plotting.get_run1(args.run1_excl,1,3,args.run1_color)
      gr.Draw("C")
      gr_1sigma = plotting.get_run1(args.run1_1sigma,3,1,args.run1_color)
      gr_1sigma.Draw("C")
      plotting.draw_run1_text(args.run1_color)
      savefilename += "_wrun1"
    if args.do_run2:
      gr = plotting.get_run2(args.run2_excl,1,3,args.run2_color)