Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TGo4FitModelFunction Class Reference

Model objects, which uses external user function to calculate model values. More...

#include <TGo4FitModelFunction.h>

Inheritance diagram for TGo4FitModelFunction:

TGo4FitModel TGo4FitComponent TGo4FitParsList TGo4FitSlotList TGo4FitNamed List of all members.

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)
TGo4FitParameterGetFuncPar (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...


Detailed Description

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.

Definition at line 45 of file TGo4FitModelFunction.h.


Constructor & Destructor Documentation

TGo4FitModelFunction::TGo4FitModelFunction  
 

Default constructor.

Definition at line 23 of file TGo4FitModelFunction.cxx.

TGo4FitModelFunction::TGo4FitModelFunction const char *    iName,
TUserFunction    iUserFunction,
Int_t    iNPars,
Bool_t    AddAmplitude = kFALSE
 

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.

TGo4FitModelFunction::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.

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().

TGo4FitModelFunction::~TGo4FitModelFunction   [virtual]
 

Destroys TGo4FitModelFunction object.

Definition at line 42 of file TGo4FitModelFunction.cxx.

References CloseLibrary().


Member Function Documentation

virtual Bool_t TGo4FitModelFunction::CanAmplTouch   [inline, virtual]
 

Signals, that amplitude parameter can be removed from or introduced to object.

Reimplemented from TGo4FitComponent.

Definition at line 75 of file TGo4FitModelFunction.h.

void TGo4FitModelFunction::SetUserFunction TUserFunction    iUserFunction
 

Set address to user function.

Definition at line 46 of file TGo4FitModelFunction.cxx.

References CloseLibrary(), fxFunctionName, fxLibraryName, fxUserFunction, and TUserFunction.

void TGo4FitModelFunction::SetUserFunction const char *    iLibraryName,
const char *    iFunctionName
 

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.

const char* TGo4FitModelFunction::GetLibraryName   [inline]
 

Returns libraray name.

Definition at line 91 of file TGo4FitModelFunction.h.

References fxLibraryName.

Referenced by TGo4FitPanelSlots::Wiz_GetModelInfo().

void TGo4FitModelFunction::SetLibraryName const char *    name [inline]
 

Sets libraray name.

Definition at line 96 of file TGo4FitModelFunction.h.

References fxLibraryName.

const char* TGo4FitModelFunction::GetFunctionName   [inline]
 

Returns function name in library.

Definition at line 101 of file TGo4FitModelFunction.h.

References fxFunctionName.

Referenced by TGo4FitPanelSlots::Wiz_GetModelInfo().

void TGo4FitModelFunction::SetFunctionName const char *    name [inline]
 

Sets function name in library.

Definition at line 106 of file TGo4FitModelFunction.h.

References fxFunctionName.

Int_t TGo4FitModelFunction::GetNumberOfFuncPar  
 

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().

Bool_t TGo4FitModelFunction::SetNumberOfFuncPar Int_t    num
 

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().

void TGo4FitModelFunction::SetPosParIndex Int_t    naxis,
Int_t    indx = -1
 

Definition at line 86 of file TGo4FitModelFunction.cxx.

References fxPosIndex, and n.

void TGo4FitModelFunction::SetWidthParIndex Int_t    naxis,
Int_t    indx = -1
 

Definition at line 96 of file TGo4FitModelFunction.cxx.

References fxWidthIndex, and n.

Bool_t TGo4FitModelFunction::BeforeEval Int_t    ndim [virtual]
 

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().

void TGo4FitModelFunction::AfterEval   [virtual]
 

Clear buffers, which were created by BeforeEval() method.

Reimplemented from TGo4FitModel.

Definition at line 137 of file TGo4FitModelFunction.cxx.

References TGo4FitModel::AfterEval().

void TGo4FitModelFunction::Print Option_t *    option const [virtual]
 

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().

Bool_t TGo4FitModelFunction::Initialize Int_t    UseBuffers = -1 [protected, virtual]
 

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().

void TGo4FitModelFunction::Finalize   [protected, virtual]
 

Finalize object.

Close library, if it was opened.

Reimplemented from TGo4FitModel.

Definition at line 127 of file TGo4FitModelFunction.cxx.

References CloseLibrary(), and TGo4FitModel::Finalize().

TString TGo4FitModelFunction::GetFuncParName Int_t    n [protected, virtual]
 

Definition at line 116 of file TGo4FitModelFunction.cxx.

References n.

Referenced by SetNumberOfFuncPar(), and TGo4FitModelFunction().

TGo4FitParameter * TGo4FitModelFunction::GetFuncPar Int_t    n [protected]
 

Definition at line 66 of file TGo4FitModelFunction.cxx.

References TGo4FitComponent::GetAmplIndex(), GetNumberOfFuncPar(), TGo4FitParsList::GetPar(), and n.

Referenced by GetPosParIndex(), GetWidthParIndex(), and SetNumberOfFuncPar().

Int_t TGo4FitModelFunction::GetPosParIndex Int_t    naxis [protected, virtual]
 

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().

Int_t TGo4FitModelFunction::GetWidthParIndex Int_t    naxis [protected, virtual]
 

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().

Double_t TGo4FitModelFunction::UserFunction Double_t *    Coordinates,
Double_t *    Parameters
[protected, virtual]
 

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.

Bool_t TGo4FitModelFunction::LoadLibrary Bool_t    CloseFirst [protected]
 

Definition at line 146 of file TGo4FitModelFunction.cxx.

References CloseLibrary(), fxFunctionName, fxLibrary, fxLibraryName, and fxUserFunction.

Referenced by BeforeEval(), and Initialize().

void TGo4FitModelFunction::CloseLibrary   [protected]
 

Definition at line 172 of file TGo4FitModelFunction.cxx.

References fxLibrary.

Referenced by Finalize(), LoadLibrary(), SetUserFunction(), and ~TGo4FitModelFunction().


Member Data Documentation

TString TGo4FitModelFunction::fxLibraryName [protected]
 

String with library name, where function is situated.

Definition at line 158 of file TGo4FitModelFunction.h.

Referenced by GetLibraryName(), LoadLibrary(), Print(), SetLibraryName(), and SetUserFunction().

TString TGo4FitModelFunction::fxFunctionName [protected]
 

Function name.

Definition at line 163 of file TGo4FitModelFunction.h.

Referenced by GetFunctionName(), LoadLibrary(), Print(), SetFunctionName(), and SetUserFunction().

TArrayI TGo4FitModelFunction::fxPosIndex [protected]
 

Definition at line 165 of file TGo4FitModelFunction.h.

Referenced by GetPosParIndex(), Print(), and SetPosParIndex().

TArrayI TGo4FitModelFunction::fxWidthIndex [protected]
 

Definition at line 167 of file TGo4FitModelFunction.h.

Referenced by GetWidthParIndex(), Print(), and SetWidthParIndex().

TUserFunction TGo4FitModelFunction::fxUserFunction [private]
 

Direct pointer on function.

Definition at line 174 of file TGo4FitModelFunction.h.

Referenced by LoadLibrary(), Print(), and SetUserFunction().

void* TGo4FitModelFunction::fxLibrary [private]
 

Pointer on loaded library descriptor.

Definition at line 179 of file TGo4FitModelFunction.h.

Referenced by CloseLibrary(), and LoadLibrary().


The documentation for this class was generated from the following files:
Generated on Tue Nov 8 10:56:41 2005 for Go4-v2.10-5 by doxygen1.2.15