Pulse shape discrimination
A/E, LQ and PSD efficiencies
JuLeAna.process_aoe_optimization_cal — Function
process_aoe_optimization_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Optimize the window length of the A/E filters for the HPGe detectors (geds) of one cal run.
For each detector with usability == :on and low_aoe_status of :valid or :present, and for each filter type listed in the aoe_filter table of the configuration, the processor runs a short DSP routine on the Tl208 DEP and SEP waveforms for a grid of window lengths, applies the configured QC expression, and evaluates the SEP survival fraction after a simple A/E cut set on the DEP. It stores the selected window length together with its survival fraction.
Inputs
- First
calfilekey of the run (start_filekey(l200, (period, run, :cal))). - Windowed and presummed waveforms of the
Tl208DEP_Bi212FEPandTl208SEPselections from thejlpkstier. l200.par.rpars.pz[period, run](decay times) andl200.par.rpars.fltopt[period, run](energy filter parameters).dataprod_config(l200).dsp(filekey): thedefaultsection merged with the detector section for the DSP settings, including the window length gridsa_grid_wl_<filter type>; andaoe_optimization(defaultmerged with the detector section) withqcand theaoe_filtertable. Each filter entry setsdep,dep_window,sep,sep_window,sep_rel_cut,min_aoe_quantile,max_aoe_quantile,min_aoe_offset,max_aoe_offset,dep_cut_search_fit_funcandsep_cut_search_fit_func.- The QC evaluator of the filekey (
load_qc_evaluator).
Outputs
l200.par.rpars.aoeopt[period, run]: per detector and filter type, the selected window length (wl), SEP survival fraction (sf) and the number of DEP and SEP events used (n_dep,n_sep), plus the matching validity entry.- One plot per detector and filter type of the window length sweep, named
<filter type>_sweep. - If
error_plotsis on, a failed DSP of DEP and SEP saveserror_dsp_dep_sep_<filter type>and a failed window length optimizationerror_window_length_optimization_<filter type>. - Run report
aoe_optimizationwith the processing status, a metadata table and one result row per detector and filter type.
Keywords
reprocess: Discard the existingaoeoptparameters of the run and optimize all detectors and filter types again. Otherwise, filter types that already have results are kept and only missing ones are computed.timeout: Seconds allowed per detector inparallel;0means no limit.
Returns
The return value is not used by run_processing.
JuLeAna.p_process_aoe_optimization_cal — Function
p_process_aoe_optimization_cal(processing_config, l200::LegendData, period::DataPeriod;
reprocess::Bool=false, timeout::Real=0, max_wvfs::Int=15000, only_first_period::Bool=true)Optimize the window length of the A/E filters for every detector and cal partition that contains period.
This is the partition-level counterpart of process_aoe_optimization_cal. The Tl208 DEP and SEP waveforms of all cal runs in a detector's partition are combined for one optimization per detector, partition and filter type. Detectors with low_aoe_status of :valid or :present are processed.
Inputs
- Channel info of the
calanalysis runs ofperiod, merged over the runs bychannelinfo(l200, period, :cal), and the start filekey of the first run of each partition (selects the configuration). - Windowed and presummed waveforms of the
Tl208DEP_Bi212FEPandTl208SEPselections from thejlpkstier of thecalruns in the partition. The configuration entryn_evtssets how many events are read per run, andselect_randomwhether they are chosen randomly. l200.par.ppars.pz[det, part](decay times) andl200.par.ppars.fltopt[det, part](energy filter parameters).dataprod_config(l200).dsp(filekey): thedefaultsection merged with the detector section for the DSP settings;aoe_optimization.p_defaultmerged withaoe_optimization.p[det]forqc,n_evts,select_randomand theaoe_filtertable (same entries as inprocess_aoe_optimization_cal).- The QC evaluator of the filekey (
load_qc_evaluator).
Outputs
l200.par.ppars.aoeopt[det, part]: per filter type, the selected window length (wl), SEP survival fraction (sf) and the number of DEP and SEP events used (n_dep,n_sep), plus the validity ofppars.aoeoptforperiod.- One plot per detector, partition and filter type, named
aoe_sweep_<filter type>, saved only at the debug plot level. - If
error_plotsis on, a failed DSP of DEP and SEP saveserror_dsp_dep_sep_<filter type>and a failed window length optimizationerror_window_length_optimization_<filter type>. - Partition report
aoe_optimizationwith the processing status, a metadata table and one result row per detector, partition and filter type.
Keywords
reprocess: Discard the existingppars.aoeoptparameters of each detector and partition and optimize all filter types again. Otherwise, filter types that already have results are kept.timeout: Seconds allowed per detector and partition inparallel;0means no limit.max_wvfs: Maximum number of DEP waveforms and of SEP waveforms used per detector and partition (default15000). If more are loaded,max_wvfsof them are selected at random, without repetition and in their original order.only_first_period: Iftrue, a detector whose partition starts in an earlier period is skipped and logged as skipped.run_processingsets it totruewhen the previous period is also being processed.
Returns
true if at least one detector was skipped because of only_first_period, otherwise false. run_processing uses this to wait for the same step in the previous period.
JuLeAna.process_aoe_calibration_cut_cal — Function
process_aoe_calibration_cut_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Calibrate A/E and generate the A/E cuts for the HPGe detectors (geds) of one cal run.
For each detector with usability == :on and low_aoe_status of :valid or :present, the A/E of every type listed in aoe_funcs is normalized and the Compton bands (compton_bands) are fitted. The fitted mean and width are described with energy-dependent correction functions, optionally refined by a combined fit (use_combined_fit). If apply_ctc is set, a charge trapping correction against the effective drift time (qdrift_expression) follows. For each classifier in aoe_classifiers, the low A/E cut is searched on the DEP, the high cut is set from sigma_high_sided, and survival fractions are computed for the configured peaks and the Qbb window with the low cut alone and with both cuts (ds).
Inputs
- First
calfilekey of the run. l200.par.rpars.ecal[period, run]: the calibration function of the energy typee_type.jlqcstier (single pulse, non-pulser events) andjldsptier of thecalrun.dataprod_config(l200).psd(filekey).aoe,defaultmerged with the detector section:e_type,aoe_funcs,aoe_classifiers,compton_bands,compton_window,p_value,use_combined_fit,apply_ctc,qdrift_expression,sigma_high_sided, the DEP cut search settings (dep,dep_window,dep_cut_search_interval,dep_bin_width_window,dep_cut_search_rtol,dep_cut_search_maxiters,dep_cut_search_target_sf,dep_cut_search_fixed_position,dep_cut_search_fit_func) and the survival fraction settings (aoe_peaks,aoe_peaks_names,aoe_peaks_windows_left,aoe_peaks_windows_right,aoe_peaks_bin_width_window,aoe_peaks_fit_funcs,qbb,qbb_window).
Outputs
l200.par.rpars.aoe[period, run]: per detector, one entry per A/E type (func,ctc,correction,apply_ctc,use_combined_fit) and one entry per classifier (lowcut,highcut, andpeaksandqbbsurvival fractions with thelowcut and with both cutsds), plus the matching validity entry. The classifier name is the A/E type name followed by_classifier.- Plots per detector:
aoe_uncalibrated_<type>,compton_bands_mu_<type>,compton_bands_sigma_<type>,aoe_ctc_<type>(ifapply_ctc),aoe_normalized_<type>,aoe_normalized_<classifier>,aoe_energy_afterAoE_zoom_<classifier>andaoe_peaks_ds_sf_<classifier>. Onlyaoe_normalized_<classifier>is saved below the debug plot level. - If
error_plotsis on, a failed Compton band fitting saveserror_compton_band_fitting_<type>and a failed cut generationerror_cut_generation_<classifier>. - Run report
aoe_calibration_cutwith the processing status, a metadata table, and one row per detector and A/E type combining the calibration and the cut results.
Keywords
reprocess: Discard the existingaoeparameters of the run and process all detectors, A/E types and classifiers again. Otherwise, entries that already exist are kept and only missing ones are computed.timeout: Seconds allowed per detector inparallel;0means no limit.
Returns
The return value is not used by run_processing.
JuLeAna.p_process_aoe_calibration_cut_cal — Function
p_process_aoe_calibration_cut_cal(processing_config, l200::LegendData, period::DataPeriod;
reprocess::Bool=false, timeout::Real=0, only_first_period::Bool=true)Calibrate A/E and generate the A/E cuts for every detector and cal partition that contains period.
This is the partition-level counterpart of process_aoe_calibration_cut_cal: the cal data of all runs in a detector's partition are combined and the A/E normalization, Compton band fits, optional charge trapping correction and cut search run once per detector and partition. Detectors with low_aoe_status of :valid or :present are processed. In addition, the Compton-band A/E is plotted against time over the partition.
Inputs
l200.par.rpars.ecal[period, run]of every run in the partition: the calibration function of the energy typee_type.jlqcstier (single pulse, non-pulser events) andjldsptier of allcalruns in the partition.dataprod_config(l200).psd(filekey).aoeof the first run of the partition,p_defaultmerged withp[det], with the same entries as described forprocess_aoe_calibration_cut_cal.
Outputs
l200.par.ppars.aoe[det, part]: per A/E type (func,ctc,correction,apply_ctc,use_combined_fit) and per classifier (lowcut,highcut,peaksandqbbsurvival fractions), plus the validity ofppars.aoeforperiod. The file is written only if the detector has results.- Plots per detector and partition:
aoe_uncalibrated_<type>,aoe_stability_<type>,compton_bands_mu_<type>,compton_bands_sigma_<type>,aoe_ctc_<type>andaoe_compton_after_ctc_<type>(ifapply_ctc),aoe_normalized_<type>,aoe_normalized_<classifier>,aoe_energy_afterAoE_zoom_<classifier>andaoe_peaks_sf_<classifier>. Onlyaoe_normalized_<classifier>is saved below the debug plot level. - If
error_plotsis on, a failed Compton band fitting saveserror_compton_band_fitting_<type>and a failed cut generationerror_cut_generation_<classifier>. - Partition report
aoe_calibration_cutwith the processing status, a metadata table, and one row per detector, partition and A/E type.
Keywords
reprocess: Discard the existingppars.aoeparameters of each detector and partition and process all A/E types and classifiers again. Otherwise, entries that already exist are kept.timeout: Seconds allowed per detector and partition inparallel;0means no limit.only_first_period: Iftrue, a detector whose partition starts in an earlier period is skipped and logged as skipped.run_processingsets it totruewhen the previous period is also being processed.
Returns
true if at least one detector was skipped because of only_first_period, otherwise false. run_processing uses this to wait for the same step in the previous period.
JuLeAna.p_process_aoe_cut_cal — Function
p_process_aoe_cut_cal(processing_config, l200::LegendData, period::DataPeriod;
reprocess::Bool=false, timeout::Real=0, only_first_period::Bool=true)Generate the A/E cuts from the combined cal data of every detector and partition that contains period.
The cal data of all runs in a detector's partition are calibrated with the run-level parameters (rpars, category aoe) through calibrate_ged_detector_data. For each A/E type in aoe_funcs, the low A/E cut of its classifier <type>_classifier is searched on the DEP of the combined data, the high cut is set from sigma_high_sided, and survival fractions are computed for the configured peaks and the Qbb window with the low cut alone and with both cuts (ds). Detectors with low_aoe_status of :valid or :present are processed.
Inputs
jlqcstier (single pulse, non-pulser events) andjldsptier of allcalruns in the partition, calibrated with the run-level A/E parametersl200.par.rpars.aoe(and the parameterscalibrate_ged_detector_datareads for the energy).dataprod_config(l200).psd(filekey).aoeof the first run of the partition,p_defaultmerged withp[det]:e_type,aoe_funcs(only the keys),sigma_high_sided, the DEP cut search settings (dep,dep_window,dep_cut_search_interval,dep_bin_width_window,dep_cut_search_rtol,dep_cut_search_maxiters,dep_cut_search_target_sf,dep_cut_search_fixed_position,dep_cut_search_fit_func) and the survival fraction settings (aoe_peaks,aoe_peaks_names,aoe_peaks_windows_left,aoe_peaks_windows_right,aoe_peaks_bin_width_window,aoe_peaks_fit_funcs,qbb,qbb_window).
Outputs
l200.par.ppars.aoecut[det, part]: per classifier,lowcut,highcut, andpeaksandqbbsurvival fractions with thelowcut and with both cutsds, plus the validity ofppars.aoecutforperiod.- Plots per detector and partition:
aoe_normalized_runcal_<classifier>,aoe_energy_afterAoE_zoom_runcal_<classifier>andaoe_peaks_sf_runcal_<classifier>. Onlyaoe_normalized_runcal_<classifier>is saved below the debug plot level. - If
error_plotsis on, a failed cut generation saveserror_cut_generation_<classifier>and a failed survival fraction steperror_survival_fractions_<classifier>. - Partition report
aoe_cutwith the processing status, a metadata table and one result row per detector, partition and classifier.
Keywords
reprocess: Discard the existingppars.aoecutparameters of each detector and partition and process all classifiers again. Otherwise, classifiers that already have results are kept.timeout: Seconds allowed per detector and partition inparallel;0means no limit.only_first_period: Iftrue, a detector whose partition starts in an earlier period is skipped and logged as skipped.run_processingsets it totruewhen the previous period is also being processed.
Returns
true if at least one detector was skipped because of only_first_period, otherwise false. run_processing uses this to wait for the same step in the previous period.
JuLeAna.process_lq_calibration_cut_cal — Function
process_lq_calibration_cut_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0)Calibrate LQ and generate the LQ cut for the HPGe detectors (geds) of one cal run.
For each detector with usability == :on and lq_status of :valid or :present, the energy-corrected LQ of every type in lq_funcs is normalized and corrected for its dependence on the effective drift time (qdrift_expression) using DEP events. The corrected LQ is then normalized with the DEP peak and its sidebands. For each classifier in lq_classifiers, the high cut is the configured value high_cut_sigma of the normalized LQ. Survival fractions are computed for the configured peaks and the Qbb window with that cut.
Inputs
- First
calfilekey of the run. l200.par.rpars.ecal[period, run]: the calibration function of the energy typee_type, and the DEP resolution from theTl208DEPpeak fit of the same energy type.jlqcstier (single pulse, non-pulser events) andjldsptier of thecalrun.dataprod_config(l200).psd(filekey).lq,defaultmerged with the detector section:e_type,lq_funcs,lq_classifiers,qdrift_expression,dep_mu, the drift time correction settings (ctc_dep_edgesigma,ctc_lq_precut_relative_cut,ctc_driftime_cutoff_method,lq_outlier_sigma,dt_eff_outlier_sigma,ctc_dt_eff_low_quantile,ctc_dt_eff_high_quantile,pol_fit_order,ctc_uncertainty), the normalization settings (dep_sideband_sigma,cut_truncation_sigma,cut_uncertainty) and the cut and survival fraction settings (high_cut_sigma,lq_peaks,lq_peaks_names,lq_peaks_windows_left,lq_peaks_windows_right,lq_peaks_fit_funcs,qbb,qbb_window).
Outputs
l200.par.rpars.lq[period, run]: per detector, one entry per LQ type (the drift time correction and normalization results, withfuncthe full LQ expression, and the mean, standard deviation and median of the energy-corrected LQ) and one entry per classifier (highcut,peaks,qbb), plus the matching validity entry. The classifier name is the LQ type name followed by_classifier.- Plots per detector:
lq_ctc_DEP_<type>,lq_ctc_<type>,lq_dep_normalization_<type>,lq_sidebands_<type>,lq_sideband_position_<type>,lq_classalized_<classifier>,lq_energy_after_<classifier>andlq_cut_fraction_<classifier>. Onlylq_classalized_<classifier>is saved below the debug plot level. - If
error_plotsis on, a failed drift time correction saveserror_drift_time_correction_<type>, a failed LQ normalizationerror_lq_normalization_<type>and a failed peak survival fraction steperror_peak_survival_fractions_<classifier>. - Run report
lq_calibration_cutwith the processing status, a metadata table, and one row per detector and LQ type combining the calibration and the cut results.
Keywords
reprocess: Discard the existinglqparameters of the run and process all detectors, LQ types and classifiers again. Otherwise, entries that already exist are kept and only missing ones are computed.timeout: Seconds allowed per detector inparallel;0means no limit.
Returns
The return value is not used by run_processing.
JuLeAna.p_process_lq_calibration_cut_cal — Function
p_process_lq_calibration_cut_cal(processing_config, l200::LegendData, period::DataPeriod;
reprocess::Bool=false, timeout::Real=0, only_first_period::Bool=true)Calibrate LQ and generate the LQ cut for every detector and cal partition that contains period.
This is the partition-level counterpart of process_lq_calibration_cut_cal: the cal data of all runs in a detector's partition are combined, and the drift time correction, normalization, cut and survival fractions are computed once per detector and partition. Detectors with lq_status of :valid or :present are processed.
Inputs
l200.par.rpars.ecal[period, run]of every run in the partition: the calibration function of the energy typee_type.l200.par.ppars.ecal[det, part]: the DEP resolution from theTl208DEPpeak fit of the same energy type.jlqcstier (single pulse, non-pulser events) andjldsptier of allcalruns in the partition.dataprod_config(l200).psd(filekey).lqof the first run of the partition,p_defaultmerged withp[det], with the same entries as described forprocess_lq_calibration_cut_cal.
Outputs
l200.par.ppars.lq[det, part]: per LQ type the drift time correction and normalization results, and per classifierhighcut,peaksandqbb, plus the validity ofppars.lqforperiod.- Plots per detector and partition:
lq_ctc_DEP_<type>,lq_ctc_<type>,lq_dep_normalization_<type>,lq_sidebands_<type>,lq_sideband_position_<type>,lq_classalized_<classifier>andlq_energy_after_<classifier>. Onlylq_classalized_<classifier>is saved below the debug plot level. - If
error_plotsis on, a failed drift time correction saveserror_drift_time_correction_<type>, a failed LQ normalizationerror_lq_normalization_<type>and a failed peak survival fraction steperror_peak_survival_fractions_<classifier>. - Partition report
lq_calibration_cutwith the processing status, a metadata table, and one row per detector, partition and LQ type.
Keywords
reprocess: Discard the existingppars.lqparameters of each detector and partition and process all LQ types and classifiers again.timeout: Seconds allowed per detector and partition inparallel;0means no limit.only_first_period: Iftrue, a detector whose partition starts in an earlier period is skipped and logged as skipped.run_processingsets it totruewhen the previous period is also being processed.
Returns
true if at least one detector was skipped because of only_first_period, otherwise false. run_processing uses this to wait for the same step in the previous period.
JuLeAna.process_psd_efficiencies_cal — Function
process_psd_efficiencies_cal(processing_config, l200::LegendData, period::DataPeriod, run::DataRun;
reprocess::Bool=false, timeout::Real=0, use_partition_pars::Bool=true)Compute the survival fractions of the combined A/E and LQ cuts for the HPGe detectors (geds) of one cal run.
For each detector with usability == :on and low_aoe_status of :valid or :present, and for each classifier in the psd_classifiers table, the processor applies the A/E and LQ cuts to the cal data of the run and fits the configured peaks and the Qbb window. Survival fractions are evaluated for four selections: the low A/E cut (low), the low and high A/E cuts (ds), the low A/E cut and the LQ cut (low_lq), and all three cuts (lq_ds).
Inputs
- First
calfilekey of the run. l200.par.rpars.ecal[period, run]: the calibration function of the energy typee_type.- A/E and LQ parameters of the run: the
aoeandlqparameters frompparsifuse_partition_parsistrue, otherwise fromrpars. The low A/E cut islowcutof the A/E classifier and the LQ cut ishighcutof the LQ classifier. jlqcstier (single pulse, non-pulser events) andjldsptier of thecalrun.dataprod_config(l200).psd(filekey).psd,defaultmerged with the detector section:e_type,psd_classifiers(per classifier name, a list of the A/E classifier, the high A/E cut and the LQ classifier),psd_peaks,psd_peaks_names,psd_peaks_windows_left,psd_peaks_windows_right,psd_peaks_bin_width_window,psd_peaks_fit_funcs,qbbandqbb_window.
Outputs
l200.par.rpars.psd[period, run]: per detector and classifier,cuts(lowcut,highcut,lq) and thepeaksandqbbsurvival fractions for the four selections, plus the matching validity entry.- Run report
psd_efficiencieswith the processing status, a metadata table and one result row per detector and classifier. - At the debug plot level, per detector and classifier, the survival fractions of the A/E peaks,
aoe_peaks_ds_sf_<classifier>. - If
error_plotsis on, a failed A/E data loading saveserror_aoe_data_loading_<classifier>and a failed survival fraction steperror_survival_fraction_<classifier>.
Keywords
reprocess: Discard the existingpsdparameters of the run and process all detectors and classifiers again. Otherwise, classifiers that already have results are kept.timeout: Seconds allowed per detector inparallel;0means no limit.use_partition_pars: Iftrue(default), read the A/E and LQ cuts from the partition parameters (ppars); iffalse, from the run parameters (rpars).
Returns
The return value is not used by run_processing.
JuLeAna.p_process_psd_efficiencies_cal — Function
p_process_psd_efficiencies_cal(processing_config, l200::LegendData, period::DataPeriod;
reprocess::Bool=false, timeout::Real=0, only_first_period::Bool=true)Compute the survival fractions of the combined A/E and LQ cuts for every detector and cal partition that contains period.
The cal data of all runs in a detector's partition are calibrated with calibrate_ged_detector_data, which applies the A/E and LQ cut flags (<A/E classifier>_low_cut and <LQ classifier>_high_cut) from the parameters selected by get_ged_evt_kwargs. The high A/E cut is taken from the psd_classifiers table of the configuration. Peaks and the Qbb window are fitted for five selections: the low A/E cut (low), the high A/E cut (high), the low and high A/E cuts (ds), the low A/E cut and the LQ cut (low_lq), and all three cuts (lq_ds). Detectors with low_aoe_status of :valid or :present are processed.
Inputs
jlqcstier (single pulse, non-pulser events) andjldsptier of allcalruns in the partition.- Calibration and cut parameters as read by
calibrate_ged_detector_datawith the keyword arguments ofget_ged_evt_kwargs(l200, filekey). dataprod_config(l200).psd(filekey).psdof the first run of the partition,defaultmerged with the detector section:e_type,psd_classifiers(per classifier name, a list of the A/E classifier, the high A/E cut and the LQ classifier),psd_peaks,psd_peaks_names,psd_peaks_windows_left,psd_peaks_windows_right,psd_peaks_bin_width_window,psd_peaks_fit_funcs,qbbandqbb_window.
Outputs
l200.par.ppars.psd[det, part]: per classifier,cuts(highcutis the configured high A/E cut;lowcutandlqare stored asNaN) and thepeaksandqbbsurvival fractions for the five selections, plus the validity ofppars.psdforperiod. The file is written only if the detector has results.- Partition report
psd_efficiencieswith the processing status, a metadata table and one result row per detector, partition and classifier. - At the debug plot level, per detector and classifier, the survival fractions of the A/E peaks,
aoe_peaks_sf_<classifier>. - If
error_plotsis on, a failed survival fraction step saveserror_survival_fraction_<classifier>.
Keywords
reprocess: Discard the existingppars.psdparameters of each detector and partition and process all classifiers again. Otherwise, classifiers that already have results are kept.timeout: Seconds allowed per detector and partition inparallel;0means no limit.only_first_period: Iftrue, a detector whose partition starts in an earlier period is skipped and logged as skipped.run_processingsets it totruewhen the previous period is also being processed.
Returns
true if at least one detector was skipped because of only_first_period, otherwise false. run_processing uses this to wait for the same step in the previous period.