Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion Script Refactoring #35

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Write_MET_binned_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ def MET_rel_error_bad(predict_met, gen_met, name='Met_res.pdf'):
# for i in range(rel_err.shape[0]):
# std += (mean - rel_err[i]) **2

#std = std/rel_err.shape[0]
#std = math.sqrt(std)
# std = std/rel_err.shape[0]
# std = math.sqrt(std)

mean = mean * 1000
mean = int(mean)
Expand Down Expand Up @@ -467,8 +467,8 @@ def Phi_abs_error(predict_met, gen_met, name='Met_res.pdf'):
def Pt_abs_error_opaque(puppi_met, ml_met, gen_met, name='Met_res.pdf'):
puppi_err = (puppi_met - gen_met)
ml_err = (ml_met - gen_met)
#minErr = min(np.array([rel_err, rel_err2]).flatten())
#maxErr = max(np.array([rel_err, rel_err2]).flatten())
# minErr = min(np.array([rel_err, rel_err2]).flatten())
# maxErr = max(np.array([rel_err, rel_err2]).flatten())
plt.figure()
plt.hist(puppi_err, bins=np.linspace(-250, 250, 50+1), alpha=0.5, label='puppi')
plt.hist(ml_err, bins=np.linspace(-250, 250, 50+1), alpha=0.5, label='ML')
Expand Down Expand Up @@ -573,7 +573,7 @@ def MET_binned_predict_mean(predict_met, gen_met, binning, mini, maxi, genMET_cu
plt.xlim(mini, maxi)
plt.ylim(mini, 700)
plt.xlabel('Gen MET mean [GeV]', fontsize=16)
#plt.ylabel('PUPPI MET mean [GeV]', fontsize = 16)
# plt.ylabel('PUPPI MET mean [GeV]', fontsize = 16)
plt.ylabel('predicted MET mean [GeV]', fontsize=16)
plt.legend()
plt.savefig(name)
Expand Down Expand Up @@ -621,7 +621,7 @@ def MET_binned_predict_mean_opaque(predict_met, predict_met2, gen_met, binning,
plt.xlim(mini, maxi)
plt.ylim(mini, maxi)
plt.xlabel('Gen MET mean [GeV]', fontsize=16)
#plt.ylabel('PUPPI MET mean [GeV]', fontsize = 16)
# plt.ylabel('PUPPI MET mean [GeV]', fontsize = 16)
plt.ylabel('predicted MET mean [GeV]', fontsize=16)
plt.legend()
plt.savefig(name)
Expand Down Expand Up @@ -673,9 +673,9 @@ def extract_result(feat_array, targ_array, path, name, mode):
def histo_2D(predict_pT, gen_pT, min_, max_, name='2D_histo.png'):
X_hist = np.arange(0, 500, 20)
Y_hist = X_hist # 1.25*X_hist
#Y_hist_1 = 0.75*X_hist
# Y_hist_1 = 0.75*X_hist
plt.plot(X_hist, Y_hist, '-r')
#plt.plot(X_hist, Y_hist_1, '-r')
# plt.plot(X_hist, Y_hist_1, '-r')
x_bins = np.linspace(min_, max_, 50)
y_bins = np.linspace(min_, max_, 50)
plt.hist2d(gen_pT, predict_pT, bins=[x_bins, y_bins], cmap=plt.cm.jet)
Expand Down
2 changes: 1 addition & 1 deletion convertNanoToHDF5_L1triggerToDeepMET.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
import awkward as ak
import h5py
#import progressbar
# import progressbar
from tqdm import tqdm
import os

Expand Down
Loading
Loading