| v2.10-0 (21000JUN2005) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Model objects, which uses external user function to calculate model values.
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.
Field Summary | |
protected TString | fxFunctionName Function name. |
private void * | fxLibrary Pointer on loaded library descriptor. |
protected TString | fxLibraryName String with library name, where function is situated. |
protected TArrayI | fxPosIndex |
private TUserFunction | fxUserFunction Direct pointer on function. |
protected TArrayI | fxWidthIndex |
Fields inherited from class Go4Fit.TGo4FitModel |
fbAbsoluteEps, fbIntegrScaling, fdIntegrEps, fiMaxIntegrDepth, fiMinIntegrDepth |
Fields inherited from class TNamed |
fName, fTitle |
Fields inherited from class Go4Fit.TGo4FitSlotList |
fbUpdateSlotList, fxSlotList |
Constructor Summary | |
TGo4FitModelFunction() Default constructor. | |
TGo4FitModelFunction(const char * iName, TUserFunction iUserFunction, Int_t iNPars, Bool_t AddAmplitude) Creates TGo4FitModelFunction object with specified name. | |
TGo4FitModelFunction(const char * iName, const char * iLibraryName, const char * iFunctionName, Int_t iNPars, Bool_t AddAmplitude) Creates TGo4FitModelFunction object with specified name. |
Destructor Summary | |
virtual synchronized | ~TGo4FitModelFunction() Destroys TGo4FitModelFunction object. |
Method Summary | |
virtual void | AfterEval() |
virtual Bool_t | BeforeEval(Int_t ndim) Preapre object to evaluations. |
virtual Bool_t | CanAmplTouch() Signals, that amplitude parameter can be removed from or introduced to object. |
protected void | CloseLibrary() |
protected virtual void | Finalize() Finalize object. |
protected TGo4FitParameter* | GetFuncPar(Int_t n) |
protected virtual TString | GetFuncParName(Int_t n) |
const const char * | GetFunctionName() Returns function name in library. |
const const char * | GetLibraryName() Returns libraray name. |
Int_t | GetNumberOfFuncPar() Returns number of parameter, which can be used by function. |
protected virtual Int_t | GetPosParIndex(Int_t naxis) |
protected virtual Int_t | GetWidthParIndex(Int_t naxis) |
protected virtual Bool_t | Initialize(Int_t UseBuffers) Initialize object. |
protected Bool_t | LoadLibrary(Bool_t CloseFirst) |
virtual const void | Print(Option_t* option) |
void | SetFunctionName(const char * name) Sets function name in library. |
void | SetLibraryName(const char * name) Sets libraray name. |
Bool_t | SetNumberOfFuncPar(Int_t num) Sets number of parameters, which can be used by function. |
void | SetPosParIndex(Int_t naxis, Int_t indx) |
void | SetUserFunction(TUserFunction iUserFunction) Set address to user function. |
void | SetUserFunction(const char * iLibraryName, const char * iFunctionName) Set library file name and function name. |
void | SetWidthParIndex(Int_t naxis, Int_t indx) |
protected virtual Double_t | UserFunction(Double_t* Coordinates, Double_t* Parameters) |
Methods inherited from class Go4Fit.TGo4FitParsList |
AddPar, CanRollbackPars, ClearPars, ClearParsBlocking, CreatePar, Find, Find, Find, FindPar, FindPar, FindPar, GetPar, GetParEpsilon, GetParError, GetParFixed, GetParFullName, GetParIndex, GetParName, GetParRange, GetParsValues, GetParValue, InsertPar, IsAllParsFixed, MemorizePars, NumFixedPars, NumFreePars, PrintPars, RememberPars, RemovePar, RemovePar, RemoveParByIndex, SetParEpsilon, SetParError, SetParFixed, SetParName, SetParRange, SetParsNames, SetParsOwner, SetParsValues, SetParsValues, SetParValue |
Methods inherited from class Go4Fit.TGo4FitNamed |
GetFullName, GetOwner, GetOwnerFullName, SetOwner |
Methods inherited from class TNamed |
operator=, Clear, Clone, Compare, Copy, FillBuffer, GetName, GetTitle, Hash, IsSortable, SetName, SetNameTitle, SetTitle, ls, Sizeof, Class, Class_Name, Class_Version, Dictionary, IsA, ShowMembers, Streamer, StreamerNVirtual, DeclFileName, ImplFileLine, ImplFileName, DeclFileLine |
Methods inherited from class Go4Fit.TGo4FitSlotList |
CheckDuplicatesOnSlot, CheckObjects, ClearObjects, ClearSlot, ConnectSlots, ConnectSlots, FillSlotList, FindSlot, GetSlot, GetSlotList, IsEmptySlots, IsObjectInSlots, NumSlots, PrepareSlotsForWriting, SetObject, SetObject, SetSaveFlagForObjects, SetUpdateSlotList |
Field Detail |
protected TString fxFunctionName
private void * fxLibrary
protected TString fxLibraryName
protected TArrayI fxPosIndex
private TUserFunction fxUserFunction
protected TArrayI fxWidthIndex
Constructor Detail |
public TGo4FitModelFunction()
public TGo4FitModelFunction(const char * iName, TUserFunction iUserFunction, Int_t iNPars, Bool_t AddAmplitude)
public TGo4FitModelFunction(const char * iName, const char * iLibraryName, const char * iFunctionName, Int_t iNPars, Bool_t AddAmplitude)
Method Detail |
public virtual synchronized ~TGo4FitModelFunction()
Method Detail |
public virtual void AfterEval()
public virtual Bool_t BeforeEval(Int_t ndim)
public virtual Bool_t CanAmplTouch()
protected void CloseLibrary()
protected virtual void Finalize()
protected TGo4FitParameter* GetFuncPar(Int_t n)
protected virtual TString GetFuncParName(Int_t n)
public const const char * GetFunctionName()
public const const char * GetLibraryName()
public Int_t GetNumberOfFuncPar()
protected virtual Int_t GetPosParIndex(Int_t naxis)
protected virtual Int_t GetWidthParIndex(Int_t naxis)
protected virtual Bool_t Initialize(Int_t UseBuffers)
protected Bool_t LoadLibrary(Bool_t CloseFirst)
public virtual const void Print(Option_t* option)
public void SetFunctionName(const char * name)
public void SetLibraryName(const char * name)
public Bool_t SetNumberOfFuncPar(Int_t num)
public void SetPosParIndex(Int_t naxis, Int_t indx)
public void SetUserFunction(TUserFunction iUserFunction)
public void SetUserFunction(const char * iLibraryName, const char * iFunctionName)
public void SetWidthParIndex(Int_t naxis, Int_t indx)
protected virtual Double_t UserFunction(Double_t* Coordinates, Double_t* Parameters)
Association Links |
to Class TArrayI
| J.Adamczewski, M.Al-Turany, D.Bertini, H.G.Essel, S.Linev | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |