spine.io.parse.larcv.particle

Module that contains all parsers related to LArCV particle data.

Contains the following parsers: - LArCVParticleParser - LArCVNeutrinoParser - LArCVParticlePointParser - LArCVParticleCoordinateParser - LArCVParticleGraphParser - LArCVSingleParticlePIDParser - LArCVSingleParticleEnergyParser

Classes

LArCVNeutrinoParser([pixel_coordinates, ...])

Class which loads larcv.Neutrino objects to local Neutrino ones.

LArCVParticleCoordinateParser(dtype, **kwargs)

Class that retrieves that end points of particles.

LArCVParticleGraphParser([...])

Class that uses larcv.EventParticle to construct edges between particles (i.e. clusters).

LArCVParticleParser([pixel_coordinates, ...])

Class which loads larcv.Particle objects to local Particle ones.

LArCVParticlePointParser([include_point_tagging])

Class that retrieves the points of interests.

LArCVSingleParticleEnergyParser(dtype, **kwargs)

Get the first true particle's kinetic energy.

LArCVSingleParticlePIDParser(dtype, **kwargs)

Get the first true particle's species.

LArCVVertexPointParser(**kwargs)

Class that retrieves the vertices.

class spine.io.parse.larcv.particle.LArCVParticleParser(pixel_coordinates: bool = True, post_process: bool = True, skip_empty: bool = False, asis: bool = False, **kwargs: Any)[source]

Class which loads larcv.Particle objects to local Particle ones.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

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

Fetch the list of true particle objects.

name: ClassVar[str | None] = 'particle'
returns: ClassVar[str | None] = 'object_list'
process(particle_event: Any, sparse_event: Any | None = None, cluster_event: Any | None = None, particle_mpv_event: Any | None = None, neutrino_event: Any | None = None) ParserObjectList[source]

Fetch the list of true particle objects.

Parameters:
  • particle_event (larcv.EventParticle) – Particle event which contains the list of true particles

  • sparse_event (larcv.EventSparseTensor3D, optional) – Tensor which contains the metadata needed to convert the positions in voxel coordinates

  • cluster_event (larcv.EventClusterVoxel3D, optional) – Cluster which contains the metadata needed to convert the positions in voxel coordinates

  • particle_mpv_event (larcv.EventParticle, optional) – Particle event which contains the list of true MPV particles

  • neutrino_event (larcv.EventNeutrino, optional) – Neutrino event which contains the list of true neutrinos

Returns:

List of true particle objects

Return type:

List[Particle]

class spine.io.parse.larcv.particle.LArCVNeutrinoParser(pixel_coordinates: bool = True, asis: bool = False, interaction_scheme: int | str = NuInteractionScheme.LARSOFT, **kwargs: Any)[source]

Class which loads larcv.Neutrino objects to local Neutrino ones.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

process(neutrino_event[, sparse_event, ...])

Fetch the list of true neutrino objects.

name: ClassVar[str | None] = 'neutrino'
returns: ClassVar[str | None] = 'object_list'
process(neutrino_event: Any, sparse_event: Any | None = None, cluster_event: Any | None = None) ParserObjectList[source]

Fetch the list of true neutrino objects.

Parameters:
  • neutrino_event (larcv.EventNeutrino) – Neutrino event which contains the list of true neutrinos

  • sparse_event (larcv.EventSparseTensor3D, optional) – Tensor which contains the metadata needed to convert the positions in voxel coordinates

  • cluster_event (larcv.EventClusterVoxel3D, optional) – Cluster which contains the metadata needed to convert the positions in voxel coordinates

Returns:

List of true neutrino objects

Return type:

List[Neutrino]

class spine.io.parse.larcv.particle.LArCVParticlePointParser(include_point_tagging: bool = True, **kwargs: Any)[source]

Class that retrieves the points of interests.

It provides the coordinates of the end points, types and particle index.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

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

Fetch the list of label points of interest.

name: ClassVar[str | None] = 'particle_points'
returns: ClassVar[str | None] = 'tensor'
process(particle_event: Any, sparse_event: Any | None = None, cluster_event: Any | None = None) ParserTensor[source]

Fetch the list of label points of interest.

Parameters:
  • particle_event (larcv.EventParticle) – Particle event which contains the list of true particles

  • sparse_event (larcv.EventSparseTensor3D, optional) – Tensor which contains the metadata needed to convert the positions in voxel coordinates

  • cluster_event (larcv.EventClusterVoxel3D, optional) – Cluster which contains the metadata needed to convert the positions in voxel coordinates

Returns:

  • np_voxels (np.ndarray) – (N, 3) array of [x, y, z] coordinates

  • np_features (np.ndarray) – (N, 2/3) array of [point type, particle index(, end point tagging)]

  • meta (Meta) – Metadata of the parsed image

class spine.io.parse.larcv.particle.LArCVParticleCoordinateParser(dtype: str, **kwargs: Any)[source]

Class that retrieves that end points of particles.

It provides the coordinates of the end points, time and shape.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

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

Fetch the start/end point and time of each true particle.

name: ClassVar[str | None] = 'particle_coords'
returns: ClassVar[str | None] = 'tensor'
process(particle_event: Any, sparse_event: Any | None = None, cluster_event: Any | None = None) ParserTensor[source]

Fetch the start/end point and time of each true particle.

Parameters:
  • particle_event (larcv.EventParticle) – Particle event which contains the list of true particles

  • sparse_event (larcv.EventSparseTensor3D, optional) – Tensor which contains the metadata needed to convert the positions in voxel coordinates

  • cluster_event (larcv.EventClusterVoxel3D, optional) – Cluster which contains the metadata needed to convert the positions in voxel coordinates

Returns:

  • np_voxels (np.ndarray) – (N, 6) array of [x_s, y_s, z_s, x_e, y_e, z_e] start and end point coordinates

  • np_features (np.ndarray) – (N, 2) array of [first_step_t, shape_id]

  • meta (Meta) – Metadata of the parsed image

class spine.io.parse.larcv.particle.LArCVVertexPointParser(**kwargs: Any)[source]

Class that retrieves the vertices.

It provides the coordinates of points where multiple particles originate: - If the neutrino_event is provided, it simply uses the coordinates of

the neutrino interaction points.

  • If the particle_event is provided instead, it looks for ancestor point positions shared by at least two particles.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

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

Fetch the list of label vertex points.

name: ClassVar[str | None] = 'vertex_points'
returns: ClassVar[str | None] = 'tensor'
process(particle_event: Any | None = None, neutrino_event: Any | None = None, sparse_event: Any | None = None, cluster_event: Any | None = None) ParserTensor[source]

Fetch the list of label vertex points.

Parameters:
  • particle_event (larcv.EventParticle) – Particle event which contains the list of true particles

  • neutrino_event (larcv.EventNeutrino) – Neutrino event which contains the list of true neutrinos

  • sparse_event (larcv.EventSparseTensor3D, optional) – Tensor which contains the metadata needed to convert the positions in voxel coordinates

  • cluster_event (larcv.EventClusterVoxel3D, optional) – Cluster which contains the metadata needed to convert the positions in voxel coordinates

Returns:

  • np_voxels (np.ndarray) – (N, 3) array of [x, y, z] coordinates

  • np_features (np.ndarray) – (N, 1) array of [vertex ID]

  • meta (Meta) – Metadata of the parsed image

class spine.io.parse.larcv.particle.LArCVParticleGraphParser(include_fragment_edges: bool = False, **kwargs: Any)[source]

Class that uses larcv.EventParticle to construct edges between particles (i.e. clusters).

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

process(particle_event[, cluster_event])

Fetch the parentage connections from the true particle list.

name: ClassVar[str | None] = 'particle_graph'
returns: ClassVar[str | None] = 'tensor'
process(particle_event: Any, cluster_event: Any | None = None) ParserEdgeIndex[source]

Fetch the parentage connections from the true particle list.

Configuration:
  • particle_event (larcv.EventParticle) – Particle event which contains the list of true particles

  • cluster_event (larcv.EventClusterVoxel3D, optional) – Cluster used to check if particles have 0 pixel in the image. If so, the edges to those clusters are removed and the broken parantage is subsequently patched.

Returns:

Parsed edge-index payload with shape (2, E) and the number of particles stored as the global shift span.

Return type:

ParserEdgeIndex

class spine.io.parse.larcv.particle.LArCVSingleParticlePIDParser(dtype: str, **kwargs: Any)[source]

Get the first true particle’s species.

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

process(particle_event)

Fetch the species of the first particle.

name: ClassVar[str | None] = 'single_particle_pid'
returns: ClassVar[str | None] = 'scalar'
overlay: ClassVar[str | None] = 'cat'
process(particle_event: Any) int[source]

Fetch the species of the first particle.

Configuration:

particle_event (larcv.EventParticle) – Particle event which contains the list of true particles

Returns:

Species of the first particle

Return type:

int

class spine.io.parse.larcv.particle.LArCVSingleParticleEnergyParser(dtype: str, **kwargs: Any)[source]

Get the first true particle’s kinetic energy.

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

process(particle_event)

Fetch the kinetic energy of the first particle.

name: ClassVar[str | None] = 'single_particle_energy'
returns: ClassVar[str | None] = 'scalar'
overlay: ClassVar[str | None] = 'cat'
process(particle_event: Any) float[source]

Fetch the kinetic energy of the first particle.

Configuration:

particle_event (larcv.EventParticle) – Particle event which contains the list of true particles

Returns:

Kinetic energy of the first particle

Return type:

float