Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions spine/data/out/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ class OutBase(PosDataBase):
# Attributes that must not be stored to file when storing lite files
_lite_skip_attrs = ('index',)

def reset_match(self):
"""Resets the reco/truth matching information for the object."""
self.is_matched = False
self.match_ids = np.empty(0, dtype=np.int64)

@property
def size(self):
"""Total number of voxels that make up the object.
Expand Down
13 changes: 8 additions & 5 deletions spine/post/reco/cathode_cross.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Cathode crossing identification + merging module."""

import numpy as np
from scipy.spatial.distance import cdist

from spine.data import RecoInteraction, TruthInteraction

from spine.math.distance import cdist, farthest_pair
from spine.math.distance import farthest_pair

from spine.utils.globals import TRACK_SHP
from spine.utils.geo import Geometry
Expand Down Expand Up @@ -81,7 +82,6 @@ def __init__(self, crossing_point_tolerance, offset_tolerance,
keys['points'] = True
if run_mode != 'reco':
keys[truth_point_mode] = True

self.update_keys(keys)

def process(self, data):
Expand All @@ -92,6 +92,11 @@ def process(self, data):
data : dict
Dictionary of data products
"""
# Reset all particle/interaction matches, they are broken by merging
for obj_key in self.obj_keys:
for obj in data[obj_key]:
obj.reset_match()

# Loop over particle types
update_dict = {}
for part_key in self.particle_keys:
Expand Down Expand Up @@ -188,8 +193,7 @@ def process(self, data):
# Check if the two particles stop at roughly the same
# position in the plane of the cathode
compat = True
dist_mat = cdist(
end_points_i[:, caxes], end_points_j[:, caxes])
dist_mat = cdist(end_points_i[:, caxes], end_points_j[:, caxes])
argmin = np.argmin(dist_mat)
pair_i, pair_j = np.unravel_index(argmin, (2, 2))
compat &= (
Expand Down Expand Up @@ -257,7 +261,6 @@ def adjust_positions(self, data, idx_i, idx_j=None, truth=False):
Index of a matched cathode crosser fragment
truth : bool, default False
If True, adjust truth object positions
Results
-------
np.ndarray
Expand Down
11 changes: 11 additions & 0 deletions spine/utils/geo/detector/tpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ def cathode_pos(self):
"""
return np.mean([c.cathode_pos for c in self.chambers])

@property
def cathode_thickness(self):
"""Thickness of the cathode.

Returns
-------
float
Thickness of the cathode
"""
return abs(self.chambers[1].cathode_pos - self.chambers[0].cathode_pos)

def __len__(self):
"""Returns the number of TPCs in the module.

Expand Down
2 changes: 1 addition & 1 deletion spine/utils/geo/source/icarus_geometry.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tpc:
dimensions: [148.2, 316.82, 1789.901]
dimensions: [148.2, 316.82, 1789.902]
module_ids: [0, 0, 1, 1]
det_ids: [0, 0, 1, 1]
positions:
Expand Down
6 changes: 3 additions & 3 deletions spine/utils/geo/source/sbnd_geometry.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
tpc:
dimensions: [201.3, 400.016, 499.51562]
dimensions: [201.1, 400.016, 499.51562]
module_ids: [0, 0]
positions:
- [-100.65, 0.0, 254.70019]
- [100.65, 0.0, 254.70019]
- [-100.75, 0.0, 254.70019]
- [100.75, 0.0, 254.70019]
optical:
volume: module
shape: [box, ellipsoid]
Expand Down
Loading