smash-transport/sparkx

update_num_output_per_event_after_filter does not work for multiplicity_cuts.

Closed this issue · 1 comments

When calling Oscar.multiplicity_cut() the num_output_per_event is not updated correctly. This is because the particle_list_ is reduced in size, but the update_num_output_per_event_after_filter() function only updates the entries in range(len(self.particle_list_)) without removing the remaining entries. This also causes problems with the print_particle_lists_to_file() function.

This code produces the errors:
path = '..' + os.sep + 'data' +os.sep+ 'SMASH_min_bias_alpha_clustering.oscar' oscar = sparkx.Oscar(path, events=(0,200)).participants() mult_cut = oscar.multiplicity_cut(1) #keep events with N >= 1 print(oscar.num_output_per_event()) mult_cut.print_particle_lists_to_file('test.oscar')

Traceback (most recent call last):
File "/mnt/c/Users/lucas/Desktop/Masterarbeit_project/sparkx_flow_checks/multiplicity_folders.py", line 11, in
mult_cut.print_particle_lists_to_file('test.oscar')
File "/usr/local/lib/python3.9/dist-packages/sparkx/Oscar.py", line 1078, in print_particle_lists_to_file
particle_output = np.asarray(self.particle_list()[i])
File "/usr/local/lib/python3.9/dist-packages/sparkx/Oscar.py", line 634, in particle_list
particle = self.particle_list_[i_ev][i_part]
IndexError: list index out of range

Closed by #296