Skip to content

Commit 2a24bb4

Browse files
committed
Add some warnings when segments are dropped
1 parent 7ae1e42 commit 2a24bb4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cli/simulate_pixels.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,12 +487,12 @@ def save_results(event_times, results, i_trig, i_mod=-1, light_only=False):
487487
RangePop() # load_properties
488488

489489
RangePush("load_hd5_file")
490-
print("Loading track segments..." , end="")
490+
print("Loading track segments...")
491491
start_load = time()
492492
# First of all we load the edep-sim output
493493
with h5py.File(input_filename, 'r') as f:
494494
tracks = np.array(f['segments'])
495-
495+
496496
# Make "t0" attribute, if it doesn't exist
497497
if 't0' not in tracks.dtype.names:
498498
# the t0 key refers to the time of energy deposition
@@ -522,7 +522,14 @@ def save_results(event_times, results, i_trig, i_mod=-1, light_only=False):
522522
tracks['t0_start'] = tracks['t0_start'] - localSpillIDs*sim.SPILL_PERIOD
523523
tracks['t0_end'] = tracks['t0_end'] - localSpillIDs*sim.SPILL_PERIOD
524524
tracks['t0'] = tracks['t0'] - localSpillIDs*sim.SPILL_PERIOD
525-
tracks = tracks[tracks['t0'] < 300] # filter out highly delayed segments (neutron decay, etc)
525+
# filter out highly delayed segments (neutron decay, etc)
526+
t0_cutoff = 300
527+
tracks_reject = tracks[tracks['t0'] >= t0_cutoff]
528+
tracks = tracks[tracks['t0'] < t0_cutoff]
529+
if tracks_reject.size > 0:
530+
print("Rejecting ",tracks_reject.size," delayed truth segments with t0 > ",t0_cutoff," microseconds:")
531+
for val in tracks_reject:
532+
print(' t0 = ',val['t0'])
526533

527534
if 'segment_id' in tracks.dtype.names:
528535
segment_ids = tracks['segment_id']

0 commit comments

Comments
 (0)