mlreco.utils.vertex module¶
-
mlreco.utils.vertex.find_closest_points_of_approach(point1, direction1, point2, direction2)[source]¶ Given two lines in 3D space, find the two points that are closest to each other on these lines.
See also https://math.stackexchange.com/a/1993990/391047.
- Parameters
point1 (np.ndarray) – Point belonging to first line. Shape (3,)
direction1 (np.ndarray) – Direction defining the first line with point1. Shape (3,)
point2 (np.ndarray) – Point belonging to second line. Shape (3,)
direction2 (np.ndarray) – Direction defining the second line with point2. Shape (3,)
- Output
tuple of np.ndarray – Two points of approach, tuple with shape ((3,), (3,))
-
mlreco.utils.vertex.get_ppn_points_per_particles(input_data, res, primary_particles, primary_particles_seg, data_idx=0, coords_col=(1, 4), attaching_threshold=10, track_label=1, shower_label=0, unwrapped=False, apply_deghosting=True, return_distances=False, min_voxel_count=10, min_track_count=2)[source]¶ Get predicted PPN points
- Parameters
input_data (dict) –
res (dict) –
primary_particles (list) –
primary_particles_seg (list) –
data_idx (int, default 0) –
coords_col (tuple of int, default (1, 4)) –
attaching_threshold (float, default 10) – Distance (in voxels) to associate PPN candidates with particles.
track_label (int, default 1) – Semantic label for track-like particles.
shower_label (int, default 0) – Semantic label for shower-like particles.
unwrapped (bool, default False) –
apply_deghosting (bool, default True) – Whether PPN post-processing should consider the output already deghosted or not.
bool (return_distancesL) – For tuning studies.
False (default) – For tuning studies.
min_voxel_count (int, default 10) – Any particle with predicted deghosted voxel count below this threshold will be ignored.
min_track_count (int, default 2) – Will ignore shower particles as soon as we have >= min_track_count track-like particles in the interaction. This can be set to None to disable this behavior completely.
- Output
- list of N arrays of shape (M_i,f) of M_i PPN candidate points, f corresponds to the number
of feature in the output of uresnet_ppn_type_point_selector.
- array of N lists of voxel indices, corresponding to the particles
whose predicted semantic is track or shower.
N is the number of particles which are either track or shower (predicted).
-
mlreco.utils.vertex.predict_vertex(inter_idx, data_idx, input_data, res, coords_col=(1, 4), primary_label=1, shower_label=0, track_label=1, attaching_threshold=10, inter_threshold=20, unwrapped=False, apply_deghosting=True, return_distances=False, other_primaries_threshold=10, other_primaries_gamma_threshold=100, pca_radius=28, min_track_count=2, min_voxel_count=10)[source]¶ Heuristic to find the vertex by looking at - predicted primary particles within predicted interaction - predicted PPN points for these primary particles
For now, very simple: taking the barycenter of potential candidates.
- Parameters
inter_idx (int) – Predicted interaction index.
data_idx (int) – Batch entry index.
input_data (dict) – Input dictionary.
res (dict) – Output dictionary.
coords_col (tuple, default (1, 4)) –
primary_label (int, default 1) – In GNN predictions, integer tagging predicted primary particles.
shower_label (int, default 0) – Semantic label for shower-like particles.
track_label (int, default 1) – Semantic label for track-like particles.
attaching_threshold (float, default 10) – See get_ppn_points_per_particles.
inter_threshold (float, default 20) – PPN candidates need to minimize difference between distance to closest primary and distance of current primary particle voxels to closest primary particle.
unwrapped (bool, default False) – Whether input_data and res are already unwrapped or not.
apply_deghosting (bool, default True) – Whether to apply deghosting.
return_distances (bool, default False) – For tuning studies.
other_primaries_threshold (float, default 10) – Primaries too far from the other primaries will be ignored.
other_primaries_gamma_threshold (float, default 100) – Same as previous but for photon-like particles exclusively ($T_B$). Can be -1, then the same threshold as all other primaries will be used.
pca_radius (float, default 28) –
min_track_count (int, default 2) – See get_ppn_points_per_particles.
min_voxel_count (int, default 10) – See get_ppn_points_per_particles.
- Output
np.ndarray – vtx_candidate with shape (3,)
-
mlreco.utils.vertex.get_vertex(kinematics, cluster_label, data_idx, inter_idx, vtx_col=9, primary_label=1)[source]¶ Getting true vertex for interaction identified by inter_idx
Look at kinematics label, selecting only primary particles within this interaction, and get vertex which occurs the most.
- Parameters
kinematics (list of np.ndarray) – Kinematics labels.
cluster_label (list of np.ndarray) – Cluster labels.
data_idx (int) – Which entry we are looking at (labels).
inter_idx (int) – The true interaction id for which we want the vertex.
vtx_col (int, default 9) – First column of vertex coordinates in the kinematics labels. Coordinates columns go from vtx_col to vtx_col+2.
primary_label (int, default 1) – What integer tags primary particles in kinematics labels (“primary particles” ~ particles coming out of the vertex).
- Output
np.ndarray – True vertex coordinates. Shape (3,)