Skip to content

Commit 23c71e9

Browse files
authored
Merge pull request #19 from legend-exp/bug-fix-muon-falg
Bug Fix `muon` flag
2 parents 452ea14 + 9c25afd commit 23c71e9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/calibrate_pmts.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ function _build_muon_evt_cut(data::LegendData, sel::AnyValiditySelection, global
9494
output_colnames = (:timestamp, :pe_cal, :multiplicity)
9595
cutout_colnames = (:is_valid_muon, :n_hit_window)
9696
colnames_types = Tuple{Bool, Int, typeof(0.0u"s"), typeof(0.0u"e_au"), Int}
97-
if isempty(pmt_events)
98-
return StructArray(fill(NamedTuple{(cutout_colnames..., output_colnames...), colnames_types}([true, 0, NaN*u"s", 0.0u"e_au", 0]), length(global_events)))
99-
elseif count(.!pmt_events.is_valid_muon) == 0
97+
if isempty(pmt_events) || count(.!pmt_events.is_valid_muon) == 0
10098
return StructArray(fill(NamedTuple{(cutout_colnames..., output_colnames...), colnames_types}([true, 0, NaN*u"s", 0.0u"e_au", 0]), length(global_events)))
10199
end
102100
geds_t0_absolute = global_events.tstart .+ global_events.geds.t0_start
@@ -111,6 +109,7 @@ function _build_muon_evt_cut(data::LegendData, sel::AnyValiditySelection, global
111109
pmt_events_trig = evtdata_output_pf.(pmt_events[findall(.!pmt_events.is_valid_muon)])
112110

113111
@assert length(propertynames(pmt_events_trig)) == length(output_colnames) && all(hasproperty.(Ref(pmt_events_trig), output_colnames)) "Invalid `evtdata_output` properties"
112+
pmt_events_trig = StructArray(NamedTuple{output_colnames}(columns(pmt_events_trig)))
114113

115114
empty_evt::typeof(first(pmt_events_trig)) = typeof(first(pmt_events_trig))([zero(first(pmt_events_trig)[k]) for k in keys(first(pmt_events_trig))])
116115

0 commit comments

Comments
 (0)