GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TSinglePeak Class Referenceabstract

Detailed Description

This is the base class for anything that is used to fit things that resemble "peaks" in data. Any derived classes must implement functions to

  • initialize parameters and parameter names,
  • set the total function and peak function, The centroid of the peak should always be parameter 1.

Definition at line 36 of file TSinglePeak.h.

Public Member Functions

 TSinglePeak ()=default
 
 TSinglePeak (const TSinglePeak &)=default
 
 TSinglePeak (TSinglePeak &&) noexcept=default
 
 ~TSinglePeak ()=default
 
Double_t Area () const
 
Double_t AreaErr () const
 
virtual Double_t Centroid () const =0
 
virtual void Centroid (const Double_t &centroid)=0
 
virtual Double_t CentroidErr () const =0
 
void Draw (Option_t *opt="") override
 
virtual void DrawBackground (Option_t *opt="")
 
virtual void DrawComponents (Option_t *opt="")
 
virtual Double_t FWHM ()
 
TF1 * GetBackgroundFunction ()
 
Double_t GetChi2 () const
 
TF1 * GetFitFunction () const
 
TF1 * GetGlobalBackground () const
 
Double_t GetNDF () const
 
Int_t GetNParameters () const
 
TF1 * GetPeakFunction () const
 
Double_t GetReducedChi2 () const
 
virtual void InitializeParameters (TH1 *, const double &, const double &)
 
virtual void InitParNames ()
 
bool IsBackgroundParameter (const Int_t &par) const
 
bool IsPeakParameter (const Int_t &par) const
 
TSinglePeakoperator= (const TSinglePeak &)=default
 
TSinglePeakoperator= (TSinglePeak &&) noexcept=default
 
bool ParameterSetByUser (int par)
 
void Print (Option_t *="") const override
 
virtual void PrintParameters () const
 
void SetArea (const Double_t &area)
 
void SetAreaErr (const Double_t &area_err)
 
void SetGlobalBackground (TF1 *background)
 
void SetListOfBGPar (const std::vector< bool > &list_of_bg_par)
 
virtual Double_t Sigma () const =0
 
void UpdateBackgroundParameters ()
 
void UpdatePeakParameters ()
 
virtual Double_t Width () const =0
 

Protected Member Functions

virtual Double_t BackgroundFunction (Double_t *, Double_t *)
 
virtual Double_t PeakFunction (Double_t *, Double_t *)
 
virtual Double_t PeakOnGlobalFunction (Double_t *dim, Double_t *par)
 
void SetChi2 (const Double_t &chi2)
 
void SetFitFunction (TF1 *function)
 
void SetNDF (const Int_t &ndf)
 
void SetPeakFunction (TF1 *function)
 
Double_t TotalFunction (Double_t *dim, Double_t *par)
 

Private Attributes

Double_t fArea {-0.1}
 
Double_t fAreaErr {0.0}
 
TF1 * fBackgroundFunction {nullptr}
 
Double_t fChi2 {std::numeric_limits<Double_t>::quiet_NaN()}
 
TF1 * fGlobalBackground {nullptr}
 
std::vector< bool > fListOfBGPars
 
Int_t fNDF {0}
 
TF1 * fPeakFunction {nullptr}
 
TF1 * fPeakOnGlobal {nullptr}
 
TF1 * fTotalFunction {nullptr}
 

Friends

class TPeakFitter
 
+ Inheritance diagram for TSinglePeak:
+ Collaboration diagram for TSinglePeak:

Constructor & Destructor Documentation

◆ TSinglePeak() [1/3]

TSinglePeak::TSinglePeak ( )
default

◆ TSinglePeak() [2/3]

TSinglePeak::TSinglePeak ( const TSinglePeak & )
default

◆ TSinglePeak() [3/3]

TSinglePeak::TSinglePeak ( TSinglePeak && )
defaultnoexcept

◆ ~TSinglePeak()

TSinglePeak::~TSinglePeak ( )
default

Member Function Documentation

◆ Area()

Double_t TSinglePeak::Area ( ) const
inline

Definition at line 57 of file TSinglePeak.h.

References fArea.

Referenced by main(), and Print().

◆ AreaErr()

Double_t TSinglePeak::AreaErr ( ) const
inline

Definition at line 58 of file TSinglePeak.h.

References fAreaErr.

Referenced by main(), and Print().

◆ BackgroundFunction()

virtual Double_t TSinglePeak::BackgroundFunction ( Double_t * ,
Double_t *  )
inlineprotectedvirtual

Reimplemented in TAB3Peak, TABPeak, and TRWPeak.

Definition at line 97 of file TSinglePeak.h.

Referenced by GetBackgroundFunction(), and TotalFunction().

◆ Centroid() [1/2]

virtual Double_t TSinglePeak::Centroid ( ) const
pure virtual

Implemented in TAB3Peak, TABPeak, TGauss, and TRWPeak.

Referenced by FWHM(), and Print().

◆ Centroid() [2/2]

virtual void TSinglePeak::Centroid ( const Double_t & centroid)
pure virtual

Implemented in TAB3Peak, TABPeak, TGauss, and TRWPeak.

Referenced by TBGSubtraction::DoPeakFit().

◆ CentroidErr()

virtual Double_t TSinglePeak::CentroidErr ( ) const
pure virtual

Implemented in TAB3Peak, TABPeak, TGauss, and TRWPeak.

Referenced by Print().

◆ Draw()

void TSinglePeak::Draw ( Option_t * opt = "")
override

◆ DrawBackground()

virtual void TSinglePeak::DrawBackground ( Option_t * opt = "")
inlinevirtual

Definition at line 69 of file TSinglePeak.h.

References fGlobalBackground.

◆ DrawComponents()

void TSinglePeak::DrawComponents ( Option_t * opt = "")
virtual

This behaves like the draw function except each daughter class decides how to break the draw into multiple components. This means that we should delegate this task to the daughter class.

Reimplemented in TAB3Peak, and TABPeak.

Definition at line 71 of file TSinglePeak.cxx.

◆ FWHM()

Double_t TSinglePeak::FWHM ( )
virtual

Return the full width at half-maximum.

Definition at line 77 of file TSinglePeak.cxx.

References Centroid(), fPeakFunction, Sigma(), and UpdatePeakParameters().

◆ GetBackgroundFunction()

TF1 * TSinglePeak::GetBackgroundFunction ( )

Definition at line 28 of file TSinglePeak.cxx.

References BackgroundFunction(), fBackgroundFunction, and fTotalFunction.

◆ GetChi2()

Double_t TSinglePeak::GetChi2 ( ) const
inline

Definition at line 89 of file TSinglePeak.h.

References fChi2.

◆ GetFitFunction()

◆ GetGlobalBackground()

◆ GetNDF()

Double_t TSinglePeak::GetNDF ( ) const
inline

Definition at line 90 of file TSinglePeak.h.

References fNDF.

◆ GetNParameters()

Int_t TSinglePeak::GetNParameters ( ) const

Definition at line 20 of file TSinglePeak.cxx.

References fTotalFunction.

◆ GetPeakFunction()

TF1 * TSinglePeak::GetPeakFunction ( ) const
inline

Definition at line 77 of file TSinglePeak.h.

References fPeakFunction.

◆ GetReducedChi2()

Double_t TSinglePeak::GetReducedChi2 ( ) const
inline

Definition at line 91 of file TSinglePeak.h.

References fChi2, and fNDF.

Referenced by main().

◆ InitializeParameters()

virtual void TSinglePeak::InitializeParameters ( TH1 * ,
const double & ,
const double &  )
inlinevirtual

Reimplemented in TAB3Peak, TABPeak, TGauss, and TRWPeak.

Definition at line 48 of file TSinglePeak.h.

◆ InitParNames()

virtual void TSinglePeak::InitParNames ( )
inlinevirtual

Reimplemented in TAB3Peak, TABPeak, TGauss, and TRWPeak.

Definition at line 47 of file TSinglePeak.h.

◆ IsBackgroundParameter()

bool TSinglePeak::IsBackgroundParameter ( const Int_t & par) const

Definition at line 4 of file TSinglePeak.cxx.

References fListOfBGPars.

Referenced by IsPeakParameter().

◆ IsPeakParameter()

bool TSinglePeak::IsPeakParameter ( const Int_t & par) const

Definition at line 15 of file TSinglePeak.cxx.

References IsBackgroundParameter().

◆ operator=() [1/2]

TSinglePeak & TSinglePeak::operator= ( const TSinglePeak & )
default

◆ operator=() [2/2]

TSinglePeak & TSinglePeak::operator= ( TSinglePeak && )
defaultnoexcept

◆ ParameterSetByUser()

bool TSinglePeak::ParameterSetByUser ( int par)

This function checks if a parameter or its limits have been set to a non-zero value. In case that the user fixed a parameter to be zero, the limits are non-zero, so this case is covered as well.

Definition at line 122 of file TSinglePeak.cxx.

References fTotalFunction.

Referenced by TAB3Peak::InitializeParameters(), TABPeak::InitializeParameters(), TGauss::InitializeParameters(), and TRWPeak::InitializeParameters().

◆ PeakFunction()

virtual Double_t TSinglePeak::PeakFunction ( Double_t * ,
Double_t *  )
inlineprotectedvirtual

Reimplemented in TAB3Peak, TABPeak, TGauss, and TRWPeak.

Definition at line 98 of file TSinglePeak.h.

Referenced by PeakOnGlobalFunction(), and TotalFunction().

◆ PeakOnGlobalFunction()

Double_t TSinglePeak::PeakOnGlobalFunction ( Double_t * dim,
Double_t * par )
protectedvirtual

Definition at line 92 of file TSinglePeak.cxx.

References fGlobalBackground, fTotalFunction, and PeakFunction().

Referenced by Draw().

◆ Print()

void TSinglePeak::Print ( Option_t * = "") const
override

Definition at line 37 of file TSinglePeak.cxx.

References Area(), AreaErr(), Centroid(), and CentroidErr().

◆ PrintParameters()

void TSinglePeak::PrintParameters ( ) const
virtual

Definition at line 45 of file TSinglePeak.cxx.

References fTotalFunction.

◆ SetArea()

void TSinglePeak::SetArea ( const Double_t & area)
inline

Definition at line 54 of file TSinglePeak.h.

References fArea.

◆ SetAreaErr()

void TSinglePeak::SetAreaErr ( const Double_t & area_err)
inline

Definition at line 55 of file TSinglePeak.h.

References fAreaErr.

◆ SetChi2()

void TSinglePeak::SetChi2 ( const Double_t & chi2)
inlineprotected

Definition at line 101 of file TSinglePeak.h.

References fChi2.

◆ SetFitFunction()

void TSinglePeak::SetFitFunction ( TF1 * function)
inlineprotected

◆ SetGlobalBackground()

void TSinglePeak::SetGlobalBackground ( TF1 * background)
inline

Definition at line 80 of file TSinglePeak.h.

References fGlobalBackground.

◆ SetListOfBGPar()

void TSinglePeak::SetListOfBGPar ( const std::vector< bool > & list_of_bg_par)
inline

Definition at line 51 of file TSinglePeak.h.

References fListOfBGPars.

Referenced by TAB3Peak::Centroid(), TABPeak::Centroid(), TGauss::Centroid(), and TRWPeak::Centroid().

◆ SetNDF()

void TSinglePeak::SetNDF ( const Int_t & ndf)
inlineprotected

Definition at line 102 of file TSinglePeak.h.

References fNDF.

◆ SetPeakFunction()

void TSinglePeak::SetPeakFunction ( TF1 * function)
inlineprotected

Definition at line 105 of file TSinglePeak.h.

References fPeakFunction.

Referenced by TAB3Peak::Centroid(), TABPeak::Centroid(), TGauss::Centroid(), and TRWPeak::Centroid().

◆ Sigma()

virtual Double_t TSinglePeak::Sigma ( ) const
pure virtual

Implemented in TAB3Peak, TABPeak, TGauss, and TRWPeak.

Referenced by FWHM().

◆ TotalFunction()

Double_t TSinglePeak::TotalFunction ( Double_t * dim,
Double_t * par )
protected

◆ UpdateBackgroundParameters()

void TSinglePeak::UpdateBackgroundParameters ( )

Definition at line 66 of file TSinglePeak.cxx.

References fBackgroundFunction, and fTotalFunction.

◆ UpdatePeakParameters()

void TSinglePeak::UpdatePeakParameters ( )

Definition at line 61 of file TSinglePeak.cxx.

References fPeakFunction, and fTotalFunction.

Referenced by FWHM().

◆ Width()

virtual Double_t TSinglePeak::Width ( ) const
pure virtual

Implemented in TAB3Peak, TABPeak, TGauss, and TRWPeak.

Friends And Related Symbol Documentation

◆ TPeakFitter

friend class TPeakFitter
friend

Definition at line 38 of file TSinglePeak.h.

Member Data Documentation

◆ fArea

Double_t TSinglePeak::fArea {-0.1}
private

Definition at line 115 of file TSinglePeak.h.

Referenced by Area(), and SetArea().

◆ fAreaErr

Double_t TSinglePeak::fAreaErr {0.0}
private

Definition at line 116 of file TSinglePeak.h.

Referenced by AreaErr(), and SetAreaErr().

◆ fBackgroundFunction

TF1* TSinglePeak::fBackgroundFunction {nullptr}
private

Definition at line 109 of file TSinglePeak.h.

Referenced by GetBackgroundFunction(), and UpdateBackgroundParameters().

◆ fChi2

Double_t TSinglePeak::fChi2 {std::numeric_limits<Double_t>::quiet_NaN()}
private

Definition at line 117 of file TSinglePeak.h.

Referenced by GetChi2(), GetReducedChi2(), and SetChi2().

◆ fGlobalBackground

TF1* TSinglePeak::fGlobalBackground {nullptr}
private

◆ fListOfBGPars

std::vector<bool> TSinglePeak::fListOfBGPars
private

Definition at line 114 of file TSinglePeak.h.

Referenced by IsBackgroundParameter(), and SetListOfBGPar().

◆ fNDF

Int_t TSinglePeak::fNDF {0}
private

Definition at line 118 of file TSinglePeak.h.

Referenced by GetNDF(), GetReducedChi2(), and SetNDF().

◆ fPeakFunction

TF1* TSinglePeak::fPeakFunction {nullptr}
private

Definition at line 112 of file TSinglePeak.h.

Referenced by FWHM(), GetPeakFunction(), SetPeakFunction(), and UpdatePeakParameters().

◆ fPeakOnGlobal

TF1* TSinglePeak::fPeakOnGlobal {nullptr}
private

Definition at line 111 of file TSinglePeak.h.

Referenced by Draw().

◆ fTotalFunction