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, use_partition_pars::Bool=true)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. A detector is skipped and reported as failed if the decay time or the optimization parameters are 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 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)".
Inputs
rawtier of thecalfilekeys of the run listed in the runinfo, except the filekeys marked unprocessabledataprod_config(l200).dsp(filekey)l200.par[pars_type, :pz],l200.par[pars_type, :fltopt]andl200.par[pars_type, :aoeopt], withpars_typebeing:pparsifuse_partition_parsistrueand:rparsotherwise- 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)
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 processoruse_partition_pars: read the decay time and optimization parameters from the partition-level parameters (:ppars) instead of the run-level parameters (:rpars)
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, use_partition_pars::Bool=false)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). A SiPM or HPGe detector is skipped and reported as failed if its parameters are missing, or if its DSP throws an error. An HPGe detector is also skipped 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)".
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)l200.par[pars_type, :pz],l200.par[pars_type, :fltopt],l200.par[pars_type, :aoeopt]andl200.par[pars_type, :sipmopt], withpars_typebeing:pparsifuse_partition_parsistrueand:rparsotherwise- 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)
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 processoruse_partition_pars: read the HPGe decay time and optimization parameters from the partition-level parameters (:ppars) instead of the run-level parameters (:rpars)
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.
The auxiliary detectors are the channels selected by get_aux_evt_detsel_propfunc. For each of them, the raw data of the phy filekeys of the run listed in the runinfo are read together and processed with the function configured for it under additional_detectors in the DSP configuration. The result is then extended by the auxiliary calibration property function. A cross-check histogram of the energy named in the cal.aux_trig condition of the event configuration is saved, with the trigger threshold marked.
Inputs
rawtier of thephyfilekeys of the run listed in the runinfo, except the filekeys marked unprocessabledataprod_config(l200).dsp(filekey), sectionadditional_detectorsdataprod_config(l200).evt(filekey), sectionaux- the auxiliary calibration from
get_aux_cal_propfunc(l200, filekey, det)
Outputs
jlauxtier file for each auxiliary detector, with the DSP and calibrated columns- plot
:dsp_aux_energyfor each auxiliary detector (debug plot level) - run report
:dsp_aux_phy, with one row per detector (status, number of events)
Keywords
reprocess: process detectors again whosejlauxfile exists; otherwise a detector with a readablejlauxfile is skippedtimeout: seconds allowed per auxiliary 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: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.
For each detector, the QC labels and the is_single_pulse flag defined in the QC configuration are evaluated on the jldsp data. Pulser events are flagged by coincidence of the event timestamps with the timestamps of the pulser channel (pulser.puls_detector) in the raw data. 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. A detector with fewer than 5000 events fails. A warning is logged if single-pulse events fail the is_valid_e flag.
Inputs
jldsptier of thecalfilekeys of the run listed in the runinfo, except the filekeys marked badrawtier timestamps of the pulser channeldataprod_config(l200).qc(filekey)anddataprod_config(l200).energy(filekey)l200.par.rpars.qcs[period, run](existing parameters, unlessreprocessistrue)
Outputs
jlqcstier file for each detector, with the QC flags and the pulser flagl200.par.rpars.qcs[period, run](flag definition, survival fractions, event counts) with its validity (categorycal)- plots
:raw_energy_e_trapand:qc_survival_fractionsfor each detector;:qc_survival_fractionsis saved only at the debug plot level - run report
:qcs_cal, with one row per detector
Keywords
reprocess: discard the existing parameters and process all detectors; otherwise a detector with complete parameters and an existingjlqcsfile is skippedtimeout: 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: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.
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). The survival fraction of each flag is computed for the pulser events and for the forced-trigger events. A detector with fewer than 5000 events fails. A warning is logged if single-pulse events fail the is_valid_dsp flag.
Inputs
jldsptier of thephyfilekeys of the run listed in the runinfo, except the filekeys marked unprocessablejlauxtier columnaux_trigof the pulser and forced-trigger channelsdataprod_config(l200).qc(filekey)l200.par.rpars.qcs[period, Symbol("<run>-phy")](existing parameters, unlessreprocessistrue)
Outputs
jlqcstier file for each detector, with the QC flags and the pulser flagl200.par.rpars.qcs[period, Symbol("<run>-phy")](flag definition, survival fractions, event counts) with its validity (categoryphy)- plots
: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 one row per detector
Keywords
reprocess: discard the existing parameters and process all detectors; otherwise a detector with complete parameters and an existingjlqcsfile is skippedtimeout: 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: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 FWHM. Waveforms of the peak named by peakname are taken from the jlpks tier. Quality cuts (qc expression of the optimization config) are applied to the waveforms before the sweeps, and at most max_wvfs waveforms are used. Filter types that already have results are skipped unless reprocess is set.
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 time, flat-top time and minimal FWHM, together with the validity entry for the run.- Per detector and filter type, plots
noise_sweep_<filter_type>andfwhm_ft_scan_<filter_type>, saved only at the debug plot level. - Run report
:filter_optimization(Main Log, Metadata, Results table with one row per detector and filter type).
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. 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 if select_random is set) and at most max_wvfs of them are used after the quality cuts (qc expression).
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 time, flat-top time and minimal FWHM, with validity entries for the partition; the validity of all partitions of the period is written tol200.par.ppars.fltopt.- Per detector, partition and filter type, plots
noise_sweep_<filter_type>andfwhm_ft_scan_<filter_type>, saved only at the debug plot level. - Partition report
:filter_optimization(Main Log, Metadata, Results table with one row per detector, partition and filter type).
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 of the startcalfilekey (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 of the startcalfilekey (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.