Multidimensional Fits in ROOT.
A common problem encountered in different fields of applied science is to find an expression for one physical quantity in terms of several others, which are directly measurable.
An example in high energy physics is the evaluation of the momentum of a charged particle from the observation of its trajectory in a magnetic field. The problem is to relate the momentum of the particle to the observations, which may consists of positional measurements at intervals along the particle trajectory.
The exact functional relationship between the measured quantities (e.g., the space-points) and the dependent quantity (e.g., the momentum) is in general not known, but one possible way of solving the problem, is to find an expression which reliably approximates the dependence of the momentum on the observations.
This explicit function of the observations can be obtained by a least squares fitting procedure applied to a representative sample of the data, for which the dependent quantity (e.g., momentum) and the independent observations are known. The function can then be used to compute the quantity of interest for new observations of the independent variables.
This class TMultiDimFit
implements such a procedure in ROOT. It is largely based on the CERNLIB MUDIFI package 2. Though the basic concepts are still sound, and therefore kept, a few implementation details have changed, and this class can take advantage of MINUIT 4 to improve the errors of the fitting, thanks to the class TMinuit.
In 5 and 6 H. Wind demonstrates the utility of this procedure in the context of tracking, magnetic field parameterisation, and so on. The outline of the method used in this class is based on Winds discussion, and I refer these two excellents text for more information.
And example of usage is given in multidimfit.C.
Let
where
such that
is minimal. Here
So what TMultiDimFit does, is to determine the number of terms
Of course it's more than a little unlikely that
Optionally, the user may impose a functional expression by specifying the powers of each variable in
As always when dealing with fits, there's a real chance of over fitting. As is well-known, it's always possible to fit an
However, since there's an infinite number of
One way of obtaining values for the maximum power in variable
There are still a huge amount of possible choices for
where
To further reduce the number of functions in the final expression, only those functions that significantly reduce
The functions
So we are let to consider an
where
and
We now take as a new model
where
or
Let
Using 9, we see that
So for each new function
Supposing that
The sum of squares of residuals can be written as
where the relation 9 have been taken into account. The contribution of the
Two test are now applied to decide whether this
Denoting by
Let
However, the method automatically readjusts the value of this angle while fitting is in progress, in order to make the selection criteria less and less difficult to be fulfilled. The result is that the functions contributing most to the reduction of
In case
where
From this we see, that by restricting
The more coefficients we evaluate, the more the sum of squares of residuals
Having found a parameterization, that is the
where
Consequently,
The model
The original model
The reason we use
It's important to realize that the training sample should be representative of the problem at hand, in particular along the borders of the region of interest. This is because the algorithm presented here, is a interpolation, rather then a extrapolation 5.
Also, the independent variables
H. Wind also outlines a method for parameterising a multidimensional dependence over a multidimensional set of variables. An example of the method from 5, is a follows (please refer to 5 for a full discussion):
To process data, using this parameterisation, do
The class also provides functionality for testing the, over the training sample, found parameterization (TMultiDimFit::Fit). This is done by passing the class a test sample of
The parameterization is then evaluated at every
is evaluated. The relative error over the test sample
should not be to low or high compared to
It's possible to use 4 to further improve the fit, using the test sample.
Christian Holm
Definition at line 15 of file TMultiDimFit.h.
Public Types | |
enum | EMDFPolyType { kMonomials , kChebyshev , kLegendre } |
![]() | |
enum | { kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 , kBitMask = 0x00ffffff } |
enum | { kSingleKey = (1ULL << ( 0 )) , kOverwrite = (1ULL << ( 1 )) , kWriteDelete = (1ULL << ( 2 )) } |
enum | EDeprecatedStatusBits { kObjInCanvas = (1ULL << ( 3 )) } |
enum | EStatusBits { kCanDelete = (1ULL << ( 0 )) , kMustCleanup = (1ULL << ( 3 )) , kIsReferenced = (1ULL << ( 4 )) , kHasUUID = (1ULL << ( 5 )) , kCannotPick = (1ULL << ( 6 )) , kNoContextMenu = (1ULL << ( 8 )) , kInvalidObject = (1ULL << ( 13 )) } |
Public Member Functions | |
TMultiDimFit () | |
Empty CTOR. Do not use. | |
TMultiDimFit (Int_t dimension, EMDFPolyType type=kMonomials, Option_t *option="") | |
Constructor Second argument is the type of polynomials to use in parameterisation, one of: TMultiDimFit::kMonomials TMultiDimFit::kChebyshev TMultiDimFit::kLegendre. | |
~TMultiDimFit () override | |
Destructor. | |
virtual void | AddRow (const Double_t *x, Double_t D, Double_t E=0) |
Add a row consisting of fNVariables independent variables, the known, dependent quantity, and optionally, the square error in the dependent quantity, to the training sample to be used for the parameterization. | |
virtual void | AddTestRow (const Double_t *x, Double_t D, Double_t E=0) |
Add a row consisting of fNVariables independent variables, the known, dependent quantity, and optionally, the square error in the dependent quantity, to the test sample to be used for the test of the parameterization. | |
void | Browse (TBrowser *b) override |
Browse the TMultiDimFit object in the TBrowser. | |
void | Clear (Option_t *option="") override |
Clear internal structures and variables. | |
void | Draw (Option_t *="d") override |
Default Draw method for all objects. | |
virtual Double_t | Eval (const Double_t *x, const Double_t *coeff=nullptr) const |
Evaluate parameterization at point x. | |
virtual Double_t | EvalError (const Double_t *x, const Double_t *coeff=nullptr) const |
Evaluate parameterization error at point x. | |
virtual void | FindParameterization (Option_t *option="") |
Find the parameterization. | |
virtual void | Fit (Option_t *option="") |
Try to fit the found parameterisation to the test sample. | |
Double_t | GetChi2 () const |
const TVectorD * | GetCoefficients () const |
const TVectorD * | GetCoefficientsRMS () const |
const TMatrixD * | GetCorrelationMatrix () const |
Double_t | GetError () const |
Int_t * | GetFunctionCodes () const |
const TMatrixD * | GetFunctions () const |
virtual TList * | GetHistograms () const |
Double_t | GetMaxAngle () const |
Int_t | GetMaxFunctions () const |
Int_t * | GetMaxPowers () const |
Double_t | GetMaxQuantity () const |
Int_t | GetMaxStudy () const |
Int_t | GetMaxTerms () const |
const TVectorD * | GetMaxVariables () const |
Double_t | GetMeanQuantity () const |
const TVectorD * | GetMeanVariables () const |
Double_t | GetMinAngle () const |
Double_t | GetMinQuantity () const |
Double_t | GetMinRelativeError () const |
const TVectorD * | GetMinVariables () const |
Int_t | GetNCoefficients () const |
Int_t | GetNVariables () const |
Int_t | GetPolyType () const |
Int_t * | GetPowerIndex () const |
Double_t | GetPowerLimit () const |
const Int_t * | GetPowers () const |
Double_t | GetPrecision () const |
const TVectorD * | GetQuantity () const |
Double_t | GetResidualMax () const |
Int_t | GetResidualMaxRow () const |
Double_t | GetResidualMin () const |
Int_t | GetResidualMinRow () const |
Double_t | GetResidualSumSq () const |
Double_t | GetRMS () const |
Int_t | GetSampleSize () const |
const TVectorD * | GetSqError () const |
Double_t | GetSumSqAvgQuantity () const |
Double_t | GetSumSqQuantity () const |
Double_t | GetTestError () const |
Double_t | GetTestPrecision () const |
const TVectorD * | GetTestQuantity () const |
Int_t | GetTestSampleSize () const |
const TVectorD * | GetTestSqError () const |
const TVectorD * | GetTestVariables () const |
const TVectorD * | GetVariables () const |
TClass * | IsA () const override |
Bool_t | IsFolder () const override |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). | |
virtual Double_t | MakeChi2 (const Double_t *coeff=nullptr) |
Calculate Chi square over either the test sample. | |
virtual void | MakeCode (const char *functionName="MDF", Option_t *option="") |
Generate the file <filename> with .C appended if argument doesn't end in .cxx or .C. | |
virtual void | MakeHistograms (Option_t *option="A") |
Make histograms of the result of the analysis. | |
virtual void | MakeMethod (const Char_t *className="MDF", Option_t *option="") |
Generate the file <classname>MDF.cxx which contains the implementation of the method: | |
void | Print (Option_t *option="ps") const override |
Print statistics etc. | |
void | SetBinVarX (Int_t nbbinvarx) |
void | SetBinVarY (Int_t nbbinvary) |
void | SetMaxAngle (Double_t angle=0) |
Set the max angle (in degrees) between the initial data vector to be fitted, and the new candidate function to be included in the fit. | |
void | SetMaxFunctions (Int_t n) |
void | SetMaxPowers (const Int_t *powers) |
Set the maximum power to be considered in the fit for each variable. | |
void | SetMaxStudy (Int_t n) |
void | SetMaxTerms (Int_t terms) |
void | SetMinAngle (Double_t angle=1) |
Set the min angle (in degrees) between a new candidate function and the subspace spanned by the previously accepted functions. | |
void | SetMinRelativeError (Double_t error) |
Set the acceptable relative error for when sum of square residuals is considered minimized. | |
void | SetPowerLimit (Double_t limit=1e-3) |
Set the user parameter for the function selection. | |
virtual void | SetPowers (const Int_t *powers, Int_t terms) |
Define a user function. | |
void | Streamer (TBuffer &) override |
Stream an object of class TObject. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
![]() | |
TNamed () | |
TNamed (const char *name, const char *title) | |
TNamed (const TNamed &named) | |
TNamed copy ctor. | |
TNamed (const TString &name, const TString &title) | |
virtual | ~TNamed () |
TNamed destructor. | |
void | Clear (Option_t *option="") override |
Set name and title to empty strings (""). | |
TObject * | Clone (const char *newname="") const override |
Make a clone of an object using the Streamer facility. | |
Int_t | Compare (const TObject *obj) const override |
Compare two TNamed objects. | |
void | Copy (TObject &named) const override |
Copy this to obj. | |
virtual void | FillBuffer (char *&buffer) |
Encode TNamed into output buffer. | |
const char * | GetName () const override |
Returns name of object. | |
const char * | GetTitle () const override |
Returns title of object. | |
ULong_t | Hash () const override |
Return hash value for this object. | |
TClass * | IsA () const override |
Bool_t | IsSortable () const override |
void | ls (Option_t *option="") const override |
List TNamed name and title. | |
TNamed & | operator= (const TNamed &rhs) |
TNamed assignment operator. | |
void | Print (Option_t *option="") const override |
Print TNamed name and title. | |
virtual void | SetName (const char *name) |
Set the name of the TNamed. | |
virtual void | SetNameTitle (const char *name, const char *title) |
Set all the TNamed parameters (name and title). | |
virtual void | SetTitle (const char *title="") |
Set the title of the TNamed. | |
virtual Int_t | Sizeof () const |
Return size of the TNamed part of the TObject. | |
void | Streamer (TBuffer &) override |
Stream an object of class TObject. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
![]() | |
TObject () | |
TObject constructor. | |
TObject (const TObject &object) | |
TObject copy ctor. | |
virtual | ~TObject () |
TObject destructor. | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. | |
ULong_t | CheckedHash () |
Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. | |
virtual void | Delete (Option_t *option="") |
Delete this object. | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1) . | |
virtual void | Dump () const |
Dump contents of object on stdout. | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. | |
virtual void | Execute (const char *method, const char *params, Int_t *error=nullptr) |
Execute method on this object with the given parameter string, e.g. | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
Execute method on this object with parameters stored in the TObjArray. | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. | |
virtual const char * | GetIconName () const |
Returns mime type name of object. | |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). | |
virtual Option_t * | GetOption () const |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. | |
Bool_t | HasInconsistentHash () const |
Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. | |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. | |
void | InvertBit (UInt_t f) |
Bool_t | IsDestructed () const |
IsDestructed. | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). | |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). | |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification (the base implementation is no-op). | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. | |
void | operator delete (void *ptr) |
Operator delete. | |
void | operator delete (void *ptr, void *vp) |
Only called by placement new when throwing an exception. | |
void | operator delete[] (void *ptr) |
Operator delete []. | |
void | operator delete[] (void *ptr, void *vp) |
Only called by placement new[] when throwing an exception. | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. | |
virtual void | Paint (Option_t *option="") |
This method must be overridden if a class wants to paint itself. | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. | |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". | |
void | SetBit (UInt_t f) |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. | |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. | |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static TMultiDimFit * | Instance () |
Return the static instance. | |
![]() | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
![]() | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Longptr_t | GetDtorOnly () |
Return destructor only flag. | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. | |
Protected Member Functions | |
virtual Double_t | EvalControl (const Int_t *powers) const |
PRIVATE METHOD: Calculate the control parameter from the passed powers. | |
virtual Double_t | EvalFactor (Int_t p, Double_t x) const |
PRIVATE METHOD: Evaluate function with power p at variable value x. | |
virtual void | MakeCandidates () |
PRIVATE METHOD: Create list of candidate functions for the parameterisation. | |
virtual void | MakeCoefficientErrors () |
PRIVATE METHOD: Compute the errors on the coefficients. | |
virtual void | MakeCoefficients () |
PRIVATE METHOD: Invert the model matrix B, and compute final coefficients. | |
virtual void | MakeCorrelation () |
PRIVATE METHOD: Compute the correlation matrix. | |
virtual Double_t | MakeGramSchmidt (Int_t function) |
PRIVATE METHOD: Make Gram-Schmidt orthogonalisation. | |
virtual void | MakeNormalized () |
PRIVATE METHOD: Normalize data to the interval [-1;1]. | |
virtual void | MakeParameterization () |
PRIVATE METHOD: Find the parameterization over the training sample. | |
virtual void | MakeRealCode (const char *filename, const char *classname, Option_t *option="") |
PRIVATE METHOD: This is the method that actually generates the code for the evaluation the parameterization on some point. | |
virtual Bool_t | Select (const Int_t *iv) |
Selection method. | |
virtual Bool_t | TestFunction (Double_t squareResidual, Double_t dResidur) |
PRIVATE METHOD: Test whether the currently considered function contributes to the fit. | |
![]() | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). | |
void | MakeZombie () |
Protected Attributes | |
Int_t | fBinVarX |
Number of bin in independent variables. | |
Int_t | fBinVarY |
Number of bin in dependent variables. | |
Double_t | fChi2 |
Chi square of fit. | |
TVectorD | fCoefficients |
Vector of the final coefficients. | |
TVectorD | fCoefficientsRMS |
Vector of RMS of coefficients. | |
Double_t | fCorrelationCoeff |
Multi Correlation coefficient. | |
TMatrixD | fCorrelationMatrix |
Correlation matrix. | |
Double_t | fError |
Error from parametrization. | |
TVirtualFitter * | fFitter |
Int_t * | fFunctionCodes |
[fMaxFunctions] acceptance code | |
TMatrixD | fFunctions |
Functions evaluated over sample. | |
Byte_t | fHistogramMask |
Bit pattern of histograms used. | |
TList * | fHistograms |
List of histograms. | |
Bool_t | fIsUserFunction |
Flag for user defined function. | |
Bool_t | fIsVerbose |
Double_t | fMaxAngle |
Max angle for accepting new function. | |
Int_t | fMaxFuncNV |
fMaxFunctions*fNVariables | |
Int_t | fMaxFunctions |
max number of functions | |
Int_t * | fMaxPowers |
[fNVariables] maximum powers | |
Int_t * | fMaxPowersFinal |
[fNVariables] maximum powers from fit; | |
Double_t | fMaxQuantity |
Max value of dependent quantity. | |
Double_t | fMaxResidual |
Max residual value. | |
Int_t | fMaxResidualRow |
Row giving max residual. | |
Int_t | fMaxStudy |
max functions to study | |
Int_t | fMaxTerms |
Max terms expected in final expr. | |
TVectorD | fMaxVariables |
max value of independent variables | |
Double_t | fMeanQuantity |
Mean of dependent quantity. | |
TVectorD | fMeanVariables |
mean value of independent variables | |
Double_t | fMinAngle |
Min angle for accepting new function. | |
Double_t | fMinQuantity |
Min value of dependent quantity. | |
Double_t | fMinRelativeError |
Min relative error accepted. | |
Double_t | fMinResidual |
Min residual value. | |
Int_t | fMinResidualRow |
Row giving min residual. | |
TVectorD | fMinVariables |
min value of independent variables | |
Int_t | fNCoefficients |
Dimension of model coefficients. | |
Int_t | fNVariables |
Number of independent variables. | |
TVectorD | fOrthCoefficients |
The model coefficients. | |
TMatrixD | fOrthCurvatureMatrix |
Model matrix. | |
TVectorD | fOrthFunctionNorms |
Norm of the evaluated functions. | |
TMatrixD | fOrthFunctions |
As above, but orthogonalised. | |
Int_t | fParameterisationCode |
Exit code of parameterisation. | |
EMDFPolyType | fPolyType |
Fit object (MINUIT) | |
Int_t * | fPowerIndex |
[fMaxTerms] Index of accepted powers | |
Double_t | fPowerLimit |
Control parameter. | |
Int_t * | fPowers |
[fMaxFuncNV] where fMaxFuncNV = fMaxFunctions*fNVariables | |
Double_t | fPrecision |
Relative precision of param. | |
TVectorD | fQuantity |
Training sample, dependent quantity. | |
TVectorD | fResiduals |
Vector of the final residuals. | |
Double_t | fRMS |
Root mean square of fit. | |
Int_t | fSampleSize |
Size of training sample. | |
Bool_t | fShowCorrelation |
print correlation matrix | |
TVectorD | fSqError |
Training sample, error in quantity. | |
Double_t | fSumSqAvgQuantity |
Sum of squares away from mean. | |
Double_t | fSumSqQuantity |
SumSquare of dependent quantity. | |
Double_t | fSumSqResidual |
Sum of Square residuals. | |
Double_t | fTestCorrelationCoeff |
Multi Correlation coefficient. | |
Double_t | fTestError |
Error from test. | |
Double_t | fTestPrecision |
Relative precision of test. | |
TVectorD | fTestQuantity |
Test sample, dependent quantity. | |
Int_t | fTestSampleSize |
Size of test sample. | |
TVectorD | fTestSqError |
Test sample, Error in quantity. | |
TVectorD | fTestVariables |
Test sample, independent variables. | |
TVectorD | fVariables |
Training sample, independent variables. | |
![]() | |
TString | fName |
TString | fTitle |
Static Private Attributes | |
static TMultiDimFit * | fgInstance = nullptr |
Additional Inherited Members | |
![]() | |
enum | { kOnlyPrepStep = (1ULL << ( 3 )) } |
#include <TMultiDimFit.h>
Enumerator | |
---|---|
kMonomials | |
kChebyshev | |
kLegendre |
Definition at line 18 of file TMultiDimFit.h.
TMultiDimFit::TMultiDimFit | ( | ) |
Empty CTOR. Do not use.
Definition at line 433 of file TMultiDimFit.cxx.
TMultiDimFit::TMultiDimFit | ( | Int_t | dimension, |
EMDFPolyType | type = kMonomials, | ||
Option_t * | option = "" ) |
Constructor Second argument is the type of polynomials to use in parameterisation, one of: TMultiDimFit::kMonomials TMultiDimFit::kChebyshev TMultiDimFit::kLegendre.
Options: K Compute (k)correlation matrix V Be verbose
Default is no options.
Definition at line 508 of file TMultiDimFit.cxx.
|
override |
Destructor.
Definition at line 586 of file TMultiDimFit.cxx.
Add a row consisting of fNVariables independent variables, the known, dependent quantity, and optionally, the square error in the dependent quantity, to the training sample to be used for the parameterization.
The mean of the variables and quantity is calculated on the fly, as outlined in TPrincipal::AddRow. This sample should be representative of the problem at hand. Please note, that if no error is given Poisson statistics is assumed and the square error is set to the value of dependent quantity. See also the class description
Definition at line 611 of file TMultiDimFit.cxx.
Add a row consisting of fNVariables independent variables, the known, dependent quantity, and optionally, the square error in the dependent quantity, to the test sample to be used for the test of the parameterization.
This sample needn't be representative of the problem at hand. Please note, that if no error is given Poisson statistics is assumed and the square error is set to the value of dependent quantity. See also the class description
Definition at line 690 of file TMultiDimFit.cxx.
|
overridevirtual |
Browse the TMultiDimFit object in the TBrowser.
Reimplemented from TObject.
Definition at line 737 of file TMultiDimFit.cxx.
|
static |
Definition at line 207 of file TMultiDimFit.h.
|
overridevirtual |
Clear internal structures and variables.
Reimplemented from TObject.
Definition at line 789 of file TMultiDimFit.cxx.
|
inlinestatic |
Definition at line 207 of file TMultiDimFit.h.
|
inlineoverridevirtual |
Default Draw method for all objects.
Reimplemented from TObject.
Definition at line 134 of file TMultiDimFit.h.
Evaluate parameterization at point x.
Optional argument coeff is a vector of coefficients for the parameterisation, fNCoefficients elements long.
Definition at line 876 of file TMultiDimFit.cxx.
PRIVATE METHOD: Calculate the control parameter from the passed powers.
Definition at line 937 of file TMultiDimFit.cxx.
|
virtual |
Evaluate parameterization error at point x.
Optional argument coeff is a vector of coefficients for the parameterisation, fNCoefficients elements long.
Definition at line 904 of file TMultiDimFit.cxx.
PRIVATE METHOD: Evaluate function with power p at variable value x.
Definition at line 952 of file TMultiDimFit.cxx.
|
virtual |
Find the parameterization.
Options: None so far
For detailed description of what this entails, please refer to the class description
Definition at line 994 of file TMultiDimFit.cxx.
|
virtual |
Try to fit the found parameterisation to the test sample.
Options M use Minuit to improve coefficients
Also, refer to class description
Definition at line 1013 of file TMultiDimFit.cxx.
|
inline |
Definition at line 140 of file TMultiDimFit.h.
|
inline |
Definition at line 142 of file TMultiDimFit.h.
|
inline |
Definition at line 143 of file TMultiDimFit.h.
|
inline |
Definition at line 141 of file TMultiDimFit.h.
|
inline |
Definition at line 144 of file TMultiDimFit.h.
|
inline |
Definition at line 145 of file TMultiDimFit.h.
|
inline |
Definition at line 146 of file TMultiDimFit.h.
Definition at line 147 of file TMultiDimFit.h.
|
inline |
Definition at line 148 of file TMultiDimFit.h.
|
inline |
Definition at line 149 of file TMultiDimFit.h.
|
inline |
Definition at line 150 of file TMultiDimFit.h.
|
inline |
Definition at line 151 of file TMultiDimFit.h.
|
inline |
Definition at line 152 of file TMultiDimFit.h.
|
inline |
Definition at line 153 of file TMultiDimFit.h.
|
inline |
Definition at line 154 of file TMultiDimFit.h.
|
inline |
Definition at line 155 of file TMultiDimFit.h.
|
inline |
Definition at line 156 of file TMultiDimFit.h.
|
inline |
Definition at line 157 of file TMultiDimFit.h.
|
inline |
Definition at line 158 of file TMultiDimFit.h.
|
inline |
Definition at line 159 of file TMultiDimFit.h.
|
inline |
Definition at line 160 of file TMultiDimFit.h.
|
inline |
Definition at line 162 of file TMultiDimFit.h.
|
inline |
Definition at line 161 of file TMultiDimFit.h.
|
inline |
Definition at line 163 of file TMultiDimFit.h.
|
inline |
Definition at line 164 of file TMultiDimFit.h.
|
inline |
Definition at line 165 of file TMultiDimFit.h.
|
inline |
Definition at line 166 of file TMultiDimFit.h.
|
inline |
Definition at line 167 of file TMultiDimFit.h.
|
inline |
Definition at line 168 of file TMultiDimFit.h.
|
inline |
Definition at line 169 of file TMultiDimFit.h.
|
inline |
Definition at line 171 of file TMultiDimFit.h.
|
inline |
Definition at line 170 of file TMultiDimFit.h.
|
inline |
Definition at line 172 of file TMultiDimFit.h.
|
inline |
Definition at line 173 of file TMultiDimFit.h.
|
inline |
Definition at line 174 of file TMultiDimFit.h.
|
inline |
Definition at line 175 of file TMultiDimFit.h.
|
inline |
Definition at line 176 of file TMultiDimFit.h.
|
inline |
Definition at line 177 of file TMultiDimFit.h.
|
inline |
Definition at line 178 of file TMultiDimFit.h.
|
inline |
Definition at line 179 of file TMultiDimFit.h.
|
inline |
Definition at line 180 of file TMultiDimFit.h.
|
inline |
Definition at line 181 of file TMultiDimFit.h.
|
inline |
Definition at line 182 of file TMultiDimFit.h.
|
inline |
Definition at line 183 of file TMultiDimFit.h.
|
inline |
Definition at line 184 of file TMultiDimFit.h.
|
inline |
Definition at line 185 of file TMultiDimFit.h.
|
static |
Return the static instance.
Definition at line 1099 of file TMultiDimFit.cxx.
|
inlineoverridevirtual |
Reimplemented from TObject.
Definition at line 207 of file TMultiDimFit.h.
|
inlineoverridevirtual |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Reimplemented from TObject.
Definition at line 188 of file TMultiDimFit.h.
|
protectedvirtual |
PRIVATE METHOD: Create list of candidate functions for the parameterisation.
See also class description
Definition at line 1110 of file TMultiDimFit.cxx.
Calculate Chi square over either the test sample.
The optional argument coeff is a vector of coefficients to use in the evaluation of the parameterisation. If coeff == 0, then the found coefficients is used. Used my MINUIT for fit (see TMultDimFit::Fit)
Definition at line 1240 of file TMultiDimFit.cxx.
|
virtual |
Generate the file <filename>
with .C appended if argument doesn't end in .cxx or .C.
The contains the implementation of the function:
Double_t <funcname>(Double_t *x)
which does the same as TMultiDimFit::Eval. Please refer to this method.
Further, the static variables:
Int_t gNVariables Int_t gNCoefficients Double_t gDMean Double_t gXMean[] Double_t gXMin[] Double_t gXMax[] Double_t gCoefficient[] Int_t gPower[]
are initialized. The only ROOT header file needed is Rtypes.h
See TMultiDimFit::MakeRealCode for a list of options
Definition at line 1290 of file TMultiDimFit.cxx.
|
protectedvirtual |
PRIVATE METHOD: Compute the errors on the coefficients.
For this to be done, the curvature matrix of the non-orthogonal functions, is computed.
Definition at line 1307 of file TMultiDimFit.cxx.
|
protectedvirtual |
PRIVATE METHOD: Invert the model matrix B, and compute final coefficients.
For a more thorough discussion of what this means, please refer to the class description
First we invert the lower triangle matrix fOrthCurvatureMatrix and store the inverted matrix in the upper triangle.
Definition at line 1365 of file TMultiDimFit.cxx.
|
protectedvirtual |
PRIVATE METHOD: Compute the correlation matrix.
Definition at line 1445 of file TMultiDimFit.cxx.
PRIVATE METHOD: Make Gram-Schmidt orthogonalisation.
The class description gives a thorough account of this algorithm, as well as references. Please refer to the class description
Definition at line 1504 of file TMultiDimFit.cxx.
|
virtual |
Make histograms of the result of the analysis.
This message should be sent after having read all data points, but before finding the parameterization
Options: A All the below X Original independent variables D Original dependent variables N Normalised independent variables S Shifted dependent variables R1 Residuals versus normalised independent variables R2 Residuals versus dependent variable R3 Residuals computed on training sample R4 Residuals computed on test sample
For a description of these quantities, refer to class description
Definition at line 1597 of file TMultiDimFit.cxx.
Generate the file <classname>MDF.cxx
which contains the implementation of the method:
Double_t <classname>::MDF(Double_t *x)
which does the same as TMultiDimFit::Eval. Please refer to this method.
Further, the public static members:
are initialized, and assumed to exist. The class declaration is assumed to be in <classname>.h
and assumed to be provided by the user.
The minimal class definition is:
Whether the method <classname>::Eval
should be static or not, is up to the user.
Definition at line 1744 of file TMultiDimFit.cxx.
|
protectedvirtual |
PRIVATE METHOD: Normalize data to the interval [-1;1].
This is needed for the classes method to work.
Definition at line 1756 of file TMultiDimFit.cxx.
|
protectedvirtual |
PRIVATE METHOD: Find the parameterization over the training sample.
A full account of the algorithm is given in the class description
Definition at line 1810 of file TMultiDimFit.cxx.
|
protectedvirtual |
PRIVATE METHOD: This is the method that actually generates the code for the evaluation the parameterization on some point.
It's called by TMultiDimFit::MakeCode and TMultiDimFit::MakeMethod.
The options are: NONE so far
Definition at line 1963 of file TMultiDimFit.cxx.
|
overridevirtual |
Print statistics etc.
Options are P Parameters S Statistics C Coefficients R Result of parameterisation F Result of fit K Correlation Matrix M Pretty print formula
Reimplemented from TObject.
Definition at line 2158 of file TMultiDimFit.cxx.
Selection method.
User can override this method for specialized selection of acceptable functions in fit. Default is to select all. This message is sent during the build-up of the function candidates table once for each set of powers in variables. Notice, that the argument array contains the powers PLUS ONE. For example, to De select the function f = x1^2 * x2^4 * x3^5, this method should return kFALSE if given the argument { 3, 4, 6 }
Definition at line 2365 of file TMultiDimFit.cxx.
|
inline |
Definition at line 195 of file TMultiDimFit.h.
|
inline |
Definition at line 196 of file TMultiDimFit.h.
void TMultiDimFit::SetMaxAngle | ( | Double_t | ang = 0 | ) |
Set the max angle (in degrees) between the initial data vector to be fitted, and the new candidate function to be included in the fit.
By default it is 0, which automatically chooses another selection criteria. See also class description
Definition at line 2377 of file TMultiDimFit.cxx.
|
inline |
Definition at line 198 of file TMultiDimFit.h.
void TMultiDimFit::SetMaxPowers | ( | const Int_t * | powers | ) |
Set the maximum power to be considered in the fit for each variable.
See also class description
Definition at line 2443 of file TMultiDimFit.cxx.
|
inline |
Definition at line 200 of file TMultiDimFit.h.
|
inline |
Definition at line 201 of file TMultiDimFit.h.
void TMultiDimFit::SetMinAngle | ( | Double_t | ang = 1 | ) |
Set the min angle (in degrees) between a new candidate function and the subspace spanned by the previously accepted functions.
See also class description
Definition at line 2393 of file TMultiDimFit.cxx.
void TMultiDimFit::SetMinRelativeError | ( | Double_t | error | ) |
Set the acceptable relative error for when sum of square residuals is considered minimized.
For a full account, refer to the class description
Definition at line 2458 of file TMultiDimFit.cxx.
Set the user parameter for the function selection.
The bigger the limit, the more functions are used. The meaning of this variable is defined in the class description
Definition at line 2433 of file TMultiDimFit.cxx.
Define a user function.
The input array must be of the form (p11, ..., p1N, ... ,pL1, ..., pLN) Where N is the dimension of the data sample, L is the number of terms (given in terms) and the first number, labels the term, the second the variable. More information is given in the class description
Definition at line 2413 of file TMultiDimFit.cxx.
|
overridevirtual |
|
inline |
Definition at line 207 of file TMultiDimFit.h.
PRIVATE METHOD: Test whether the currently considered function contributes to the fit.
See also class description
Definition at line 2470 of file TMultiDimFit.cxx.
|
protected |
Number of bin in independent variables.
Definition at line 98 of file TMultiDimFit.h.
|
protected |
Number of bin in dependent variables.
Definition at line 99 of file TMultiDimFit.h.
|
protected |
Chi square of fit.
Definition at line 85 of file TMultiDimFit.h.
|
protected |
Vector of the final coefficients.
Definition at line 82 of file TMultiDimFit.h.
|
protected |
Vector of RMS of coefficients.
Definition at line 83 of file TMultiDimFit.h.
|
protected |
Multi Correlation coefficient.
Definition at line 92 of file TMultiDimFit.h.
|
protected |
Correlation matrix.
Definition at line 93 of file TMultiDimFit.h.
|
protected |
Error from parametrization.
Definition at line 88 of file TMultiDimFit.h.
|
protected |
Definition at line 101 of file TMultiDimFit.h.
|
protected |
[fMaxFunctions] acceptance code
Definition at line 60 of file TMultiDimFit.h.
|
protected |
Functions evaluated over sample.
Definition at line 58 of file TMultiDimFit.h.
|
staticprivate |
Definition at line 25 of file TMultiDimFit.h.
|
protected |
Bit pattern of histograms used.
Definition at line 97 of file TMultiDimFit.h.
|
protected |
List of histograms.
Definition at line 96 of file TMultiDimFit.h.
|
protected |
Flag for user defined function.
Definition at line 105 of file TMultiDimFit.h.
|
protected |
Definition at line 106 of file TMultiDimFit.h.
|
protected |
Max angle for accepting new function.
Definition at line 51 of file TMultiDimFit.h.
|
protected |
fMaxFunctions*fNVariables
Definition at line 62 of file TMultiDimFit.h.
|
protected |
max number of functions
Definition at line 59 of file TMultiDimFit.h.
|
protected |
[fNVariables] maximum powers
Definition at line 54 of file TMultiDimFit.h.
|
protected |
[fNVariables] maximum powers from fit;
Definition at line 68 of file TMultiDimFit.h.
|
protected |
Max value of dependent quantity.
Definition at line 31 of file TMultiDimFit.h.
|
protected |
Max residual value.
Definition at line 73 of file TMultiDimFit.h.
|
protected |
Row giving max residual.
Definition at line 75 of file TMultiDimFit.h.
|
protected |
max functions to study
Definition at line 61 of file TMultiDimFit.h.
|
protected |
Max terms expected in final expr.
Definition at line 52 of file TMultiDimFit.h.
|
protected |
max value of independent variables
Definition at line 39 of file TMultiDimFit.h.
|
protected |
Mean of dependent quantity.
Definition at line 30 of file TMultiDimFit.h.
|
protected |
mean value of independent variables
Definition at line 38 of file TMultiDimFit.h.
|
protected |
Min angle for accepting new function.
Definition at line 50 of file TMultiDimFit.h.
|
protected |
Min value of dependent quantity.
Definition at line 32 of file TMultiDimFit.h.
|
protected |
Min relative error accepted.
Definition at line 53 of file TMultiDimFit.h.
|
protected |
Min residual value.
Definition at line 74 of file TMultiDimFit.h.
|
protected |
Row giving min residual.
Definition at line 76 of file TMultiDimFit.h.
|
protected |
min value of independent variables
Definition at line 40 of file TMultiDimFit.h.
|
protected |
Dimension of model coefficients.
Definition at line 79 of file TMultiDimFit.h.
|
protected |
Number of independent variables.
Definition at line 37 of file TMultiDimFit.h.
|
protected |
The model coefficients.
Definition at line 80 of file TMultiDimFit.h.
|
protected |
Model matrix.
Definition at line 81 of file TMultiDimFit.h.
|
protected |
Norm of the evaluated functions.
Definition at line 65 of file TMultiDimFit.h.
|
protected |
As above, but orthogonalised.
Definition at line 64 of file TMultiDimFit.h.
|
protected |
Exit code of parameterisation.
Definition at line 86 of file TMultiDimFit.h.
|
protected |
|
protected |
[fMaxTerms] Index of accepted powers
Definition at line 70 of file TMultiDimFit.h.
|
protected |
Control parameter.
Definition at line 55 of file TMultiDimFit.h.
|
protected |
[fMaxFuncNV] where fMaxFuncNV = fMaxFunctions*fNVariables
Definition at line 69 of file TMultiDimFit.h.
|
protected |
Relative precision of param.
Definition at line 90 of file TMultiDimFit.h.
|
protected |
Training sample, dependent quantity.
Definition at line 28 of file TMultiDimFit.h.
|
protected |
Vector of the final residuals.
Definition at line 72 of file TMultiDimFit.h.
|
protected |
Root mean square of fit.
Definition at line 84 of file TMultiDimFit.h.
|
protected |
Size of training sample.
Definition at line 42 of file TMultiDimFit.h.
|
protected |
print correlation matrix
Definition at line 104 of file TMultiDimFit.h.
|
protected |
Training sample, error in quantity.
Definition at line 29 of file TMultiDimFit.h.
|
protected |
Sum of squares away from mean.
Definition at line 34 of file TMultiDimFit.h.
|
protected |
SumSquare of dependent quantity.
Definition at line 33 of file TMultiDimFit.h.
|
protected |
Sum of Square residuals.
Definition at line 77 of file TMultiDimFit.h.
|
protected |
Multi Correlation coefficient.
Definition at line 94 of file TMultiDimFit.h.
|
protected |
Error from test.
Definition at line 89 of file TMultiDimFit.h.
|
protected |
Relative precision of test.
Definition at line 91 of file TMultiDimFit.h.
|
protected |
Test sample, dependent quantity.
Definition at line 44 of file TMultiDimFit.h.
|
protected |
Size of test sample.
Definition at line 48 of file TMultiDimFit.h.
|
protected |
Test sample, Error in quantity.
Definition at line 45 of file TMultiDimFit.h.
|
protected |
Test sample, independent variables.
Definition at line 46 of file TMultiDimFit.h.
|
protected |
Training sample, independent variables.
Definition at line 36 of file TMultiDimFit.h.