diff --git a/benchmarks/zdc_sigma/analysis/sigma_plots.py b/benchmarks/zdc_sigma/analysis/sigma_plots.py index 228dbb920fa7efda3f356e7f3a09a41c9a7bccff..302bbe0781a44034363481437c2abbf7e88c2896 100644 --- a/benchmarks/zdc_sigma/analysis/sigma_plots.py +++ b/benchmarks/zdc_sigma/analysis/sigma_plots.py @@ -39,7 +39,7 @@ for p in momenta: plt.hist(nclusters[p],bins=20, range=(0,20)) plt.xlabel("number of clusters") plt.yscale('log') - plt.title(f"$p_\Sigma={p}$ GeV") + plt.title(rf"$p_\Sigma={p}$ GeV") plt.ylim(1) plt.savefig(outdir+f"nclust_{p}GeV_recon.pdf") print("saved file ", outdir+f"nclust_{p}GeV_recon.pdf") @@ -309,10 +309,13 @@ from scipy.optimize import curve_fit slc=abs(bc)<5 fnc=gauss p0=[100, 0, 1] -coeff, var_matrix = curve_fit(fnc, bc[slc], y[slc], p0=p0, - sigma=np.sqrt(y[slc])+(y[slc]==0), maxfev=10000) -x=np.linspace(-5, 5) -plt.plot(x, gauss(x, *coeff), color='tab:orange') +try: + coeff, var_matrix = curve_fit(fnc, bc[slc], y[slc], p0=p0, + sigma=np.sqrt(y[slc])+(y[slc]==0), maxfev=10000) + x=np.linspace(-5, 5) + plt.plot(x, gauss(x, *coeff), color='tab:orange') +except RuntimeError: + print("fit failed") plt.xlabel("$z^{*\\rm recon}_{\\rm vtx}-z^{*\\rm truth}_{\\rm vtx}$ [m]") plt.ylabel("events")