Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor correction so mpvmpr (particle generation) can run as the beam … #200

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions cli/simulate_pixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ def save_results(event_times, is_first_batch, results, i_mod=-1, light_only=Fals
importlib.reload(lightLUT)
importlib.reload(fee)

if light.LIGHT_TRIG_MODE == 1 and not sim.IS_SPILL_SIM:
raise ValueError("The simulation property indicates it is not beam simulation, but the light trigger mode is set to the beam trigger mode!")
#if light.LIGHT_TRIG_MODE == 1 and not sim.IS_SPILL_SIM:
# raise ValueError("The simulation property indicates it is not beam simulation, but the light trigger mode is set to the beam trigger mode!")

RangePush("load_pixel_thresholds")
if pixel_thresholds_file is not None:
Expand Down Expand Up @@ -1075,19 +1075,19 @@ def save_results(event_times, is_first_batch, results, i_mod=-1, light_only=Fals
all_mod_tracks['t0_end'] = all_mod_tracks['t0_end'] + localSpillIDs*sim.SPILL_PERIOD
all_mod_tracks['t0'] = all_mod_tracks['t0'] + localSpillIDs*sim.SPILL_PERIOD

# store light triggers altogether if it's beam trigger (all light channels are forced to trigger)
# FIXME one can merge the beam + threshold for LIGHT_TRIG_MODE = 1 in future
# once mod2mod variation is enabled, the light threshold triggering does not work properly
# compare the light trigger between different module and digitize afterwards should solve the issue
if light.LIGHT_TRIG_MODE == 1:
light_event_id = np.unique(localSpillIDs)
light_start_times = np.full(len(light_event_id), 0) # if it is beam trigger it is set to 0
light_trigger_idx = np.full(len(light_event_id), 0) # one beam spill, one trigger
light_op_channel_idx = light.TPC_TO_OP_CHANNEL[:].ravel()
light_event_times = light_event_id * sim.SPILL_PERIOD # us

light_sim.export_light_trig_to_hdf5(light_event_id, light_start_times, light_trigger_idx, light_op_channel_idx, output_filename, light_event_times)
#fee.export_pacman_trigger_to_hdf5(output_filename, light_event_times)
# store light triggers altogether if it's beam trigger (all light channels are forced to trigger)
# FIXME one can merge the beam + threshold for LIGHT_TRIG_MODE = 1 in future
# once mod2mod variation is enabled, the light threshold triggering does not work properly
# compare the light trigger between different module and digitize afterwards should solve the issue
if light.LIGHT_TRIG_MODE == 1:
light_event_id = np.unique(localSpillIDs) if sim.IS_SPILL_SIM else vertices['event_id']
light_start_times = np.full(len(light_event_id), 0) # if it is beam trigger it is set to 0
light_trigger_idx = np.full(len(light_event_id), 0) # one beam spill, one trigger
light_op_channel_idx = light.TPC_TO_OP_CHANNEL[:].ravel()
light_event_times = light_event_id * sim.SPILL_PERIOD if sim.IS_SPILL_SIM else event_times.get() # us

light_sim.export_light_trig_to_hdf5(light_event_id, light_start_times, light_trigger_idx, light_op_channel_idx, output_filename, light_event_times)
#fee.export_pacman_trigger_to_hdf5(output_filename, light_event_times)

# FIXME
#if light.LIGHT_TRIG_MODE == 0:
Expand Down
5 changes: 5 additions & 0 deletions larndsim/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ module0:
LIGHT_DET_NOISE: light_noise_2x2_4mod_July2023.npy
MOD2MOD_VARIATION: False

# 2x2 (same module configuration), mpvmpr
2x2_mpvmpr:
<<: *2x2main
SIM_PROPERTIES: singles_sim.yaml

# 2x2 (same module configuration), non-beam
2x2_non_beam:
<<: *2x2main
Expand Down