Repository navigation
Fitting
HOME > RUNNING GRSISORT > ANALYSIS > FITTING
As part of the GRSISort analysis package, there are a number of classes and methods available for fitting:
- GGaus: Used to fit peaks with a gaussian and a linear background. This class is used when the 'g' key is used on a GCanvas (see Canvas Hotkeys).
- GPeak: Used to fit peaks with a gaussian + skewed gaussian and a background of a step function + constant. This class is used when the 'f' key is used on a GCanvas (see Canvas Hotkeys).
- TPeak: Used to fit peaks with a gaussian + skewed gaussian. This class is used when the 'F' key is used on a GCanvas (see Canvas Hotkeys).
- TPeakFitter: This is a versatile class than can fit any number of peaks of different shapes plus a global background (by default a quadratic polynomial). Each peak has to be added individually and can be one of the classes derived from TSinglePeak:
Below is a comparions of different fits of a standard photopeak with or without including a skewed gaussian:

In order to fix parameters of specific peaks, use the fit function of the peak:
TPeakFitter pf(<low range>,<high range>);
TRWPeak peak(<centroid>);
pf.AddPeak(&peak);
TF1* peakFunc = peak.GetFitFunction();
peakFunc->FixParameter(<index>, <value>);
pf.Fit(<histogram>);
To get a list of the parameters use the TF1::Print("v") function (peakFunc->Print("v") in the example above).
To access parameters of the global background function use TPeakFitter::GetBackground() (pf.GetBackground()->FixParameter(<index>, <value>) in the example above). See also #1262.
This is a simple gaussian peak with parameters:
| Index | Name |
|---|---|
| 0 | height |
| 1 | centroid |
| 2 | sigma |
This is a gaussian peak with a tail on the left side as in radware. The tails height is expressed as the height of the peak times “R”, and its skewness is given by “beta". Its background function has a step (error function) at the position of the centroid with the same sigma as the peak, and a height expressed in percent of the height of the peak. These are the parameters:
| Index | Name | Comment |
|---|---|---|
| 0 | height | initialized to bin content of centroid bin |
| 1 | centroid | |
| 2 | sigma | initialized to |
| 3 | beta | initialized to sigma / 2 |
| 4 | R | initialized to 0.001 / fixed to 0? |
| 5 | step | initialized to 0.1 with limits 0. to 100. |
This peak is comprised of two gaussian peaks on top of each other and a background function with a step. The seconds peak height and sigma are expressed as relative to the height and sigma of the first peak:
| Index | Name |
|---|---|
| 0 | height |
| 1 | centroid |
| 2 | sigma |
| 3 | rel_height |
| 4 | rel_sigma |
| 5 | step |
This peak is comprised of three gaussian peaks on top of each other and a background function with a step. The second and thirds peaks height and sigma are expressed as relative to the height and sigma of the first peak:
| Index | Name |
|---|---|
| 0 | height |
| 1 | centroid |
| 2 | sigma |
| 3 | rel_height1 |
| 4 | rel_sigma1 |
| 5 | rel_height2 |
| 6 | rel_sigma2 |
| 7 | step |
- TDecay Used to fit nuclear decay curves.
Home | Setup Guide | Running GRSISort | Technical Docs | Commands | Issue Tracker | Team