spine.data.out.RecoParticle

class spine.data.out.RecoParticle(is_truth: bool = False, units: str = 'cm', id: int = -1, is_contained: bool = False, is_time_contained: bool = False, is_cathode_crosser: bool = False, is_matched: bool = False, cathode_offset: float = nan, index: ndarray = <factory>, orig_index: ndarray = <factory>, points: ndarray = <factory>, depositions: ndarray = <factory>, sources: ndarray = <factory>, match_ids: ndarray = <factory>, match_overlaps: ndarray = <factory>, interaction_id: int = -1, chi2_pid: int = -1, is_primary: bool = False, is_crt_matched: bool = False, is_valid: bool = True, length: float = nan, calo_ke: float = nan, csda_ke: float = nan, mcs_ke: float = nan, shape: int = -1, pid: int = -1, fragment_ids: ndarray = <factory>, start_point: ndarray = <factory>, end_point: ndarray = <factory>, chi2_per_pid: ndarray = <factory>, csda_ke_per_pid: ndarray = <factory>, mcs_ke_per_pid: ndarray = <factory>, crt_ids: ndarray = <factory>, crt_times: ndarray = <factory>, crt_scores: ndarray = <factory>, start_dedx: float = nan, end_dedx: float = nan, vertex_distance: float = nan, start_straightness: float = nan, directional_spread: float = nan, axial_spread: float = nan, fragments: list[RecoFragment] = <factory>, start_dir: ndarray = <factory>, end_dir: ndarray = <factory>, pid_scores: ndarray = <factory>, primary_scores: ndarray = <factory>, ppn_ids: ndarray = <factory>, ppn_points: ndarray = <factory>)[source]

Reconstructed particle information.

fragments

List of fragments that make up this particle

Type:

List[RecoFragment]

pdg_code

PDG code corresponding to the PID number

Type:

int

mass

Rest mass of the particle in MeV/c^2

Type:

float

ke

Best guess kinetic energy of the particle in MeV

Type:

float

momentum

3-momentum of the particle at the production point in MeV/c

Type:

np.ndarray

start_dir
  1. Particle direction w.r.t. the start point

Type:

np.ndarray

end_dir

(3) Particle direction w.r.t. the end point (only assigned to track objects)

Type:

np.ndarray

pid_scores
  1. Array of softmax scores associated with each particle class

Type:

np.ndarray

primary_scores
  1. Array of softmax scores associated with secondary and primary

Type:

np.ndarray

ppn_ids
  1. List of indexes of PPN points associated with this particle

Type:

np.ndarray

ppn_points

(M, 3) List of PPN points tagged to this particle

Type:

np.ndarray

start_dedx

dE/dx around a user-defined neighborhood of the start point in MeV/cm

Type:

float

end_dedx

dE/dx around a user-defined neighborhood of the end point in MeV/cm

Type:

float

vertex_distance

Set-to-point distance between all particle points and the parent interaction vertex position in cm

Type:

float

start_straightness

Explained variance ratio of the beginning of the particle

Type:

float

directional_spread

Estimate of the angular spread of the particle (cosine spread)

Type:

float

axial_spread

Pearson correlation coefficient of the axial profile of the particle w.r.t. to the distance from its start point

Type:

float

Attributes:
depositions_sum

Total deposition value for the entire object.

enum_attrs

Fetches HDF5-friendly enumerator descriptors for enum-backed fields.

enum_dicts

Fetches the dictionary of enumerated attributes and their enumerator descriptors.

enum_values

Fetches reverse enum lookups from stored values to symbolic names.

field_units

Fetches the documented units for each field.

index_attrs

Return the tuple of index-bearing attributes.

ke

Best-guess kinetic energy in MeV.

mass

Rest mass of the particle in MeV/c^2.

module_ids

List of modules that contribute to this object.

momentum

Best-guess momentum in MeV/c.

num_fragments

Number of fragments that make up this particle.

p

Computes the magnitude of the initial momentum.

pdg_code

Translates the enumerated particle type to a sign-less PDG code.

reco_end_dir

Alias for end_dir, to match nomenclature in truth.

reco_ke

Alias for ke, to match nomenclature in truth.

reco_length

Alias for length, to match nomenclature in truth.

reco_momentum

Alias for momentum, to match nomenclature in truth.

reco_start_dir

Alias for start_dir, to match nomenclature in truth.

size

Total number of voxels that make up the object.

Methods

as_dict([lite, include_derived])

Returns the data class as dictionary of (key, value) pairs.

attr_names([include_derived, ...])

Return the names of valid attributes on this data class.

from_dict(cls_dict)

Builds and returns an object of the class from a dictionary of attributes.

merge(other)

Merge another particle instance into this one.

reset_cathode_crosser()

Resets the cathode crossing information for the object.

reset_crt_match()

Reset all the CRT hit matching attributes.

reset_match()

Resets the reco/truth matching information for the object.

scalar_dict([attrs, lengths, lite])

Returns the data class attributes as a dictionary of scalars.

set_precision([precision])

Casts all the vector attributes to a different precision.

shift_indexes(shifts)

Apply offsets to index attributes in place.

to_cm(meta)

Converts the coordinates of the positional attributes to cm in place.

to_px(meta)

Converts the coordinates of the positional attributes to pixel in place.

value_with_units(attr)

Fetch an attribute value with its documented units.

__init__(is_truth: bool = False, units: str = 'cm', id: int = -1, is_contained: bool = False, is_time_contained: bool = False, is_cathode_crosser: bool = False, is_matched: bool = False, cathode_offset: float = nan, index: ndarray = <factory>, orig_index: ndarray = <factory>, points: ndarray = <factory>, depositions: ndarray = <factory>, sources: ndarray = <factory>, match_ids: ndarray = <factory>, match_overlaps: ndarray = <factory>, interaction_id: int = -1, chi2_pid: int = -1, is_primary: bool = False, is_crt_matched: bool = False, is_valid: bool = True, length: float = nan, calo_ke: float = nan, csda_ke: float = nan, mcs_ke: float = nan, shape: int = -1, pid: int = -1, fragment_ids: ndarray = <factory>, start_point: ndarray = <factory>, end_point: ndarray = <factory>, chi2_per_pid: ndarray = <factory>, csda_ke_per_pid: ndarray = <factory>, mcs_ke_per_pid: ndarray = <factory>, crt_ids: ndarray = <factory>, crt_times: ndarray = <factory>, crt_scores: ndarray = <factory>, start_dedx: float = nan, end_dedx: float = nan, vertex_distance: float = nan, start_straightness: float = nan, directional_spread: float = nan, axial_spread: float = nan, fragments: list[RecoFragment] = <factory>, start_dir: ndarray = <factory>, end_dir: ndarray = <factory>, pid_scores: ndarray = <factory>, primary_scores: ndarray = <factory>, ppn_ids: ndarray = <factory>, ppn_points: ndarray = <factory>) None

Methods

__init__(is_truth, units, id, is_contained, ...)

as_dict([lite, include_derived])

Returns the data class as dictionary of (key, value) pairs.

attr_names([include_derived, ...])

Return the names of valid attributes on this data class.

from_dict(cls_dict)

Builds and returns an object of the class from a dictionary of attributes.

merge(other)

Merge another particle instance into this one.

reset_cathode_crosser()

Resets the cathode crossing information for the object.

reset_crt_match()

Reset all the CRT hit matching attributes.

reset_match()

Resets the reco/truth matching information for the object.

scalar_dict([attrs, lengths, lite])

Returns the data class attributes as a dictionary of scalars.

set_precision([precision])

Casts all the vector attributes to a different precision.

shift_indexes(shifts)

Apply offsets to index attributes in place.

to_cm(meta)

Converts the coordinates of the positional attributes to cm in place.

to_px(meta)

Converts the coordinates of the positional attributes to pixel in place.

value_with_units(attr)

Fetch an attribute value with its documented units.

Attributes

axial_spread

calo_ke

cathode_offset

chi2_pid

csda_ke

depositions_sum

Total deposition value for the entire object.

directional_spread

end_dedx

enum_attrs

Fetches HDF5-friendly enumerator descriptors for enum-backed fields.

enum_dicts

Fetches the dictionary of enumerated attributes and their enumerator descriptors.

enum_values

Fetches reverse enum lookups from stored values to symbolic names.

field_units

Fetches the documented units for each field.

id

index_attrs

Return the tuple of index-bearing attributes.

interaction_id

is_cathode_crosser

is_contained

is_crt_matched

is_matched

is_primary

is_time_contained

is_truth

is_valid

ke

Best-guess kinetic energy in MeV.

length

mass

Rest mass of the particle in MeV/c^2.

mcs_ke

module_ids

List of modules that contribute to this object.

momentum

Best-guess momentum in MeV/c.

num_fragments

Number of fragments that make up this particle.

p

Computes the magnitude of the initial momentum.

pdg_code

Translates the enumerated particle type to a sign-less PDG code.

pid

reco_end_dir

Alias for end_dir, to match nomenclature in truth.

reco_ke

Alias for ke, to match nomenclature in truth.

reco_length

Alias for length, to match nomenclature in truth.

reco_momentum

Alias for momentum, to match nomenclature in truth.

reco_start_dir

Alias for start_dir, to match nomenclature in truth.

shape

size

Total number of voxels that make up the object.

start_dedx

start_straightness

units

vertex_distance

fragments

start_dir

end_dir

pid_scores

primary_scores

ppn_ids

ppn_points

fragment_ids

start_point

end_point

chi2_per_pid

csda_ke_per_pid

mcs_ke_per_pid

crt_ids

crt_times

crt_scores

index

orig_index

points

depositions

sources

match_ids

match_overlaps

start_dedx: float = nan
end_dedx: float = nan
vertex_distance: float = nan
start_straightness: float = nan
directional_spread: float = nan
axial_spread: float = nan
fragments: list[RecoFragment]
start_dir: ndarray
end_dir: ndarray
pid_scores: ndarray
primary_scores: ndarray
ppn_ids: ndarray
ppn_points: ndarray
merge(other)[source]

Merge another particle instance into this one.

The merging strategy differs depending on the the particle shapes merged together:

  • Track plus track: the merged particle uses the pair of end points that are farthest apart, and the primary and PID scores are copied from the constituent with the highest primary score.

  • Shower plus track: the track is merged into the shower, the shower start point is updated to the track end point farthest from the current shower start point, the primary score follows the most primary-like constituent and the PID stays that of the shower.

Parameters:

other (RecoParticle) – Other reconstructed particle to merge into this one

property pdg_code: int

Translates the enumerated particle type to a sign-less PDG code.

Returns:

Reconstructed sign-less PDG code

Return type:

int

property mass: float

Rest mass of the particle in MeV/c^2.

The mass is inferred from the predicted mass.

Returns:

Rest mass of the particle

Return type:

float

property ke: float

Best-guess kinetic energy in MeV.

Uses calorimetry for EM activity and this order for track: - CSDA-based estimate if it is available - MCS-based estimate if it is available - Calorimetry if all else fails

Returns:

Best-guess kinetic energy

Return type:

float

property momentum: ndarray

Best-guess momentum in MeV/c.

Returns:

  1. Momentum vector

Return type:

np.ndarray

property p: float

Computes the magnitude of the initial momentum.

Returns:

Norm of the initial momentum vector

Return type:

float

property reco_ke: float

Alias for ke, to match nomenclature in truth.

property reco_momentum: ndarray

Alias for momentum, to match nomenclature in truth.

property reco_length: float

Alias for length, to match nomenclature in truth.

property reco_start_dir: ndarray

Alias for start_dir, to match nomenclature in truth.

property reco_end_dir: ndarray

Alias for end_dir, to match nomenclature in truth.