reboost.shape package

Submodules

reboost.shape.cluster module

reboost.shape.cluster._cluster_by_distance_numba(local_index, trackid, pos, dist_to_surf, surf_cut=None, threshold=0.1, threshold_surf=None)

Cluster steps by the distance between points in the same track.

This function gives the basic numerical calculations for cluster_by_step_length().

Parameters:
  • local_index (np.ndarray) – 1D array of the local index within each hit (step group)

  • trackid (np.ndarray) – 1D array of index of the track

  • pos (np.ndarray) – (n,3) size array of the positions

  • dist_to_surf (np.ndarray | None) – 1D array of the distance to the detector surface. Can be None in which case all steps are treated as being in the bulk.

  • surf_cut (float | None) – Size of the surface region (in mm), if None no selection is applied.

  • threshold (float) – Distance threshold in mm to combine steps in the bulk.

  • threshold_surf (float | None) – Distance threshold in mm to combine steps in the surface.

Returns:

np.ndarray

1D array of cluster indices

Return type:

np.ndarray

reboost.shape.cluster.apply_cluster(cluster_run_lengths, field)

Apply clustering to a field.

Parameters:
  • cluster_ids – run lengths of each cluster

  • field (Array) – the field to cluster

  • cluster_run_lengths (Array)

Return type:

Array

reboost.shape.cluster.cluster_by_step_length(trackid, pos_x, pos_y, pos_z, dist=None, surf_cut=None, threshold_in_mm=0.1, threshold_surf_in_mm=None)

Perform clustering based on the step length.

Steps are clustered based on distance, if either:
  • a step is in a new track,

  • a step moves from surface to bulk region (or visa versa),

  • the distance between the current step and the first step of the current cluster is above a threshold.

Then a new cluster is started. The surface region is defined as the volume less than surf_cut distance to the surface. This allows for a fine tuning of the parameters to be different for bulk and surface.

Parameters:
  • trackid (Array) – index of the tracks.

  • pos_x (Array) – x position of the steps.

  • pos_y (Array) – y position of the steps.

  • pos_z (Array) – z position of the steps.

  • dist (Array | None) – distance to the detector surface. Can be None in which case all steps are treated as being in the “bulk”.

  • surf_cut (float | None) – Size of the surface region (in mm), if None no selection is applied (default).

  • threshold_in_mm (float) – Distance threshold in mm to combine steps in the bulk.

  • threshold_surf_in_mm (float | None) – Distance threshold in mm to combine steps in the surface.

Returns:

Array of the run lengths of each cluster within a hit.

Return type:

VectorOfVectors

reboost.shape.cluster.step_lengths(x_cluster, y_cluster, z_cluster)

Compute the distance between consecutive steps.

This is based on calculating the distance between consecutive steps in the same track, thus the input arrays should already be clustered (have dimension 3). The output will have a similar shape to the input with one less entry in the outermost dimension.

Example config (assuming that the clustered positions are obtained already):

step_lengths: reboost.shape.cluster.step_lengths(HITS.cluster_x,HITS.cluster_y,HITS.cluster_z))
Parameters:
  • x_cluster (Array) – The x location of each step in each cluster and event.

  • y_cluster (Array) – The y location of each step in each cluster and event.

  • z_cluster (Array) – The z location of each step in each cluster and event.

Returns:

a VectorOfVectors of the step lengths in each cluster.

Return type:

Array

reboost.shape.group module

reboost.shape.group._sort_data(obj, *, time_name='time', evtid_name='evtid')

Sort the data by evtid then time.

Parameters:
  • obj (Array) – array of records containing fields time and evtid.

  • time_name (str) – name of the time field in obj.

  • evtid_name (str) – name of the evtid field in obj.

Returns:

sorted awkward array

Return type:

Array

reboost.shape.group.get_isin_group(channels, groups, tcm_tables, group='off')

For each channel check if it is in the group.

Parameters:
  • channels (ArrayLike) – Array of the channel indices.

  • groups (AttrsDict) – A mapping of the group for every channel name.

  • tcm_tables (dict) – the mapping of indices to table names

  • group (str) – the group to select.

Returns:

an awkward array of the same shape of channels of booleans.

Return type:

Array

reboost.shape.group.group_by_evtid(data, *, evtid_name='evtid')

Simple grouping by evtid.

Takes the input stp lgdo.Table from remage and defines groupings of steps (i.e the cumulative_length for a vector of vectors). This then defines the output table (also lgdo.Table), on which processors can add fields.

Parameters:
  • data (Table | Array) – LGDO Table which must contain the evtid field.

  • evtid_name (str) – the name of the index field in the input table.

Returns:

LGDO table of VectorOfVector for each field.

Return type:

Table

Note

The input table must be sorted (by evtid).

reboost.shape.group.group_by_time(data, window=10, time_name='time', evtid_name='evtid', fields=None)

Grouping of steps by evtid and time.

Takes the input stp lgdo.Table from remage and defines groupings of steps (i.e the cumulative_length for a vector of vectors). This then defines the output table (also lgdo.Table), on which processors can add fields.

The windowing is based on defining a new group when the evtid changes or when the time increases by > window, which is in units of us.

Parameters:
  • data (Table | Array) – lgdo.Table or ak.Array which must contain the time_name and evtid_name fields

  • window (float) – time window in us used to search for coincident hits.

  • time_name (str) – name of the timing field

  • evtid_name (str) – name of the evtid field

  • fields (list | None) – names of fields to include in the output table, if None includes all

Returns:

LGDO table of VectorOfVector for each field.

Return type:

Table

Note

The input table must be sorted (first by evtid then time).

reboost.shape.group.isin(channels, chan_list)

Check if each element of the awkward array channels is in the channel list.

Parameters:
  • channels (Array)

  • chan_list (list)

reboost.shape.reduction module