v2.10-0 (21000JUN2005)

Go4Fit
Class TGo4FitModel

Direct Known Subclasses:
TGo4FitModelFormula, TGo4FitModelFromData, TGo4FitModelFunction, TGo4FitModelGauss1, TGo4FitModelGauss2, TGo4FitModelGaussN, TGo4FitModelPolynom, TModelTemplate

class TGo4FitModel
derived from TGo4FitComponent

Basic abstract class for represnting model components of fitted data.


Field Summary
 protected Bool_tfbAbsoluteEps
          States, if integration precision absolute or relative.
 protected Bool_tfbIntegrScaling
          Scale integral to integration volume.
 private Bool_tfbNeedToRebuild
          Internal flag.
 protected Double_tfdIntegrEps
          Integration precision.
 private Int_tfiGroupIndex
          Store group index of specified model.
 protected Int_tfiMaxIntegrDepth
          Maximum intergration depth.
 protected Int_tfiMinIntegrDepth
          Minimum depth of integration.
 private TGo4FitParsList*fxAllPars
          List of all parameters, associated not only with component directly but also with incapsulated objects.
 private TArrayD*fxAllParsValues
           
 private TObjArrayfxAssigments
          List of TGo4FitAssignment objects.
 private TArrayDfxCurrentPars
          Array of values of parameters.
 private Double_t*fxCurrentParsArray
          Pointer on array of parameters values.

Fields inherited from class TNamed
fName, fTitle

Fields inherited from class Go4Fit.TGo4FitSlotList
fbUpdateSlotList, fxSlotList

Constructor Summary
TGo4FitModel()
          Default constructor.
TGo4FitModel(const char * iName, const char * iTitle, Bool_t MakeAmplitude)
          Creates TGo4FitModel object with given name.

Destructor Summary
 virtual synchronized ~TGo4FitModel()
          Delete TGo4FitModel object.

Method Summary
 Bool_tAddModelToDataResult(TGo4FitData* data)
          Evaluate model values for all data point and add them to result buffer.
 virtual voidAfterEval()
          Clear buffers, which were created by BeforeEval() method.
 const const char *AssignmentName(Int_t n)
          Returns name of data, to which model object is assigned.
 voidAssignToData(const char * DataName, Double_t RatioValue, Bool_t FixRatio)
          Assign model to specified data object.
 virtual Bool_tBeforeEval(Int_t ndim)
          Prepares (if necesary) some intermediate variables to be able calculate values of model via EvalN() function.
 protected const Bool_tBuffersAllocated()
          Checks if model allocate buffers for calculations
 voidChangeDataNameInAssignments(const char * oldname, const char * newname)
          Change name of data in assignments.
 voidClearAssigmentTo(const char * DataName)
           
 voidClearAssignments()
          Remove all assignments.
 voidClearAssignmentTo(const char * DataName)
          Remove assignment to given data (if exists).
 voidConnectToDataIfAssigned(TGo4FitData* data)
          Check, if model assigned to such a data (via name) and store pointer on this data object.
 virtual Double_tEvalN(const Double_t* v)
          Calculates value of model according current parameters values and provided axes values.
 virtual Double_tEvaluate(Double_t x)
          Calculates value of model for given x value.
 virtual Double_tEvaluate(Double_t x, Double_t y)
          Calculates value of model for given x,y values.
 virtual Double_tEvaluate(Double_t x, Double_t y, Double_t z)
          Calculates value of model for given x,y,z values.
 virtual Double_tEvaluate(Double_t* v, Int_t ndim)
          Calculates value of model for given axis values.
 protected Double_tEvaluateAndIntegrate(Int_t NumScales, const Double_t* Scales, const Double_t* Widths)
          Make integration of model inside given point, if integration specified.
 virtual Double_tEvaluateAtPoint(TGo4FitData* data, Int_t nbin, Bool_t UseRanges)
          Evaluate model value for specified data point.
 virtual Double_tEvaluateAtPoint(TGo4FitDataIter* iter, Bool_t UseRanges)
          Evaluate model value for point, specified by current values of iterator.
 protected virtual voidFinalize()
          Deletes all buffers, created during initialization.
 private const TGo4FitAssignment*FindAssigment(const char * DataName)
          Find assignment to given data.
 protected virtual TGo4FitParameter*Get(Int_t n)
           
 private TGo4FitAssignment*GetAssigment(Int_t n)
          Return TGo4FitAssignment object with given index.
 private const TGo4FitAssignment*GetAssigment(Int_t n)
           
 protected TGo4FitData*GetAssignedConnection(Int_t n)
          Return pointer on assigned data.
 protected const const Int_t*GetDataFullIndex(TGo4FitData* data, Int_t nbin)
           
 protected Int_tGetDataIndexesSize(TGo4FitData* data)
           
 const Int_tGetGroupIndex()
          Returns group index of model.
 protected const Double_t*GetModelBins(const char * DataName)
          Get model bins for specified data (if exists)
 virtual Bool_tGetPosition(Int_t naxis, Double_t& pos)
          Return position of model, if exists.
 protected virtual TGo4FitParameter*GetPosPar(Int_t naxis)
          Return parameter (if exist), which represent position of model for given axis.
 protected virtual Int_tGetPosParIndex(Int_t )
          Return index of parameter (if exist), which represent position of model for given axis.
 private TStringGetRatioName(Int_t n)
          Set name of ratio parameter.
 Double_tGetRatioValueFor(const char * DataName)
          Returns ratio value for specified data object.
 virtual Bool_tGetWidth(Int_t naxis, Double_t& width)
          Returns with of model component, if exists.
 protected virtual TGo4FitParameter*GetWidthPar(Int_t naxis)
          Return parameter (if exist), which represent width of model component for given axis.
 protected virtual Int_tGetWidthParIndex(Int_t )
          Return index of parameter (if exist), which represent width of model component for given axis.
 protected virtual Bool_tInitialize(Int_t UseBuffers)
          Initialize model object.
 virtual Double_tIntegral()
          Calculates intagral of model component
 const Bool_tIsAssignTo(const char * DataName)
          Checks, if model assigned to given data.
 Bool_tNeedIntegration()
          Returns kTRUE, if integration properties were specified.
 const Int_tNumAssigments()
          Returns number of assignment for this model.
 virtual Int_tNumPars()
           
 virtual const voidPrint(Option_t* option)
          Print information about model object on standard output.
 protected voidRebuildShape(Bool_t ForceBuild)
          Recalculates shape of object.
 private voidRemoveAllPars()
          Clear all buffers, allocated during initialization.
 voidSetBackgroundGroupIndex()
          Set group index to background (index=0).
 voidSetGroupIndex(Int_t index)
          Set group index of model.
 voidSetIntegrationsProperty(Int_t iMinIntegrDepth, Int_t iMaxIntegrDepth, Double_t iIntegrEps, Bool_t iAbsoluteEps, Bool_t iIntegrScaling)
          Set integration properties.
 protected voidSetNeedToRebuild()
          Sets flag, that shape bins should be refilled next time, when RebuildShape() routine will be called.
 virtual Bool_tSetPosition(Int_t naxis, Double_t pos)
          Sets position of model component, if possible.
 virtual Bool_tSetWidth(Int_t naxis, Double_t width)
          Sets width of model component, if possible.
 protected virtual Double_tUserFunction(Double_t* , Double_t* )
          Another place, where user specific code can be placed for model values calculation.

Methods inherited from class Go4Fit.TGo4FitComponent
AddRangeCondition, AddRangeCut, CanAmplTouch, CheckRangeConditions, ClearRanges, CollectParsTo, ExcludeRange, GetAmplError, GetAmplFullName, GetAmplIndex, GetAmplName, GetAmplPar, GetAmplValue, GetNumRangeCondition, GetNumRangeCut, GetRangeCondition, GetRangeCut, GetRangeMax, GetRangeMin, GetUseBuffers, IsAnyRangeLimits, IsRangeCutExcluding, MakeAmpl, NewAmplitude, NewParameter, RemoveAmpl, RemoveRangeCondition, RemoveRangeCut, SetAmplError, SetAmplIndex, SetAmplValue, SetRange, SetRangeCondition, SetRangeCutExcluding, SetRangeMax, SetRangeMin, SetUseBuffers

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

fbAbsoluteEps

protected Bool_t fbAbsoluteEps
States, if integration precision absolute or relative.

fbIntegrScaling

protected Bool_t fbIntegrScaling
Scale integral to integration volume.

fbNeedToRebuild

private Bool_t fbNeedToRebuild
Internal flag. Signals, when object should be rebuild.

fdIntegrEps

protected Double_t fdIntegrEps
Integration precision.

fiGroupIndex

private Int_t fiGroupIndex
Store group index of specified model.

fiMaxIntegrDepth

protected Int_t fiMaxIntegrDepth
Maximum intergration depth.

fiMinIntegrDepth

protected Int_t fiMinIntegrDepth
Minimum depth of integration.

fxAllPars

private TGo4FitParsList* fxAllPars
List of all parameters, associated not only with component directly but also with incapsulated objects.

fxAllParsValues

private TArrayD* fxAllParsValues

fxAssigments

private TObjArray fxAssigments
List of TGo4FitAssignment objects.

fxCurrentPars

private TArrayD fxCurrentPars
Array of values of parameters.

fxCurrentParsArray

private Double_t* fxCurrentParsArray
Pointer on array of parameters values.
Constructor Detail

TGo4FitModel

public TGo4FitModel()
Default constructor.

TGo4FitModel

public TGo4FitModel(const char * iName, const char * iTitle, Bool_t MakeAmplitude)
Creates TGo4FitModel object with given name.
Standard constrcutor. Add amplitude parameter, if specified.
TGo4FitModel object should not be used directly. It is only basic class for concrete implementations like gaussians, polynoms and so on.
Method Detail

~TGo4FitModel

public virtual synchronized ~TGo4FitModel()
Delete TGo4FitModel object.
Method Detail

AddModelToDataResult

public Bool_t AddModelToDataResult(TGo4FitData* data)
Evaluate model values for all data point and add them to result buffer.
Data should be initialized.

AfterEval

public virtual void AfterEval()
Clear buffers, which were created by BeforeEval() method.

AssignmentName

public const const char * AssignmentName(Int_t n)
Returns name of data, to which model object is assigned.

AssignToData

public void AssignToData(const char * DataName, Double_t RatioValue, Bool_t FixRatio)
Assign model to specified data object.
When model assigns to more then one data, additional "Ratio1", "Ratio2" and so on parameters will be created.
They means ratio in amplitude of model component in this data to ampltute of this component in data, to wich model was assigned first. By default, this ratio is 1. and not fixed.

BeforeEval

public virtual Bool_t BeforeEval(Int_t ndim)
Prepares (if necesary) some intermediate variables to be able calculate values of model via EvalN() function.
Number of axis, which will be used in evaluations, should be specified.

BuffersAllocated

protected const Bool_t BuffersAllocated()
Checks if model allocate buffers for calculations

ChangeDataNameInAssignments

public void ChangeDataNameInAssignments(const char * oldname, const char * newname)
Change name of data in assignments.

ClearAssigmentTo

public void ClearAssigmentTo(const char * DataName)

ClearAssignments

public void ClearAssignments()
Remove all assignments.

ClearAssignmentTo

public void ClearAssignmentTo(const char * DataName)
Remove assignment to given data (if exists).

ConnectToDataIfAssigned

public void ConnectToDataIfAssigned(TGo4FitData* data)
Check, if model assigned to such a data (via name) and store pointer on this data object.

EvalN

public virtual Double_t EvalN(const Double_t* v)
Calculates value of model according current parameters values and provided axes values.
BeforeEval(), EvalN() & AfterEval() virtual methods provides general interface, where user-specific code should be situated.

Evaluate

public virtual Double_t Evaluate(Double_t x)
Calculates value of model for given x value.

Evaluate

public virtual Double_t Evaluate(Double_t x, Double_t y)
Calculates value of model for given x,y values.

Evaluate

public virtual Double_t Evaluate(Double_t x, Double_t y, Double_t z)
Calculates value of model for given x,y,z values.

Evaluate

public virtual Double_t Evaluate(Double_t* v, Int_t ndim)
Calculates value of model for given axis values.

EvaluateAndIntegrate

protected Double_t EvaluateAndIntegrate(Int_t NumScales, const Double_t* Scales, const Double_t* Widths)
Make integration of model inside given point, if integration specified.

EvaluateAtPoint

public virtual Double_t EvaluateAtPoint(TGo4FitData* data, Int_t nbin, Bool_t UseRanges)
Evaluate model value for specified data point.
All scales values will be take from data buffers, therefore data should be initialized.

EvaluateAtPoint

public virtual Double_t EvaluateAtPoint(TGo4FitDataIter* iter, Bool_t UseRanges)
Evaluate model value for point, specified by current values of iterator.

Finalize

protected virtual void Finalize()
Deletes all buffers, created during initialization.

FindAssigment

private const TGo4FitAssignment* FindAssigment(const char * DataName)
Find assignment to given data.

Get

protected virtual TGo4FitParameter* Get(Int_t n)

GetAssigment

private TGo4FitAssignment* GetAssigment(Int_t n)
Return TGo4FitAssignment object with given index.

GetAssigment

private const TGo4FitAssignment* GetAssigment(Int_t n)

GetAssignedConnection

protected TGo4FitData* GetAssignedConnection(Int_t n)
Return pointer on assigned data.

GetDataFullIndex

protected const const Int_t* GetDataFullIndex(TGo4FitData* data, Int_t nbin)

GetDataIndexesSize

protected Int_t GetDataIndexesSize(TGo4FitData* data)

GetGroupIndex

public const Int_t GetGroupIndex()
Returns group index of model.

GetModelBins

protected const Double_t* GetModelBins(const char * DataName)
Get model bins for specified data (if exists)

GetPosition

public virtual Bool_t GetPosition(Int_t naxis, Double_t& pos)
Return position of model, if exists.

GetPosPar

protected virtual TGo4FitParameter* GetPosPar(Int_t naxis)
Return parameter (if exist), which represent position of model for given axis.

GetPosParIndex

protected virtual Int_t GetPosParIndex(Int_t )
Return index of parameter (if exist), which represent position of model for given axis.

GetRatioName

private TString GetRatioName(Int_t n)
Set name of ratio parameter.

GetRatioValueFor

public Double_t GetRatioValueFor(const char * DataName)
Returns ratio value for specified data object.
Return 1., if model not assign to data.

GetWidth

public virtual Bool_t GetWidth(Int_t naxis, Double_t& width)
Returns with of model component, if exists.

GetWidthPar

protected virtual TGo4FitParameter* GetWidthPar(Int_t naxis)
Return parameter (if exist), which represent width of model component for given axis.

GetWidthParIndex

protected virtual Int_t GetWidthParIndex(Int_t )
Return index of parameter (if exist), which represent width of model component for given axis.

Initialize

protected virtual Bool_t Initialize(Int_t UseBuffers)
Initialize model object.
If usage of buffers is specified (UseBuffers>0),
method creates a number of buffers for representing model bins for each data, to which model was assign to.

Integral

public virtual Double_t Integral()
Calculates intagral of model component

IsAssignTo

public const Bool_t IsAssignTo(const char * DataName)
Checks, if model assigned to given data.

NeedIntegration

public Bool_t NeedIntegration()
Returns kTRUE, if integration properties were specified.

NumAssigments

public const Int_t NumAssigments()
Returns number of assignment for this model.

NumPars

public virtual Int_t NumPars()

Print

public virtual const void Print(Option_t* option)
Print information about model object on standard output.

RebuildShape

protected void RebuildShape(Bool_t ForceBuild)
Recalculates shape of object.

RemoveAllPars

private void RemoveAllPars()
Clear all buffers, allocated during initialization.

SetBackgroundGroupIndex

public void SetBackgroundGroupIndex()
Set group index to background (index=0).

SetGroupIndex

public void SetGroupIndex(Int_t index)
Set group index of model.
Models, having same group index, can be displayed together
If index=-1, models are not belongs to any group
index=0 reserved for "Background" group.
All polynoms gets background group index.
By default index = -1

SetIntegrationsProperty

public void SetIntegrationsProperty(Int_t iMinIntegrDepth, Int_t iMaxIntegrDepth, Double_t iIntegrEps, Bool_t iAbsoluteEps, Bool_t iIntegrScaling)
Set integration properties.
This function make sence, if model assign to histogramic data. In this case each bins defined on some finite range.
By default there is no integration and model uses central positions in each range, where data bins is defined.
If model changes much in these ranges, it may cause big error in modeling. In this case integration inside each data bin ranges can highly reduce these errors.
To make integration, bin range on each axis divides on (2^depth) segemnts and value of model calculates in each segments. Thus, if data bins defined on two-dimensional space and depth=3, each bins range were diveded on 8x8=64 squares and model will be calculated 64 times.
MinIntegrDepth and MaxIntegrDepth means minimum and maximum allowed integration depth correspondently. If MaxIntegrDepth not specified, it will be equal to MinIntegrDepth.
If MinIntegrDepth less then MaxIntegrDepth, model will try to use minimum value first. Then it checks, if result value changes not very much. If so, it finish calculation, otherwise it increases depth of integration up to MaxIntegrDepth.
IntegrEps sets maximum allowed error in result value. It can be absolute (when AbsoluteEps = kTRUE) or relative to previous calculated value (with depth-1).
Value of each bin also can be scaled on volume (IntegrScalink = kTRUE, default = kFALSE).

SetNeedToRebuild

protected void SetNeedToRebuild()
Sets flag, that shape bins should be refilled next time, when RebuildShape() routine will be called.

SetPosition

public virtual Bool_t SetPosition(Int_t naxis, Double_t pos)
Sets position of model component, if possible.

SetWidth

public virtual Bool_t SetWidth(Int_t naxis, Double_t width)
Sets width of model component, if possible.

UserFunction

protected virtual Double_t UserFunction(Double_t* , Double_t* )
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.

Association Links

to Class TObjArray

List of TGo4FitAssignment objects.

to Class TArrayD

Array of values of parameters.

to Class TGo4FitParsList

List of all parameters, associated not only with component directly but also with incapsulated objects.

to Class TArrayD

to Class TGo4FitAssignment

Supplier Cardinality 0..*
Type aggregation

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

30-06-2005