Front-End Electronics (fee)

Simulates the LArPix front-end electronics: self-trigger discriminator, ADC digitisation, and serialisation into the LArPix HDF5 packet format.

Module that simulates the front-end electronics (triggering, ADC)

larndsim.fee.get_trig_io()[source][source]

Returns the io_group if the trigger is only forwarded to one pacman

larndsim.fee.rotate_tile(pixel_id, tile_id)[source][source]

Returns the pixel ID of the rotated tile.

Parameters:
  • pixel_id (int) – pixel ID

  • tile_id (int) – tile ID

Returns:

pixel indices

Return type:

tuple

larndsim.fee.gen_event_times(nevents, t0=0)[source][source]

Generate sequential event times assuming events are uncorrelated

Parameters:
  • nevents (int) – number of event times to generate

  • t0 (int) – offset to apply [microseconds]

Returns:

shape (nevents,), sequential event times [microseconds]

Return type:

array

larndsim.fee.export_to_hdf5(event_id_list, adc_list, adc_ticks_list, unique_pix, current_fractions, track_ids, traj_ids, filename, event_start_times, light_trigger_times=None, light_trigger_event_id=None, light_trigger_modules=None, bad_channels=None, i_mod=-1, compression=None)[source][source]

Saves the ADC counts in the LArPix HDF5 format.

Parameters:
  • event_id_list (numpy.ndarray) – event ids for each tick; shape (nticks, max_adcs); dtype uint32

  • adc_list (numpy.ndarray) – ADC values for each tick; shape (nticks, max_adcs); dtype float64

  • adc_ticks_list (numpy.ndarray) – timestamps for each tick; shape (nticks, max_adcs); dtype float64

  • unique_pix (numpy.ndarray) – pixel IDs for each tick; shape (nticks,); dtype int32

  • current_fractions (numpy.ndarray) – fractional current induced by each track on each pixel; shape (nticks, max_adcs, max_backtracks); dtype float64

  • track_ids (numpy.ndarray) – track IDs associated to each pixel; shape (nticks, max_backtracks); dtype int64

  • filename (str) – filename of HDF5 output file

  • event_start_times (numpy.ndarray) – timestamps of start of each unique event [in microseconds]; shape (nevents,); dtype float64

  • light_trigger_times (numpy.ndarray) – light trigger timestamps (relative to event t0) [in microseconds]; shape (ntrigs,); dtype float64

  • light_trigger_event_id (numpy.ndarray) – event id for each light trigger; shape (ntrigs,); dtype uint32

  • light_trigger_modules (numpy.ndarray) – module id for each light trigger; shape (ntrigs,); dtype int64

  • bad_channels (dict) – dictionary mapping a chip key to a list of bad channels

  • i_mod (int) – module index for saving the result in each module individually if needed.

  • compression (str, optional) – enable file compression of the output HDF5 datasets. Defaults to None, supported options are ‘lzf’ and ‘gzip’

Returns:

a tuple containing the list of LArPix packets and the list of

entries for the mc_packets_assn dataset

Return type:

tuple

larndsim.fee.export_sync_to_hdf5(filename, event, sync_times, i_mod, compression=None)[source][source]

Saves sync packets in the LArPix HDF5 format. :param event: ID of the event :type event: int :param sync_times: list of sync timestamps [us] :type sync_times: numpy.ndarray

Returns:

a tuple containing the list of LArPix sync packets and the list of entries for the mc_packets_assn dataset

Return type:

tuple

larndsim.fee.export_timestamp_trigger_to_hdf5(filename, event_ids, event_start_times, i_mod, compression=None)[source][source]

Saves timestamp and trigger packets in the LArPix HDF5 format. :param event_ids: list of IDs for each unique event :type event_ids: numpy.ndarray :param event_start_times: list of timestamps for start each unique event [in microseconds] :type event_start_times: numpy.ndarray

Returns:

a tuple containing the list of LArPix timestamp and trigger packets and the list of entries for the mc_packets_assn dataset

Return type:

tuple

larndsim.fee.digitize(integral_list, gain=0.004, pedestal=580)[source][source]

The function takes as input the integrated charge and returns the digitized ADC counts.

Parameters:
  • integral_list (numpy.ndarray) – list of charge collected by each pixel

  • gain (numpy.ndarray) – list of gain values (or float) for each pixel

Returns:

list of ADC values for each pixel

Return type:

numpy.ndarray

larndsim.fee.get_adc_values(pixels_signals, pixels_signals_tracks, num_backtrack, offset_backtrack, time_ticks, adc_list, adc_ticks_list, time_padding, rng_states, current_fractions, pixel_thresholds)[source]

Implementation of self-trigger logic

Parameters:
  • pixels_signals (numpy.ndarray) – list of induced currents for each pixel. Shape (n_unique_pix, n_ticks).

  • pixels_signals_tracks (numpy.ndarray) – list of induced currents for each track that induces current on each pixel. Jagged; “shape” (n_unique_pix, n_ticks, num_backtrack[ipix]).

  • num_backtrack (numpy.ndarray) – For a given pixel, the number of backtracked track segments. Shape (n_unique_pix,).

  • offset_backtrack (numpy.ndarray) – For a given pixel, the offset into pixels_signals_tracks for that pixel’s data. Shape (n_unique_pix,).

  • time_ticks (numpy.ndarray) – list of time ticks for each pixel. Shape (n_ticks+1,).

  • adc_list (numpy.ndarray) – Output; list of integrated charges for each pixel. Shape (n_unique_pix, max_adc_vals).

  • adc_ticks_list (numpy.ndarray) – Output; list of the time ticks that correspond to each integrated charge. Shape (n_unique_pix, max_adc_vals).

  • time_padding (float) – time interval to add to each time tick.

  • rng_states (numpy.ndarray) – array of random states for noise generation. Shape (TPB*BPG,).

  • current_fractions (numpy.ndarray) – Output; 2D array that will contain the fraction of current induced on the pixel by each track. Shape (n_unique_pix, max_adc_vals, MAX_TRACKS_PER_PIXEL). TODO: Jaggedize.

  • pixel_thresholds( – obj: numpy.ndarray): list of discriminator thresholds for each pixel. Shape (n_unique_pix,)