Skip to content

Commit e7ef639

Browse files
francois-drielsmaBear Carlson
authored andcommitted
Changes for flash matching
1 parent 4b90f74 commit e7ef639

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

spine/ana/script/fmatch_performance.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ def __init__(self, log_name, flash_tmin=-0.4, flash_tmax=1.5, flash_tolerance=0.
4747
# Add additional required data products
4848
self.update_keys({'interaction_matches_t2r': True})
4949
self.update_keys({'interaction_matches_t2r_overlap': True})
50+
51+
self.update_keys({'interaction_matches_r2t': True})
52+
self.update_keys({'interaction_matches_r2t_overlap': True})
5053

5154
# Initialize the flash time window
5255
self.flash_tmin = flash_tmin
@@ -62,12 +65,14 @@ def process(self, data):
6265
Dictionary of data products
6366
"""
6467
# Fetch the keys you want
68+
interaction_matches_r2t = data['interaction_matches_r2t']
6569
interaction_matches_t2r = data['interaction_matches_t2r']
6670

6771
# Loop over matched interactions (t2r)
6872
for idx, (true_inter, reco_inter) in enumerate(interaction_matches_t2r):
69-
70-
if true_inter == None: continue
73+
#for idx, (reco_inter, true_inter) in enumerate(interaction_matches_r2t):
74+
#if true_inter == None: continue
75+
#if reco_inter == None: continue
7176

7277
# Storage
7378
row_dict = {}
@@ -181,6 +186,8 @@ def process(self, data):
181186
row_dict[f'truth_flash_hypo_pe'] = true_inter.flash_hypo_pe
182187
row_dict[f'truth_reduced_flash_score'] = (true_inter.flash_total_pe - true_inter.flash_hypo_pe) / true_inter.flash_total_pe
183188

189+
#Energy info - get E of all true particles
190+
row_dict['truth_energy_init'] = 0
184191
# Energy info - get KE of all true particles
185192
row_dict['truth_calo_energy'] = 0
186193
# Also get average time of particles
@@ -189,11 +196,14 @@ def process(self, data):
189196
nprim = 0
190197
for i,p in enumerate(true_inter.particles):
191198
row_dict[f'truth_calo_energy'] += p.calo_ke
199+
row_dict['truth_energy_init'] += p.energy_init
192200
if p.is_primary:
193201
row_dict[f'truth_avg_time'] += p.t*1e-3 #us
194202
nprim += 1
195203
if nprim > 0:
196204
row_dict['truth_avg_time'] /= nprim
205+
else:
206+
row_dict['truth_avg_time'] = -9999
197207

198208
#Efficiency - is the flash time within the BNB window?
199209
# Truth values get some slack because of the time resolution +- 0.2 us
@@ -203,6 +213,7 @@ def process(self, data):
203213
row_dict['truth_in_bnb'] = False
204214

205215
# Overlap
206-
overlap = data['interaction_matches_t2r_overlap'][idx]
207-
row_dict.update({'match_overlap': overlap})
216+
#overlap = data['interaction_matches_t2r_overlap'][idx]
217+
#overlap = data['interaction_matches_r2t_overlap'][idx]
218+
#row_dict.update({'match_overlap': overlap})
208219
self.append(f'{self.log_name}_fmatch_performance', **row_dict)

spine/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Module which stores the current software version."""
22

3-
__version__ = '0.2.1'
3+
__version__ = '0.3.0'

0 commit comments

Comments
 (0)