Skip to content

Commit

Permalink
updated femc benchmark scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sebouh137 committed Oct 1, 2024
1 parent 31a9ad9 commit 11d2384
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions benchmarks/femc_electron/analysis/femc_electron_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@
plt.legend()
plt.savefig(outdir+f"/{field}.pdf")

fig, axs=plt.subplots(1,2, figsize=(16,8))
avgs=[]
stds=[]
pvals=[]

#number of hits per cluster
fig, axs=plt.subplots(1,2, figsize=(16,8))
Expand All @@ -78,6 +74,8 @@
nn=-a['EcalEndcapPClusters.hits_begin']+a['EcalEndcapPClusters.hits_end']
E=a['EcalEndcapPClusters.energy']
for evt in range(len(array)):
if len(E[evt])==0:
continue
maxE=np.max(E[evt])
found=False
for i in range(len(E[evt])):
Expand Down Expand Up @@ -193,6 +191,8 @@ def gauss(x, A,mu, sigma):

try:
coeff, var_matrix = curve_fit(fnc, list(bcs[slc]), list(y[slc]), p0=p0,sigma=list(sigma))
if abs(coeff[1])>100 or np.sqrt(var_matrix[1][1])>100:
continue
pvals.append(p)
res.append(abs(coeff[2])/coeff[1])
dres.append(np.sqrt(var_matrix[2][2])/coeff[1])
Expand Down
12 changes: 7 additions & 5 deletions benchmarks/femc_photon/analysis/femc_photon_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@
plt.legend()
plt.savefig(outdir+f"/{field}.pdf")

fig, axs=plt.subplots(1,2, figsize=(16,8))
avgs=[]
stds=[]
pvals=[]

#number of hits per cluster
fig, axs=plt.subplots(1,2, figsize=(16,8))
avgs=[]
Expand All @@ -78,6 +73,8 @@
nn=-a['EcalEndcapPClusters.hits_begin']+a['EcalEndcapPClusters.hits_end']
E=a['EcalEndcapPClusters.energy']
for evt in range(len(array)):
if len(E[evt])==0:
continue
maxE=np.max(E[evt])
found=False
for i in range(len(E[evt])):
Expand Down Expand Up @@ -170,6 +167,9 @@ def gauss(x, A,mu, sigma):
plt.tight_layout()
plt.savefig(outdir+"/energy_res.pdf")

#energy res in eta bins
fig, axs=plt.subplots(1,2, figsize=(16,8))

partitions=[1.5, 2.0, 2.5, 3.0]
for eta_min, eta_max in zip(partitions[:-1], partitions[1:]):
pvals=[]
Expand All @@ -189,6 +189,8 @@ def gauss(x, A,mu, sigma):
p0=(100, p, 3)
try:
coeff, var_matrix = curve_fit(fnc, list(bcs[slc]), list(y[slc]), p0=p0,sigma=list(sigma))
if abs(coeff[1])>100 or np.sqrt(var_matrix[1][1])>100:
continue
pvals.append(p)
res.append(abs(coeff[2])/coeff[1])
dres.append(np.sqrt(var_matrix[2][2])/coeff[1])
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/femc_pi0/analysis/femc_pi0_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def gauss(x, A,mu, sigma):

try:
coeff, var_matrix = curve_fit(fnc, list(bcs[slc]), list(y[slc]), p0=p0,sigma=list(sigma))
if abs(coeff[1])>100 or np.sqrt(var_matrix[1][1])>100:
continue
pvals.append(p)
res.append(abs(coeff[2])/coeff[1])
dres.append(np.sqrt(var_matrix[2][2])/coeff[1])
Expand Down

0 comments on commit 11d2384

Please sign in to comment.