Skip to content

Commit

Permalink
Bugfix: light mc event generator - adapted event generator to handle …
Browse files Browse the repository at this point in the history
…any number of modules per event from larndsim
  • Loading branch information
liviocali committed Dec 21, 2023
1 parent fb4d160 commit 9eb95ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/proto_nd_flow/reco/light/mc_event_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class LightEventGeneratorMC(H5FlowGenerator):
Parameters:
- ``wvfm_dset_name`` : ``str``, required, path to dataset to store raw waveforms
- ``n_modules`` : ``int``, number of modules
- ``n_adcs`` : ``int``, number of ADC serial numbers
- ``n_channels`` : ``int``, number of channels per ADC
- ``n_sipms_per_module`` : ``int``, total number of SiPM channels per module
- ``n_modules_per_trig`` : ``int``, number of proto ND modules per trigger
- ``adc_sn`` : ``list`` of ``int``, serial number of each ADC
- ``channel_map``: ``list`` of ``list`` of ``int``, mapping from simulation optical detector to adc, channel, ``-1`` values indicate channel is not connected
- ``busy_channel``: ``list`` of ``int``, channel used for busy signal on each ADC (if relevant)
Expand All @@ -43,9 +43,10 @@ class LightEventGeneratorMC(H5FlowGenerator):
dset_name: 'light/events'
params:
wvfm_dset_name: 'light/wvfm'
n_adcs: 2
n_modules: 4
n_adcs: 8
n_channels: 64
n_simps: 96
n_sipms_per_module: 96
adc_sn:
- 0
- 1
Expand Down Expand Up @@ -77,10 +78,10 @@ class LightEventGeneratorMC(H5FlowGenerator):
defaults = dict(
wvfm_dset_name='light/wvfm',
mc_truth_dset_name='mc_truth/light',
n_modules=4,
n_adcs=2,
n_channels=64,
n_sipms_per_module= 96,
n_modules_per_trig= 4,
busy_delay=123,
busy_ampl=20e3,
chunk_size=32
Expand Down Expand Up @@ -165,10 +166,10 @@ def init(self):
self.data_manager.set_attrs(self.event_dset_name,
classname=self.classname,
class_version=self.class_version,
n_modules=self.n_modules,
n_adcs=self.n_adcs,
n_channels=self.n_channels,
n_sipms_per_module=self.n_sipms_per_module,
n_modules_per_trig=self.n_modules_per_trig,
n_samples=self.n_samples,
chunk_size=self.chunk_size,
busy_delay=self.busy_delay,
Expand Down Expand Up @@ -210,9 +211,9 @@ def next(self):
next_startch = [tr_ev[0][0] for tr_ev in next_trig]

# convert channel map
tmp_wvfms = np.zeros((next_wvfms.shape[0], next_wvfms.shape[1], next_wvfms.shape[-1]),dtype=next_wvfms.dtype)
tmp_wvfms = np.zeros((next_wvfms.shape[0], self.n_modules*self.n_sipms_per_module, next_wvfms.shape[-1]),dtype=next_wvfms.dtype)
for ev in range(next_wvfms.shape[0]):
tmp_wvfms[ev,next_startch[ev]:next_startch[ev]+(self.n_sipms_per_module*self.n_modules_per_trig),:] = next_wvfms[ev]
tmp_wvfms[ev,next_startch[ev]:(next_startch[ev]+next_wvfms[ev].shape[0]),:] = next_wvfms[ev]
next_wvfms=tmp_wvfms
del tmp_wvfms
remapped_wvfms = self._remap_array(self.channel_map, -next_wvfms, axis=-2)
Expand Down
2 changes: 1 addition & 1 deletion yamls/proto_nd_flow/reco/light/LightEventGeneratorMC.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ params:
wvfm_dset_name: 'light/wvfm'

# configuration parameters
n_modules: 4
n_adcs: 8
n_channels: 64
n_sipms_per_module: 96
n_modules_per_trig: 4
adc_sn:
- 0
- 1
Expand Down

0 comments on commit 9eb95ad

Please sign in to comment.