Closed sam-fogarty closed 12 months ago
@sam-fogarty Can you check if this commit solves the above issue?
@YifanC Hi Yifan, sorry for getting back to you so late on this! I checked and that commit does work and I can run particle gun-type MC and cosmics MC through larnd-sim now without this error. Thanks for fixing this!
Currently we are calculating the total number of event ids with this line in
simulate_pixels.py
:num_evids = (tracks[sim.EVENT_SEPARATOR].max() % sim.MAX_EVENTS_PER_FILE) + 1
The purpose of this is to deal with offsets in the event ids. You need to set
sim.MAX_EVENTS_PER_FILE
equal to the maximum number of events in the input file (which in and of itself is not ideal IMO). Some events will not deposit energy in the detector and will not be accounted for in the datasets at this stage. So for instance if there are 10000 events initially simulated and 50 don't deposit energy, then there will only be 9950 event ids in the datasets (e.g.len(np.unique(tracks['event_id'])) = 9950
). Now just below the line above, inside theif input_has_vertices and not sim.IS_SPILL_SIM
statement, we have the following lines:We'll get an error at the second of these two lines like this:
ValueError: operands could not be broadcast together with shape (10000,) (9950,)
This happens because
counts
andevent_times.get()
have different lengths, which is caused by the fact thatvertices[sim.EVENT_SEPARATOR]
doesn't contain all 10000 event ids. We need to modify these lines to avoid this error.