Skip to content

Commit 81047d2

Browse files
Merge pull request #68 from francois-drielsma/develop
Massive edge selector speed-up + vertexer bug fix
2 parents 698935e + 8f4c879 commit 81047d2

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

bin/larcv_count_entries.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def main(source, source_list, tree_name):
6060
help='Path to a text file of data file paths',
6161
type=str)
6262

63-
parser.add_argument('--tree_name',
63+
parser.add_argument('--tree-name',
6464
help='TTree name used to count the entries.',
6565
type=str)
6666

bin/larcv_find_duplicates.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def main(source, source_list, output, tree_name):
100100
help='Path to the output text file with the duplicate list',
101101
type=str, required=True)
102102

103-
parser.add_argument('--tree_name',
103+
parser.add_argument('--tree-name',
104104
help='TTree name used to count the entries.',
105105
type=str)
106106

bin/larcv_find_run.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def main(source, source_list, output, run_number, tree_name):
8383
help='Run number to look for',
8484
type=int, required=True)
8585

86-
parser.add_argument('--tree_name',
86+
parser.add_argument('--tree-name',
8787
help='TTree name used to count the entries.',
8888
type=str)
8989

spine/post/reco/vertex.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def reconstruct_vertex_single(self, inter):
115115
elif (np.linalg.norm(part.start_point - inter.vertex)
116116
< self.touching_threshold):
117117
part.is_primary = True
118-
elif (part.shape == SHOWR_SHP and
119-
np.dot(part.start_point, inter.vertex) < self.angle_threshold):
120-
part.is_primary = True
118+
elif part.shape == SHOWR_SHP:
119+
vec = part.start_point - inter.vertex
120+
cos = np.dot(vec/np.linalg.norm(vec), part.start_dir)
121+
if cos < self.angle_threshold:
122+
part.is_primary = True

spine/utils/gnn/evaluation.py

+6
Original file line numberDiff line numberDiff line change
@@ -642,12 +642,15 @@ def edge_assignment_score(edge_index: nb.int64[:,:],
642642
best_groups = np.arange(num_nodes, dtype=np.int64)
643643
track_used = np.zeros(num_nodes, dtype=np.bool_)
644644
best_loss = grouping_loss(pred_adj.flatten(), empty_adj.flatten())
645+
group_set = {np.int64(-1)} # Cannot be empty (typing)
645646
for k, e in enumerate(ord_index):
646647
# If the edge connect two nodes already in the same group, proceed
647648
a, b = e
648649
group_a, group_b = best_groups[a], best_groups[b]
649650
if group_a == group_b:
650651
continue
652+
if group_a in group_set and group_b in group_set:
653+
continue
651654

652655
# If requested, check whether there is already a track connection
653656
if track_node is not None:
@@ -677,6 +680,9 @@ def edge_assignment_score(edge_index: nb.int64[:,:],
677680
best_groups[best_groups == group_b] = group_a
678681
best_loss += combined_loss - current_loss
679682
best_ids = np.append(best_ids, k)
683+
group_set -= {group_a, group_b}
684+
else:
685+
group_set.update({group_a, group_b})
680686

681687
# Build the edge index
682688
best_index = ord_index[best_ids]

0 commit comments

Comments
 (0)