Skip to content

Commit

Permalink
sigma_plots: another place to ignore fit fail
Browse files Browse the repository at this point in the history
  • Loading branch information
veprbl committed Jan 20, 2025
1 parent 18f5188 commit a934572
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions benchmarks/zdc_sigma/analysis/sigma_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def gauss(x, A,mu, sigma):
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")
Expand Down Expand Up @@ -309,10 +309,13 @@ def gauss(x, A,mu, sigma):
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")

Expand Down

0 comments on commit a934572

Please sign in to comment.