#include <TGo4FitModelFunction.h>
Inheritance diagram for TGo4FitModelFunction:
Public Methods | |
TGo4FitModelFunction () | |
Default constructor. More... | |
TGo4FitModelFunction (const char *iName, TUserFunction iUserFunction, Int_t iNPars, Bool_t AddAmplitude=kFALSE) | |
Creates TGo4FitModelFunction object with specified name. More... | |
TGo4FitModelFunction (const char *iName, const char *iLibraryName="libName.so", const char *iFunctionName="Funcname", Int_t iNPars=0, Bool_t AddAmplitude=kFALSE) | |
Creates TGo4FitModelFunction object with specified name. More... | |
virtual | ~TGo4FitModelFunction () |
Destroys TGo4FitModelFunction object. More... | |
virtual Bool_t | CanAmplTouch () |
Signals, that amplitude parameter can be removed from or introduced to object. More... | |
void | SetUserFunction (TUserFunction iUserFunction) |
Set address to user function. More... | |
void | SetUserFunction (const char *iLibraryName, const char *iFunctionName) |
Set library file name and function name. More... | |
const char * | GetLibraryName () |
Returns libraray name. More... | |
void | SetLibraryName (const char *name) |
Sets libraray name. More... | |
const char * | GetFunctionName () |
Returns function name in library. More... | |
void | SetFunctionName (const char *name) |
Sets function name in library. More... | |
Int_t | GetNumberOfFuncPar () |
Returns number of parameter, which can be used by function. More... | |
Bool_t | SetNumberOfFuncPar (Int_t num) |
Sets number of parameters, which can be used by function. More... | |
void | SetPosParIndex (Int_t naxis, Int_t indx=-1) |
void | SetWidthParIndex (Int_t naxis, Int_t indx=-1) |
virtual Bool_t | BeforeEval (Int_t ndim) |
Preapre object to evaluations. More... | |
virtual void | AfterEval () |
Clear buffers, which were created by BeforeEval() method. More... | |
virtual void | Print (Option_t *option) const |
Print information about model object on standard output. More... | |
Protected Methods | |
virtual Bool_t | Initialize (Int_t UseBuffers=-1) |
Initialize object. More... | |
virtual void | Finalize () |
Finalize object. More... | |
virtual TString | GetFuncParName (Int_t n) |
TGo4FitParameter * | GetFuncPar (Int_t n) |
virtual Int_t | GetPosParIndex (Int_t naxis) |
Return index of parameter (if exist), which represent position of model for given axis. More... | |
virtual Int_t | GetWidthParIndex (Int_t naxis) |
Return index of parameter (if exist), which represent width of model component for given axis. More... | |
virtual Double_t | UserFunction (Double_t *Coordinates, Double_t *Parameters) |
Another place, where user specific code can be placed for model values calculation. More... | |
Bool_t | LoadLibrary (Bool_t CloseFirst) |
void | CloseLibrary () |
Protected Attributes | |
TString | fxLibraryName |
String with library name, where function is situated. More... | |
TString | fxFunctionName |
Function name. More... | |
TArrayI | fxPosIndex |
TArrayI | fxWidthIndex |
Private Attributes | |
TUserFunction | fxUserFunction |
Direct pointer on function. More... | |
void * | fxLibrary |
Pointer on loaded library descriptor. More... |
The function should has such signature:
Double_t Func(Double_t* coord, Int_t ncoord, Double_t* pars, Int_t npars) { // coord - array of axis values, ncoord - number of axis values // pars - model parameters values, npars - number of parameters return (coord[0]-pars[0])*(coord[1]-pars[1])*(coord[2]-pars[2]); } In constructer user should define name and title of object, pointer to user function, number of parameters and, optionally, using additional amplitude parameters. For instance, user function with three parameters and amplitude:
TGo4FitModelFunction *f = new TGo4FitModelFunction("func", "user function Func",&Func, 3, kTRUE);
In constructor "Par0", "Par1", "Par2" and "Ampl" parameters will be created. They are accessible in usual way from fitter or model object itself. Important notice - this model object can not be saved to file and restored in proper way, because address of user function may change in between. To correctly use this object after saving and restoring routines, user should directly set address of user function to TGo4FitModelFunction object (SetUserFunction() method) before using it. Otherwise, run-time error will occur. To avoid this user should create it's own model class (see example 4) or put function to shared library (example 2). If shared library is created, it can be used in constructor like:
new TGo4FitModelFunction("Gauss1", "Example8Func.so", "gaussian",3,kTRUE) );
During initialization routine library will be loaded and function will be used for modeling. In this case, if library will be present on the same location, model object can be reused directly after storing to file and reading it back.
Definition at line 45 of file TGo4FitModelFunction.h.
|
Default constructor.
Definition at line 23 of file TGo4FitModelFunction.cxx. |
|
Creates TGo4FitModelFunction object with specified name. Pointer on function and number of parameters should be specified. Additionally usage of amplitude parameter can be invoked. !!! Pointer on function, specidied in this method, can not be correctly restored from streamer. Therefore, object can not be directly reused after streaming. SetUserFunction() should be called before. Definition at line 26 of file TGo4FitModelFunction.cxx. References GetFuncParName(), n, TGo4FitComponent::NewParameter(), and TUserFunction. |
|
Creates TGo4FitModelFunction object with specified name. Library and function name can be specified. Additionally usage of amplitude parameter can be invoked. Definition at line 34 of file TGo4FitModelFunction.cxx. References GetFuncParName(), n, and TGo4FitComponent::NewParameter(). |
|
Destroys TGo4FitModelFunction object.
Definition at line 42 of file TGo4FitModelFunction.cxx. References CloseLibrary(). |
|
Signals, that amplitude parameter can be removed from or introduced to object.
Reimplemented from TGo4FitComponent. Definition at line 75 of file TGo4FitModelFunction.h. |
|
Set address to user function.
Definition at line 46 of file TGo4FitModelFunction.cxx. References CloseLibrary(), fxFunctionName, fxLibraryName, fxUserFunction, and TUserFunction. |
|
Set library file name and function name. Libraray will be loaded during initialization. Definition at line 53 of file TGo4FitModelFunction.cxx. References CloseLibrary(), fxFunctionName, fxLibraryName, and fxUserFunction. |
|
Returns libraray name.
Definition at line 91 of file TGo4FitModelFunction.h. References fxLibraryName. Referenced by TGo4FitPanelSlots::Wiz_GetModelInfo(). |
|
Sets libraray name.
Definition at line 96 of file TGo4FitModelFunction.h. References fxLibraryName. |
|
Returns function name in library.
Definition at line 101 of file TGo4FitModelFunction.h. References fxFunctionName. Referenced by TGo4FitPanelSlots::Wiz_GetModelInfo(). |
|
Sets function name in library.
Definition at line 106 of file TGo4FitModelFunction.h. References fxFunctionName. |
|
Returns number of parameter, which can be used by function.
Definition at line 60 of file TGo4FitModelFunction.cxx. References TGo4FitComponent::GetAmplPar(), and TGo4FitParsList::NumPars(). Referenced by GetFuncPar(), and SetNumberOfFuncPar(). |
|
Sets number of parameters, which can be used by function.
Definition at line 72 of file TGo4FitModelFunction.cxx. References GetFuncPar(), GetFuncParName(), GetNumberOfFuncPar(), n, TGo4FitComponent::NewParameter(), and TGo4FitParsList::RemovePar(). |
|
Definition at line 86 of file TGo4FitModelFunction.cxx. References fxPosIndex, and n. |
|
Definition at line 96 of file TGo4FitModelFunction.cxx. References fxWidthIndex, and n. |
|
Preapre object to evaluations. When usage of function from library is specified, library will be loaded at this time. Reimplemented from TGo4FitModel. Definition at line 132 of file TGo4FitModelFunction.cxx. References TGo4FitModel::BeforeEval(), and LoadLibrary(). |
|
Clear buffers, which were created by BeforeEval() method.
Reimplemented from TGo4FitModel. Definition at line 137 of file TGo4FitModelFunction.cxx. References TGo4FitModel::AfterEval(). |
|
Print information about model object on standard output.
Reimplemented from TGo4FitModel. Definition at line 179 of file TGo4FitModelFunction.cxx. References fxFunctionName, fxLibraryName, fxPosIndex, fxUserFunction, fxWidthIndex, and TGo4FitModel::Print(). |
|
Initialize object. When usage of function from library is specified, library will be loaded at this time. Reimplemented from TGo4FitModel. Definition at line 122 of file TGo4FitModelFunction.cxx. References TGo4FitModel::Initialize(), and LoadLibrary(). |
|
Finalize object. Close library, if it was opened. Reimplemented from TGo4FitModel. Definition at line 127 of file TGo4FitModelFunction.cxx. References CloseLibrary(), and TGo4FitModel::Finalize(). |
|
Definition at line 116 of file TGo4FitModelFunction.cxx. References n. Referenced by SetNumberOfFuncPar(), and TGo4FitModelFunction(). |
|
Definition at line 66 of file TGo4FitModelFunction.cxx. References TGo4FitComponent::GetAmplIndex(), GetNumberOfFuncPar(), TGo4FitParsList::GetPar(), and n. Referenced by GetPosParIndex(), GetWidthParIndex(), and SetNumberOfFuncPar(). |
|
Return index of parameter (if exist), which represent position of model for given axis.
Reimplemented from TGo4FitModel. Definition at line 106 of file TGo4FitModelFunction.cxx. References fxPosIndex, GetFuncPar(), and TGo4FitParsList::GetParIndex(). |
|
Return index of parameter (if exist), which represent width of model component for given axis.
Reimplemented from TGo4FitModel. Definition at line 111 of file TGo4FitModelFunction.cxx. References fxWidthIndex, GetFuncPar(), and TGo4FitParsList::GetParIndex(). |
|
Another place, where user specific code can be placed for model values calculation. Function gets as parameter array of Coordinates and array of Parameters values. Only user-specific calculation should be done and result value should be return. Reimplemented from TGo4FitModel. Definition at line 141 of file TGo4FitModelFunction.cxx. |
|
Definition at line 146 of file TGo4FitModelFunction.cxx. References CloseLibrary(), fxFunctionName, fxLibrary, fxLibraryName, and fxUserFunction. Referenced by BeforeEval(), and Initialize(). |
|
Definition at line 172 of file TGo4FitModelFunction.cxx. References fxLibrary. Referenced by Finalize(), LoadLibrary(), SetUserFunction(), and ~TGo4FitModelFunction(). |
|
String with library name, where function is situated.
Definition at line 158 of file TGo4FitModelFunction.h. Referenced by GetLibraryName(), LoadLibrary(), Print(), SetLibraryName(), and SetUserFunction(). |
|
Function name.
Definition at line 163 of file TGo4FitModelFunction.h. Referenced by GetFunctionName(), LoadLibrary(), Print(), SetFunctionName(), and SetUserFunction(). |
|
Definition at line 165 of file TGo4FitModelFunction.h. Referenced by GetPosParIndex(), Print(), and SetPosParIndex(). |
|
Definition at line 167 of file TGo4FitModelFunction.h. Referenced by GetWidthParIndex(), Print(), and SetWidthParIndex(). |
|
Direct pointer on function.
Definition at line 174 of file TGo4FitModelFunction.h. Referenced by LoadLibrary(), Print(), and SetUserFunction(). |
|
Pointer on loaded library descriptor.
Definition at line 179 of file TGo4FitModelFunction.h. Referenced by CloseLibrary(), and LoadLibrary(). |