コード例 #1
0
                fig,
                ax,
                xlabel=
                r'$N(P_T^\mathrm{{oJet\ subjet}} >\ 20 \ \mathrm{{GeV}}) \geq X$',
                ylabel='Efficiency',
                title=gJetEtCutLabel)
            helpers.add_description(
                fig,
                ax,
                align='tl',
                strings=[
                    helpers.dataSetStr,
                    'isolated, $\Delta R(\mathrm{gJet},\mathrm{oJet})\leq 1$',
                    helpers.seedCutStr, helpers.noiseCutStr, offlineLabel
                ])
            helpers.add_grid(fig, ax)
            helpers.to_file(
                fig, ax,
                'plots/subjets/{}_XoJet_gJetEt{:0.0f}_gTowerEt{:0.0f}{}.png'.
                format(filename_id, gJetEt_cut, gTowerEt_cut, filenameEnd))
            pl.close(fig)

pickle.dump(
    dataStorage,
    file(helpers.write_file('plots/subjets/{}.pkl'.format(filename_id)), 'w+'))

endTime_wall = time.time()
endTime_processor = time.clock()
print "Finished job in:\n\t Wall time: {:0.2f} s \n\t Clock Time: {:0.2f} s".format(
    (endTime_wall - startTime_wall), (endTime_processor - startTime_processor))
コード例 #2
0
    pl_res_proj = {}
    fig, ax = pl.subplots(figsize=helpers.figsize)
    for oJetPt_cuts in [(170., 180.), (200., 220.), (300., 350.)]:
      oJetPt_cut = helpers.btwn(data['oJet.pt'], oJetPt_cuts[0], oJetPt_cuts[1])
      hist, bins = np.histogram(resolution[np.where(cut & oJetPt_cut & tJet_exists_subtracted)], bins=100, density=True)
      fwhm = helpers.FWHM(bins, hist)
      ax.plot(bins[:-1], hist, linestyle='steps-post', alpha=0.75, color='b', label=r'${:0.0f}\ \mathrm{{GeV}} < p_T^\mathrm{{oJet}} <\ {:0.0f}\ \mathrm{{GeV}}$\nFWHM = {:0.4f}'.format(oJetPt_cuts[0], oJetPt_cuts[1], fwhm), linewidth=helpers.linewidth)

      pl_res_proj['{:0.0f}to{:0.0f}'.format(oJetPt_cuts[0], oJetPt_cuts[1])] = resolution[np.where(cut & oJetPt_cut & tJet_exists_subtracted)]

    helpers.add_legend(fig, ax)
    helpers.add_labels(fig, ax, xlabel=r'resolution $\frac{E_T^\mathrm{gFEX} - p_T^\mathrm{offline}}{p_T^\mathrm{offline}}$', ylabel='normalized counts', title='Y-Axis Projections of Resolution')
    helpers.add_description(fig, ax, align='br', strings=[helpers.dataSetStr, helpers.seedCutStr, helpers.noiseCutStr, helpers.towerThrStr])
    ax.set_xlim((-1.0, 1.0))
    helpers.add_grid(fig, ax)
    pickle.dump(pl_res_proj, file(helpers.write_file('plots/pickle/{}_resolution_PtOffline_projection_region{}.pkl'.format(filename_id, i)), 'w+'))
    helpers.to_file(fig, ax, 'plots/resolution/{}_resolution_PtOffline_projection_region{}.png'.format(filename_id, i))
    pl.close(fig)
  except:
    print "\t"*2, "Error for {}: could not make resolution projection".format(region)
    pl.close(fig)
    pass

  try:
    print "\t"*2, "y-projection slices of corrected resolution"
    pl_res_proj = {}
    fig, ax = pl.subplots(figsize=helpers.figsize)
    for oJetPt_cuts in [(170., 180.), (200., 220.), (300., 350.)]:
      oJetPt_cut = helpers.btwn(data['oJet.pt'], oJetPt_cuts[0], oJetPt_cuts[1])
      hist, bins = np.histogram(resolution_subtracted[np.where(cut & oJetPt_cut & tJet_exists_subtracted)], bins=100, density=True)
      fwhm = helpers.FWHM(bins, hist)
コード例 #3
0
        # make a label for gJet nsj cut
        gJetnsjCutLabel = r'$N(E_T^\mathrm{{gJet\ gTower}} > {:0.2f} \ \mathrm{{GeV}}) \geq {:d}$'.format(gTowerEt_cut, gJetnsj_cut)

        hist_num, bins_num = np.histogram(oJetsubjets_count[np.where(cut & offlineCut & triggerCut)], bins=np.arange(1, 6, 1), weights=data['weight'][np.where(tJet_exists)][np.where(cut & offlineCut & triggerCut)])
        # integral, inclusive
        hist_num = np.cumsum(hist_num[::-1])[::-1]

        vals = hist_num.astype(float)/hist_den.astype(float)
        ax.plot(bins_den[:-1], vals, linestyle='steps-mid', alpha=0.75, color=color, marker='x', ms=20, mew=10, linewidth=0, label=gJetnsjCutLabel)

        # store the data
        myStore['bins'] = bins_den[:-1]
        myStore['vals'] = vals

      ax.set_xlim((0.0, 6.0))
      ax.set_ylim((0.0, 2.0))
      ax.set_xticks(np.arange(1, 6, 1))
      ax.set_yticks(np.linspace(0., 1., 6))
      helpers.add_legend(fig, ax, numpoints=1)
      helpers.add_labels(fig, ax, xlabel=r'$N(P_T^\mathrm{{oJet\ subjet}} >\ 20 \ \mathrm{{GeV}}) \geq X$', ylabel='Efficiency', title=gJetEtCutLabel)
      helpers.add_description(fig, ax, align='tl', strings=[helpers.dataSetStr, 'isolated, $\Delta R(\mathrm{gJet},\mathrm{oJet})\leq 1$', helpers.seedCutStr, helpers.noiseCutStr, offlineLabel])
      helpers.add_grid(fig, ax)
      helpers.to_file(fig, ax, 'plots/subjets/{}_XoJet_gJetEt{:0.0f}_gTowerEt{:0.0f}{}.png'.format(filename_id, gJetEt_cut, gTowerEt_cut, filenameEnd))
      pl.close(fig)

pickle.dump(dataStorage, file(helpers.write_file('plots/subjets/{}.pkl'.format(filename_id)), 'w+'))

endTime_wall      = time.time()
endTime_processor = time.clock()
print "Finished job in:\n\t Wall time: {:0.2f} s \n\t Clock Time: {:0.2f} s".format((endTime_wall - startTime_wall), (endTime_processor - startTime_processor))