spine.io.parse.larcv.cluster

Module that contains all parsers related to LArCV cluster data.

Contains the following parsers: - LArCVCluster2DParser - LArCVCluster3DParser - LArCVCluster3DAggregateParser - LArCVCluster3DChargeRescaledParser

Classes

LArCVCluster2DParser(dtype, cluster_event, ...)

Class that retrieves and parses a 2D cluster list.

LArCVCluster3DAggregateParser(dtype, ...)

Identical to Cluster3DParser, but aggregates charge information from multiple value sources.

LArCVCluster3DChargeRescaledParser(dtype, ...)

Identical to Cluster3DParser, but computes rescaled charges on the fly.

LArCVCluster3DParser(dtype[, ...])

Class that retrieves and parses a 3D cluster list.

class spine.io.parse.larcv.cluster.LArCVCluster2DParser(dtype: str, cluster_event: str, projection_id: int)[source]

Class that retrieves and parses a 2D cluster list.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

Build the parser-call input dictionary from loaded tree products.

process(cluster_event)

Converts a 2D clusters tensor into a single tensor.

name: ClassVar[str | None] = 'cluster2d'
returns: ClassVar[str | None] = 'tensor'
process(cluster_event: Any) ParserTensor[source]

Converts a 2D clusters tensor into a single tensor.

Parameters:

cluster_event (larcv.EventClusterPixel2D) – Event which contains the 2D clusters

Returns:

coordsnp.ndarray

(N, 2) array of [x, y] coordinates

featuresnp.ndarray

(N, 2) array of [pixel value, cluster ID]

metaMeta

Metadata of the parsed image

Return type:

ParserTensor

class spine.io.parse.larcv.cluster.LArCVCluster3DParser(dtype: str, particle_event: Any | None = None, add_particle_info: bool = False, clean_data: bool = False, type_include_mpr: bool = True, type_include_secondary: bool = True, primary_include_mpr: bool = True, break_clusters: bool = False, break_eps: float = 1.1, break_metric: str = 'chebyshev', shape_precedence: ndarray | list[int] | tuple[int, ...] = (1, 2, 0, 3, 4, 6, 5), **kwargs: Any)[source]

Class that retrieves and parses a 3D cluster list.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

Build the parser-call input dictionary from loaded tree products.

process(cluster_event[, particle_event, ...])

Parse a list of 3D clusters into a single tensor.

name: ClassVar[str | None] = 'cluster3d'
returns: ClassVar[str | None] = 'tensor'
process(cluster_event: Any, particle_event: Any | None = None, particle_mpv_event: Any | None = None, neutrino_event: Any | None = None, sparse_semantics_event: Any | None = None, sparse_value_event: Any | None = None) ParserTensor[source]

Parse a list of 3D clusters into a single tensor.

Parameters:
  • cluster_event (larcv.EventClusterVoxel3D) – Event which contains the 3D clusters

  • particle_event (larcv.EventParticle, optional) – List of true particle information. If prodided, allows to fetch more information about each of the pixels in the image

  • particle_mpv_event (larcv.EventNeutrino, optional) – List of true particle information for MPV particles only. If provided, it is used to determine which particles are MPV

  • particle_mpv_event – List of true neutrino information. If provided, it is used to determine which particles are MPV

  • sparse_semantics_event (larcv.EventSparseTensor3D, optional) – Semantics of each of the voxels in the image. If provided, overrides the order of precedence used in combining clusters which share voxels.

  • sparse_value_event (larcv.EventSparseTensor3D, optional) – Value of each of the voxels in the image. If provided, overrides the value provided byt eh list of 3D clusters itself

Returns:

coordsnp.ndarray

(N, 3) array of [x, y, z] coordinates

featuresnp.ndarray

(N, 2/14) array of features, minimally [voxel value, cluster ID]. If add_particle_info is True, the additonal columns are [particle ID, group ID, interaction ID, neutrino ID, particle type, group primary bool, interaction primary bool, vertex x, vertex y, vertex z, momentum, semantic type]

metaMeta

Metadata of the parsed image

Return type:

ParserTensor

class spine.io.parse.larcv.cluster.LArCVCluster3DAggregateParser(dtype: str, sparse_value_event_list: list[str], value_aggr: str, **kwargs: Any)[source]

Identical to Cluster3DParser, but aggregates charge information from multiple value sources.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

Build the parser-call input dictionary from loaded tree products.

process(cluster_event[, particle_event, ...])

Parse a list of 3D clusters into a single tensor.

process_aggr(sparse_value_event_list, **kwargs)

Parse a list of 3D clusters into a single tensor and fetch the value column by aggregating multiple tensor features.

name: ClassVar[str | None] = 'cluster3d_aggr'
process_aggr(sparse_value_event_list: list[Any], **kwargs: Any) ParserTensor[source]

Parse a list of 3D clusters into a single tensor and fetch the value column by aggregating multiple tensor features.

Parameters:
  • sparse_value_event_list (List[larcv.EventSparseTensor3D]) – List of sparse value tensors

  • **kwargs (dict, optional) – Extra data products to pass to the parent Cluster3DParser

Returns:

coordsnp.ndarray

(N, 3) array of [x, y, z] coordinates

featuresnp.ndarray

(N, 2/14) array of features, minimally [voxel value, cluster ID]. If add_particle_info is True, the additonal columns are [group ID, interaction ID, neutrino ID, particle type, group primary bool, interaction primary bool, vertex x, vertex y, vertex z, momentum, semantic type, particle ID]

metaMeta

Metadata of the parsed image

Return type:

ParserTensor

class spine.io.parse.larcv.cluster.LArCVCluster3DChargeRescaledParser(dtype: str, sparse_value_event_list: list[str], collection_only: bool = False, collection_id: int = 2, **kwargs: Any)[source]

Identical to Cluster3DParser, but computes rescaled charges on the fly.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

Build the parser-call input dictionary from loaded tree products.

process(cluster_event[, particle_event, ...])

Parse a list of 3D clusters into a single tensor.

process_rescale(sparse_value_event_list, ...)

Parse a list of 3D clusters into a single tensor and reset the value column by rescaling the charge coming from 3 wire planes.

name: ClassVar[str | None] = 'cluster3d_rescale_charge'
process_rescale(sparse_value_event_list: list[Any], **kwargs: Any) ParserTensor[source]

Parse a list of 3D clusters into a single tensor and reset the value column by rescaling the charge coming from 3 wire planes.

Parameters:
  • sparse_value_event_list (List[larcv.EventSparseTensor3D]) – (7) List of sparse tensors used to compute the rescaled charge - Charge value of each of the contributing planes (3) - Index of the plane hit contributing to the space point (3) - Semantic labels (1)

  • **kwargs (dict, optional) – Extra data products to pass to the parent Cluster3DParser

Returns:

coordsnp.ndarray

(N, 3) array of [x, y, z] coordinates

featuresnp.ndarray

(N, 2/14) array of features, minimally [voxel value, cluster ID]. If add_particle_info is True, the additonal columns are [group ID, interaction ID, neutrino ID, particle type, group primary bool, interaction primary bool, vertex x, vertex y, vertex z, momentum, semantic type, particle ID]

metaMeta

Metadata of the parsed image

Return type:

ParserTensor