Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Fit Namespace Reference

Namespace for the fitting classes. More...

Namespaces

namespace  FitUtil
 namespace defining utility free functions using in Fit for evaluating the various fit method functions (chi2, likelihood, etc..) given the data and the model function
 
namespace  HFitInterface
 

Classes

class  AreaComparer
 
class  BasicFCN
 BasicFCN class: base class for the objective functions used in the fits It has a reference to the data and the model function used in the fit. More...
 
class  BinData
 Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y values and error on coordinates The dimension of the coordinate is free There are 4 different options: More...
 
class  Box
 
class  BoxContainer
 
class  Chi2FCN
 Chi2FCN class for binned fits using the least square methods. More...
 
struct  DataOptions
 DataOptions : simple structure holding the options on how the data are filled. More...
 
class  DataRange
 class describing the range in the coordinates it supports multiple range in a coordinate. More...
 
class  FcnAdapter
 
class  FitConfig
 Class describing the configuration of the fit, options and parameter settings using the ROOT::Fit::ParameterSettings class. More...
 
class  FitData
 Base class for all the fit data types: Stores the coordinates and the DataOptions. More...
 
class  FitResult
 class containing the result of the fit and all the related information (fitted parameter values, error, covariance matrix and minimizer result information) Contains a pointer also to the fitted (model) function, modified with the fit parameter values. More...
 
class  Fitter
 Fitter class, entry point for performing all type of fits. More...
 
class  LogLikelihoodFCN
 LogLikelihoodFCN class for likelihood fits. More...
 
struct  ObjFuncTrait
 
struct  ObjFuncTrait< ROOT::Math::FitMethodFunction >
 
struct  ObjFuncTrait< ROOT::Math::FitMethodGradFunction >
 
class  ParameterSettings
 Class, describing value, limits and step size of the parameters Provides functionality also to set/retrieve values, step sizes, limits and fix the parameters. More...
 
class  PoissonLikelihoodFCN
 class evaluating the log likelihood for binned Poisson likelihood fits it is template to distinguish gradient and non-gradient case More...
 
class  ProxyListBox
 
class  SparseData
 SparseData class representing the data of a THNSparse histogram The data needs to be converted to a BinData class before fitting using the GetBinData functions. More...
 
class  UnBinData
 Class describing the un-binned data sets (just x coordinates values) of any dimensions. More...
 

Typedefs

typedef Chi2FCN< ROOT::Math::IMultiGenFunction, ROOT::Math::IParamMultiFunctionChi2Function
 
typedef Chi2FCN< ROOT::Math::IMultiGradFunction, ROOT::Math::IParamMultiFunctionChi2GradFunction
 
typedef LogLikelihoodFCN< ROOT::Math::IMultiGenFunction, ROOT::Math::IParamMultiFunctionLogLikelihoodFunction
 
typedef LogLikelihoodFCN< ROOT::Math::IMultiGradFunction, ROOT::Math::IParamMultiFunctionLogLikelihoodGradFunction
 
typedef PoissonLikelihoodFCN< ROOT::Math::IMultiGenFunction, ROOT::Math::IParamMultiFunctionPoissonLLFunction
 
typedef PoissonLikelihoodFCN< ROOT::Math::IMultiGradFunction, ROOT::Math::IParamMultiFunctionPoissonLLGradFunction
 

Enumerations

enum class  EChisquareType { kNeyman = 0 , kPLikeRatio , kPearson }
 
enum class  EFitObjectType { kHistogram , kGraph }
 

Functions

double Chisquare (const TGraph &h1, TF1 &f1, bool useRange)
 compute the chi2 value for a graph given a function (see TGraph::Chisquare)
 
double Chisquare (const TH1 &h1, TF1 &f1, bool useRange, EChisquareType type)
 compute the chi2 value for an histogram given a function (see TH1::Chisquare for the documentation)
 
void DivideBox (const vector< double > &min, const vector< double > &max, const vector< double > &bmin, const vector< double > &bmax, const unsigned int size, const unsigned int n, list< Box > &l, const double val, const double error)
 
void DoFillData (BinData &dv, const TGraph *gr, BinData::ErrorType type, TF1 *func)
 
void FillData (BinData &dv, const TGraph *gr, TF1 *func=nullptr)
 fill the data vector from a TGraph.
 
void FillData (BinData &dv, const TGraph2D *gr, TF1 *func=nullptr)
 fill the data vector from a TGraph2D.
 
void FillData (BinData &dv, const TH1 *hist, TF1 *func=nullptr)
 fill the data vector from a TH1.
 
void FillData (BinData &dv, const THnBase *hist, TF1 *func=nullptr)
 fill the data vector from a THnBase.
 
void FillData (BinData &dv, const TMultiGraph *gr, TF1 *func=nullptr)
 fill the data vector from a TMultiGraph.
 
void FillData (SparseData &dv, const TH1 *hist, TF1 *func=nullptr)
 fill the data vector from a TH1 with sparse data.
 
void FillData (SparseData &dv, const THnBase *hist, TF1 *func=nullptr)
 fill the data vector from a THnBase.
 
TFitResultPtr FitObject (TGraph *gr, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
 fitting function for a TGraph (called from TGraph::Fit)
 
TFitResultPtr FitObject (TGraph2D *gr, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
 fitting function for a TGraph2D (called from TGraph2D::Fit)
 
TFitResultPtr FitObject (TH1 *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
 fitting function for a TH1 (called from TH1::Fit)
 
TFitResultPtr FitObject (THnBase *s1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
 fitting function for a THn / THnSparse (called from THnBase::Fit)
 
TFitResultPtr FitObject (TMultiGraph *mg, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
 fitting function for a MultiGraph (called from TMultiGraph::Fit)
 
void FitOptionsMake (EFitObjectType type, const char *option, Foption_t &fitOption)
 Decode list of options into fitOption.
 
bool GetConfidenceIntervals (const TH1 *h1, const ROOT::Fit::FitResult &r, TGraphErrors *gr, double cl=0.95)
 compute confidence intervals at level cl for a fitted histogram h1 in a TGraphErrors gr
 
BinData::ErrorType GetDataType (const TGraph *gr, DataOptions &fitOpt)
 
BinData::ErrorType GetDataType (const TGraph2D *gr, const DataOptions &fitOpt)
 
void Init2DGaus (const ROOT::Fit::BinData &data, TF1 *f1)
 compute initial parameter for 2D gaussian function given the fit data Set the sigma limits for zero top 10* initial rms values Set the initial parameter values in the TF1
 
void InitExpo (const ROOT::Fit::BinData &data, TF1 *f1)
 compute initial parameter for an exponential function given the fit data Set the constant and slope assuming a simple exponential going through xmin and xmax of the data set
 
void InitGaus (const ROOT::Fit::BinData &data, TF1 *f1)
 compute initial parameter for gaussian function given the fit data Set the sigma limits for zero top 10* initial rms values Set the initial parameter values in the TF1
 
bool lessRange (const std::pair< double, double > &r1, const std::pair< double, double > &r2)
 
ostream & operator<< (ostream &os, const ROOT::Fit::Box &b)
 
TFitResultPtr UnBinFit (ROOT::Fit::UnBinData *data, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption)
 fit an unbin data set (from tree or from histogram buffer) using a TF1 pointer and fit options.
 

Variables

double gDefaultErrorDef = ROOT::Math::MinimizerOptions::DefaultErrorDef()
 
const int gInitialResultStatus = -99
 

Detailed Description

Namespace for the fitting classes.

Typedef Documentation

◆ Chi2Function

◆ Chi2GradFunction

◆ LogLikelihoodFunction

◆ LogLikelihoodGradFunction

◆ PoissonLLFunction

◆ PoissonLLGradFunction

Enumeration Type Documentation

◆ EChisquareType

enum class ROOT::Fit::EChisquareType
strong
Enumerator
kNeyman 
kPLikeRatio 
kPearson 

Definition at line 53 of file HFitInterface.h.

◆ EFitObjectType

enum class ROOT::Fit::EFitObjectType
strong
Enumerator
kHistogram 
kGraph 

Definition at line 48 of file HFitInterface.h.

Function Documentation

◆ Chisquare() [1/2]

double ROOT::Fit::Chisquare ( const TGraph h1,
TF1 f1,
bool  useRange 
)

compute the chi2 value for a graph given a function (see TGraph::Chisquare)

Definition at line 1031 of file HFitImpl.cxx.

◆ Chisquare() [2/2]

double ROOT::Fit::Chisquare ( const TH1 h1,
TF1 f1,
bool  useRange,
EChisquareType  type 
)

compute the chi2 value for an histogram given a function (see TH1::Chisquare for the documentation)

Definition at line 1027 of file HFitImpl.cxx.

◆ DivideBox()

void ROOT::Fit::DivideBox ( const vector< double > &  min,
const vector< double > &  max,
const vector< double > &  bmin,
const vector< double > &  bmax,
const unsigned int  size,
const unsigned int  n,
list< Box > &  l,
const double  val,
const double  error 
)

Definition at line 151 of file SparseData.cxx.

◆ DoFillData()

void ROOT::Fit::DoFillData ( BinData dv,
const TGraph gr,
BinData::ErrorType  type,
TF1 func 
)

Definition at line 576 of file HFitInterface.cxx.

◆ FillData() [1/7]

void ROOT::Fit::FillData ( BinData dv,
const TGraph gr,
TF1 func = nullptr 
)

fill the data vector from a TGraph.

Pass also the TF1 function which is needed in case to exclude points rejected by the function

Definition at line 792 of file HFitInterface.cxx.

◆ FillData() [2/7]

void ROOT::Fit::FillData ( BinData dv,
const TGraph2D gr,
TF1 func = nullptr 
)

fill the data vector from a TGraph2D.

Pass also the TF1 function which is needed in case of integral option and to reject points rejected by the function

Definition at line 878 of file HFitInterface.cxx.

◆ FillData() [3/7]

void ROOT::Fit::FillData ( BinData dv,
const TH1 hist,
TF1 func = nullptr 
)

fill the data vector from a TH1.

Pass also the TF1 function which is needed in case of integral option and to reject points rejected by the function

Definition at line 107 of file HFitInterface.cxx.

◆ FillData() [4/7]

void ROOT::Fit::FillData ( BinData dv,
const THnBase hist,
TF1 func = nullptr 
)

fill the data vector from a THnBase.

Pass also the TF1 function which is needed in case of integral option and to reject points rejected by the function

Definition at line 760 of file HFitInterface.cxx.

◆ FillData() [5/7]

void ROOT::Fit::FillData ( BinData dv,
const TMultiGraph gr,
TF1 func = nullptr 
)

fill the data vector from a TMultiGraph.

Pass also the TF1 function which is needed in case to exclude points rejected by the function

Definition at line 824 of file HFitInterface.cxx.

◆ FillData() [6/7]

void ROOT::Fit::FillData ( SparseData dv,
const TH1 hist,
TF1 func = nullptr 
)

fill the data vector from a TH1 with sparse data.

Pass also the TF1 function which is needed in case of integral option and to reject points rejected by the function

Definition at line 673 of file HFitInterface.cxx.

◆ FillData() [7/7]

void ROOT::Fit::FillData ( SparseData dv,
const THnBase hist,
TF1 func = nullptr 
)

fill the data vector from a THnBase.

Pass also the TF1 function which is needed in case of integral option and to reject points rejected by the function

Definition at line 717 of file HFitInterface.cxx.

◆ FitObject() [1/5]

TFitResultPtr ROOT::Fit::FitObject ( TGraph gr,
TF1 f1,
Foption_t option,
const ROOT::Math::MinimizerOptions moption,
const char *  goption,
ROOT::Fit::DataRange range 
)

fitting function for a TGraph (called from TGraph::Fit)

Definition at line 984 of file HFitImpl.cxx.

◆ FitObject() [2/5]

TFitResultPtr ROOT::Fit::FitObject ( TGraph2D gr,
TF1 f1,
Foption_t option,
const ROOT::Math::MinimizerOptions moption,
const char *  goption,
ROOT::Fit::DataRange range 
)

fitting function for a TGraph2D (called from TGraph2D::Fit)

Definition at line 998 of file HFitImpl.cxx.

◆ FitObject() [3/5]

TFitResultPtr ROOT::Fit::FitObject ( TH1 h1,
TF1 f1,
Foption_t option,
const ROOT::Math::MinimizerOptions moption,
const char *  goption,
ROOT::Fit::DataRange range 
)

fitting function for a TH1 (called from TH1::Fit)

Definition at line 972 of file HFitImpl.cxx.

◆ FitObject() [4/5]

TFitResultPtr ROOT::Fit::FitObject ( THnBase s1,
TF1 f1,
Foption_t option,
const ROOT::Math::MinimizerOptions moption,
const char *  goption,
ROOT::Fit::DataRange range 
)

fitting function for a THn / THnSparse (called from THnBase::Fit)

Definition at line 1005 of file HFitImpl.cxx.

◆ FitObject() [5/5]

TFitResultPtr ROOT::Fit::FitObject ( TMultiGraph mg,
TF1 f1,
Foption_t option,
const ROOT::Math::MinimizerOptions moption,
const char *  goption,
ROOT::Fit::DataRange range 
)

fitting function for a MultiGraph (called from TMultiGraph::Fit)

Definition at line 991 of file HFitImpl.cxx.

◆ FitOptionsMake()

void ROOT::Fit::FitOptionsMake ( EFitObjectType  type,
const char *  option,
Foption_t fitOption 
)

Decode list of options into fitOption.

Definition at line 685 of file HFitImpl.cxx.

◆ GetConfidenceIntervals()

bool ROOT::Fit::GetConfidenceIntervals ( const TH1 h1,
const ROOT::Fit::FitResult r,
TGraphErrors gr,
double  cl = 0.95 
)

compute confidence intervals at level cl for a fitted histogram h1 in a TGraphErrors gr

Definition at line 965 of file HFitInterface.cxx.

◆ GetDataType() [1/2]

BinData::ErrorType ROOT::Fit::GetDataType ( const TGraph gr,
DataOptions fitOpt 
)

Definition at line 476 of file HFitInterface.cxx.

◆ GetDataType() [2/2]

BinData::ErrorType ROOT::Fit::GetDataType ( const TGraph2D gr,
const DataOptions fitOpt 
)

Definition at line 545 of file HFitInterface.cxx.

◆ Init2DGaus()

void ROOT::Fit::Init2DGaus ( const ROOT::Fit::BinData data,
TF1 f1 
)

compute initial parameter for 2D gaussian function given the fit data Set the sigma limits for zero top 10* initial rms values Set the initial parameter values in the TF1

Compute Initial values of parameters for a gaussian derived from function H1InitGaus defined in TH1.cxx.

Definition at line 388 of file HFitInterface.cxx.

◆ InitExpo()

void ROOT::Fit::InitExpo ( const ROOT::Fit::BinData data,
TF1 f1 
)

compute initial parameter for an exponential function given the fit data Set the constant and slope assuming a simple exponential going through xmin and xmax of the data set

Compute rough values of parameters for an exponential.

Definition at line 267 of file HFitInterface.cxx.

◆ InitGaus()

void ROOT::Fit::InitGaus ( const ROOT::Fit::BinData data,
TF1 f1 
)

compute initial parameter for gaussian function given the fit data Set the sigma limits for zero top 10* initial rms values Set the initial parameter values in the TF1

Compute Initial values of parameters for a gaussian derived from function H1InitGaus defined in TH1.cxx.

Definition at line 306 of file HFitInterface.cxx.

◆ lessRange()

bool ROOT::Fit::lessRange ( const std::pair< double, double > &  r1,
const std::pair< double, double > &  r2 
)

Definition at line 73 of file DataRange.cxx.

◆ operator<<()

ostream & ROOT::Fit::operator<< ( ostream &  os,
const ROOT::Fit::Box b 
)

Definition at line 374 of file SparseData.cxx.

◆ UnBinFit()

TFitResultPtr ROOT::Fit::UnBinFit ( ROOT::Fit::UnBinData data,
TF1 f1,
Foption_t option,
const ROOT::Math::MinimizerOptions moption 
)

fit an unbin data set (from tree or from histogram buffer) using a TF1 pointer and fit options.

N.B. ownership of fit data is passed to the UnBinFit function which will be responsible of deleting the data after the fit. User calling this function MUST NOT delete UnBinData after calling it.

Definition at line 821 of file HFitImpl.cxx.

Variable Documentation

◆ gDefaultErrorDef

double ROOT::Fit::gDefaultErrorDef = ROOT::Math::MinimizerOptions::DefaultErrorDef()

Definition at line 48 of file Fitter.cxx.

◆ gInitialResultStatus

const int ROOT::Fit::gInitialResultStatus = -99

Definition at line 43 of file FitResult.cxx.