338 Error(
"TLinearFitter",
"Trying to fit with a nonlinear function");
367 fParams(
tlf.fParams),
368 fParCovar(
tlf.fParCovar),
369 fTValues(
tlf.fTValues),
370 fParSign(
tlf.fParSign),
371 fDesign(
tlf.fDesign),
372 fDesignTemp(
tlf.fDesignTemp),
373 fDesignTemp2(
tlf.fDesignTemp2),
374 fDesignTemp3(
tlf.fDesignTemp3),
376 fAtbTemp(
tlf.fAtbTemp),
377 fAtbTemp2(
tlf.fAtbTemp2),
378 fAtbTemp3(
tlf.fAtbTemp3),
382 fY2Temp(
tlf.fY2Temp),
385 fInputFunction(
tlf.fInputFunction),
387 fNpoints(
tlf.fNpoints),
388 fNfunctions(
tlf.fNfunctions),
389 fFormulaSize(
tlf.fFormulaSize),
391 fNfixed(
tlf.fNfixed),
392 fSpecial(
tlf.fSpecial),
395 fStoreData(
tlf.fStoreData),
396 fChisquare(
tlf.fChisquare),
398 fRobust(
tlf.fRobust),
399 fFitsample(
tlf.fFitsample),
400 fFixedParams(nullptr)
584 Error(
"AddPoint",
"Point can't be added, because the formula hasn't been set");
602 Error(
"AddData",
"Those points are already added");
650 for (i=1; i<
npar; i++)
652 for (i=0; i<
npar; i++)
658 for (i=0; i<
npar; i++)
675 Error(
"AddToDesign",
"Basis Function %s is of an invalid type %s",obj->
GetName(),obj->
IsA()->GetName());
681 Error(
"AddToDesign",
"Function %s has no linear parts - maybe missing a ++ in the formula expression",
fInputFunction->
GetName());
846 for (i=1; i<
npar; i++)
847 val[i] = val[i-1]*
fX(point, 0);
848 for (i=0; i<
npar; i++)
855 for (i=0; i<
npar; i++)
865 temp2 = (
fY(point)-temp)*(
fY(point)-temp);
894 Error(
"TLinearFitter::Eval",
"The formula hasn't been set");
962 Error(
"Eval",
"Matrix inversion failed");
1020 Error(
"FixParameter",
"no value available to fix the parameter");
1024 Error(
"FixParameter",
"illegal parameter value");
1028 Error(
"FixParameter",
"no free parameters left");
1043 Error(
"FixParameter",
"illegal parameter value");
1047 Error(
"FixParameter",
"no free parameters left");
1065 Error(
"ReleaseParameter",
"illegal parameter value");
1069 Warning(
"ReleaseParameter",
"This parameter is not fixed\n");
1167 Error(
"GetConfidenceIntervals",
"The case of fitting not with a TFormula is not yet implemented");
1176 Error(
"GetConfidenceIntervals",
"A TGraphErrors should be passed instead of a graph");
1180 Error(
"GetConfidenceIntervals",
"A TGraph2DErrors should be passed instead of a graph");
1185 Error(
"GetConfidenceIntervals",
"A TGraph2DErrors or a TH23 should be passed instead of a graph");
1199 Error(
"GetConfidenceIntervals",
"A TGraph2DErrors should be passed instead of a TGraph2D");
1203 Error(
"GetConfidenceIntervals",
"A TGraphErrors should be passed instead of a TGraph2D");
1208 Error(
"GetConfidenceIntervals",
"A TGraphErrors or a TH1 should be passed instead of a graph");
1244 if (((
TH1*)obj)->GetDimension()>1){
1245 Error(
"GetConfidenceIntervals",
"Fitted graph and passed histogram have different number of dimensions");
1250 if (((
TH1*)obj)->GetDimension()!=2){
1251 Error(
"GetConfidenceIntervals",
"Fitted graph and passed histogram have different number of dimensions");
1257 Error(
"GetConfidenceIntervals",
"Fitted and passed histograms have different number of dimensions");
1305 Error(
"GetConfidenceIntervals",
"This object type is not supported");
1372 Error(
"GetParError",
"illegal value of parameter");
1390 Error(
"GetParError",
"illegal value of parameter");
1404 Error(
"GetParError",
"illegal value of parameter");
1418 Error(
"GetParTValue",
"illegal value of parameter");
1432 Error(
"GetParSignificance",
"illegal value of parameter");
1446 Error(
"GetFitSample",
"there is no fit sample in ordinary least-squares fit");
1459 if (!list)
return -1;
1464 Error(
"Add",
"Attempt to add object of class: %s to a %s",
lfit->ClassName(),
this->ClassName());
1505 for (
int i=0; i<
size; i++)
1585 for (i=0; i<
fNdim; i++){
1586 snprintf(pattern,
sizeof(pattern),
"x%d", i);
1609 Error(
"TLinearFitter",
"f_linear not allocated");
1648 for (i=0; i<
size; i++)
1768 printf(
"Fitting results:\nParameters:\nNO.\t\tVALUE\t\tERROR\n");
1773 printf(
"Fitting results:\nParameters:\nNO.\t\tVALUE\n");
1796 Int_t fitResult = 0;
1807 for (
Int_t i=0; i<
n; i++){
1809 e=
grr->GetErrorY(i);
1825 for (
Int_t i=0; i<
n; i++){
1828 temp2=(
y[i]-temp)*(
y[i]-temp);
1829 e=
grr->GetErrorY(i);
1869 for (
Int_t bin=0;bin<
n;bin++) {
1876 e=
gr->GetErrorZ(bin);
1892 for (
Int_t bin=0; bin<
n; bin++){
1900 temp=f2->
Eval(
x[0],
x[1]);
1901 temp2=(z-temp)*(z-temp);
1902 e=
gr->GetErrorZ(bin);
1943 for (i=0; i<
n; i++){
1967 for (i=0; i<
n; i++){
2025 cu =
hfit->GetBinContent(bin);
2027 if (
hfit->GetDimension() > 2)
cu =
x[2];
2034 eu =
hfit->GetBinError(bin);
2035 if (eu <= 0)
continue;
2055 cu =
hfit->GetBinContent(bin);
2061 eu =
hfit->GetBinError(bin);
2062 if (eu <= 0)
continue;
2083 if (
R__b.IsReading()) {
2121 Error(
"TLinearFitter::EvalRobust",
"The formula hasn't been set");
2127 for (i=0; i<
nbest; i++)
2136 if (
h>0)
Warning(
"Fitting:",
"illegal value of H, default is taken, h = %3.2f",
double(
hdef)/
fNpoints);
2152 for (k = 0; k <
k1; k++) {
2167 for (i=0; i<
nbest; i++) {
2180 for (
j=0;
j<
fH;
j++){
2192 for (
j=0;
j<
fH;
j++){
2228 for (i=0; i<
nbest; i++)
2230 for (k=0; k<
k2; k++) {
2247 for (i=0; i<
nbest; i++)
2251 for (k=0; k<
nbest*5; k++) {
2264 for (k=0; k<
nbest; k++) {
2286 for (
j=0;
j<
fH;
j++)
2321 for(
j=0;
j<=i-1;
j++) {
2351 for(i=0; i<
nindex; i++) {
2380 for (i=0; i<
n; i++) {
2425 val[
j] = val[
j-1]*
fX(i, 0);
2456 if (step==1)
return 0;
2461 for (i=0; i<
h; i++) {
2492 for (i=0; i<
h; i++) {
2556 Error(
"Linf",
"Matrix inversion failed");
2609 for(
Int_t i=0; i<5; i++)
2628 for (i=0; i<5; i++) {
2633 for (k=1; k<=
ngroup; k++) {
2641 for (i=1; i<=
jndex-1; i++) {
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint xy
TMatrixTRow< Double_t > TMatrixDRow
R__EXTERN TVirtualMutex * gROOTMutex
#define R__LOCKGUARD(mutex)
const_iterator end() const
Class to manage histogram axis.
void Clear(Option_t *option="") override
Clear the value.
Bool_t TestBitNumber(UInt_t bitnumber) const
void SetBitNumber(UInt_t bitnumber, Bool_t value=kTRUE)
Buffer base class used for serializing objects.
Collection abstract base class.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Cholesky Decomposition class.
virtual void SetChisquare(Double_t chi2)
virtual TFormula * GetFormula()
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=nullptr)
Evaluate function with given coordinates and parameters.
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
virtual Bool_t IsInside(const Double_t *x) const
return kTRUE if the point is inside the function range
virtual Int_t GetNdim() const
A 2-Dim function with parameters.
Bool_t IsInside(const Double_t *x) const override
Return kTRUE is the point is inside the function range.
Graphics object made of three arrays X, Y and Z with the same number of points each.
Double_t GetErrorY(Int_t bin) const override
It returns the error along Y at point i.
Double_t * GetEY() const override
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
TH1 is the base class of all histogram classes in ROOT.
virtual void AddTempMatrices()
TMatrixDSym fDesignTemp2
temporary matrix, used for num.stability
Int_t GraphLinearFitter(Double_t h)
Used in TGraph::Fit().
~TLinearFitter() override
Linear fitter cleanup.
virtual Double_t GetChisquare()
Get the Chisquare.
Int_t Partition(Int_t nmini, Int_t *indsubdat)
divides the elements into approximately equal subgroups number of elements in each subgroup is stored...
virtual void GetErrors(TVectorD &vpar)
Returns parameter errors.
Double_t CStep(Int_t step, Int_t h, Double_t *residuals, Int_t *index, Int_t *subdat, Int_t start, Int_t end)
The CStep procedure, as described in the article.
virtual Int_t Merge(TCollection *list)
Merge objects in list.
void ComputeTValues()
Computes parameters' t-values and significance.
void Clear(Option_t *option="") override
Clears everything. Used in TH1::Fit and TGraph::Fit().
TLinearFitter()
default c-tor, input data is stored If you don't want to store the input data, run the function Store...
const char * GetParName(Int_t ipar) const override
Returns name of parameter #ipar
Int_t MultiGraphLinearFitter(Double_t h)
Minimisation function for a TMultiGraph.
virtual Double_t GetParSignificance(Int_t ipar)
Returns the significance of parameter #ipar
virtual Int_t Eval()
Perform the fit and evaluate the parameters Returns 0 if the fit is ok, 1 if there are errors.
TVectorD fAtbTemp2
temporary vector, used for num.stability
void PrintResults(Int_t level, Double_t amin=0) const override
Level = 3 (to be consistent with minuit) prints parameters and parameter errors.
Int_t HistLinearFitter()
Minimization function for H1s using a Chisquare method.
Int_t Graph2DLinearFitter(Double_t h)
Minimisation function for a TGraph2D.
virtual void ClearPoints()
To be used when different sets of points are fitted with the same formula.
TObjArray fFunctions
map of basis functions and formula
Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs) override
To use in TGraph::Fit and TH1::Fit().
virtual void GetFitSample(TBits &bits)
For robust lts fitting, returns the sample, on which the best fit was based.
virtual void Add(TLinearFitter *tlf)
Add another linear fitter to this linear fitter.
virtual void GetDesignMatrix(TMatrixD &matr)
Returns the internal design matrix.
void Streamer(TBuffer &) override
Stream an object of class TObject.
virtual void AssignData(Int_t npoints, Int_t xncols, Double_t *x, Double_t *y, Double_t *e=nullptr)
This function is to use when you already have all the data in arrays and don't want to copy them into...
virtual void GetParameters(TVectorD &vpar)
Returns parameter values.
void RDraw(Int_t *subdat, Int_t *indsubdat)
Draws ngroup nonoverlapping subdatasets out of a dataset of size n such that the selected case number...
static std::map< TString, TFormula * > fgFormulaMap
virtual void SetDim(Int_t n)
set the number of dimensions
TFormula * fInputFunction
void GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t *x, Double_t *ci, Double_t cl=0.95) override
Computes point-by-point confidence intervals for the fitted function Parameters: n - number of points...
TMatrixD fX
temporary variable used for num.stability
virtual Bool_t UpdateMatrix()
Update the design matrix after the formula has been changed.
virtual void GetAtbVector(TVectorD &v)
Get the Atb vector - a vector, used for internal computations.
virtual void Chisquare()
Calculates the chisquare.
virtual void SetBasisFunctions(TObjArray *functions)
set the basis functions in case the fitting function is not set directly The TLinearFitter will manag...
virtual Int_t EvalRobust(Double_t h=-1)
Finds the parameters of the fitted function in case data contains outliers.
Double_t GetParError(Int_t ipar) const override
Returns the error of parameter #ipar
void AddToDesign(Double_t *x, Double_t y, Double_t e)
Add a point to the AtA matrix and to the Atb vector.
void FixParameter(Int_t ipar) override
Fixes paramter #ipar at its current value.
TLinearFitter & operator=(const TLinearFitter &tlf)
Assignment operator.
void CreateSubset(Int_t ntotal, Int_t h, Int_t *index)
Creates a p-subset to start ntotal - total number of points from which the subset is chosen.
virtual void SetFormula(const char *formula)
Additive parts should be separated by "++".
void ReleaseParameter(Int_t ipar) override
Releases parameter #ipar.
virtual void AddPoint(Double_t *x, Double_t y, Double_t e=1)
Adds 1 point to the fitter.
virtual Double_t GetParTValue(Int_t ipar)
Returns the t-value for parameter #ipar
Double_t * GetCovarianceMatrix() const override
Returns covariance matrix.
Double_t GetParameter(Int_t ipar) const override
virtual void StoreData(Bool_t store)
virtual TMatrixTBase< Element > & Zero()
Set matrix elements to zero.
TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1) override
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
void Clear(Option_t *="") override
const Element * GetMatrixArray() const override
TMatrixT< Element > & Use(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Element *data)
Use the array data to fill the matrix ([row_lwb..row_upb] x [col_lwb..col_upb])
void Clear(Option_t *="") override
const Element * GetMatrixArray() const override
TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1) override
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
A TMultiGraph is a collection of TGraph (or derived) objects.
TList * GetListOfGraphs() const
const char * GetName() const override
Returns name of object.
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
void Clear(Option_t *option="") override
Remove all objects from the array.
Int_t GetEntries() const override
Return the number of objects in array (i.e.
void Delete(Option_t *option="") override
Remove all objects from the array AND delete all heap based objects.
TObject * UncheckedAt(Int_t i) const
Bool_t IsEmpty() const override
void Add(TObject *obj) override
Collectable string class.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual TClass * IsA() const
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
This is the base class for the ROOT Random number generators.
TVectorT< Element > & Zero()
Set vector elements to zero.
TVectorT< Element > & ResizeTo(Int_t lwb, Int_t upb)
Resize the vector to [lwb:upb] .
TVectorT< Element > & Use(Int_t lwb, Int_t upb, Element *data)
Use the array data to fill the vector lwb..upb].
void Clear(Option_t *="") override
Int_t NonZeros() const
Compute the number of elements != 0.0.
Int_t GetNoElements() const
Element * GetMatrixArray()
Abstract Base Class for Fitting.
virtual Int_t GetXlast() const
virtual Int_t GetYfirst() const
virtual TObject * GetObjectFit() const
virtual Foption_t GetFitOption() const
virtual Int_t GetZfirst() const
virtual Int_t GetZlast() const
virtual Int_t GetXfirst() const
TObject * fObjectFit
Pointer to object being fitted.
virtual Int_t GetYlast() const
TVirtualFitter & operator=(const TVirtualFitter &tvf)
assignment operator
static TVirtualFitter * GetFitter()
static: return the current Fitter
virtual TObject * GetUserFunc() const
Element KOrdStat(Size n, const Element *a, Size k, Size *work=0)
Returns k_th order statistic of the array a of size n (k_th smallest element out of n elements).
Long64_t LocMin(Long64_t n, const T *a)
Returns index of array with the minimum element.
T MinElement(Long64_t n, const T *a)
Returns minimum of array a of length n.
Long64_t LocMax(Long64_t n, const T *a)
Returns index of array with the maximum element.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t StudentI(Double_t T, Double_t ndf)
Calculates the cumulative distribution function of Student's t-distribution second parameter stands f...
Double_t StudentQuantile(Double_t p, Double_t ndf, Bool_t lower_tail=kTRUE)
Computes quantiles of the Student's t-distribution 1st argument is the probability,...
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
static uint64_t sum(uint64_t i)