Skip to content
Snippets Groups Projects

added eta and theta distribution to performance plot

Merged Shujie Li requested to merge single_track_performance into master
1 file
+ 29
3
Compare changes
  • Side-by-side
  • Inline
@@ -139,7 +139,7 @@ if __name__ == '__main__':
@@ -139,7 +139,7 @@ if __name__ == '__main__':
df['theta'] = df['direction.theta']
df['theta'] = df['direction.theta']
df['phi'] = df['direction.phi']
df['phi'] = df['direction.phi']
fig, axs = plt.subplots(2, 2, figsize=(16, 12), dpi=120)
fig, axs = plt.subplots(3, 2, figsize=(16, 18), dpi=120)
for ax in axs.flat:
for ax in axs.flat:
ax.tick_params(direction='in', which='both', labelsize=20)
ax.tick_params(direction='in', which='both', labelsize=20)
ax.grid(linestyle=':')
ax.grid(linestyle=':')
@@ -170,7 +170,7 @@ if __name__ == '__main__':
@@ -170,7 +170,7 @@ if __name__ == '__main__':
ax.errorbar(eta_centers, track_eff, xerr=eta_binsize/2., yerr=[track_eff_lower, track_eff_upper],
ax.errorbar(eta_centers, track_eff, xerr=eta_binsize/2., yerr=[track_eff_lower, track_eff_upper],
fmt='o', capsize=3)
fmt='o', capsize=3)
ax.set_ylim(0., 1.)
ax.set_ylim(0., 1.1)
ax.set_xlim(-4.5, 4.5)
ax.set_xlim(-4.5, 4.5)
ax.set_ylabel('Tracking Efficiency', fontsize=20)
ax.set_ylabel('Tracking Efficiency', fontsize=20)
ax.set_xlabel('$\eta$', fontsize=20)
ax.set_xlabel('$\eta$', fontsize=20)
@@ -212,6 +212,32 @@ if __name__ == '__main__':
@@ -212,6 +212,32 @@ if __name__ == '__main__':
ax.set_ylabel('Normalized Counts / {:d} Bins'.format(nbins), fontsize=20)
ax.set_ylabel('Normalized Counts / {:d} Bins'.format(nbins), fontsize=20)
ax.set_xlabel(r'$d\phi$ (rad)', fontsize=20)
ax.set_xlabel(r'$d\phi$ (rad)', fontsize=20)
fig.text(0.5, 0.95, 'Barrel Tracker Benchmark (Truth Init.)', fontsize=22, ha='center')
# eta distribution
 
ax = axs.flat[4]
 
sim_eta = dfm.groupby('event')['eta'].first().values
 
rec_eta = -np.log(np.tan(df.groupby('event')['direction.theta'].first().values/2.))
 
hval, hbins, _ = ax.hist(sim_eta, bins=np.linspace(-4, 4, 41), ec='k',alpha=0.3,label="Generated")
 
hval, hbins, _ = ax.hist(rec_eta, bins=np.linspace(-4, 4, 41), ec='k',alpha=0.3, label="Reconstructed")
 
nbins = hbins.shape[0] - 1
 
ax.set_ylabel('Normalized Counts / {:d} Bins'.format(nbins), fontsize=20)
 
ax.set_xlabel(r'$\eta$', fontsize=20)
 
ax.legend(loc="upper right")
 
 
# theta distribution
 
ax = axs.flat[5]
 
sim_th_deg = dfm.groupby('event')['theta'].first().values*180/np.pi
 
rec_th_deg = df.groupby('event')['direction.theta'].first().values*180/np.pi
 
 
hval, hbins, _ = ax.hist(sim_th_deg, bins=np.linspace(-0, 180,61),
 
ec='k',alpha=0.3,label="Generated")
 
hval, hbins, _ = ax.hist(rec_th_deg, bins=np.linspace(-0,180, 61),
 
ec='k',alpha=0.3, label="Reconstructed")
 
nbins = hbins.shape[0] - 1
 
ax.set_ylabel('Normalized Counts / {:d} Bins'.format(nbins), fontsize=20)
 
ax.set_xlabel(r'$\theta (degree)$', fontsize=20)
 
 
 
fig.text(0.5, 0.95, 'Tracker Benchmark (Truth Init.)', fontsize=22, ha='center')
fig.savefig(os.path.join(args.outdir, '{}_performance.png'.format(args.nametag)))
fig.savefig(os.path.join(args.outdir, '{}_performance.png'.format(args.nametag)))
 
Loading