goldpan.rq_cuts¶
Selections made from already-processed RQs, with no raw traces: the fast path (ported from scdms-analysis-tools).
The idea is the excursion ratio of goldpan.quantities, |max| / std per channel, computed from the RQs a reconstruction
has already stored, so that selecting clean random triggers needs no raw-file access:
ratios = phonon_log_ratios(rqs, channels) # log10(|max| / std) of each channel
clean = tight_randoms(ratios, low, pileup_thresholds, tight_ranges)
What this module does not contain is any analysis result: the per-channel thresholds, floors and ranges are derived
from one dataset’s own distributions, so they are always passed in. The channel names are passed in too (a mapping’s keys,
or channels=); Z7_PHONON_CHANNELS is the list of the Z7 phonon channels, for convenience.
Units of the RQ files this was written for (BatCommon’s BasicPulseCalc): P<ch>max is stored in microamps and
P<ch>std in amps, so channel_max_amps converts before a ratio is taken (MAX_RQ_UA_TO_A). A channel with no data for an
event (absent from the mapping, or NaN) is skipped rather than failing the event. The total phonon channel PT has no
max or std RQ of its own: pt_std_proxy estimates its std from the other channels (uncorrelated noise assumed).
Module Attributes
The twelve phonon channels of Z7, in RQ naming. |
|
|
Functions
|
|
|
|
|
True where |
|
|
|
|
|
True for a clean-enough random trigger: every channel with data has |
|
|
|
True where a random trigger is pileup-contaminated: ANY channel's |
|
Estimate of the total channel's baseline std from the channels' own |
|
True for a clean random trigger: |
|
- goldpan.rq_cuts.Z7_PHONON_CHANNELS = ['PAS1', 'PAS2', 'PBS1', 'PBS2', 'PCS1', 'PCS2', 'PDS1', 'PDS2', 'PES1', 'PES2', 'PFS1', 'PFS2']¶
The twelve phonon channels of Z7, in RQ naming.
- goldpan.rq_cuts.MAX_RQ_UA_TO_A = 1e-06¶
P<ch>maxis stored in microamps (BatCommonBasicPulseCalc.cxx,fMaximum = minMax.max*1e6),P<ch>stdin amps.
- goldpan.rq_cuts.channel_max_amps(max_rq)[source]¶
P<ch>max(stored in microamps) converted to amps, the unit ofP<ch>std, before taking a ratio.
- goldpan.rq_cuts.pt_std_proxy(std_rqs_by_channel, channels=None)[source]¶
Estimate of the total channel’s baseline std from the channels’ own
stdRQs:sqrt(sum(std_i ** 2)).std_rqs_by_channel: a mapping channel -> array (one entry per event), or a list of such arrays.channelslimits a mapping to those names (default: all of its keys). Assumes uncorrelated noise, so the variances add; it is an approximation, not an RQ of the processing. Built from whichever channels are present: not all of them are required.
- goldpan.rq_cuts.excursion_ratio_rq(amp, std)[source]¶
|amp| / std: the RQ-only stand-in forgoldpan.quantities.excursion_ratio.amp:channel_max_amps(P<ch>max), orPTOFampsfor the total channel (noPTmaxexists);std:P<ch>stdorpt_std_proxy(...). Same length, aligned to the same events.
- goldpan.rq_cuts.phonon_log_ratios(rqs, channels)[source]¶
log10(|P<ch>max| / P<ch>std)for each ofchannelsthat has both RQs inrqs(a mapping of RQ name to array).Ready for
pileup_randoms,loose_randomsandtight_randoms. A zerostdgives infinity, not an error.
- goldpan.rq_cuts.excursion_band_rq(log_ratio, low, high)[source]¶
True where
log_ratiois in[low, high). No default band: the bands differ from channel to channel.
- goldpan.rq_cuts.pileup_randoms(log_ratios_by_channel, thresholds)[source]¶
True where a random trigger is pileup-contaminated: ANY channel’s
log10(ratio)is above its entry inthresholds.In every phonon channel the pooled
log10(ratio)of random triggers has a main noise peak, a gap, then a sparse pileup cluster; a channel’s threshold is, for example, the start of that gap. The numbers are an analysis result and are passed in.log_ratios_by_channel: channel -> array (fromphonon_log_ratios);thresholds: channel -> value. A channel absent from the first, or NaN for an event, is skipped.
- goldpan.rq_cuts.loose_randoms(log_ratios_by_channel, low, pileup_thresholds)[source]¶
True for a clean-enough random trigger: every channel with data has
log10(ratio) >= low, and it is notpileup_randoms.lowis one sanity floor for every channel; each channel’s upper limit is its pileup threshold. Only the channels named inpileup_thresholdstake part (a channel with no threshold is not judged).
- goldpan.rq_cuts.tight_randoms(log_ratios_by_channel, low, pileup_thresholds, tight_ranges)[source]¶
True for a clean random trigger:
loose_randoms, and every channel with data inside itstight_rangesentry.tight_ranges: channel ->(low, high), the “broad peak” of that channel’s smoothedlog10(ratio)histogram with pileup removed (an analysis result, passed in). A subset ofloose_randoms.
- goldpan.rq_cuts.triggered_physics(rqs, detector, physics_event_type=1)[source]¶
Warning
Under development: ported from scdms-analysis-tools line_cuts, written for one Z7 calibration line; the RQ names are those of that reconstruction
Physics triggers (
EventType == physics_event_type) that were fired bydetector(TriggerDetectorNum).
- goldpan.rq_cuts.calibration_line(rqs, windows, detector, allow_missing=False)[source]¶
Warning
Under development: ported from scdms-analysis-tools line_cuts (ten_kev_line); the per-series windows are an analysis result set by eye, and the RQ names are those of the Z7 reconstruction
True for triggered physics events inside their series’ line window:
PTOFampsinampandPTOFdelayin adelaywindow.rqsneedsseries,EventType,TriggerDetectorNum,PTOFampsandPTOFdelay.windows: series ->dict(amp=(lo, hi), delay=[(lo, hi), ...]), passed in (they are an analysis result).detector: the trigger detector number, required. A series ofrqswith no window raisesValueErrornaming it, rather than quietly returning False (which would look like a series with no line events);allow_missing=Truegives False for those series instead.