Signal Calculation

Signal calculation module for far field

larndsim.far_field.signal_calculation.calculate_ff_voxels(voxel_x, voxel_y, voxel_z, charges, pixel_x, pixel_y, pixel_categories, z_anode, z_cathode, output)[source]

CUDA kernel: Calculate far-field induced current using voxels.

Uses 2D grid/block launch for (pixel, tick) indexing. Each thread sums contributions from all voxels for its pixel-tick pair. Exclusion applies only to COLLECTION (cat=1) and NEIGHBOR (cat=2) pixels.

Parameters:
  • voxel_x/y/z – (n_voxels,) array of x/y/z-positions of each voxel’s center

  • charges (cupy.typing.NDArray.cupy.float32) – (n_voxels,) array of summed charge in each voxel

  • pixel_x/y – (n_pixels,) array of x/y-positions of each pixel’s center

  • pixel_categories (cupy.typing.NDArray.cupy.float32) – (n_pixels,) array: 0=INDUCTION, 1=COLLECTION, 2=NEIGHBOR

  • z_anode/cathode – Drift coordinate of the anode/cathode

  • output (cupy.ndarray.(tuple[int, int], cupy.float32)) – (n_pixels, n_ticks) array of current signals

larndsim.far_field.signal_calculation.calculate_ff_segments(tracks, pixel_x, pixel_y, z_anode, z_cathode, output)[source]

CUDA kernel: Calculate far-field induced current using segments.

Sums over segment contributions outside exclude_radius. Long segments are split into pieces of roughly FAR_FIELD_SEGMENT_STEP_CM and each piece contributes as a point charge located at the piece midpoint.

Parameters:
  • tracks (cupy.typing.NDArray) – structured track array (fields: x_start, y_start, z_start, x_end, y_end, z_end, n_electrons, pixel_plane, …)

  • pixel_x/y – (n_pixels,) array of x/y-positions of each pixel’s center

  • z_anode/cathode – Drift coordinate of the anode/cathode

  • output (cupy.ndarray.(tuple[int, int], cupy.float32)) – (n_pixels, n_ticks) array of current signals

larndsim.far_field.signal_calculation.dipole_dWdz(dx, dy, dz, l, n_terms)[source]

Dipole field calculation (Eq. 3.21, 3.22 from P. Madigan’s thesis)

Parameters:
  • (dx – Vector from electron to pixel (test point relative to dipole)

  • dy (float) – Vector from electron to pixel (test point relative to dipole)

  • dz) – Vector from electron to pixel (test point relative to dipole)

  • l (float) – Drift length

  • n_terms (int) – Degree of calculation

Returns:

Calculated Shockley-Ramo weighting field for the current induced on the pixel

Return type:

float

larndsim.far_field.signal_calculation.launch_ffe_kernel(tpc_idx, tracks, pixel_x, pixel_y, n_ticks, category, voxel_cache)[source][source]

Launch CUDA kernel for far-field induced current calculation.

This uses a 2D grid/block launch for (pixel, tick) and sums over voxels/segments in each thread.

Parameters:
  • tpc_idx (int) – TPC index to consider

  • tracks (cupy.typing.NDArray) – 1D array of edep-sim track segments

  • pixel_x (cupy.typing.NDArray.cupy.float32) – 1D array of pixel x-positions

  • pixel_y (cupy.typing.NDArray.cupy.float32) – 1D array of pixel y-positions

  • n_ticks (int) – Length (in time ticks) of the calculated current

  • category (int) – Category to assign to the pixels (ignored in ‘segments’ mode)

  • voxel_cache (dict[int, dict[str, cupy.typing.NDArray.cupy.float32 | None]]) – Dict that maps from a TPC ID to a dict of voxel data for that TPC. The latter has keys of ‘x’, ‘y’, ‘z’, and ‘q’; each one maps to a 1D array of the corresponding value for all the voxels.

Returns:

2D array that maps (pixel, tick) to dQ

Return type:

cupy.ndarray.(tuple[int, int], cupy.float32)