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
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
Array of softmax scores associated with each particle class
- Type:
np.ndarray
- primary_scores
Array of softmax scores associated with secondary and primary
- Type:
np.ndarray
- ppn_ids
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_sumTotal deposition value for the entire object.
enum_attrsFetches HDF5-friendly enumerator descriptors for enum-backed fields.
enum_dictsFetches the dictionary of enumerated attributes and their enumerator descriptors.
enum_valuesFetches reverse enum lookups from stored values to symbolic names.
field_unitsFetches the documented units for each field.
index_attrsReturn the tuple of index-bearing attributes.
keBest-guess kinetic energy in MeV.
massRest mass of the particle in MeV/c^2.
module_idsList of modules that contribute to this object.
momentumBest-guess momentum in MeV/c.
num_fragmentsNumber of fragments that make up this particle.
pComputes the magnitude of the initial momentum.
pdg_codeTranslates the enumerated particle type to a sign-less PDG code.
reco_end_dirAlias for end_dir, to match nomenclature in truth.
reco_keAlias for ke, to match nomenclature in truth.
reco_lengthAlias for length, to match nomenclature in truth.
reco_momentumAlias for momentum, to match nomenclature in truth.
reco_start_dirAlias for start_dir, to match nomenclature in truth.
sizeTotal 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
calo_kecathode_offsetchi2_pidcsda_kedepositions_sumTotal deposition value for the entire object.
enum_attrsFetches HDF5-friendly enumerator descriptors for enum-backed fields.
enum_dictsFetches the dictionary of enumerated attributes and their enumerator descriptors.
enum_valuesFetches reverse enum lookups from stored values to symbolic names.
field_unitsFetches the documented units for each field.
idindex_attrsReturn the tuple of index-bearing attributes.
interaction_idis_cathode_crosseris_containedis_crt_matchedis_matchedis_primaryis_time_containedis_truthis_validBest-guess kinetic energy in MeV.
lengthRest mass of the particle in MeV/c^2.
mcs_kemodule_idsList of modules that contribute to this object.
Best-guess momentum in MeV/c.
num_fragmentsNumber of fragments that make up this particle.
Computes the magnitude of the initial momentum.
Translates the enumerated particle type to a sign-less PDG code.
pidAlias for end_dir, to match nomenclature in truth.
Alias for ke, to match nomenclature in truth.
Alias for length, to match nomenclature in truth.
Alias for momentum, to match nomenclature in truth.
Alias for start_dir, to match nomenclature in truth.
shapesizeTotal number of voxels that make up the object.
unitsfragment_idsstart_pointend_pointchi2_per_pidcsda_ke_per_pidmcs_ke_per_pidcrt_idscrt_timescrt_scoresindexorig_indexpointsdepositionssourcesmatch_idsmatch_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:
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.