Ejemplo n.º 1
0
    # y projection slices
    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)