MUSIC unknown
Analysis for the MUSIC active-target ionization chamber
Loading...
Searching...
No Matches
CalibrateBeam Class Reference

Per-channel beam-peak calibration, gain matching and strip alignment. More...

#include <CalibrateBeam.hpp>

Static Public Member Functions

static std::vector< ChannelCal > BuildChannels ()
 One ChannelCal per readout channel in the active channel map.
static void CalibrateBeamOneSubfile (const FileSpec &spec, const std::vector< ChannelCal > &chans_template)
 Calibrate one subfile end to end.
static void AggregateRidgeRatiosForRun (Int_t run, const std::vector< FileSpec > &specs)
 Replace each subfile's ridge ratio and short-end offset with the run-level medians.
static void Run (const TString &file_label="")
 Calibrate every configured subfile, then aggregate per run.

Detailed Description

Per-channel beam-peak calibration, gain matching and strip alignment.

Runs after the pipeline over its events files. For each subfile it locates every channel's modal beam peak, matches the left and right gains of each segmented strip onto a common charge scale by anchoring both ends on the charge-sharing ridge, then aligns every strip's total so that the beam peak sits at 1.0 and the two-particle pile-up peak at 2.0.

The ridge ratios are per-channel constants rather than per-subfile measurements, and are aggregated to the run level once every subfile has been processed.

Todo
Reintroduce the per-run energy-resolution TOML for Remix-MUSIC-Sim. It was removed on 2026-09-16 together with the per-channel peak width it was built from, when the beam anchor became the modal bin with no fit. It took each channel's relative resolution in percent FWHM from the calibration tree, medianed it over a run's subfiles, and wrote sim_control/Calibration_Run<N>_eres.toml as a [detector.eres] table keyed Cathode, S0, S17, L1..L16, R1..R16. Bringing it back needs a width per channel again, measured from the beam-peak histogram rather than a fit, and a run-level aggregation after the ridge ratios.

Definition at line 156 of file CalibrateBeam.hpp.

Member Function Documentation

◆ AggregateRidgeRatiosForRun()

void CalibrateBeam::AggregateRidgeRatiosForRun ( Int_t run,
const std::vector< FileSpec > & specs )
static

Replace each subfile's ridge ratio and short-end offset with the run-level medians.

Replace each subfile's short-side gain with one built from the run-level median ridge ratio.

The ratio is a preamplifier gain ratio and the offset a channel property, so both are fixed per channel. Taking the median across the subfiles that measured the ridge makes the values robust for subfiles where it was not measurable.

Parameters
runRun number.
specsThat run's subfiles.

C_short/C_long is a ratio of preamp gains, so it is fixed per channel and does not vary subfile to subfile – the measured scatter is ~1%, well below the ~7% spread between strips. But a single subfile often cannot fit the ridge on the low-occupancy short ends (on 87Rb the even strips fit in only ~45% of subfiles, and 37Cl's upstream strips almost never do), so per-subfile fitting leaves a large fraction of strips on a fallback.

Aggregating fixes that without re-reading any event data: take the median ratio and the median short-end offset (both in units of C_long) per strip over the subfiles that did measure the ridge, then rebuild every subfile's short gain as 1/(ratio * C_long) and its short offset as offset * C_long, using that subfile's own C_long so per-subfile gain drift is preserved. Strips that no subfile could fit keep whatever the per-subfile fallback gave them.

Definition at line 1637 of file CalibrateBeam.cpp.

◆ BuildChannels()

std::vector< ChannelCal > CalibrateBeam::BuildChannels ( )
static

One ChannelCal per readout channel in the active channel map.

Returns
The templates, with names, sides and strips filled and the fitted quantities left at their defaults.

Definition at line 34 of file CalibrateBeam.cpp.

Referenced by Run().

◆ CalibrateBeamOneSubfile()

void CalibrateBeam::CalibrateBeamOneSubfile ( const FileSpec & spec,
const std::vector< ChannelCal > & chans_template )
static

Calibrate one subfile end to end.

Parameters
specSubfile to process.
chans_templateChannel templates from BuildChannels(); copied, not modified.

Definition at line 1504 of file CalibrateBeam.cpp.

Referenced by Run(), and RunFusedPipelineForFile().

◆ Run()

void CalibrateBeam::Run ( const TString & file_label = "")
static

Calibrate every configured subfile, then aggregate per run.

Parameters
file_labelRestrict to one subfile by its FileSet::FileLabel(). Empty, the default, processes all of them.

Definition at line 1759 of file CalibrateBeam.cpp.

Referenced by main().


The documentation for this class was generated from the following files: