HPGe calibration
Peak splitting, DSP and quality cuts
JuLeAna.process_daq_energy_calibration_cal — Function
process_daq_energy_calibration_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Calibrate the DAQ online energy (daqenergy) of the HPGe detectors (geds) of a cal run.
For each detector, the daqenergy of the raw cal files of the run listed in the runinfo, except the filekeys marked unprocessable, is calibrated automatically with the Th-228 lines (th228_cal_lines) by autocal_energy. The result is a linear calibration c * daqenergy in keV, which process_peak_split_cal and process_peak_split_phy use to select the events of their peaks. When the calibration fails, the uncalibrated spectrum is plotted instead.
Inputs
rawtier of thecalfilekeys of the run listed in the runinfo, except the filekeys marked unprocessabledataprod_config(l200).raw(filekey), sectionsdefaultand per detector
Outputs
l200.par.rpars.daqecal[period, run]: per detector the calibration constantcand the calibration functionfunc, with a validity entry of categoryallfor the run- plot
:daq_energyfor each calibrated detector,:daq_energy_failedfor each detector whose calibration failed - run report
:daq_energy_calibration_calwith one row per detector
Keywords
reprocess: discard the existing parameters and calibrate all detectors; otherwise a detector with parameters is skippedtimeout: seconds allowed per detector inparallel(0 = no limit)
Returns
Return nothing.
JuLeAna.process_peak_split_cal — Function
process_peak_split_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Extract the events in the Th-228 peaks from the raw cal data of the HPGe detectors (geds) of a run.
For each detector, the DAQ energy of the raw cal files of the run listed in the runinfo, except the filekeys marked unprocessable, is calibrated with the parameters of process_daq_energy_calibration_cal, and the events inside the energy windows given by peaks (for example Tl208FEP and Tl208SEP) are written with their raw waveforms. A detector without DAQ energy calibration fails. The processor throws an error if no file is found.
Inputs
rawtier of thecalfilekeys of the run listed in the runinfo, except the filekeys marked unprocessablel200.par.rpars.daqecal[period, run]: DAQ energy calibration functionfuncper detectordataprod_config(l200).raw(filekey), sectionsdefaultand per detector, entrypeaks
Outputs
jlpkstier file of the start filekey of the run for each detector, with one table per entry ofpeaks- run report
:peak_split, with one row per detector (number of events per peak, time, allocations)
Keywords
reprocess: recreate thejlpksfiles; otherwise a detector with a readablejlpksfile is skipped (an unreadable file is removed and recreated)timeout: seconds allowed per detector inparallel(0 = no limit)use_cache: write each output file to a local cache directory first and move it to its place when done; otherwise write it next to its final location (default:false)
Returns
Return nothing.
JuLeAna.process_peak_split_phy — Function
process_peak_split_phy(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Extract the events in the peaks of the phy raw config, such as the K-40 and K-42 lines, from the raw phy data of the HPGe detectors (geds) of a run.
The same as process_peak_split_cal for the phy files of the run. The DAQ energy is calibrated with the parameters of process_daq_energy_calibration_cal of the cal data of the same run.
Inputs
rawtier of thephyfilekeys of the run listed in the runinfo, except the filekeys marked unprocessablel200.par.rpars.daqecal[period, run]: DAQ energy calibration functionfuncper detectordataprod_config(l200).raw(filekey)for thephyfilekey, sectionsdefaultand per detector, entrypeaks
Outputs
jlpkstier file of the startphyfilekey of the run for each detector, with one table per entry ofpeaks- run report
:peak_split_phy, with one row per detector (number of events per peak, time, allocations)
Keywords
reprocess: recreate thejlpksfiles; otherwise a detector with a readablejlpksfile is skipped (an unreadable file is removed and recreated)timeout: seconds allowed per detector inparallel(0 = no limit)use_cache: write each output file to a local cache directory first and move it to its place when done; otherwise write it next to its final location (default:false)
Returns
Return nothing.
JuLeAna.process_dsp_cal — Function
process_dsp_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0,
max_wvfs::Int=10000)Run the DSP on the cal raw data of the HPGe detectors (geds) of a run.
For every raw cal file of the run, each detector is processed with its DSP configuration, its pole-zero decay time, and its energy and A/E filter optimization parameters, in three @process_steps: DSP parameters of <detector> in <filekey>, raw data loading of <detector> in <filekey> and DSP of <detector> in <filekey>. A detector fails, and the others go on, if the decay time is missing, if its DSP configuration has no required_fltopt_selection or required_aoeopt_selection, if a parameter listed in required_fltopt (or required_aoeopt) is missing for a detector whose channel info row satisfies required_fltopt_selection (or required_aoeopt_selection), or if its raw data or its DSP throws an error. The selections are strings of LegendDataManagement.ljl_propfunc expressions, e.g. "usability == :on && (low_aoe_status == :valid || low_aoe_status == :present)". run_step with detectors and debug = true captures each failed step of these detectors with the variables of the processor, e.g. the raw data of a failed DSP.
Inputs
rawtier of thecalfilekeys of the run listed in the runinfo, except the filekeys marked unprocessabledataprod_config(l200).dsp(filekey)- the decay time and the optimization parameters of each detector from
get_dsp_pars(l200, filekey, detector, pars_cat)withpars_cat:pz,:fltoptand:aoeopt, read from thepars_typethat the DSP config sets for the detector, e.g.pparsorrpars. A detector whose parameters cannot be loaded fails. Filter parameters that are not set for a detector take the defaults of its DSP configuration. - the QC evaluator from
load_qc_evaluator(l200, filekey)
Outputs
jldsptier file for each filekey, with one table per detector- run report
:dsp_cal, with one row per filekey (number of processed detectors, failed detectors, time, allocations) and the time of each detector summed over the filekeys (seeJuLeAna.timing_table)
Keywords
reprocess: remove the existingjldspfiles and process all detectors again; otherwise detectors already present in a file are skippedtimeout: seconds allowed per filekey inparallel(0 = no limit)use_cache: write each output file to a local cache directory first and move it to its place when done; otherwise write it next to its final location (default:true)max_wvfs: not used by this processor
Returns
Return nothing.
JuLeAna.process_dsp_phy — Function
process_dsp_phy(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0,
max_wvfs::Int=10000)Run the DSP on the phy raw data of a run for the additional detectors, PMTs, SiPMs (spms) and HPGe detectors (geds).
For every raw phy file of the run, the channel groups are processed in this order: the detectors listed under additional_detectors in the DSP configuration, the PMTs, the SiPMs (with their per-detector thresholds), and the HPGe detectors (with their pole-zero decay time and energy and A/E filter optimization parameters). Each detector is processed in @process_steps: DSP parameters of <detector> in <filekey> for all but the PMTs, then raw data loading of <detector> in <filekey> and DSP of <detector> in <filekey>. A detector fails, and the others go on, if its parameters are missing, or if its raw data or its DSP throws an error. An HPGe detector also fails if its DSP configuration has no required_fltopt_selection or required_aoeopt_selection, or if a parameter listed in required_fltopt (or required_aoeopt) is missing for a detector whose channel info row satisfies required_fltopt_selection (or required_aoeopt_selection). The selections are strings of LegendDataManagement.ljl_propfunc expressions, e.g. "usability == :on && (low_aoe_status == :valid || low_aoe_status == :present)". A PMT without raw data in a file is skipped and counts as processed. run_step with detectors and debug = true captures each failed step of these detectors with the variables of the processor, e.g. the raw data of a failed DSP.
Inputs
rawtier of thephyfilekeys of the run listed in the runinfo, except the filekeys marked unprocessabledataprod_config(l200).dsp(filekey),dataprod_config(l200).sipm(filekey)anddataprod_config(l200).pmt(filekey)- the decay time, the optimization parameters and the SiPM thresholds of each detector from
get_dsp_pars(l200, filekey, detector, pars_cat)withpars_cat:pz,:fltopt,:aoeoptand:sipmopt, read from thepars_typethat the DSP config sets for the detector, e.g.pparsorrpars. A detector whose parameters cannot be loaded fails. Filter parameters that are not set for an HPGe detector take the defaults of its DSP configuration. - the QC evaluator from
load_qc_evaluator(l200, filekey)
Outputs
jldsptier file for each filekey, with one table per detector- run report
:dsp_phy, with one row per filekey (number of processed detectors, failed detectors, time, allocations) and the time of each detector summed over the filekeys (seeJuLeAna.timing_table)
Keywords
reprocess: remove the existingjldspfiles and process all detectors again; otherwise detectors already present in a file are skippedtimeout: seconds allowed per filekey inparallel(0 = no limit)use_cache: write each output file to a local cache directory first and move it to its place when done; otherwise write it next to its final location (default:true)max_wvfs: not used by this processor
Returns
Return nothing.
JuLeAna.process_dsp_aux_phy — Function
process_dsp_aux_phy(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Run the DSP and the calibration for the auxiliary detectors (for example the pulser) of the phy data of a run, per filekey.
The auxiliary detectors are the channels selected by get_aux_evt_detsel_propfunc. For each filekey, the raw fields listed under raw_fields for the DSP function of each auxiliary detector (additional_detectors in the DSP configuration) are read and processed with that function, and the result is extended by the auxiliary calibration property function. After all filekeys, each detector is summarized over the run without the filekeys in bad_filekeys (also the removed ones): its number of events, a cross-check histogram of the energy named in the cal.aux_trig condition of the event configuration with the trigger threshold marked, and, for detectors with a cal.aux_trig_intime condition, a 2D histogram of that energy versus the time column of the condition (t_max, or t50 for the pulser) with its time window marked.
Inputs
rawtier of thephyfilekeys of the run listed in the runinfo, except the filekeys marked unprocessabledataprod_config(l200).dsp(filekey), sectionsadditional_detectorsandraw_fieldsdataprod_config(l200).evt(filekey), sectionaux- the auxiliary calibration from
get_aux_cal_propfunc(l200, filekey, det)
Outputs
jlauxtier file for each filekey, with one table per auxiliary detector (DSP and calibrated columns)- plots
:dsp_aux_energyand:dsp_aux_energy_timefor each auxiliary detector (debug plot level) - run report
:dsp_aux_phy, with one row per detector (status, number of events) and one row per filekey
Keywords
reprocess: remove the existingjlauxfiles and process all detectors again; otherwise detectors already present in a file are skippedtimeout: seconds allowed per filekey and per detector summary inparallel(0 = no limit)use_cache: write each output file to a local cache directory first and move it to its place when done; otherwise write it next to its final location (default:true)
Returns
Return nothing.
JuLeAna.process_qcs_cal — Function
process_qcs_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Generate the quality-cut (QC) flags and their survival fractions for the cal data of the HPGe detectors (geds) of a run.
The QC flags are generated per filekey: for each detector, the QC labels and the is_single_pulse flag defined in the QC configuration are evaluated on the jldsp data, and pulser events are flagged by coincidence of the event timestamps with the raw timestamps of the pulser channel (pulser.puls_detector) of the filekey. Each detector is then summarized over the run without the removed filekeys: the survival fraction of each flag is computed for the pulser events and for the Tl-208 full-energy peak, which is located with a simple Th-228 calibration of the non-pulser events. Only the Tl-208 FEP survival fraction of is_single_pulse has an uncertainty; it is NaN for the other flags. A detector with fewer than 5000 events fails. A detector with single-pulse events that fail the is_valid_e flag gets the status warning. The single-pulse survival fraction of the pulser events of each filekey is compared with that of the other nonremoved filekeys by an exact count test, and deviations above filekey_stability.sigma of the QC config are reported without changing the status; the non-pulser survival fraction is shown for diagnosis only.
Inputs
jldsptier of thecalfilekeys of the run listed in the runinfo, except the filekeys marked unprocessablerawtier timestamps of the pulser channel- the filekeys marked removed in
datasets/ignored_daq_cycles, which are left out of the run summary dataprod_config(l200).qc(filekey)anddataprod_config(l200).energy(filekey)l200.par.rpars.qcs[period, run](existing parameters, unlessreprocessistrue)
Outputs
jlqcstier file for each filekey, with one table per detector (QC flags,timestamp,is_pulser)l200.par.rpars.qcs[period, run](flag definition, survival fractions, event counts, and per filekey the event counts and stability tests infilekey_summary) with its validity (categorycal)- plots
:raw_energy_e_trap,:qc_filekey_efficiencyand:qc_survival_fractionsfor each detector;:qc_survival_fractionsis saved only at the debug plot level - run report
:qcs_cal, with the stability warnings, one row per detector and one row per filekey
Keywords
reprocess: remove the existingjlqcsfiles and parameters and process all detectors again; otherwise detectors already present in ajlqcsfile are skipped there. The run summary of every detector is always recomputed.timeout: seconds allowed per filekey and per detector summary inparallel(0 = no limit)use_cache: write each output file to a local cache directory first and move it to its place when done; otherwise write it next to its final location (default:true)
Returns
Return nothing.
JuLeAna.process_qcs_phy — Function
process_qcs_phy(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Generate the quality-cut (QC) flags and their survival fractions for the phy data of the HPGe detectors (geds) of a run.
The QC flags are generated per filekey: for each detector, the QC labels and the is_single_pulse and is_empty_trace flags defined in the QC configuration are evaluated on the jldsp data. Pulser events and forced-trigger events (without pulser events) are taken from the aux_trig flags of the pulser channel (pulser.puls_detector) and of the forced-trigger channel (forced_trigger.detector) of the filekey. Each detector is then summarized over the run without the removed filekeys: the survival fraction of each flag is computed for the pulser events and for the forced-trigger events. A detector with single-pulse events that fail the is_valid_dsp flag gets the status warning. The pulser single-pulse and forced-trigger empty-trace survival fractions of each filekey are compared with those of the other nonremoved filekeys by an exact count test, and deviations above filekey_stability.sigma of the QC config are reported without changing the status.
Inputs
jldsptier of thephyfilekeys of the run listed in the runinfo, except the filekeys marked unprocessablejlauxtier columnaux_trigof the pulser and forced-trigger channels- the filekeys marked removed in
datasets/ignored_daq_cycles, which are left out of the run summary dataprod_config(l200).qc(filekey)l200.par.rpars.qcs[period, Symbol("<run>-phy")](existing parameters, unlessreprocessistrue)
Outputs
jlqcstier file for each filekey, with one table per detector (QC flags,timestamp,is_pulser,is_forced)l200.par.rpars.qcs[period, Symbol("<run>-phy")](flag definition, survival fractions, event counts, and per filekey the event counts and stability tests infilekey_summary) with its validity (categoryphy)- plots
:qc_filekey_efficiency,:qc_survival_fractionsand:qc_survival_fractions_forced_triggerfor each detector;:qc_survival_fractions_forced_triggeris saved only at the debug plot level - run report
:qcs_phy, with the stability warnings, one row per detector and one row per filekey
Keywords
reprocess: remove the existingjlqcsfiles and parameters and process all detectors again; otherwise detectors already present in ajlqcsfile are skipped there. The run summary of every detector is always recomputed.timeout: seconds allowed per filekey and per detector summary inparallel(0 = no limit)use_cache: write each output file to a local cache directory first and move it to its place when done; otherwise write it next to its final location (default:true)
Returns
Return nothing.
Decay time and filter optimization
JuLeAna.process_decay_time_cal — Function
process_decay_time_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Determine the preamplifier decay time of the HPGe detectors (geds) from the cal data of a run.
For each detector, the presummed waveforms of the peak named by peakname in the pz section of the DSP configuration are read from the jlpks tier. If there are more than max_wvfs waveforms, max_wvfs of them are selected at random, without repetition and in their original order. Waveforms that fail the QC condition qc are removed. The decay time of each remaining waveform is computed, and a truncated Gaussian is fitted to the values between min_tau and max_tau; its mean is the decay time. A detector gets warning status if the decay time is outside 350 to 700 µs. A detector fails if its jlpks file is missing or if loading, QC, DSP or the fit throws an error.
Inputs
jlpkstier of the start filekey of the run, entrypeaknamedataprod_config(l200).dsp(filekey), sectionsdefault, per detector, andpz(min_tau,max_tau,nbins,rel_cut_fit,peakname,qc,max_wvfs)- the QC evaluator from
load_qc_evaluator(l200, filekey) l200.par.rpars.pz[period, run](existing parameters, unlessreprocessistrue)
Outputs
l200.par.rpars.pz[period, run]with the decay timeτand the fit result of each detector, with its validity- plot
:decay_timefor each detector (debug plot level) - If
error_plotsis on, a failed decay time extraction saveserror_decay_time_extraction. - run report
:decay_time, with one row per detector (decay time, width)
Keywords
reprocess: discard the existing parameters and process all detectors; otherwise detectors that already have parameters are skippedtimeout: seconds allowed per detector inparallel(0 = no limit)
Returns
Return nothing.
JuLeAna.p_process_decay_time_cal — Function
p_process_decay_time_cal(processing_config, l200::LegendData, period::DataPeriod;
reprocess::Bool=false, timeout::Real=0, only_first_period::Bool=true) -> BoolDetermine the preamplifier decay time of the HPGe detectors (geds) for every cal partition that contains period.
For each detector and partition, the presummed waveforms of the peak named by peakname in the pz section of the DSP configuration are read from the jlpks tier of the runs of the partition, n_evts events per run. If there are more than max_wvfs waveforms in total, max_wvfs of them are selected at random, without repetition and in their original order. Waveforms that fail the QC condition qc are removed. The decay time of each remaining waveform is computed, and a truncated Gaussian is fitted to the values between min_tau and max_tau; its mean is the decay time. An entry gets warning status if the decay time is outside 350 to 700 µs. An entry fails if loading, QC, DSP or the fit throws an error.
Inputs
jlpkstier of all runs of each partition, entrypeaknamedataprod_config(l200).dsp(filekey), sectionsdefault, per detector, andpz(p_default,p)- the QC evaluator from
load_qc_evaluator(l200, filekey) l200.par.ppars.pz[det, part](existing parameters, unlessreprocessistrue)
Outputs
l200.par.ppars.pz[det, part]with the decay timeτand the fit result, for each detector and partition, and the validity of all partitions- plot
:decay_timefor each detector and partition (debug plot level) - If
error_plotsis on, a failed decay time extraction saveserror_decay_time_extraction. - partition report
:decay_time, with one row per detector and partition
Keywords
reprocess: discard the existing parameters and process all entries again; otherwise entries that already have parameters are skippedtimeout: seconds allowed per detector and partition inparallel(0 = no limit)only_first_period: skip a detector whose partition starts in an earlier period thanperiod; it is then processed with that period.run_processingsets this totruewhen the previous period is also being processed.
Returns
true if at least one detector was skipped because of only_first_period, false otherwise. run_processing then waits for this step in the previous period.
JuLeAna.process_filter_optimization_cal — Function
process_filter_optimization_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Optimize the energy filter rise time and flat-top time for all processable HPGe detectors (geds) of the cal run.
For each filter type listed under e_filter in the optimization config, the rise time is chosen first from a sweep over the baseline noise (minimal ENC at a fixed flat-top time). The flat-top time is then chosen from a sweep over the full-energy-peak events as the one with the smallest objective (see fit_fwhm_ft). If joint_search is enabled, a search over rise time and flat-top time on the sampling lattice, starting from these two values, gives the optimum instead. Waveforms of the peak named by peakname are taken from the jlpks tier. At most max_wvfs waveforms, selected with a seeded random number generator, are used. Quality cuts are applied before the sweeps: an event is kept if, for every column => k of the optional qc_mad section of the optimization config (e.g. blsigma, blslope), its value lies within k normalized MADs of the median of the finite values, and the qc expression holds on the QC table of dsp_qc_flt_optimization_compressed extended by qdrift. Without a qc_mad section no MAD cut is applied. Filter types that already have results from this method are skipped unless reprocess is set; results lacking objective, w90, ct_spread or joint_search are optimized again (families instead of joint_search for dplms).
If e_filter lists dplms, a DPLMS filter is synthesized after the other filter types on the same QC-selected waveforms with dsp_dplms_optimization, for every point of LegendDSP's dplms_default_grid, with the flat-top widenings ff of the config range e_filter.dplms.ff (start, stop, step; whole multiples of the sample time) if given and multiples of the number of samples of the pulse rise of the DPLMS reference otherwise. The grid points that share all weights (nm, za, ft, ct, zo) form a family. For each family the FEP is fitted at every ff with fit_fwhm_ft and the objective of the config, and the ff with the smallest objective is selected (rel_tol is zero: the DPLMS filter length does not depend on ff, so the scan minimum is taken without a preference for long flat tops). The family with the smallest objective is kept and the result stores the objective, FWHM and ff of every family and its scan over ff under families. The qc_mad section is required if e_filter lists dplms. The qc expression must remove events with a non-finite qdrift and events with a t50_pre outside the current window; the DPLMS synthesis throws otherwise.
Inputs
jlpkstier of the startcalfilekey of the run, for each detector (peak waveforms named bypeakname).dataprod_config(l200).dsp(filekey), in particular theflt_optimizationsection (defaultand per-detector entries) and the DSP config used for the filter grids.l200.par.rpars.pz[period, run](decay times).- Quality-cut evaluator loaded by
load_qc_evaluator(l200, filekey). l200.par.rpars.fltopt[period, run](existing results, unlessreprocessis set).
Outputs
l200.par.rpars.fltopt[period, run]: per detector and filter type the optimal rise timertand flat-top timeft(the flat-top time the CUSP and ZAC filters apply), theobjectivewith its valuemin_objective, thefwhm,w90,asym,fctandct_spreadat the optimum,ctc_rel_uncertainty,joint_search,containment, the noise sweep resultsrt_encandmin_enc, andn_evalsandconvergedof the joint search if it ran, together with the validity entry for the run. Thedplmsentry holds instead the filtercoefficients, thereferencepulse over the window (n_presamples before ton_postaftert50, unit plateau), its filter outputresponseover then_pre + n_post + 1samples fromt50, the read-out timet_pickoffaftert50,shaping_time,flat_top,ff(in samples),n_pre,n_post, the synthesisweights, theoutput_areaof the filter output, the objective fields of the other filters (objective,ctc_rel_uncertainty,containment,min_objective,min_fwhm,w90,asym,fct,ct_spread) and per family itsweights,ff(in samples),min_objective,min_fwhmand the scan (ffin µs,fwhm,w90,statusper grid point) underfamilies.- Per detector and filter type, plots
noise_sweep_<filter_type>,fwhm_ft_scan_<filter_type>,rtft_landscape_<filter_type>(joint search only),ctc_<filter_type>,residuals_<filter_type>andexample_wvfs_<filter_type>, saved only at the debug plot level. Fordplms:fwhm_ft_scan_dplms(scan overffof the selected family),dplms_filter,dplms_reference,dplms_responseanddplms_matrices, and no noise sweep, joint search, CTC, residual or example waveform plots. - Run report
:filter_optimization(Main Log, Metadata, Results table with one row per detector and filter type; thedplmsrow shows shaping time and flat top in the rise-time and flat-top columns).
Keywords
reprocess: redo all detectors and filter types, discarding existing results inl200.par.rpars.fltopt[period, run]. Iffalse, only filter types without results are processed.timeout: seconds allowed per detector inparallel(0 = no limit).
Returns
nothing.
JuLeAna.p_process_filter_optimization_cal — Function
p_process_filter_optimization_cal(processing_config, l200::LegendData, period::DataPeriod;
reprocess::Bool=false, timeout::Real=0, only_first_period::Bool=true)Optimize the energy filter rise time and flat-top time per detector and cal partition for all partitions that contain period, using all analysis runs of the partition (HPGe detectors geds).
The method is the same as in process_filter_optimization_cal: for each filter type listed under e_filter, the rise time is chosen from a baseline noise sweep and the flat-top time from a sweep over full-energy-peak events, or both from a joint search if joint_search is enabled. The waveforms of the peak named by peakname are read from the jlpks tier of all runs of the partition (n_evts events per run, drawn randomly with a seeded random number generator if select_random is set) and at most max_wvfs of them are used. The quality cuts (qc expression and optional qc_mad section) are those of process_filter_optimization_cal. Results lacking objective, w90, ct_spread or joint_search are optimized again (families instead of joint_search for dplms).
If e_filter lists dplms, a DPLMS filter is synthesized and selected after the other filter types as in process_filter_optimization_cal, on the same QC-selected waveforms and with the flat-top widenings ff of the config range e_filter.dplms.ff (start, stop, step; whole multiples of the sample time) if given. The qc_mad section is required, and the qc expression must remove events with a non-finite qdrift and events with a t50_pre outside the current window; the DPLMS synthesis throws otherwise.
Inputs
jlpkstier of thecalruns of each partition, for each detector.dataprod_config(l200).dsp(filekey), in particularflt_optimization.p_defaultand the per-detector entriesflt_optimization.p, and the DSP config used for the filter grids.l200.par.ppars.pz[det, part](decay times).- Quality-cut evaluator loaded by
load_qc_evaluator(l200, filekey). l200.par.ppars.fltopt[det, part](existing results, if present).
Outputs
l200.par.ppars.fltopt[det, part]: per filter type the optimal rise timertand flat-top timeft(the flat-top time the CUSP and ZAC filters apply), theobjectivewith its valuemin_objective, thefwhm,w90,asym,fctandct_spreadat the optimum,ctc_rel_uncertainty,joint_search,containment, the noise sweep resultsrt_encandmin_enc, andn_evalsandconvergedof the joint search if it ran, with validity entries for the partition; the validity of all partitions of the period is written tol200.par.ppars.fltopt. Thedplmsentry holds instead the filtercoefficients, thereferencepulse over the window (n_presamples before ton_postaftert50, unit plateau), its filter outputresponseover then_pre + n_post + 1samples fromt50, the read-out timet_pickoffaftert50,shaping_time,flat_top,ff(in samples),n_pre,n_post, the synthesisweights, theoutput_areaof the filter output, the objective fields of the other filters (objective,ctc_rel_uncertainty,containment,min_objective,min_fwhm,w90,asym,fct,ct_spread) and per family itsweights,ff(in samples),min_objective,min_fwhmand the scan (ffin µs,fwhm,w90,statusper grid point) underfamilies.- Per detector, partition and filter type, plots
noise_sweep_<filter_type>,fwhm_ft_scan_<filter_type>,rtft_landscape_<filter_type>(joint search only),ctc_<filter_type>,residuals_<filter_type>andexample_wvfs_<filter_type>, saved only at the debug plot level. Fordplms:fwhm_ft_scan_dplms(scan overffof the selected family),dplms_filter,dplms_reference,dplms_responseanddplms_matrices, and no noise sweep, joint search, CTC, residual or example waveform plots. - Partition report
:filter_optimization(Main Log, Metadata, Results table with one row per detector, partition and filter type; thedplmsrow shows shaping time and flat top in the rise-time and flat-top columns).
Keywords
reprocess: redo all filter types, ignoring results inl200.par.ppars.fltopt[det, part]. Iffalse, only filter types without results are processed.timeout: seconds allowed per detector and partition inparallel(0 = no limit).only_first_period: iftrue, a detector whose partition starts in an earlier period is skipped (it is processed with that earlier period).run_processingsets this totruewhen the previous period is also being processed.
Returns
true if at least one detector and partition was skipped because of only_first_period, otherwise false. run_processing uses this to wait for the same step in the previous period.
Energy calibration
JuLeAna.process_ct_correction_cal — Function
process_ct_correction_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Determine the charge-trapping correction for all processable HPGe detectors (geds) of the cal run.
For each energy type in energy_types of the ctc section of the energy config, the energy is calibrated with a simple Th-228 calibration, and the correction parameters (polynomial in qdrift of order ctc_order) are optimized on the peak peak within the window (left_window_size, right_window_size). The FWHM of the peak before and after the correction is reported. Only single-pulse, non-pulser events passing the quality cuts are used.
Inputs
jlqcstier (event maskis_single_pulse && !is_pulser) andjldsptier of thecalrun (energy types andqdrift), for each detector. A missingjlqcsfile counts as a failure of that detector.dataprod_config(l200).energy(filekey)(default,ctc.defaultand per-detector entries).l200.par.rpars.ctc[period, run](existing results, unlessreprocessis set).
Outputs
l200.par.rpars.ctc[period, run]: per detector and energy type the correction result (includingfct,fwhm_before,fwhm_after), together with the validity entry for the run.- Per detector and energy type, plots
simple_calibration_<e_type>andctc_<e_type>, saved only at the debug plot level. - If
error_plotsis on, a failed simple calibration saveserror_simple_calibration_<e_type>and a failed alpha generationerror_alpha_generation_<e_type>. - Run report
:ct_correction(Main Log, Metadata, Results table with one row per detector and energy type).
Keywords
reprocess: redo all detectors and energy types, discarding existing results inl200.par.rpars.ctc[period, run]. Iffalse, only energy types without results are processed.timeout: seconds allowed per detector inparallel(0 = no limit).
Returns
nothing.
JuLeAna.process_energy_calibration_cal — Function
process_energy_calibration_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Calibrate the energy of all processable HPGe detectors (geds) of the cal run with the Th-228 spectrum.
For each energy type in energy_types of the energy config, the uncalibrated energies of single-pulse, non-pulser events passing the quality cuts are calibrated in three steps: a simple calibration locates the Th-228 peaks, the peaks are fitted with the functions in th228_fit_func, and a polynomial calibration curve (cal_pol_order) and a FWHM curve (fwhm_pol_order for energy types ending in _ctc, otherwise a quadratic FWHM² model) are fitted to the peaks that pass the fit quality cuts in qc. Peaks in cal_fit_excluded_peaks and fwhm_fit_excluded_peaks are left out of the respective fit. Energy types ending in _ctc use the charge-trapping-corrected energy expression from the CT correction results.
Inputs
jlqcstier (event maskis_single_pulse && !is_pulser) andjldsptier of thecalrun, for each detector.dataprod_config(l200).energy(filekey)(defaultand per-detector entries).l200.par.rpars.ctc[period, run](needed for_ctcenergy types).l200.par.rpars.ecal[period, run](existing results, unlessreprocessis set).
Outputs
l200.par.rpars.ecal[period, run]: per detector and energy type the simple calibration constant (m_cal_simple), FWHM curve (fwhm), calibration curve (cal) and calibrated peak fit results (fit), together with the validity entry for the run.- Per detector and energy type, plots
simple_calibration_<e_type>,peak_fits_<e_type>,calibration_curve_<e_type>andfwhm_<e_type>.simple_calibration_<e_type>andpeak_fits_<e_type>are saved only at the debug plot level. - Run report
:energy_calibration(Main Log, Metadata, Results table with one row per detector and energy type).
Keywords
reprocess: redo all detectors and energy types, discarding existing results inl200.par.rpars.ecal[period, run]. Iffalse, only energy types without results are processed.timeout: seconds allowed per detector inparallel(0 = no limit).
Returns
nothing.
JuLeAna.p_process_energy_cal — Function
p_process_energy_cal(processing_config, l200::LegendData, period::DataPeriod;
reprocess::Bool=false, timeout::Real=0, only_first_period::Bool=true)Calibrate the energy per detector and cal partition for all partitions that contain period (HPGe detectors geds).
For each energy type in energy_types of the partition energy config, the energies of all runs of the partition are calibrated with the run-level calibration function (cal.func from l200.par.rpars.ecal) and concatenated, after selecting single-pulse, non-pulser events that pass the quality cuts. The Th-228 peaks in the resulting spectrum are fitted with the functions in th228_fit_func, then a polynomial calibration curve (cal_pol_order) and a FWHM curve (fwhm_pol_order for energy types ending in _ctc, otherwise a quadratic FWHM² model) are fitted to the peaks that pass the fit quality cuts in qc. Peaks in cal_fit_excluded_peaks and fwhm_fit_excluded_peaks are left out of the respective fit.
Inputs
jlqcsandjldsptiers of allcalruns of each partition, for each detector.l200.par.rpars.ecal[period, run](run-level calibration function) for each run of the partition.dataprod_config(l200).energy(filekey), sectionsp_defaultand per-detector entriesp.l200.par.ppars.ecal[det, part](existing results, unlessreprocessis set).
Outputs
l200.par.ppars.ecal[det, part]: per energy type the FWHM curve (fwhm), calibration curve (cal) and peak fit results (fit), with validity entries for the partition; the validity of all partitions of the period is written tol200.par.ppars.ecal.- Per detector, partition and energy type, plots
partition_spectrum_<e_type>,peak_fits_<e_type>,calibration_curve_<e_type>andfwhm_<e_type>.peak_fits_<e_type>is saved only at the debug plot level. - If
error_plotsis on, a failed peak fitting saveserror_peak_fitting_<e_type>. - Partition report
:energy(Main Log, Metadata, Results table with one row per detector, partition and energy type).
Keywords
reprocess: redo all energy types, ignoring results inl200.par.ppars.ecal[det, part]. Iffalse, only energy types without results are processed.timeout: seconds allowed per detector and partition inparallel(0 = no limit).only_first_period: iftrue, a detector whose partition starts in an earlier period is skipped (it is processed with that earlier period).run_processingsets this totruewhen the previous period is also being processed.
Returns
true if at least one detector and partition was skipped because of only_first_period, otherwise false. run_processing uses this to wait for the same step in the previous period.