Analysis-Utilities 26.9.9
C++/ROOT utilities for nuclear measurement data analysis
Loading...
Searching...
No Matches
FittingFunctions Namespace Reference

Raw model functions in TF1 form: f(Double_t *x, Double_t *par). More...

Functions

Double_t Gaussian (Double_t *x, Double_t *par)
 Gaussian peak.
Double_t LinearBackground (Double_t *x, Double_t *par)
 Straight-line background.
Double_t Step (Double_t *x, Double_t *par)
 Resolution-smeared step shelf below the peak.
Double_t LowTail (Double_t *x, Double_t *par)
 Combined exponential and linear tail below the peak.
Double_t HighTail (Double_t *x, Double_t *par)
 Exponential tail above the peak, from pileup.
Double_t PeakFunction (Double_t *x, Double_t *par)
 One peak with every optional component, plus a linear background.
Double_t DoublePeakFunction (Double_t *x, Double_t *par)
 Two peaks sharing one linear background.
Double_t TriplePeakFunction (Double_t *x, Double_t *par)
 Three peaks sharing one linear background.

Detailed Description

Raw model functions in TF1 form: f(Double_t *x, Double_t *par).

Exposed so a caller can build a custom TF1 from the same components the class uses. Every function is un-normalised — amplitudes are peak heights in counts, not yields.

In the composite functions the step and tail amplitudes are expressed as ratios of the Gaussian amplitude rather than absolute heights, which is what keeps a constrained fit meaningful when the peak height changes. Tail ratio parameters are decay constants in units of sigma, so tau = ratio * sigma.

Function Documentation

◆ DoublePeakFunction()

Double_t FittingFunctions::DoublePeakFunction ( Double_t * x,
Double_t * par )

Two peaks sharing one linear background.

Each peak occupies a ten-parameter block laid out as parameters 0 to 9 of PeakFunction(): peak one at [0..9], peak two at [10..19], with the background constant and slope appended at [20] and [21].

Parameters
xObservable; only x[0] is used.
parThe 22 parameters above.
Returns
The summed model value.

Definition at line 186 of file FittingUtils.cpp.

Referenced by FittingUtils::FitDoublePeak(), and FittingUtils::FitDoublePeak().

◆ Gaussian()

Double_t FittingFunctions::Gaussian ( Double_t * x,
Double_t * par )

Gaussian peak.

Parameters
xObservable; only x[0] is used.
par[0] centroid, [1] sigma, [2] peak height.
Returns
The un-normalised Gaussian value.

Definition at line 73 of file FittingUtils.cpp.

Referenced by DoublePeakFunction(), PeakFunction(), FittingUtils::PlotFitSinglePeak(), and TriplePeakFunction().

◆ HighTail()

Double_t FittingFunctions::HighTail ( Double_t * x,
Double_t * par )

Exponential tail above the peak, from pileup.

Parameters
xObservable; only x[0] is used.
par[0] centroid, [1] sigma, [2] amplitude, [3] decay constant in units of sigma.
Returns
The tail value; zero when sigma <= 0, the amplitude is zero, or the decay constant is non-positive.

Definition at line 115 of file FittingUtils.cpp.

Referenced by DoublePeakFunction(), PeakFunction(), FittingUtils::PlotFitSinglePeak(), and TriplePeakFunction().

◆ LinearBackground()

Double_t FittingFunctions::LinearBackground ( Double_t * x,
Double_t * par )

Straight-line background.

Parameters
xObservable; only x[0] is used.
par[0] constant, [1] slope.
Returns
slope * x + constant.

Definition at line 81 of file FittingUtils.cpp.

Referenced by DoublePeakFunction(), FittingUtils::FitSinglePeak(), PeakFunction(), FittingUtils::PlotFitDoublePeak(), FittingUtils::PlotFitSinglePeak(), FittingUtils::PlotFitTriplePeak(), and TriplePeakFunction().

◆ LowTail()

Double_t FittingFunctions::LowTail ( Double_t * x,
Double_t * par )

Combined exponential and linear tail below the peak.

Parameters
xObservable; only x[0] is used.
par[0] centroid, [1] sigma, [2] exponential amplitude, [3] exponential decay in units of sigma, [4] linear amplitude, [5] linear slope.
Returns
The summed tail, cut off above the centroid by a complementary error function. Zero when sigma <= 0 or both amplitudes are zero.

Definition at line 87 of file FittingUtils.cpp.

Referenced by DoublePeakFunction(), PeakFunction(), FittingUtils::PlotFitSinglePeak(), and TriplePeakFunction().

◆ PeakFunction()

Double_t FittingFunctions::PeakFunction ( Double_t * x,
Double_t * par )

One peak with every optional component, plus a linear background.

Twelve parameters: [0] centroid, [1] sigma, [2] Gaussian height, [3] step amplitude, [4] low exponential tail amplitude, [5] its decay in units of sigma, [6] low linear tail amplitude, [7] its slope, [8] high exponential tail amplitude, [9] its decay in units of sigma, [10] background constant, [11] background slope.

Parameters
xObservable; only x[0] is used.
parThe twelve parameters above.
Returns
The summed model value.
Note
Parameters 3, 4, 6 and 8 are ratios of the Gaussian amplitude, not absolute heights. Setting a ratio to zero disables that component.

Definition at line 154 of file FittingUtils.cpp.

Referenced by FittingUtils::FittingUtils().

◆ Step()

Double_t FittingFunctions::Step ( Double_t * x,
Double_t * par )

Resolution-smeared step shelf below the peak.

Parameters
xObservable; only x[0] is used.
par[0] centroid, [1] sigma, [2] step amplitude.
Returns
The shelf value; zero when sigma <= 0 or the denominator underflows.

Definition at line 138 of file FittingUtils.cpp.

Referenced by DoublePeakFunction(), PeakFunction(), FittingUtils::PlotFitSinglePeak(), and TriplePeakFunction().

◆ TriplePeakFunction()

Double_t FittingFunctions::TriplePeakFunction ( Double_t * x,
Double_t * par )

Three peaks sharing one linear background.

As DoublePeakFunction(), with a third ten-parameter block at [20..29] and the background appended at [30] and [31].

Parameters
xObservable; only x[0] is used.
parThe 32 parameters above.
Returns
The summed model value.

Definition at line 246 of file FittingUtils.cpp.

Referenced by FittingUtils::FitTriplePeak().