diff --git a/cli/simulate_pixels.py b/cli/simulate_pixels.py index a2b975db..996e6148 100755 --- a/cli/simulate_pixels.py +++ b/cli/simulate_pixels.py @@ -803,13 +803,14 @@ def save_results(event_times, is_first_batch, results, i_trig, i_mod=-1, light_o i_trig = 0 sync_start = event_times[0] // (fee.CLOCK_RESET_PERIOD * fee.CLOCK_CYCLE) * (fee.CLOCK_RESET_PERIOD * fee.CLOCK_CYCLE) + (fee.CLOCK_RESET_PERIOD * fee.CLOCK_CYCLE) det_borders = module_borders if mod2mod_variation else detector.TPC_BORDERS - for batch_mask in tqdm(batching.TPCBatcher(all_mod_tracks, tracks, sim.EVENT_SEPARATOR, tpc_batch_size=sim.EVENT_BATCH_SIZE, tpc_borders=det_borders), + # Batching is carried out by simulating detector response with selected segments from X number of tpcs per event + # X is set by "sim.EVENT_BATCH_SIZE" and can be any number + for ievd, batch_mask in tqdm(batching.TPCBatcher(all_mod_tracks, tracks, sim.EVENT_SEPARATOR, tpc_batch_size=sim.EVENT_BATCH_SIZE, tpc_borders=det_borders), desc='Simulating batches...', ncols=80, smoothing=0): i_batch = i_batch+1 - # grab only tracks from current batch + # Grab segments from the current batch + # If there are no segments in the batch, we still check if we need to generate null light signals track_subset = tracks[batch_mask] - # go through all simulated events in all modules even there might be no segments in the module - ievd = np.unique(all_mod_tracks[sim.EVENT_SEPARATOR])[i_batch-1] evt_tracks = track_subset #first_trk_id = np.argmax(batch_mask) # first track in batch diff --git a/larndsim/config/config.yaml b/larndsim/config/config.yaml index c5cfb37b..ca5d4a72 100644 --- a/larndsim/config/config.yaml +++ b/larndsim/config/config.yaml @@ -62,12 +62,12 @@ module0: SIM_PROPERTIES: singles_sim_mod2mod_variation.yaml # nd-lar (same module configuration) -# NuMI beam (not realistic) # lack of light configuration files ndlar: - SIM_PROPERTIES: 2x2_NuMI_sim.yaml + SIM_PROPERTIES: NDLAr_LBNF_sim.yaml PIXEL_LAYOUT: multi_tile_layout-3.0.40.yaml DET_PROPERTIES: ndlar-module.yaml RESPONSE: response_38.npy + LIGHT_SIMULATED: 0 LIGHT_LUT: '' LIGHT_DET_NOISE: '' diff --git a/larndsim/detector_properties/ndlar-module.yaml b/larndsim/detector_properties/ndlar-module.yaml index 666fbd94..2bd67ce7 100644 --- a/larndsim/detector_properties/ndlar-module.yaml +++ b/larndsim/detector_properties/ndlar-module.yaml @@ -9,50 +9,50 @@ response_sampling: 0.05 # us response_bin_size: 0.038 # cm time_padding: 190.2 # us time_window: 189.8 # us -# These TPC offsets in y are estimated by -# looking at the edep-sim segement y positions -# of events simulated in the geometry -# nd_hall_with_lar_tms_sand_TDR_Production_geometry_v_1.0.3.gdml -# and top voulume volArgonCubeDetector75. The max -# and min y positions are read from the plot and the midpoint -# is found to be -91 cm. We probably want something more -# robust than this in the end. +# These TPC offsets are obtained by inspecting +# geometry/nd_hall_with_lar_tms_sand_TDR_Production_geometry_v_1.0.3.gdml +# using the https://github.com/DUNE/dunendggd/blob/master/locateVolume.C +# tool with paths like, for example, +# volWorld/rockBox_lv_0/volDetEnclosure_0/volArgonCubeDetector_0/ \ +# volArgonCubeCryostatWithTagger_0/volArgonCubeCryostat_0/volWarmSteel_0/ \ +# volVaporBarrier_0/volNitrogenGap_0/volThermalInsulation_0/volMembrane_0/ \ +# volArgonInner_0/volLArBath_0/volArgonCubeDetector75_0/volNDBucket_8 tpc_offsets: # cm - - [-306.3, -91.0, 462.36] - - [-306.3, -91.0, 563.78] - - [-306.3, -91.0, 665.2] - - [-306.3, -91.0, 766.62] - - [-306.3, -91.0, 868.04] - - [-204.2, -91.0, 462.36] - - [-204.2, -91.0, 563.78] - - [-204.2, -91.0, 665.2] - - [-204.2, -91.0, 766.62] - - [-204.2, -91.0, 868.04] - - [-102.1, -91.0, 462.36] - - [-102.1, -91.0, 563.78] - - [-102.1, -91.0, 665.2] - - [-102.1, -91.0, 766.62] - - [-102.1, -91.0, 868.04] - - [0.0, -91.0, 462.36] - - [0.0, -91.0, 563.78] - - [0.0, -91.0, 665.2] - - [0.0, -91.0, 766.62] - - [0.0, -91.0, 868.04] - - [102.1, -91.0, 462.36] - - [102.1, -91.0, 563.78] - - [102.1, -91.0, 665.2] - - [102.1, -91.0, 766.62] - - [102.1, -91.0, 868.04] - - [204.2, -91.0, 462.36] - - [204.2, -91.0, 563.78] - - [204.2, -91.0, 665.2] - - [204.2, -91.0, 766.62] - - [204.2, -91.0, 868.04] - - [306.3, -91.0, 462.36] - - [306.3, -91.0, 563.78] - - [306.3, -91.0, 665.2] - - [306.3, -91.0, 766.62] - - [306.3, -91.0, 868.04] + - [-300.0000, -60.9290, 465.7559] + - [-300.0000, -60.9290, 565.7559] + - [-300.0000, -60.9290, 665.7559] + - [-300.0000, -60.9290, 765.7559] + - [-300.0000, -60.9290, 865.7559] + - [-200.0000, -60.9290, 465.7559] + - [-200.0000, -60.9290, 565.7559] + - [-200.0000, -60.9290, 665.7559] + - [-200.0000, -60.9290, 765.7559] + - [-200.0000, -60.9290, 865.7559] + - [-100.0000, -60.9290, 465.7559] + - [-100.0000, -60.9290, 565.7559] + - [-100.0000, -60.9290, 665.7559] + - [-100.0000, -60.9290, 765.7559] + - [-100.0000, -60.9290, 865.7559] + - [0.0000, -60.9290, 465.7559] + - [0.0000, -60.9290, 565.7559] + - [0.0000, -60.9290, 665.7559] + - [0.0000, -60.9290, 765.7559] + - [0.0000, -60.9290, 865.7559] + - [100.0000, -60.9290, 465.7559] + - [100.0000, -60.9290, 565.7559] + - [100.0000, -60.9290, 665.7559] + - [100.0000, -60.9290, 765.7559] + - [100.0000, -60.9290, 865.7559] + - [200.0000, -60.9290, 465.7559] + - [200.0000, -60.9290, 565.7559] + - [200.0000, -60.9290, 665.7559] + - [200.0000, -60.9290, 765.7559] + - [200.0000, -60.9290, 865.7559] + - [300.0000, -60.9290, 465.7559] + - [300.0000, -60.9290, 565.7559] + - [300.0000, -60.9290, 665.7559] + - [300.0000, -60.9290, 765.7559] + - [300.0000, -60.9290, 865.7559] tile_map: - [[19,17,15,13,11,9,7,5,3,1],[20,18,16,14,12,10,8,6,4,2]] - [[39,37,35,33,31,29,27,25,23,21],[40,38,36,34,32,30,28,26,24,22]] diff --git a/larndsim/simulation_properties/NDLAr_LBNF_sim.yaml b/larndsim/simulation_properties/NDLAr_LBNF_sim.yaml index 680e32bc..1b9c0a07 100644 --- a/larndsim/simulation_properties/NDLAr_LBNF_sim.yaml +++ b/larndsim/simulation_properties/NDLAr_LBNF_sim.yaml @@ -1,6 +1,6 @@ # Discussions of some of these parameters here: # https://dunescience.slack.com/archives/C05BMKCBW3B/p1692623569387309 -batch_size: 5000 # track segments +batch_size: 2500 # track segments event_batch_size: 2 # tpcs write_batch_size: 1 # batches is_spill_sim: 1 # boolean diff --git a/larndsim/util/batching.py b/larndsim/util/batching.py index 01576deb..49ec1d79 100644 --- a/larndsim/util/batching.py +++ b/larndsim/util/batching.py @@ -64,4 +64,4 @@ def __next__(self): mask = mask & tpc_mask self._simulated = self._simulated | mask - return mask + return self._events[self._curr_event], mask