@@ -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.0 u " s" ), typeof (0.0 u " 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.0 u " 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.0 u " 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