GSI Object Oriented Online Offline (Go4)
GO4-5.3.2
|
#include <TGo4FitModelFunction.h>
Public Member Functions | |
TGo4FitModelFunction () | |
TGo4FitModelFunction (const char *iName, TUserFunction iUserFunction, Int_t iNPars, Bool_t AddAmplitude=kFALSE) | |
TGo4FitModelFunction (const char *iName, const char *iLibraryName="libName.so", const char *iFunctionName="Funcname", Int_t iNPars=0, Bool_t AddAmplitude=kFALSE) | |
virtual | ~TGo4FitModelFunction () |
virtual Bool_t | CanAmplTouch () |
void | SetUserFunction (TUserFunction iUserFunction) |
void | SetUserFunction (const char *iLibraryName, const char *iFunctionName) |
const char * | GetLibraryName () |
void | SetLibraryName (const char *name) |
const char * | GetFunctionName () |
void | SetFunctionName (const char *name) |
Int_t | GetNumberOfFuncPar () |
Bool_t | SetNumberOfFuncPar (Int_t num) |
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) |
virtual void | AfterEval () |
virtual void | Print (Option_t *option) const |
Public Member Functions inherited from TGo4FitModel | |
TGo4FitModel () | |
TGo4FitModel (const char *iName, const char *iTitle, Bool_t MakeAmplitude=kFALSE) | |
virtual | ~TGo4FitModel () |
void | SetGroupIndex (Int_t index=-1) |
void | SetBackgroundGroupIndex () |
Int_t | GetGroupIndex () const |
Int_t | NumAssigments () const |
const char * | AssignmentName (Int_t n) |
void | AssignToData (const char *DataName, Double_t RatioValue=1., Bool_t FixRatio=kFALSE) |
Bool_t | IsAssignTo (const char *DataName) const |
void | ChangeDataNameInAssignments (const char *oldname, const char *newname) |
void | ClearAssignmentTo (const char *DataName) |
void | ClearAssigmentTo (const char *DataName) |
void | ClearAssignments () |
void | ConnectToDataIfAssigned (TGo4FitData *data) |
Double_t | GetRatioValueFor (const char *DataName) |
virtual Double_t | Evaluate (Double_t x) |
virtual Double_t | Evaluate (Double_t x, Double_t y) |
virtual Double_t | Evaluate (Double_t x, Double_t y, Double_t z) |
virtual Double_t | Evaluate (Double_t *v, Int_t ndim) |
virtual Double_t | Integral () |
virtual Bool_t | GetPosition (Int_t naxis, Double_t &pos) |
virtual Bool_t | SetPosition (Int_t naxis, Double_t pos) |
virtual Bool_t | GetWidth (Int_t naxis, Double_t &width) |
virtual Bool_t | SetWidth (Int_t naxis, Double_t width) |
void | SetIntegrationsProperty (Int_t iMinIntegrDepth, Int_t iMaxIntegrDepth=0, Double_t iIntegrEps=0., Bool_t iAbsoluteEps=kFALSE, Bool_t iIntegrScaling=kFALSE) |
Bool_t | NeedIntegration () |
virtual Double_t | EvalN (const Double_t *v) |
virtual Double_t | EvaluateAtPoint (TGo4FitData *data, Int_t nbin, Bool_t UseRanges=kTRUE) |
virtual Double_t | EvaluateAtPoint (TGo4FitDataIter *iter, Bool_t UseRanges=kTRUE) |
Bool_t | AddModelToDataResult (TGo4FitData *data) |
virtual Int_t | NumPars () |
Public Member Functions inherited from TGo4FitComponent | |
TGo4FitComponent () | |
TGo4FitComponent (const char *iName, const char *iTitle) | |
virtual | ~TGo4FitComponent () |
TGo4FitParameter * | GetAmplPar () |
const char * | GetAmplName () |
const char * | GetAmplFullName () |
Double_t | GetAmplValue () |
void | SetAmplValue (Double_t iAmpl) |
Double_t | GetAmplError () |
void | SetAmplError (Double_t iError) |
Bool_t | MakeAmpl (Bool_t isFixed=kFALSE) |
Bool_t | RemoveAmpl () |
void | SetRange (Int_t naxis, Double_t min, Double_t max) |
void | ExcludeRange (Int_t naxis, Double_t min, Double_t max) |
void | SetRangeMin (Int_t naxis, Double_t value) |
void | SetRangeMax (Int_t naxis, Double_t value) |
void | AddRangeCut (TCutG *cut, Bool_t exclude=kFALSE) |
void | ClearRanges (Int_t naxis=-1) |
Bool_t | IsAnyRangeLimits () |
Bool_t | GetRangeMin (Int_t naxis, Double_t &value) |
Bool_t | GetRangeMax (Int_t naxis, Double_t &value) |
Int_t | GetNumRangeCondition () const |
void | GetRangeCondition (Int_t n, Int_t &typ, Int_t &naxis, Double_t &left, Double_t &right) const |
void | SetRangeCondition (Int_t n, Int_t typ, Int_t naxis, Double_t left, Double_t right) |
void | AddRangeCondition (Int_t typ, Int_t naxis, Double_t left, Double_t right) |
void | RemoveRangeCondition (Int_t n) |
Int_t | GetNumRangeCut () const |
TCutG * | GetRangeCut (Int_t n) const |
Bool_t | IsRangeCutExcluding (Int_t n) |
void | SetRangeCutExcluding (Int_t n, Bool_t exclude=kTRUE) |
void | RemoveRangeCut (Int_t n) |
Bool_t | CheckRangeConditions (const Double_t *values, Int_t numaxis) |
virtual void | CollectParsTo (TGo4FitParsList &list) |
void | SetUseBuffers (Bool_t iUse) |
Bool_t | GetUseBuffers () |
Public Member Functions inherited from TGo4FitParsList | |
TGo4FitParsList () | |
TGo4FitParsList (Bool_t IsParsOwned) | |
TGo4FitParsList (const char *Name, const char *Title, Bool_t IsParsOwned) | |
virtual | ~TGo4FitParsList () |
TGo4FitParameter * | GetPar (Int_t n) |
Int_t | GetParIndex (const TGo4FitParameter *par) |
TGo4FitParameter * | FindPar (const char *ParName) |
TGo4FitParameter * | FindPar (const char *OwnerFullName, const char *ParName) |
TGo4FitParameter * | FindPar (TGo4FitParameter *par) |
Double_t | GetParValue (const char *ParName) |
Bool_t | SetParValue (const char *ParName, Double_t iValue) |
void | GetParsValues (Double_t *pars) |
void | SetParsValues (Double_t *pars) |
Double_t | GetParError (const char *ParName) |
Bool_t | SetParError (const char *ParName, Double_t iError) |
virtual Bool_t | SetParFixed (const char *ParName, Bool_t iFixed=kTRUE) |
virtual Bool_t | GetParFixed (const char *ParName) |
Int_t | NumFixedPars () |
Int_t | NumFreePars () |
virtual Bool_t | SetParRange (const char *ParName, Double_t RangeMin, Double_t RangeMax) |
virtual Bool_t | GetParRange (const char *ParName, Double_t &RangeMin, Double_t &RangeMax) |
virtual Bool_t | SetParEpsilon (const char *ParName, Double_t Epsilon) |
virtual Bool_t | GetParEpsilon (const char *ParName, Double_t &Epsilon) |
void | SetParName (Int_t n, const char *name) |
const char * | GetParName (Int_t n) |
const char * | GetParFullName (Int_t n) |
void | SetParsNames (const char *name0="Par0", const char *name1="Par1", const char *name2="Par2", const char *name3="Par3", const char *name4="Par4", const char *name5="Par5", const char *name6="Par6", const char *name7="Par7", const char *name8="Par8", const char *name9="Par9") |
void | SetParsValues (Double_t par0=0., Double_t par1=0., Double_t par2=0., Double_t par3=0., Double_t par4=0., Double_t par5=0., Double_t par6=0., Double_t par7=0., Double_t par8=0., Double_t par9=0.) |
virtual void | MemorizePars () |
virtual bool | CanRollbackPars () |
virtual void | RememberPars () |
Bool_t | IsAllParsFixed () |
TGo4FitParameter * | CreatePar (const char *ParName, const char *Title, Double_t iValue=0) |
Bool_t | RemovePar (const char *name) |
Bool_t | RemovePar (TGo4FitParameter *par) |
void | PrintPars () const |
void | ClearPars () |
Public Member Functions inherited from TGo4FitNamed | |
TGo4FitNamed () | |
TGo4FitNamed (const char *Name, const char *Title, TNamed *Owner=0) | |
virtual | ~TGo4FitNamed () |
const char * | GetFullName () |
const char * | GetOwnerFullName () |
void | SetOwner (TNamed *iOwner) |
TNamed * | GetOwner () |
void | Print (Option_t *option) const |
Public Member Functions inherited from TGo4FitSlotList | |
TGo4FitSlotList () | |
virtual | ~TGo4FitSlotList () |
virtual void | FillSlotList (TSeqCollection *lst) |
void | SetUpdateSlotList () |
const TObjArray * | GetSlotList (Bool_t ForceUpdate=kFALSE) |
Int_t | NumSlots () |
TGo4FitSlot * | GetSlot (Int_t nslot) |
TGo4FitSlot * | FindSlot (const char *FullSlotName) |
Bool_t | ConnectSlots (TGo4FitSlot *slot1, TGo4FitSlot *slot2) |
Bool_t | ConnectSlots (const char *Slot1FullName, const char *Slot2FullName) |
TGo4FitSlot * | SetObject (TObject *obj, Bool_t iOwned=kFALSE) |
TGo4FitSlot * | SetObject (const char *PlaceName, TObject *obj, Bool_t iOwned=kFALSE) |
TGo4FitSlot * | IsObjectInSlots (TObject *obj) |
Bool_t | CheckObjects (Bool_t MakeOut=kTRUE) |
Bool_t | IsEmptySlots () |
void | ClearObjects (const char *PlaceName=0, Bool_t NonOwned=kTRUE) |
void | ClearSlot (TGo4FitSlot *slot, Bool_t NonOwned) |
void | SetSaveFlagForObjects (Int_t iSaveFlag, const char *PlaceName=0) |
Protected Member Functions | |
virtual Bool_t | Initialize (Int_t UseBuffers=-1) |
virtual void | Finalize () |
virtual TString | GetFuncParName (Int_t n) |
TGo4FitParameter * | GetFuncPar (Int_t n) |
virtual Int_t | GetPosParIndex (Int_t naxis) |
virtual Int_t | GetWidthParIndex (Int_t naxis) |
virtual Double_t | UserFunction (Double_t *Coordinates, Double_t *Parameters) |
Bool_t | LoadLibrary (Bool_t CloseFirst) |
void | CloseLibrary () |
Protected Member Functions inherited from TGo4FitModel | |
virtual TGo4FitParameter * | Get (Int_t n) |
Double_t | EvaluateAndIntegrate (Int_t NumScales, const Double_t *Scales, const Double_t *Widths) |
TGo4FitData * | GetAssignedConnection (Int_t n) |
Bool_t | BuffersAllocated () const |
void | RebuildShape (Bool_t ForceBuild=kFALSE) |
Double_t * | GetModelBins (const char *DataName) const |
void | SetNeedToRebuild () |
virtual TGo4FitParameter * | GetPosPar (Int_t naxis=0) |
virtual TGo4FitParameter * | GetWidthPar (Int_t naxis=0) |
const Int_t * | GetDataFullIndex (TGo4FitData *data, Int_t nbin) |
Int_t | GetDataIndexesSize (TGo4FitData *data) |
Protected Member Functions inherited from TGo4FitComponent | |
TGo4FitParameter * | NewParameter (const char *Name, const char *Title, Double_t iValue=0., Bool_t Fixed=kFALSE, Int_t AtIndx=-1) |
TGo4FitParameter * | NewAmplitude (const char *Name=0, Double_t iValue=0., Bool_t IsFixed=kFALSE, Int_t AtIndx=0) |
Int_t | GetAmplIndex () |
void | SetAmplIndex (Int_t iAmplIndex=-1) |
Protected Member Functions inherited from TGo4FitParsList | |
TGo4FitParameter * | AddPar (TGo4FitParameter *par) |
TGo4FitParameter * | InsertPar (TGo4FitParameter *par, Int_t indx) |
void | SetParsOwner (TGo4FitNamed *iOwner) |
void | ClearParsBlocking () |
TGo4FitParameter * | Find (const char *ParName) |
TGo4FitParameter * | Find (const char *OwnerFullName, const char *ParName) |
TGo4FitParameter * | Find (TGo4FitParameter *par) |
Bool_t | RemoveParByIndex (Int_t indx) |
Protected Member Functions inherited from TGo4FitSlotList | |
void | CheckDuplicatesOnSlot () |
void | PrepareSlotsForWriting () |
ClassDef (TGo4FitSlotList, 1) | |
Protected Attributes | |
TString | fxLibraryName |
TString | fxFunctionName |
TArrayI | fxPosIndex |
TArrayI | fxWidthIndex |
Protected Attributes inherited from TGo4FitModel | |
Int_t | fiMinIntegrDepth |
Int_t | fiMaxIntegrDepth |
Double_t | fdIntegrEps |
Bool_t | fbAbsoluteEps |
Bool_t | fbIntegrScaling |
Protected Attributes inherited from TGo4FitSlotList | |
TObjArray * | fxSlotList |
Bool_t | fbUpdateSlotList |
Private Attributes | |
TUserFunction | fxUserFunction |
void * | fxLibrary |
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 43 of file TGo4FitModelFunction.h.
TGo4FitModelFunction::TGo4FitModelFunction | ( | ) |
Default constructor.
Definition at line 26 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 30 of file TGo4FitModelFunction.cxx.
References GetFuncParName(), and TGo4FitComponent::NewParameter().
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 39 of file TGo4FitModelFunction.cxx.
References GetFuncParName(), and TGo4FitComponent::NewParameter().
|
virtual |
Destroys TGo4FitModelFunction object.
Definition at line 48 of file TGo4FitModelFunction.cxx.
References CloseLibrary().
|
virtual |
Clear buffers, which were created by BeforeEval() method.
Reimplemented from TGo4FitModel.
Definition at line 157 of file TGo4FitModelFunction.cxx.
References TGo4FitModel::AfterEval().
|
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 151 of file TGo4FitModelFunction.cxx.
References TGo4FitModel::BeforeEval(), and LoadLibrary().
|
inlinevirtual |
Signals, that amplitude parameter can be removed from or introduced to object.
Reimplemented from TGo4FitComponent.
Definition at line 73 of file TGo4FitModelFunction.h.
|
protected |
Definition at line 197 of file TGo4FitModelFunction.cxx.
References fxLibrary.
Referenced by Finalize(), LoadLibrary(), SetUserFunction(), and ~TGo4FitModelFunction().
|
protectedvirtual |
Finalize object. Close library, if it was opened.
Reimplemented from TGo4FitModel.
Definition at line 145 of file TGo4FitModelFunction.cxx.
References CloseLibrary(), and TGo4FitModel::Finalize().
|
protected |
Definition at line 76 of file TGo4FitModelFunction.cxx.
References TGo4FitComponent::GetAmplIndex(), GetNumberOfFuncPar(), and TGo4FitParsList::GetPar().
Referenced by GetPosParIndex(), GetWidthParIndex(), and SetNumberOfFuncPar().
|
protectedvirtual |
Definition at line 132 of file TGo4FitModelFunction.cxx.
Referenced by SetNumberOfFuncPar(), and TGo4FitModelFunction().
|
inline |
Returns function name in library.
Definition at line 99 of file TGo4FitModelFunction.h.
References fxFunctionName.
Referenced by TGo4FitPanel::Wiz_GetModelInfo().
|
inline |
Returns libraray name.
Definition at line 89 of file TGo4FitModelFunction.h.
References fxLibraryName.
Referenced by TGo4FitPanel::Wiz_GetModelInfo().
Int_t TGo4FitModelFunction::GetNumberOfFuncPar | ( | ) |
Returns number of parameter, which can be used by function.
Definition at line 69 of file TGo4FitModelFunction.cxx.
References TGo4FitComponent::GetAmplPar(), and TGo4FitParsList::NumPars().
Referenced by GetFuncPar(), and SetNumberOfFuncPar().
|
protectedvirtual |
Return index of parameter (if exist), which represent position of model for given axis.
Reimplemented from TGo4FitModel.
Definition at line 120 of file TGo4FitModelFunction.cxx.
References fxPosIndex, GetFuncPar(), and TGo4FitParsList::GetParIndex().
|
protectedvirtual |
Return index of parameter (if exist), which represent width of model component for given axis.
Reimplemented from TGo4FitModel.
Definition at line 126 of file TGo4FitModelFunction.cxx.
References fxWidthIndex, GetFuncPar(), and TGo4FitParsList::GetParIndex().
|
protectedvirtual |
Initialize object. When usage of function from library is specified, library will be loaded at this time.
Reimplemented from TGo4FitModel.
Definition at line 139 of file TGo4FitModelFunction.cxx.
References TGo4FitModel::Initialize(), and LoadLibrary().
|
protected |
Definition at line 170 of file TGo4FitModelFunction.cxx.
References CloseLibrary(), fxFunctionName, fxLibrary, fxLibraryName, and fxUserFunction.
Referenced by BeforeEval(), and Initialize().
|
virtual |
Print information about model object on standard output.
Reimplemented from TGo4FitModel.
Definition at line 224 of file TGo4FitModelFunction.cxx.
References fxFunctionName, fxLibraryName, fxPosIndex, fxUserFunction, fxWidthIndex, and TGo4FitModel::Print().
|
inline |
Sets function name in library.
Definition at line 104 of file TGo4FitModelFunction.h.
References fxFunctionName.
Referenced by QFitModelFunctionWidget::FuncNameEdt_textChanged().
|
inline |
Sets libraray name.
Definition at line 94 of file TGo4FitModelFunction.h.
References fxLibraryName.
Referenced by QFitModelFunctionWidget::LibNameEdt_textChanged().
Bool_t TGo4FitModelFunction::SetNumberOfFuncPar | ( | Int_t | num | ) |
Sets number of parameters, which can be used by function.
Definition at line 83 of file TGo4FitModelFunction.cxx.
References GetFuncPar(), GetFuncParName(), GetNumberOfFuncPar(), TGo4FitComponent::NewParameter(), and TGo4FitParsList::RemovePar().
void TGo4FitModelFunction::SetPosParIndex | ( | Int_t | naxis, |
Int_t | indx = -1 |
||
) |
Definition at line 98 of file TGo4FitModelFunction.cxx.
References fxPosIndex.
void TGo4FitModelFunction::SetUserFunction | ( | TUserFunction | iUserFunction | ) |
Set address to user function.
Definition at line 53 of file TGo4FitModelFunction.cxx.
References CloseLibrary(), fxFunctionName, fxLibraryName, and fxUserFunction.
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 61 of file TGo4FitModelFunction.cxx.
References CloseLibrary(), fxFunctionName, fxLibraryName, and fxUserFunction.
void TGo4FitModelFunction::SetWidthParIndex | ( | Int_t | naxis, |
Int_t | indx = -1 |
||
) |
Definition at line 109 of file TGo4FitModelFunction.cxx.
References fxWidthIndex.
|
protectedvirtual |
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 162 of file TGo4FitModelFunction.cxx.
References fxUserFunction.
|
protected |
Function name.
Definition at line 161 of file TGo4FitModelFunction.h.
Referenced by GetFunctionName(), LoadLibrary(), Print(), SetFunctionName(), and SetUserFunction().
|
private |
Pointer on loaded library descriptor.
Definition at line 177 of file TGo4FitModelFunction.h.
Referenced by CloseLibrary(), and LoadLibrary().
|
protected |
String with library name, where function is situated.
Definition at line 156 of file TGo4FitModelFunction.h.
Referenced by GetLibraryName(), LoadLibrary(), Print(), SetLibraryName(), and SetUserFunction().
|
protected |
Definition at line 163 of file TGo4FitModelFunction.h.
Referenced by GetPosParIndex(), Print(), and SetPosParIndex().
|
private |
Direct pointer on function.
Definition at line 172 of file TGo4FitModelFunction.h.
Referenced by LoadLibrary(), Print(), SetUserFunction(), and UserFunction().
|
protected |
Definition at line 165 of file TGo4FitModelFunction.h.
Referenced by GetWidthParIndex(), Print(), and SetWidthParIndex().