Skip to content
Snippets Groups Projects

AI energy-recon for SiPM-on-tile ZDC

Open Sebouh Paul requested to merge zdc_sipmontile_ai into master
38 files
+ 3880
4
Compare changes
  • Side-by-side
  • Inline
Files
38
 
 
import numpy as np, pandas as pd, matplotlib.pyplot as plt
 
import sys
 
import compress_pickle as pickle
 
 
infile=sys.argv[1]
 
outdir=sys.argv[2]
 
 
npz_unpacked = np.load(infile)
 
 
predictions = npz_unpacked['outputs_scaled'] ### predicted value of the energy
 
targets = npz_unpacked['targets_scaled'] ### true value of the energy
 
 
print(dict(npz_unpacked))
 
 
path_to_result_indv="benchmarks/far_forward/pointcloud/model/"
 
 
E_truth = targets[:,0]
 
E_reco = predictions[::2]
 
 
print(targets)
 
print("E_truth", E_truth)
 
print("E_reco", E_reco)
 
 
#not used, since HEXPLIT provides a better theta resolution
 
### True THETA
 
#targets_plt_theta = targets[:,1]*stdvs['theta'] + means['theta']
 
### Predicted THETA
 
#predictions_plt_theta = predictions[:,1]*stdvs['theta'] + means['theta']
 
 
plt.hist((E_reco-E_truth)/E_truth*100, bins=np.linspace(-30,30,30))
 
 
plt.xlabel("$(E_{\\rm reco}-E_{truth})/E_{\\rm truth}$ [%]")
 
plt.ylabel("events")
 
plt.savefig(outdir+"/energy_residuals.png")
Loading