Skip to content
Snippets Groups Projects

feat: DIS: replace gaudirun with eicrecon

Merged Wouter Deconinck requested to merge eicrecon into master
3 files
+ 53
23
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -12,6 +12,7 @@ parser.add_argument('--rec_file', type=str, help='Reconstructed track file.')
@@ -12,6 +12,7 @@ parser.add_argument('--rec_file', type=str, help='Reconstructed track file.')
parser.add_argument('--config', type=str, help='Momentum configuration.')
parser.add_argument('--config', type=str, help='Momentum configuration.')
parser.add_argument('--nevents', type=float, help='Number of events to process.')
parser.add_argument('--nevents', type=float, help='Number of events to process.')
parser.add_argument('--results_path', type=str, help='Output directory.')
parser.add_argument('--results_path', type=str, help='Output directory.')
 
parser.add_argument('--dconfig', type=str, help='Detector configuration.')
args = parser.parse_args()
args = parser.parse_args()
kwargs = vars(args)
kwargs = vars(args)
@@ -19,26 +20,49 @@ rec_file = args.rec_file
@@ -19,26 +20,49 @@ rec_file = args.rec_file
config = args.config
config = args.config
Nevents = int(args.nevents)
Nevents = int(args.nevents)
r_path = args.results_path + '/truth_reconstruction/'
r_path = args.results_path + '/truth_reconstruction/'
Dconfig = args.dconfig
for array in ur.iterate(rec_file + ':events',['MCParticles/MCParticles.generatorStatus',
if Dconfig == 'epic_brycecanyon':
'MCParticles/MCParticles.PDG',
for array in ur.iterate(rec_file + ':events',['MCParticles/MCParticles.generatorStatus',
'MCParticles/MCParticles.momentum.x',
'MCParticles/MCParticles.PDG',
'MCParticles/MCParticles.momentum.y',
'MCParticles/MCParticles.momentum.x',
'MCParticles/MCParticles.momentum.z',
'MCParticles/MCParticles.momentum.y',
'ReconstructedChargedParticles/ReconstructedChargedParticles.PDG',
'MCParticles/MCParticles.momentum.z',
'ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.x',
'ReconstructedChargedParticles/ReconstructedChargedParticles.PDG',
'ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.y',
'ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.x',
'ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.z',
'ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.y',
'ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.simID',
'ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.z',
'ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.recID'],step_size=Nevents):
'ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.simID',
 
'ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.recID'],step_size=Nevents):
 
PDG_mc = array['MCParticles/MCParticles.PDG']
 
px_mc = array['MCParticles/MCParticles.momentum.x']
 
py_mc = array['MCParticles/MCParticles.momentum.y']
 
pz_mc = array['MCParticles/MCParticles.momentum.z']
 
PDG_rc = array['ReconstructedChargedParticles/ReconstructedChargedParticles.PDG']
 
px_rc = array['ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.x']
 
py_rc = array['ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.y']
 
pz_rc = array['ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.z']
 
simID = array['ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.simID']
 
recID = array['ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.recID']
 
else:
 
for array in ur.iterate(rec_file + ':events',['MCParticles/MCParticles.generatorStatus',
 
'MCParticles/MCParticles.PDG',
 
'MCParticles/MCParticles.momentum.x',
 
'MCParticles/MCParticles.momentum.y',
 
'MCParticles/MCParticles.momentum.z',
 
'ReconstructedParticles/ReconstructedParticles.PDG',
 
'ReconstructedParticles/ReconstructedParticles.momentum.x',
 
'ReconstructedParticles/ReconstructedParticles.momentum.y',
 
'ReconstructedParticles/ReconstructedParticles.momentum.z',
 
'ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.simID',
 
'ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.recID'],step_size=Nevents):
PDG_mc = array['MCParticles/MCParticles.PDG']
PDG_mc = array['MCParticles/MCParticles.PDG']
px_mc = array['MCParticles/MCParticles.momentum.x']
px_mc = array['MCParticles/MCParticles.momentum.x']
py_mc = array['MCParticles/MCParticles.momentum.y']
py_mc = array['MCParticles/MCParticles.momentum.y']
pz_mc = array['MCParticles/MCParticles.momentum.z']
pz_mc = array['MCParticles/MCParticles.momentum.z']
PDG_rc = array['ReconstructedChargedParticles/ReconstructedChargedParticles.PDG']
PDG_rc = array['ReconstructedParticles/ReconstructedParticles.PDG']
px_rc = array['ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.x']
px_rc = array['ReconstructedParticles/ReconstructedParticles.momentum.x']
py_rc = array['ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.y']
py_rc = array['ReconstructedParticles/ReconstructedParticles.momentum.y']
pz_rc = array['ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.z']
pz_rc = array['ReconstructedParticles/ReconstructedParticles.momentum.z']
simID = array['ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.simID']
simID = array['ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.simID']
recID = array['ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.recID']
recID = array['ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.recID']
@@ -165,7 +189,7 @@ for i in range(len(MC_list)):
@@ -165,7 +189,7 @@ for i in range(len(MC_list)):
x_range = list(ax1.get_xlim())
x_range = list(ax1.get_xlim())
fig.set_figwidth(20)
fig.set_figwidth(20)
fig.set_figheight(10)
fig.set_figheight(10)
ax1.set_title('%s %s %s %s events'%(title_list[i],title,config,Nevents))
ax1.set_title('%s %s %s %s events\n DETECTOR_CONFIG: %s'%(title_list[i],title,config,Nevents,Dconfig))
plt.savefig(os.path.join(r_path, '%s_%s_%s.png' % (title_list[i],title,config)))
plt.savefig(os.path.join(r_path, '%s_%s_%s.png' % (title_list[i],title,config)))
plt.close()
plt.close()
############
############
@@ -211,7 +235,7 @@ for i in range(len(MC_list)):
@@ -211,7 +235,7 @@ for i in range(len(MC_list)):
axs[1].set_xlabel('%s_mc'%(title_list[i]))
axs[1].set_xlabel('%s_mc'%(title_list[i]))
axs[1].set_ylabel('%s_rc'%(title_list[i]))
axs[1].set_ylabel('%s_rc'%(title_list[i]))
axs[1].set_title('%s Correlation'%(title_list[i]))
axs[1].set_title('%s Correlation'%(title_list[i]))
fig.suptitle('%s %s events'%(config,Nevents))
fig.suptitle('%s %s events\n DETECTOR_CONFIG: %s'%(config,Nevents,Dconfig))
plt.savefig(os.path.join(r_path, '%s_correlation_%s.png' % (title_list[i],config)))
plt.savefig(os.path.join(r_path, '%s_correlation_%s.png' % (title_list[i],config)))
###############
###############
@@ -252,7 +276,7 @@ for i in range(len(MC_list)):
@@ -252,7 +276,7 @@ for i in range(len(MC_list)):
ax6.set_title('Photons')
ax6.set_title('Photons')
fig.set_figwidth(20)
fig.set_figwidth(20)
fig.set_figheight(10)
fig.set_figheight(10)
ax1.set_title('%s Difference Vs Momentum %s %s events'%(title_list[i],config,Nevents))
ax1.set_title('%s Difference Vs Momentum %s %s events\n DETECTOR_CONFIG: %s'%(title_list[i],config,Nevents,Dconfig))
plt.savefig(os.path.join(r_path, '%s_difference_vs_momentum_%s.png' % (title_list[i],config)))
plt.savefig(os.path.join(r_path, '%s_difference_vs_momentum_%s.png' % (title_list[i],config)))
################
################
@@ -298,7 +322,7 @@ if particle in particle_dict.keys():
@@ -298,7 +322,7 @@ if particle in particle_dict.keys():
particle_name = particle_dict[particle][1]
particle_name = particle_dict[particle][1]
particle_plots(boolean_particle)
particle_plots(boolean_particle)
plt.suptitle('%s in %s %s events'%(particle_name,config,Nevents))
plt.suptitle('%s in %s %s events\n DETECTOR_CONFIG: %s'%(particle_name,config,Nevents,Dconfig))
plt.savefig(os.path.join(r_path, '%s_%s.png' % (particle_name,config)))
plt.savefig(os.path.join(r_path, '%s_%s.png' % (particle_name,config)))
else:
else:
for i in [[boolean_photon,'Photons'],[boolean_electron,'Electrons'],[boolean_pion,'Pions']]:
for i in [[boolean_photon,'Photons'],[boolean_electron,'Electrons'],[boolean_pion,'Pions']]:
@@ -306,7 +330,7 @@ else:
@@ -306,7 +330,7 @@ else:
particle_name = i[1]
particle_name = i[1]
particle_plots(boolean_particle)
particle_plots(boolean_particle)
plt.suptitle('%s in %s %s events'%(particle_name,config,Nevents))
plt.suptitle('%s in %s %s events\n DETECTOR_CONFIG: %s'%(particle_name,config,Nevents,Dconfig))
plt.savefig(os.path.join(r_path, '%s_%s.png' % (particle_name,config)))
plt.savefig(os.path.join(r_path, '%s_%s.png' % (particle_name,config)))
Loading