spine.data.out.TruthParticle
- class spine.data.out.TruthParticle(orig_id: int = -1, is_truth: bool = True, index_adapt: ndarray = <factory>, index_g4: ndarray = <factory>, points_adapt: ndarray = <factory>, points_g4: ndarray = <factory>, depositions_q: ndarray = <factory>, depositions_adapt: ndarray = <factory>, depositions_adapt_q: ndarray = <factory>, depositions_g4: ndarray = <factory>, sources_adapt: ndarray = <factory>, 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>, parent_id: int = -1, group_id: int = -1, nu_id: int = -1, children_id: ndarray = <factory>, mct_index: int = -1, mcst_index: int = -1, group_primary: int = -1, interaction_primary: int = -1, track_id: int = -1, parent_track_id: int = -1, ancestor_track_id: int = -1, pdg_code: int = -1, parent_pdg_code: int = -1, ancestor_pdg_code: int = -1, num_voxels: int = -1, t: float = nan, end_t: float = nan, parent_t: float = nan, ancestor_t: float = nan, energy_init: float = nan, energy_deposit: float = nan, distance_travel: float = nan, creation_process: str = '', parent_creation_process: str = '', ancestor_creation_process: str = '', position: ndarray = <factory>, end_position: ndarray = <factory>, parent_position: ndarray = <factory>, ancestor_position: ndarray = <factory>, first_step: ndarray = <factory>, last_step: ndarray = <factory>, momentum: ndarray = <factory>, end_momentum: ndarray = <factory>, orig_interaction_id: int = -1, orig_parent_id: int = -1, orig_group_id: int = -1, reco_length: float = nan, fragments: list[TruthFragment] = <factory>, orig_children_id: ndarray = <factory>, children_counts: ndarray = <factory>, reco_start_dir: ndarray = <factory>, reco_end_dir: ndarray = <factory>)[source]
Truth particle information.
This inherits all of the attributes of
Particle, which contains the G4 truth information for the particle.- fragments
List of fragments that make up this particle
- Type:
List[TruthFragment]
- orig_interaction_id
Unaltered index of the interaction in the original MC particle list
- Type:
int
- orig_parent_id
Unaltered index of the particle parent in the original MC particle list
- Type:
int
- orig_group_id
Unaltered index of the particle group in the original MC particle list
- Type:
int
- orig_children_id
Unaltered list of the particle children in the original MC particle list
- Type:
np.ndarray
- children_counts
Number of truth child particle of each shape
- Type:
np.ndarray
- pdg_code
PDG code corresponding to the PID number
- Type:
int
- mass
Rest mass of the particle in MeV/c^2
- Type:
float
- ke
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
- reco_length
Reconstructed length of the particle (only assigned to track objects)
- Type:
float
- reco_start_dir
Particle direction estimate w.r.t. the start point
- Type:
np.ndarray
- reco_end_dir
(3) Particle direction estimate w.r.t. the end point (only assigned to track objects)
- Type:
np.ndarray
- reco_ke
Best-guess reconstructed KE of the particle
- Type:
float
- reco_momentum
Best-guess reconstructed momentum of the particle
- Type:
np.ndarray
- Attributes:
depositions_adapt_q_sumTotal deposition value for the entire object in the adapted tensor and in the original units.
depositions_adapt_sumTotal deposition value for the entire object in the adapted tensor.
depositions_g4_sumTotal deposition value for the entire object in the Geant4 tensor.
depositions_q_sumTotal deposition value for the entire object in the original units.
depositions_sumTotal deposition value for the entire object.
end_dirConverts the final momentum to a direction vector.
end_pComputes the magnitude of the final momentum.
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.
keConverts the particle initial energy to a kinetic energy.
massComputes the rest mass of the particle from its energy/momentum.
module_idsList of modules that contribute to this object.
num_fragmentsNumber of fragments that make up this particle.
pComputes the magnitude of the initial momentum.
reco_keBest-guess reconstructed kinetic energy in MeV.
reco_momentumBest-guess reconstructed momentum in MeV/c.
sizeTotal number of voxels that make up the object.
size_adaptTotal number of voxels that make up the object in the adapted tensor.
size_g4Total number of voxels that make up the object in the Geant4 tensor.
start_dirConverts the initial momentum to a direction vector.
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.
from_larcv(particle)Builds and returns a Particle object from a LArCV Particle object.
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__(orig_id: int = -1, is_truth: bool = True, index_adapt: ndarray = <factory>, index_g4: ndarray = <factory>, points_adapt: ndarray = <factory>, points_g4: ndarray = <factory>, depositions_q: ndarray = <factory>, depositions_adapt: ndarray = <factory>, depositions_adapt_q: ndarray = <factory>, depositions_g4: ndarray = <factory>, sources_adapt: ndarray = <factory>, 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>, parent_id: int = -1, group_id: int = -1, nu_id: int = -1, children_id: ndarray = <factory>, mct_index: int = -1, mcst_index: int = -1, group_primary: int = -1, interaction_primary: int = -1, track_id: int = -1, parent_track_id: int = -1, ancestor_track_id: int = -1, pdg_code: int = -1, parent_pdg_code: int = -1, ancestor_pdg_code: int = -1, num_voxels: int = -1, t: float = nan, end_t: float = nan, parent_t: float = nan, ancestor_t: float = nan, energy_init: float = nan, energy_deposit: float = nan, distance_travel: float = nan, creation_process: str = '', parent_creation_process: str = '', ancestor_creation_process: str = '', position: ndarray = <factory>, end_position: ndarray = <factory>, parent_position: ndarray = <factory>, ancestor_position: ndarray = <factory>, first_step: ndarray = <factory>, last_step: ndarray = <factory>, momentum: ndarray = <factory>, end_momentum: ndarray = <factory>, orig_interaction_id: int = -1, orig_parent_id: int = -1, orig_group_id: int = -1, reco_length: float = nan, fragments: list[TruthFragment] = <factory>, orig_children_id: ndarray = <factory>, children_counts: ndarray = <factory>, reco_start_dir: ndarray = <factory>, reco_end_dir: ndarray = <factory>) None
Methods
__init__(orig_id, is_truth, index_adapt, ...)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.
from_larcv(particle)Builds and returns a Particle object from a LArCV Particle object.
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
ancestor_creation_processancestor_pdg_codeancestor_tancestor_track_idcalo_kecathode_offsetchi2_pidcreation_processcsda_kedepositions_adapt_q_sumTotal deposition value for the entire object in the adapted tensor and in the original units.
depositions_adapt_sumTotal deposition value for the entire object in the adapted tensor.
depositions_g4_sumTotal deposition value for the entire object in the Geant4 tensor.
depositions_q_sumTotal deposition value for the entire object in the original units.
depositions_sumTotal deposition value for the entire object.
distance_travelConverts the final momentum to a direction vector.
end_pComputes the magnitude of the final momentum.
end_tenergy_depositenergy_initenum_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.
group_idgroup_primaryidindex_attrsReturn the tuple of index-bearing attributes.
interaction_idinteraction_primaryis_cathode_crosseris_containedis_crt_matchedis_matchedis_primaryis_time_containedis_truthis_validConverts the particle initial energy to a kinetic energy.
lengthComputes the rest mass of the particle from its energy/momentum.
mcs_kemcst_indexmct_indexmodule_idsList of modules that contribute to this object.
nu_idnum_fragmentsNumber of fragments that make up this particle.
num_voxelsorig_idpComputes the magnitude of the initial momentum.
parent_creation_processparent_idparent_pdg_codeparent_tparent_track_idpidBest-guess reconstructed kinetic energy in MeV.
Best-guess reconstructed momentum in MeV/c.
shapesizeTotal number of voxels that make up the object.
size_adaptTotal number of voxels that make up the object in the adapted tensor.
size_g4Total number of voxels that make up the object in the Geant4 tensor.
Converts the initial momentum to a direction vector.
ttrack_idunitschildren_idpositionend_positionparent_positionancestor_positionfirst_steplast_stepend_momentumfragment_idsstart_pointend_pointchi2_per_pidcsda_ke_per_pidmcs_ke_per_pidcrt_idscrt_timescrt_scoresindexorig_indexpointsdepositionssourcesmatch_idsmatch_overlapsindex_adaptindex_g4points_adaptpoints_g4depositions_qdepositions_adaptdepositions_adapt_qdepositions_g4sources_adapt- orig_interaction_id: int = -1
- orig_parent_id: int = -1
- orig_group_id: int = -1
- reco_length: float = nan
- fragments: list[TruthFragment]
- orig_children_id: ndarray
- children_counts: ndarray
- reco_start_dir: ndarray
- reco_end_dir: ndarray
- property start_dir: ndarray
Converts the initial momentum to a direction vector.
- Returns:
Start direction vector
- Return type:
np.ndarray
- property end_dir: ndarray
Converts the final momentum to a direction vector.
Note that if a particle stops, this is unreliable as an estimate of the direction of the particle before it stops.
- Returns:
End direction vector
- Return type:
np.ndarray
- property ke: float
Converts the particle initial energy to a kinetic energy.
This only works for particles with a known mass (as defined in spine.constants).
- Returns:
Initial kinetic energy of the particle
- Return type:
float
- property reco_ke: float
Best-guess reconstructed 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 reco_momentum: ndarray
Best-guess reconstructed momentum in MeV/c.
- Returns:
Momentum vector
- Return type:
np.ndarray