diff --git a/benchmarks/femc_electron/analysis/femc_electron_plots.py b/benchmarks/femc_electron/analysis/femc_electron_plots.py index 88e4c98..ff552b3 100644 --- a/benchmarks/femc_electron/analysis/femc_electron_plots.py +++ b/benchmarks/femc_electron/analysis/femc_electron_plots.py @@ -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)) @@ -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])): @@ -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]) diff --git a/benchmarks/femc_photon/analysis/femc_photon_plots.py b/benchmarks/femc_photon/analysis/femc_photon_plots.py index 275f900..9b45207 100644 --- a/benchmarks/femc_photon/analysis/femc_photon_plots.py +++ b/benchmarks/femc_photon/analysis/femc_photon_plots.py @@ -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=[] @@ -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])): @@ -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=[] @@ -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]) diff --git a/benchmarks/femc_pi0/analysis/femc_pi0_plots.py b/benchmarks/femc_pi0/analysis/femc_pi0_plots.py index 34eed63..a52c524 100644 --- a/benchmarks/femc_pi0/analysis/femc_pi0_plots.py +++ b/benchmarks/femc_pi0/analysis/femc_pi0_plots.py @@ -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])