Skip to content

Commit

Permalink
updated etc classifier
Browse files Browse the repository at this point in the history
  • Loading branch information
patgo25 authored and gipert committed Jan 30, 2024
1 parent 2c5b9b4 commit 013dc04
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/pygama/evt/modules/spm.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ def get_majority_dplms(
# trail = 1: Singlet window = [t_first_lar_pulse, t_first_lar_pulse+ swin]
# trail = 2: Like trail = 1, but t_first_lar_pulse <= tge is ensured
# min_first_pls_ene sets the minimum energy of the first pulse (only used in trail > 0)
# max_per_channel, maximum number of pes a channel is allowed to have, if above it gets excluded
def get_etc(
f_hit,
f_dsp,
Expand All @@ -385,6 +386,7 @@ def get_etc(
swin,
trail,
min_first_pls_ene,
max_per_channel,
) -> Array:
# load TCM data to define an event
store = LH5Store()
Expand Down Expand Up @@ -419,9 +421,18 @@ def get_etc(
mask = get_spm_mask(lim, tge, tmin, tmax, pe, times)

pe = pe[mask]

# max pe mask
max_pe_mask = ak.nansum(pe, axis=-1) < max_per_channel
pe = ak.drop_none(
ak.nan_to_none(ak.where(max_pe_mask, pe, ak.Array([[np.nan]])))
)
pe_lst.append(pe)

times = times[mask] * 16
times = ak.drop_none(
ak.nan_to_none(ak.where(max_pe_mask, times, ak.Array([[np.nan]])))
)
time_lst.append(times)

pe_all = ak.concatenate(pe_lst, axis=-1)
Expand Down
2 changes: 1 addition & 1 deletion tests/evt/configs/module-test-evt-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"lar_classifier": {
"channels": "spms_on",
"aggregation_mode": "function",
"expression": ".modules.spm.get_etc(0.5,evt.t0,48000,100,6000,80,1,0)"
"expression": ".modules.spm.get_etc(0.5,evt.t0,48000,100,6000,80,1,0,50)"
},
"lar_energy_dplms": {
"channels": "spms_on",
Expand Down
2 changes: 1 addition & 1 deletion tests/evt/configs/module-test-t0-vov-evt-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"lar_classifier": {
"channels": "spms_on",
"aggregation_mode": "function",
"expression": ".modules.spm.get_etc(0.5,evt.t0,48000,100,6000,80,1,0)"
"expression": ".modules.spm.get_etc(0.5,evt.t0,48000,100,6000,80,1,0,50)"
},
"lar_energy_dplms": {
"channels": "spms_on",
Expand Down

0 comments on commit 013dc04

Please sign in to comment.