diff --git a/benchmarks/dis/analysis/truth_reconstruction.py b/benchmarks/dis/analysis/truth_reconstruction.py index 220f1991e34283d12cb285b23a432d0c232d78c4..8f63665ed322e2e6c33a5581a457d6be6742114b 100644 --- a/benchmarks/dis/analysis/truth_reconstruction.py +++ b/benchmarks/dis/analysis/truth_reconstruction.py @@ -16,31 +16,32 @@ args = parser.parse_args() kwargs = vars(args) rec_file = args.rec_file -config = args.config +config = args.config.split('_epic')[0].strip() Nevents = int(args.nevents) r_path = args.results_path + '/truth_reconstruction/' #Path for output figures and file. +Dconfig = 'epic' + config.split('_epic')[1].strip() #detector configuration 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', - 'ReconstructedParticlesAssoc/ReconstructedParticlesAssoc.simID', - 'ReconstructedParticlesAssoc/ReconstructedParticlesAssoc.recID',],step_size=Nevents): + 'ReconstructedChargedParticles/ReconstructedChargedParticles.PDG', + 'ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.x', + 'ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.y', + 'ReconstructedChargedParticles/ReconstructedChargedParticles.momentum.z', + 'ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.simID', + 'ReconstructedChargedParticlesAssociations/ReconstructedChargedParticlesAssociations.recID'],step_size=Nevents): PDG_mc = array['MCParticles/MCParticles.PDG'] #Monte Carlo (MC) particle numbering scheme. px_mc = array['MCParticles/MCParticles.momentum.x'] py_mc = array['MCParticles/MCParticles.momentum.y'] pz_mc = array['MCParticles/MCParticles.momentum.z'] - PDG_rc = array['ReconstructedParticles/ReconstructedParticles.PDG'] - px_rc = array['ReconstructedParticles/ReconstructedParticles.momentum.x'] - py_rc = array['ReconstructedParticles/ReconstructedParticles.momentum.y'] - pz_rc = array['ReconstructedParticles/ReconstructedParticles.momentum.z'] - simID = array['ReconstructedParticlesAssoc/ReconstructedParticlesAssoc.simID'] - recID = array['ReconstructedParticlesAssoc/ReconstructedParticlesAssoc.recID'] + 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'] #SimID and recID contain the indices of the MCParticles and ReconstructedParticles entry for that event. ### MCParticles Variables @@ -172,7 +173,7 @@ for i in range(len(MC_list)): #Repeat the following steps for each variable (mom x_range = list(ax1.get_xlim()) fig.set_figwidth(20) 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.close() @@ -215,7 +216,7 @@ for i in range(len(MC_list)): #Repeat the following steps for each variable (mom ax6.set_title('Photons') fig.set_figwidth(20) 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))) ################################################################################################### @@ -264,7 +265,7 @@ for i in range(len(MC_list)): #Repeat the following steps for each variable (mom axs[1].set_xlabel('%s_mc'%(title_list[i])) axs[1].set_ylabel('%s_rc'%(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))) ################################################################################################### @@ -314,7 +315,7 @@ if particle in particle_dict.keys(): particle_name = particle_dict[particle][1] 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))) else: for i in [[boolean_photon,'Photons'],[boolean_electron,'Electrons'],[boolean_pion,'Pions']]: @@ -322,7 +323,7 @@ else: particle_name = i[1] 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))) diff --git a/benchmarks/single/analysis/analyze.cxx b/benchmarks/single/analysis/analyze.cxx index 4070868e5e475f4b33a38c8b163b2f201ca96d3b..8151c94a5a0437ef0890d9d415981bcad49b82c4 100644 --- a/benchmarks/single/analysis/analyze.cxx +++ b/benchmarks/single/analysis/analyze.cxx @@ -8,7 +8,7 @@ int analyze(std::string file) { // open dataframe - ROOT::RDataFrame df("events", file, {"GeneratedParticles", "ReconstructedParticles"}); + ROOT::RDataFrame df("events", file, {"GeneratedParticles", "ReconstructedChargedParticles"}); // count total events auto count = df.Count(); @@ -21,7 +21,7 @@ int analyze(std::string file) auto d = df .Define("n_tracks_gen", n_tracks, {"GeneratedParticles"}) - .Define("n_tracks_rec", n_tracks, {"ReconstructedParticles"}) + .Define("n_tracks_rec", n_tracks, {"ReconstructedChargedParticles"}) ; auto stats_n_tracks_gen = d.Stats("n_tracks_gen");