![]() |
GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
|
![]() |
This class is used to fit things that resemble "peaks" in data
Definition at line 30 of file TPeakFitter.h.
Public Member Functions | |
TPeakFitter () | |
TPeakFitter (const Double_t &rangeLow, const Double_t &rangeHigh) | |
TPeakFitter (const TPeakFitter &)=default | |
TPeakFitter (TPeakFitter &&) noexcept=default | |
~TPeakFitter () | |
void | AddPeak (TSinglePeak *peak) |
void | DrawPeaks (Option_t *="") const |
TFitResultPtr | Fit (TH1 *fit_hist, Option_t *opt="") |
TF1 * | GetBackground () const |
TF1 * | GetFitFunction () const |
Int_t | GetNParameters () const |
void | InitializeBackgroundParameters (TH1 *fit_hist) |
void | InitializeParameters (TH1 *fit_hist) |
size_t | NumberOfPeaks () |
TPeakFitter & | operator= (const TPeakFitter &)=default |
TPeakFitter & | operator= (TPeakFitter &&) noexcept=default |
TSinglePeak * | Peak (const size_t &index) |
std::list< TSinglePeak * > & | Peaks () |
void | Print (Option_t *opt="") const override |
void | PrintParameters () const |
void | RemoveAllPeaks () |
void | RemovePeak (TSinglePeak *peak) |
void | ResetInitFlag () |
void | SetBackground (TF1 *bg_to_fit) |
void | SetColorIndex (const int &index) |
void | SetRange (const Double_t &low, const Double_t &high) |
Static Public Member Functions | |
static EVerbosity | VerboseLevel () |
static void | VerboseLevel (EVerbosity val) |
Private Member Functions | |
Double_t | BackgroundFunction (Double_t *dim, Double_t *par) |
Double_t | DefaultBackgroundFunction (Double_t *dim, Double_t *par) |
Double_t | FitFunction (Double_t *dim, Double_t *par) |
void | ResetTotalFitFunction () |
void | UpdateFitterParameters () |
void | UpdatePeakParameters (const TFitResultPtr &fit_res, TH1 *fit_hist) |
Private Attributes | |
TF1 * | fBGToFit {nullptr} |
int | fColorIndex {0} |
bool | fInitFlag {false} |
TH1 * | fLastHistFit {nullptr} |
std::list< TSinglePeak * > | fPeaksToFit |
Double_t | fRangeHigh {0.} |
Double_t | fRangeLow {0.} |
TF1 * | fTotalFitFunction {nullptr} |
Static Private Attributes | |
static EVerbosity | fVerboseLevel = EVerbosity::kQuiet |
|
inline |
Definition at line 33 of file TPeakFitter.h.
TPeakFitter::TPeakFitter | ( | const Double_t & | rangeLow, |
const Double_t & | rangeHigh ) |
Definition at line 10 of file TPeakFitter.cxx.
References DefaultBackgroundFunction(), fBGToFit, fColorIndex, fRangeHigh, fRangeLow, fVerboseLevel, and kSubroutines.
|
default |
|
defaultnoexcept |
TPeakFitter::~TPeakFitter | ( | ) |
Definition at line 19 of file TPeakFitter.cxx.
References fRangeHigh, fRangeLow, fVerboseLevel, and kSubroutines.
|
inline |
Definition at line 41 of file TPeakFitter.h.
References fPeaksToFit, and ResetTotalFitFunction().
Referenced by main(), and TBGSubtraction::PeakComboSelected().
|
private |
Definition at line 347 of file TPeakFitter.cxx.
References fBGToFit, and fPeaksToFit.
Referenced by UpdatePeakParameters().
|
private |
Definition at line 403 of file TPeakFitter.cxx.
Referenced by TPeakFitter().
void TPeakFitter::DrawPeaks | ( | Option_t * | = "" | ) | const |
Definition at line 414 of file TPeakFitter.cxx.
References fColorIndex, fPeaksToFit, and fTotalFitFunction.
TFitResultPtr TPeakFitter::Fit | ( | TH1 * | fit_hist, |
Option_t * | opt = "" ) |
Fit the histogram. Recognized options are "q" for a quiet fit, "retryfit" to retry a fit without parameter limits if one of the parameters got close to its limit. All options (apart from "retryfit") are passed on to the actual call to TH1::Fit.
Definition at line 88 of file TPeakFitter.cxx.
References TGRSIFunctions::CheckParameterErrors(), fBGToFit, fColorIndex, fInitFlag, FitFunction(), fLastHistFit, fPeaksToFit, fRangeHigh, fRangeLow, fTotalFitFunction, GetNParameters(), GREEN, InitializeBackgroundParameters(), InitializeParameters(), Print(), PrintParameters(), RED, RESET_COLOR, UpdateFitterParameters(), UpdatePeakParameters(), and YELLOW.
Referenced by TBGSubtraction::DoPeakFit(), and main().
|
private |
Definition at line 326 of file TPeakFitter.cxx.
References fBGToFit, fPeaksToFit, fVerboseLevel, kLoops, and kSubroutines.
Referenced by Fit().
|
inline |
|
inline |
Definition at line 77 of file TPeakFitter.h.
References fTotalFitFunction.
Int_t TPeakFitter::GetNParameters | ( | ) | const |
Definition at line 66 of file TPeakFitter.cxx.
References fBGToFit, and fPeaksToFit.
Referenced by Fit().
void TPeakFitter::InitializeBackgroundParameters | ( | TH1 * | fit_hist | ) |
Definition at line 361 of file TPeakFitter.cxx.
References fBGToFit, fPeaksToFit, fRangeHigh, and fRangeLow.
Referenced by Fit().
void TPeakFitter::InitializeParameters | ( | TH1 * | fit_hist | ) |
Definition at line 283 of file TPeakFitter.cxx.
References fPeaksToFit, fRangeHigh, and fRangeLow.
Referenced by Fit().
|
inline |
Definition at line 56 of file TPeakFitter.h.
References fPeaksToFit.
|
default |
|
defaultnoexcept |
|
inline |
Definition at line 58 of file TPeakFitter.h.
References fPeaksToFit.
|
inline |
Definition at line 57 of file TPeakFitter.h.
References fPeaksToFit.
|
override |
Print information from the fit, opt is passed along to each individual peaks Print function.
Definition at line 24 of file TPeakFitter.cxx.
References fBGToFit, fPeaksToFit, fRangeHigh, fRangeLow, and fTotalFitFunction.
Referenced by Fit().
void TPeakFitter::PrintParameters | ( | ) | const |
Print the range of the fit and the parameters of each peak on a single line.
Definition at line 54 of file TPeakFitter.cxx.
References fPeaksToFit, fRangeHigh, and fRangeLow.
Referenced by Fit().
|
inline |
Definition at line 51 of file TPeakFitter.h.
References fPeaksToFit, and ResetTotalFitFunction().
|
inline |
Definition at line 46 of file TPeakFitter.h.
References fPeaksToFit, and ResetTotalFitFunction().
Referenced by TBGSubtraction::PeakComboSelected().
|
inline |
Definition at line 83 of file TPeakFitter.h.
References fInitFlag.
Referenced by TBGSubtraction::DoPeakFit(), and TBGSubtraction::PeakComboSelected().
|
inlineprivate |
Definition at line 94 of file TPeakFitter.h.
References fTotalFitFunction.
Referenced by AddPeak(), RemoveAllPeaks(), and RemovePeak().
|
inline |
Definition at line 69 of file TPeakFitter.h.
References fBGToFit.
|
inline |
Definition at line 85 of file TPeakFitter.h.
References fColorIndex.
void TPeakFitter::SetRange | ( | const Double_t & | low, |
const Double_t & | high ) |
Definition at line 79 of file TPeakFitter.cxx.
References fRangeHigh, fRangeLow, and fTotalFitFunction.
Referenced by TBGSubtraction::DoPeakFit().
|
private |
This functions gets the parameters and their limits from the peak functions and sets them for the total fit function
Definition at line 290 of file TPeakFitter.cxx.
References fBGToFit, fPeaksToFit, and fTotalFitFunction.
Referenced by Fit().
|
private |
Definition at line 191 of file TPeakFitter.cxx.
References BackgroundFunction(), fBGToFit, fPeaksToFit, fRangeHigh, fRangeLow, fTotalFitFunction, fVerboseLevel, and kQuiet.
Referenced by Fit().
|
inlinestatic |
Definition at line 88 of file TPeakFitter.h.
References fVerboseLevel.
Referenced by TGauss::Centroid(), and TGauss::InitParNames().
|
inlinestatic |
Definition at line 87 of file TPeakFitter.h.
References fVerboseLevel.
|
private |
Definition at line 101 of file TPeakFitter.h.
Referenced by TPeakFitter(), BackgroundFunction(), Fit(), FitFunction(), GetBackground(), GetNParameters(), InitializeBackgroundParameters(), Print(), SetBackground(), UpdateFitterParameters(), and UpdatePeakParameters().
|
private |
this index is added to the colors kRed for the total function and kMagenta for the individual peaks
Definition at line 115 of file TPeakFitter.h.
Referenced by TPeakFitter(), DrawPeaks(), Fit(), and SetColorIndex().
|
private |
Definition at line 111 of file TPeakFitter.h.
Referenced by Fit(), and ResetInitFlag().
|
private |
Definition at line 113 of file TPeakFitter.h.
Referenced by Fit().
|
private |
Definition at line 100 of file TPeakFitter.h.
Referenced by AddPeak(), BackgroundFunction(), DrawPeaks(), Fit(), FitFunction(), GetNParameters(), InitializeBackgroundParameters(), InitializeParameters(), NumberOfPeaks(), Peak(), Peaks(), Print(), PrintParameters(), RemoveAllPeaks(), RemovePeak(), UpdateFitterParameters(), and UpdatePeakParameters().
|
private |
Definition at line 106 of file TPeakFitter.h.
Referenced by TPeakFitter(), ~TPeakFitter(), Fit(), InitializeBackgroundParameters(), InitializeParameters(), Print(), PrintParameters(), SetRange(), and UpdatePeakParameters().
|
private |
Definition at line 105 of file TPeakFitter.h.
Referenced by TPeakFitter(), ~TPeakFitter(), Fit(), InitializeBackgroundParameters(), InitializeParameters(), Print(), PrintParameters(), SetRange(), and UpdatePeakParameters().
|
private |
Definition at line 103 of file TPeakFitter.h.
Referenced by DrawPeaks(), Fit(), GetFitFunction(), Print(), ResetTotalFitFunction(), SetRange(), UpdateFitterParameters(), and UpdatePeakParameters().
|
staticprivate |
Changes verbosity of code.
Definition at line 117 of file TPeakFitter.h.
Referenced by TPeakFitter(), ~TPeakFitter(), FitFunction(), UpdatePeakParameters(), VerboseLevel(), and VerboseLevel().