This class is used to fit things that resemble "peaks" in data
Definition at line 31 of file TPeakFitter.h.
Public Member Functions | |
TPeakFitter () | |
TPeakFitter (const Double_t &range_low, const Double_t &range_high) | |
~TPeakFitter () override | |
void | AddPeak (TSinglePeak *p) |
void | DrawPeaks (Option_t *="") const |
void | Fit (TH1 *fit_hist, Option_t *opt="") |
TF1 * | GetBackground () |
TF1 * | GetFitFunction () |
Int_t | GetNParameters () const |
void | InitializeBackgroundParameters (TH1 *fit_hist) |
void | InitializeParameters (TH1 *fit_hist) |
virtual void | Print (Option_t *opt="") const override |
void | PrintParameters () const |
void | RemoveAllPeaks () |
void | RemovePeak (TSinglePeak *p) |
void | ResetInitFlag () |
void | SetBackground (TF1 *bg_to_fit) |
void | SetIndex (const int &index) |
void | SetRange (const Double_t &low, const Double_t &high) |
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 | UpdateFitterParameters () |
void | UpdatePeakParameters (const TFitResultPtr &fit_res, TH1 *fit_hist) |
Private Attributes | |
TF1 * | fBGToFit {nullptr} |
int | fIndex {0} |
bool | fInitFlag {false} |
TH1 * | fLastHistFit {nullptr} |
MultiplePeak_t | fPeaksToFit |
Double_t | fRangeHigh |
Double_t | fRangeLow |
TF1 * | fTotalFitFunction {nullptr} |
#include <TPeakFitter.h>
|
inlineoverride |
Definition at line 34 of file TPeakFitter.h.
TPeakFitter::TPeakFitter | ( | ) |
Definition at line 12 of file TPeakFitter.cxx.
References DefaultBackgroundFunction().
TPeakFitter::TPeakFitter | ( | const Double_t & | range_low, |
const Double_t & | range_high | ||
) |
Definition at line 20 of file TPeakFitter.cxx.
References fRangeHigh, and fRangeLow.
|
inline |
Definition at line 39 of file TPeakFitter.h.
References fPeaksToFit.
Referenced by TBGSubtraction::PeakComboSelected().
|
private |
Definition at line 325 of file TPeakFitter.cxx.
References fBGToFit, and fPeaksToFit.
Referenced by UpdatePeakParameters().
|
private |
Definition at line 380 of file TPeakFitter.cxx.
Referenced by TPeakFitter().
void TPeakFitter::DrawPeaks | ( | Option_t * | = "" | ) | const |
Definition at line 392 of file TPeakFitter.cxx.
References fIndex, fPeaksToFit, and fTotalFitFunction.
void 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 84 of file TPeakFitter.cxx.
References TGRSIFunctions::CheckParameterErrors(), fIndex, fInitFlag, FitFunction(), fLastHistFit, fPeaksToFit, fRangeHigh, fRangeLow, fTotalFitFunction, GetNParameters(), GREEN, InitializeBackgroundParameters(), InitializeParameters(), Print(), PrintParameters(), RED, RESET_COLOR, UpdateFitterParameters(), UpdatePeakParameters(), and YELLOW.
Referenced by TBGSubtraction::DoPeakFit().
|
private |
Definition at line 309 of file TPeakFitter.cxx.
References fBGToFit, and fPeaksToFit.
Referenced by Fit().
|
inline |
Definition at line 50 of file TPeakFitter.h.
References fBGToFit.
|
inline |
Definition at line 51 of file TPeakFitter.h.
References fTotalFitFunction.
Int_t TPeakFitter::GetNParameters | ( | ) | const |
Definition at line 67 of file TPeakFitter.cxx.
References fBGToFit, and fPeaksToFit.
Referenced by Fit().
void TPeakFitter::InitializeBackgroundParameters | ( | TH1 * | fit_hist | ) |
Definition at line 340 of file TPeakFitter.cxx.
References fBGToFit, fPeaksToFit, fRangeHigh, and fRangeLow.
Referenced by Fit().
void TPeakFitter::InitializeParameters | ( | TH1 * | fit_hist | ) |
|
overridevirtual |
Print information from the fit, opt is passed along to each individual peaks Print function.
Definition at line 26 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 55 of file TPeakFitter.cxx.
References fPeaksToFit, fRangeHigh, and fRangeLow.
Referenced by Fit().
|
inline |
Definition at line 41 of file TPeakFitter.h.
References fPeaksToFit.
|
inline |
Definition at line 40 of file TPeakFitter.h.
References fPeaksToFit.
Referenced by TBGSubtraction::PeakComboSelected().
|
inline |
Definition at line 57 of file TPeakFitter.h.
References fInitFlag.
Referenced by TBGSubtraction::DoPeakFit(), and TBGSubtraction::PeakComboSelected().
|
inline |
Definition at line 43 of file TPeakFitter.h.
References fBGToFit.
|
inline |
Definition at line 59 of file TPeakFitter.h.
References fIndex.
void TPeakFitter::SetRange | ( | const Double_t & | low, |
const Double_t & | high | ||
) |
Definition at line 78 of file TPeakFitter.cxx.
References fRangeHigh, and fRangeLow.
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 275 of file TPeakFitter.cxx.
References fBGToFit, fPeaksToFit, and fTotalFitFunction.
Referenced by Fit().
|
private |
Definition at line 177 of file TPeakFitter.cxx.
References BackgroundFunction(), fBGToFit, fPeaksToFit, fRangeHigh, fRangeLow, and fTotalFitFunction.
Referenced by Fit().
|
private |
Definition at line 69 of file TPeakFitter.h.
Referenced by BackgroundFunction(), 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 83 of file TPeakFitter.h.
Referenced by DrawPeaks(), Fit(), and SetIndex().
|
private |
Definition at line 79 of file TPeakFitter.h.
Referenced by Fit(), and ResetInitFlag().
|
private |
Definition at line 81 of file TPeakFitter.h.
Referenced by Fit().
|
private |
Definition at line 68 of file TPeakFitter.h.
Referenced by AddPeak(), BackgroundFunction(), DrawPeaks(), Fit(), FitFunction(), GetNParameters(), InitializeBackgroundParameters(), InitializeParameters(), Print(), PrintParameters(), RemoveAllPeaks(), RemovePeak(), UpdateFitterParameters(), and UpdatePeakParameters().
|
private |
Definition at line 74 of file TPeakFitter.h.
Referenced by Fit(), InitializeBackgroundParameters(), Print(), PrintParameters(), SetRange(), TPeakFitter(), and UpdatePeakParameters().
|
private |
Definition at line 73 of file TPeakFitter.h.
Referenced by Fit(), InitializeBackgroundParameters(), Print(), PrintParameters(), SetRange(), TPeakFitter(), and UpdatePeakParameters().
|
private |
Definition at line 71 of file TPeakFitter.h.
Referenced by DrawPeaks(), Fit(), GetFitFunction(), Print(), UpdateFitterParameters(), and UpdatePeakParameters().