v2.10-0 (21000JUN2005)

Go4Fit
Class TGo4FitterAbstract

Direct Known Subclasses:
TGo4Fitter

class TGo4FitterAbstract
derived from TGo4FitParsList, TGo4FitSlotList

Abstract fitter class.
This is abstract class, which implement a general behaviour of fitter.
It has a list of all parameters (class inherited from TGo4FitParsList) and function, which should be fitted.
It has a list of action, which may be performed on the fitter.
The specific things, like list of data and list of models, are implemented in inherited TGo4Fitter class.


Field Summary
 protected Bool_tfbInitializationDone
          Flag showing, that initialization was complete.
 protected Bool_tfbNeedToFinalize
          Flag, showing, that finalize method should be called before fitter will be destroyed.
 protected Bool_tfbParsAsResults
           
 protected Bool_tfbParsChange
          Boolean variable, showing that number of parameters is changed.
 protected TObjArrayfxActions
          Array of actions onkects (inherited from TGo4FitterAction).
 protected TGo4FitterConfig*fxCurrentConfig
          Pointer on currently activated config object.
 protected TArrayDfxResults
          Array of result values.

Fields inherited from class TNamed
fName, fTitle

Fields inherited from class Go4Fit.TGo4FitSlotList
fbUpdateSlotList, fxSlotList

Constructor Summary
TGo4FitterAbstract()
          Default constructor.
TGo4FitterAbstract(const char * iName, const char * iTitle)
          Create TGo4FitterAbstract object with given name and tiile.

Destructor Summary
 virtual synchronized ~TGo4FitterAbstract()
          Destroy TGo4FitterAbstract object.

Method Summary
 voidAddAction(TGo4FitterAction* Action)
          Add action to action list.
 voidAddActionAt(TGo4FitterAction* Action, Int_t indx)
          Add action to action list at specified index.
 TGo4FitterOutput*AddOutputAction(const char * Action, const char * Option)
          Creates and add TGo4FitterOutput action with given parameters to actions list.
 voidAddSimpleMinuit()
          Creates and add TGo4FitMinuit object to actions list.
 Bool_tApplyConfig(TGo4FitterConfig* Config)
          Set active configuration object.
 Double_tCalculateFitFunction(Double_t* pars)
          Calculates value of fit function.
 protected voidCheckParsListChanging()
          If appropriate flag sets (via SetParsListChange() method), function recollect all parameters from all objects, associated to fitter.
 virtual voidClear(Option_t* option)
          Clear fitter.
 protected virtual voidCollectAllPars()
          Should collect parameters from all associated to fitter objects.
 voidCopyParsValuesFrom(TGo4FitterAbstract* fitter)
          If provided fitter has a same list of parameters, their values will be copied to fitter.
 voidDeleteAction(TGo4FitterAction* action)
          Remove action from actions list and destroy it.
 voidDeleteActions()
          Remove and delete all actions from actions list.
 voidDeleteOutputActions()
          Remove and delete all output actions from actions list.
 voidDoAction(TGo4FitterAction* Action)
          Executes specified action.
 voidDoAction(Int_t indx)
          Executes specified action from actions list.
 voidDoActions(Bool_t AllowFitterChange, TObjArray* Actions)
          Executes actions list.
 protected virtual Double_tDoCalculation()
          Calculates value of fit function according current values of parameters.
 protected virtual Int_tDoNDFCalculation()
          Calculates number of dimensions of freedom;
Should be implemented in inherited classes.
 protected voidExecuteDependencies(Double_t* pars)
          Execute dependenices in currently associated configuration (if exist).
 protected virtual voidFinalize()
          Remove all buffer, created in Initialize() routine.
 protected voidFinalizeDependencies(TObjArray& Dependencies)
          Relese memory, allocated for dependency executions.
 protected virtual voidFinalizeFitterData()
          Finalize fitter data.
 protected virtual TGo4FitParameter*Get(Int_t n)
          Return pointer on parameter of given index.
 TGo4FitterAction*GetAction(Int_t num)
          Returns pointer on action with given index.
 Int_tGetNumActions()
          Returns number of action in actions list.
 const Int_tGetNumResults()
          Return number of result values.
 virtual Bool_tGetParEpsilon(const char * ParName, Double_t& Epsilon)
          Return kTRUE, if epsilon value specified for parameter.
 virtual Bool_tGetParFixed(const char * ParName)
          Return kTRUE, if parameter should be fixed.
 virtual Bool_tGetParRange(const char * ParName, Double_t& RangeMin, Double_t& RangeMax)
          Return kTRUE, if range condition specified for parameter and range boundaries.
 const Double_tGetResultFF()
          Return result value of fit function.
 const Int_tGetResultNDF()
          Return result value of number of degree of freedom.
 const const TArrayD*GetResults()
          Returns pointer on array of result values.
 const Double_tGetResultValue(Int_t n)
          Return value of result with given index.
 protected virtual Bool_tInitFitterData()
          Initialize fitter data.
 protected virtual Bool_tInitialize()
          Initialize fitter.
 protected Bool_tInitializeDependencies(TObjArray& Dependencies, Bool_t BlockPars, Bool_t DoInit)
          Initialize a list of dependencies (TGo4FitDependecy object), which used in configuration.
 protected Bool_tIsInitialized()
          Return kTRUE, if Initialize() was done.
 Bool_tIsParsAsResults()
          Return kTRUE, if parameters were taken as result values.
 Bool_tIsSuitableConfig(TGo4FitterConfig* Config)
          Checks, if config object corresponds to fitter parameters.
 Int_tNeedPadsNumber()
          Returns required number of TPad for actions output.
 virtual Int_tNumPars()
          Return total number of parameters, which should be fitted.
 virtual const voidPrint(Option_t* option)
          Print information about fitter to standar output.
 const voidPrintResults()
          Print result values to standard output.
 TObjArray*ProcessObjects(TObjArray* objs, Bool_t CloneFitter, Bool_t OnlyRequired, TObjArray* rownames, TObjArray* colnames)
           
 voidReplaceAction(TGo4FitterAction* action, Int_t dir)
          Shift action in action list upward (dir=-1) or downward (dir=+1).
 protected voidRunDependenciesList(TObjArray& Dependencies, Double_t* pars)
          Execute dependency equations.
 voidSetPad(Int_t indx, TVirtualPad* pad)
          Set pad, which will be used for output of TGo4FitterOutput object.
 voidSetParsListChange()
          Should be used, when number of parameters are changed.

Methods inherited from class Go4Fit.TGo4FitParsList
AddPar, CanRollbackPars, ClearPars, ClearParsBlocking, CollectParsTo, CreatePar, Find, Find, Find, FindPar, FindPar, FindPar, GetPar, GetParError, GetParFullName, GetParIndex, GetParName, 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=, 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

fbInitializationDone

protected Bool_t fbInitializationDone
Flag showing, that initialization was complete.

fbNeedToFinalize

protected Bool_t fbNeedToFinalize
Flag, showing, that finalize method should be called before fitter will be destroyed.

fbParsAsResults

protected Bool_t fbParsAsResults

fbParsChange

protected Bool_t fbParsChange
Boolean variable, showing that number of parameters is changed.

fxActions

protected TObjArray fxActions
Array of actions onkects (inherited from TGo4FitterAction).

fxCurrentConfig

protected TGo4FitterConfig* fxCurrentConfig
Pointer on currently activated config object.

fxResults

protected TArrayD fxResults
Array of result values.
If no specific configuration is used, this just values of fitter parameters.
Result array creates in the end of actions execution.
Constructor Detail

TGo4FitterAbstract

public TGo4FitterAbstract()
Default constructor.

TGo4FitterAbstract

public TGo4FitterAbstract(const char * iName, const char * iTitle)
Create TGo4FitterAbstract object with given name and tiile.
TGo4FitterAbstract object should not be create directly, because it is abstract class.
TGo4Fitter or other implementation class should be used.
Method Detail

~TGo4FitterAbstract

public virtual synchronized ~TGo4FitterAbstract()
Destroy TGo4FitterAbstract object.
Method Detail

AddAction

public void AddAction(TGo4FitterAction* Action)
Add action to action list.
Action is a object, derived from TGo4FitterAction class.
Action object always owned by fitter, thus it will be destroyed when fitter is destroing. Therefore, stack object should not be added to fitter.

AddActionAt

public void AddActionAt(TGo4FitterAction* Action, Int_t indx)
Add action to action list at specified index.

AddOutputAction

public TGo4FitterOutput* AddOutputAction(const char * Action, const char * Option)
Creates and add TGo4FitterOutput action with given parameters to actions list.

AddSimpleMinuit

public void AddSimpleMinuit()
Creates and add TGo4FitMinuit object to actions list.
TGo4FitMinuit object contain the only command:
MIGRAD 500 1

ApplyConfig

public Bool_t ApplyConfig(TGo4FitterConfig* Config)
Set active configuration object.
This function calls in TGo4FitterConfig::DoAction() method.

CalculateFitFunction

public Double_t CalculateFitFunction(Double_t* pars)
Calculates value of fit function.
Fitter should be initialized before.
Instead of using values of parameters (from parameters list) array of values can be sets directly.

CheckParsListChanging

protected void CheckParsListChanging()
If appropriate flag sets (via SetParsListChange() method), function recollect all parameters from all objects, associated to fitter.

Clear

public virtual void Clear(Option_t* option)
Clear fitter.
Removes and delete all actions from actions list.

CollectAllPars

protected virtual void CollectAllPars()
Should collect parameters from all associated to fitter objects.
This function should be extend in inherited classes.

CopyParsValuesFrom

public void CopyParsValuesFrom(TGo4FitterAbstract* fitter)
If provided fitter has a same list of parameters, their values will be copied to fitter.

DeleteAction

public void DeleteAction(TGo4FitterAction* action)
Remove action from actions list and destroy it.

DeleteActions

public void DeleteActions()
Remove and delete all actions from actions list.

DeleteOutputActions

public void DeleteOutputActions()
Remove and delete all output actions from actions list.

DoAction

public void DoAction(TGo4FitterAction* Action)
Executes specified action.

DoAction

public void DoAction(Int_t indx)
Executes specified action from actions list.

DoActions

public void DoActions(Bool_t AllowFitterChange, TObjArray* Actions)
Executes actions list.
First Initialize() method will be called to create buffers (if required by actions).
Then for each action in actions list will be called DoAction() method.
AllowFitterChange flag specify, if action which may change fitter, can be executed.
Alternative array with actions can also be specified to function.
In the end Finalize() method close all buffers.

DoCalculation

protected virtual Double_t DoCalculation()
Calculates value of fit function according current values of parameters.
Should be implemented in inherited classes.

DoNDFCalculation

protected virtual Int_t DoNDFCalculation()
Calculates number of dimensions of freedom;
Should be implemented in inherited classes.

ExecuteDependencies

protected void ExecuteDependencies(Double_t* pars)
Execute dependenices in currently associated configuration (if exist).

Finalize

protected virtual void Finalize()
Remove all buffer, created in Initialize() routine.

FinalizeDependencies

protected void FinalizeDependencies(TObjArray& Dependencies)
Relese memory, allocated for dependency executions.

FinalizeFitterData

protected virtual void FinalizeFitterData()
Finalize fitter data.
Called during Finalize() method.
Should be reimplemented in derived classes.

Get

protected virtual TGo4FitParameter* Get(Int_t n)
Return pointer on parameter of given index.
First check, if parameters should be recollected.

GetAction

public TGo4FitterAction* GetAction(Int_t num)
Returns pointer on action with given index.

GetNumActions

public Int_t GetNumActions()
Returns number of action in actions list.

GetNumResults

public const Int_t GetNumResults()
Return number of result values.

GetParEpsilon

public virtual Bool_t GetParEpsilon(const char * ParName, Double_t& Epsilon)
Return kTRUE, if epsilon value specified for parameter.
If configuration object assigned to fitter, epsilon value will be tested there first and only then original parameter configuration will be used.

GetParFixed

public virtual Bool_t GetParFixed(const char * ParName)
Return kTRUE, if parameter should be fixed.
If configuration object assigned to fitter, this flag will be tested there first and only then original parameter configuration will be used.ÿ

GetParRange

public virtual Bool_t GetParRange(const char * ParName, Double_t& RangeMin, Double_t& RangeMax)
Return kTRUE, if range condition specified for parameter and range boundaries.
If configuration object assigned to fitter, range values will be tested there first and only then original parameter configuration will be used.

GetResultFF

public const Double_t GetResultFF()
Return result value of fit function.

GetResultNDF

public const Int_t GetResultNDF()
Return result value of number of degree of freedom.

GetResults

public const const TArrayD* GetResults()
Returns pointer on array of result values.

GetResultValue

public const Double_t GetResultValue(Int_t n)
Return value of result with given index.
Normally at the end of execution of actions list values of parameters stores to results array.
This array can be accessed later by GetNumResults(), GetResultValue() or GetResults() methods.
If configuration was assigned during action, it may provide alternative way to calculating result values, which will be stored in fitter.

InitFitterData

protected virtual Bool_t InitFitterData()
Initialize fitter data.
Called during Initialize() method.
Should be reimplemented in derived classes.

Initialize

protected virtual Bool_t Initialize()
Initialize fitter.
Called automatically before any actions execution.

InitializeDependencies

protected Bool_t InitializeDependencies(TObjArray& Dependencies, Bool_t BlockPars, Bool_t DoInit)
Initialize a list of dependencies (TGo4FitDependecy object), which used in configuration.

IsInitialized

protected Bool_t IsInitialized()
Return kTRUE, if Initialize() was done.

IsParsAsResults

public Bool_t IsParsAsResults()
Return kTRUE, if parameters were taken as result values.

IsSuitableConfig

public Bool_t IsSuitableConfig(TGo4FitterConfig* Config)
Checks, if config object corresponds to fitter parameters.

NeedPadsNumber

public Int_t NeedPadsNumber()
Returns required number of TPad for actions output.
Currently only "Draw" command of TGo4FitterOutput method requires pad for output.

NumPars

public virtual Int_t NumPars()
Return total number of parameters, which should be fitted.
Parameters are collects from all associated objects like data or models.

Print

public virtual const void Print(Option_t* option)
Print information about fitter to standar output.

PrintResults

public const void PrintResults()
Print result values to standard output.

ProcessObjects

public TObjArray* ProcessObjects(TObjArray* objs, Bool_t CloneFitter, Bool_t OnlyRequired, TObjArray* rownames, TObjArray* colnames)

ReplaceAction

public void ReplaceAction(TGo4FitterAction* action, Int_t dir)
Shift action in action list upward (dir=-1) or downward (dir=+1).

RunDependenciesList

protected void RunDependenciesList(TObjArray& Dependencies, Double_t* pars)
Execute dependency equations.

SetPad

public void SetPad(Int_t indx, TVirtualPad* pad)
Set pad, which will be used for output of TGo4FitterOutput object.
If pad will not be set or command will not create new pad, current gPad object will be used for output.
Thus, if several "Draw" command occur, result of last command will be seen on current pad.

SetParsListChange

public void SetParsListChange()
Should be used, when number of parameters are changed.
Next time, when somebody will access fitter parameter list, fitter automatically recollect parameters from associated objects.

Association Links

to Class TObjArray

Array of actions onkects (inherited from TGo4FitterAction).

to Class TArrayD

Array of result values.
If no specific configuration is used, this just values of fitter parameters.
Result array creates in the end of actions execution.

to Class TGo4FitterConfig

Pointer on currently activated config object.

to Class TGo4FitterAction

Supplier Cardinality 0..*
Type aggregation

J.Adamczewski, M.Al-Turany, D.Bertini, H.G.Essel, S.Linev

30-06-2005