GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4FitterAbstract.h
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
14#ifndef TGO4FITTERABSTRACT_H
15#define TGO4FITTERABSTRACT_H
16
17#include "TGo4FitParsList.h"
18#include "TGo4FitSlot.h"
19
20#include "TObjArray.h"
21#include "TArrayD.h"
22
23class TVirtualPad;
27
37 public:
38
43
49 TGo4FitterAbstract(const char *iName, const char *iTitle);
50
54 virtual ~TGo4FitterAbstract();
55
60 void Clear(Option_t *option = "") override;
61
66 Int_t NumPars() override
67 {
70 }
71
76 void SetParsListChange() { fbParsChange = kTRUE; }
77
82
87 Bool_t GetParFixed(const char *ParName) override;
88
93 Bool_t GetParRange(const char *ParName, Double_t& RangeMin, Double_t& RangeMax) override;
94
99 Bool_t GetParEpsilon(const char *ParName, Double_t& Epsilon) override;
100
104 Bool_t IsSuitableConfig(TGo4FitterConfig* Config);
105
110 Bool_t ApplyConfig(TGo4FitterConfig* Config);
111
117 Double_t CalculateFitFunction(Double_t *pars = nullptr);
118
124 void AddAction(TGo4FitterAction* Action);
125
129 void AddActionAt(TGo4FitterAction* Action, Int_t indx);
130
134 Int_t GetNumActions() const { return fxActions.GetLast()+1; }
135
139 TGo4FitterAction* GetAction(Int_t num);
140
144 void DeleteActions() { fxActions.Delete(); }
145
149 void DeleteAction(TGo4FitterAction* action);
150
154 void ReplaceAction(TGo4FitterAction* action, Int_t dir);
155
164 void DoActions(Bool_t AllowFitterChange = kFALSE, TObjArray *Actions = nullptr);
165
169 void DoAction(TGo4FitterAction* Action);
170
174 void DoAction(Int_t indx);
175
176
177 TObjArray *ProcessObjects(TObjArray *objs, Bool_t CloneFitter = kTRUE, Bool_t OnlyRequired = kTRUE, TObjArray *rownames = nullptr, TObjArray *colnames = nullptr);
178
184 void AddSimpleMinuit();
185
189 TGo4FitterOutput* AddOutputAction(const char *Action, const char *Option = nullptr);
190
194 void DeleteOutputActions();
195
200 Int_t NeedPadsNumber();
201
207 void SetPad(Int_t indx, TVirtualPad *pad);
208
212 Bool_t IsParsAsResults() const { return fbParsAsResults; }
213
217 Int_t GetNumResults() const { return fxResults.GetSize() > 2 ? fxResults.GetSize() - 2 : 0; }
218
225 Double_t GetResultValue(Int_t n) const;
226
230 Double_t GetResultFF() const;
231
235 Int_t GetResultNDF() const;
236
240 const TArrayD* GetResults() { return &fxResults; }
241
245 void PrintResults() const;
246
250 void Print(Option_t *option = "") const override;
251
252 protected:
253
258 virtual Bool_t Initialize();
259
263 Bool_t IsInitialized() const { return fbInitializationDone; }
264
268 virtual void Finalize();
269
274 virtual void CollectAllPars();
275
280 TGo4FitParameter *Get(Int_t n) override
281 {
283 return TGo4FitParsList::Get(n);
284 }
285
290
295 virtual Double_t DoCalculation() { return 0.; }
296
301 virtual Int_t DoNDFCalculation() { return 0; }
302
306 Bool_t InitializeDependencies(TObjArray& Dependencies, Bool_t BlockPars, Bool_t DoInit);
307
311 void RunDependenciesList(TObjArray& Dependencies, Double_t *pars);
312
316 void FinalizeDependencies(TObjArray& Dependencies);
317
321 void ExecuteDependencies(Double_t *pars);
322
328 virtual Bool_t InitFitterData() { return kTRUE; }
329
335 virtual void FinalizeFitterData() {}
336
340 TObjArray fxActions;
341
347 TArrayD fxResults;
348
353
357 Bool_t fbParsChange{kFALSE};
358
362 Bool_t fbInitializationDone{kFALSE};
363
367 Bool_t fbNeedToFinalize{kFALSE};
368
369 Bool_t fbParsAsResults{kFALSE};
370
371 ClassDefOverride(TGo4FitterAbstract,1)
372};
373
374#endif // TGO4FITTERABSTRACT_H
Model and data objects parameter.
virtual TGo4FitParameter * Get(Int_t n)
TGo4FitParsList()
Default constructor.
virtual Int_t NumPars()
Return number of parameters in list.
Abstract fitter class.
virtual Int_t DoNDFCalculation()
Calculates number of dimensions of freedom; Should be implemented in inherited classes.
void DoActions(Bool_t AllowFitterChange=kFALSE, TObjArray *Actions=nullptr)
Executes actions list.
Bool_t GetParRange(const char *ParName, Double_t &RangeMin, Double_t &RangeMax) override
Return kTRUE, if range condition specified for parameter and range boundaries.
void SetParsListChange()
Should be used, when number of parameters are changed.
virtual void FinalizeFitterData()
Finalize fitter data.
Bool_t IsInitialized() const
Return kTRUE, if Initialize() was done.
TObjArray * ProcessObjects(TObjArray *objs, Bool_t CloneFitter=kTRUE, Bool_t OnlyRequired=kTRUE, TObjArray *rownames=nullptr, TObjArray *colnames=nullptr)
void Clear(Option_t *option="") override
Clear fitter.
void DeleteOutputActions()
Remove and delete all output actions from actions list.
Bool_t GetParEpsilon(const char *ParName, Double_t &Epsilon) override
Return kTRUE, if epsilon value specified for parameter.
TObjArray fxActions
Array of actions objects (inherited from TGo4FitterAction).
void Print(Option_t *option="") const override
Print information about fitter to standard output.
void DeleteActions()
Remove and delete all actions from actions list.
Bool_t fbParsChange
Boolean variable, showing that number of parameters is changed.
const TArrayD * GetResults()
Returns pointer on array of result values.
void CheckParsListChanging()
If appropriate flag sets (via SetParsListChange() method), function recollect all parameters from all...
Bool_t GetParFixed(const char *ParName) override
Return kTRUE, if parameter should be fixed.
Bool_t InitializeDependencies(TObjArray &Dependencies, Bool_t BlockPars, Bool_t DoInit)
Initialize a list of dependencies (TGo4FitDependecy object), which used in configuration.
Double_t CalculateFitFunction(Double_t *pars=nullptr)
Calculates value of fit function.
TGo4FitterOutput * AddOutputAction(const char *Action, const char *Option=nullptr)
Creates and add TGo4FitterOutput action with given parameters to actions list.
Bool_t IsSuitableConfig(TGo4FitterConfig *Config)
Checks, if config object corresponds to fitter parameters.
virtual Bool_t Initialize()
Initialize fitter.
Int_t NeedPadsNumber()
Returns required number of TPad for actions output.
void PrintResults() const
Print result values to standard output.
virtual ~TGo4FitterAbstract()
Destroy TGo4FitterAbstract object.
Bool_t ApplyConfig(TGo4FitterConfig *Config)
Set active configuration object.
Int_t GetResultNDF() const
Return result value of number of degree of freedom.
Bool_t fbInitializationDone
Flag showing, that initialization was complete.
Double_t GetResultFF() const
Return result value of fit function.
void SetPad(Int_t indx, TVirtualPad *pad)
Set pad, which will be used for output of TGo4FitterOutput object.
void DeleteAction(TGo4FitterAction *action)
Remove action from actions list and destroy it.
TGo4FitterAction * GetAction(Int_t num)
Returns pointer on action with given index.
void AddAction(TGo4FitterAction *Action)
Add action to action list.
TGo4FitParameter * Get(Int_t n) override
Return pointer on parameter of given index.
Double_t GetResultValue(Int_t n) const
Return value of result with given index.
void CopyParsValuesFrom(TGo4FitterAbstract *fitter)
If provided fitter has a same list of parameters, their values will be copied to fitter.
void AddSimpleMinuit()
Creates and add TGo4FitMinuit object to actions list.
TGo4FitterAbstract()
Default constructor.
virtual void Finalize()
Remove all buffer, created in Initialize() routine.
void FinalizeDependencies(TObjArray &Dependencies)
Relese memory, allocated for dependency executions.
void RunDependenciesList(TObjArray &Dependencies, Double_t *pars)
Execute dependency equations.
Bool_t fbNeedToFinalize
Flag, showing, that finalize method should be called before fitter will be destroyed.
virtual Double_t DoCalculation()
Calculates value of fit function according current values of parameters.
void ExecuteDependencies(Double_t *pars)
Execute dependencies in currently associated configuration (if exist).
void DoAction(TGo4FitterAction *Action)
Executes specified action.
Int_t NumPars() override
Return total number of parameters, which should be fitted.
TArrayD fxResults
Array of result values.
void ReplaceAction(TGo4FitterAction *action, Int_t dir)
Shift action in action list upward (dir=-1) or downward (dir=+1).
Int_t GetNumResults() const
Return number of result values.
Bool_t IsParsAsResults() const
Return kTRUE, if parameters were taken as result values.
virtual void CollectAllPars()
Should collect parameters from all associated to fitter objects.
Int_t GetNumActions() const
Returns number of action in actions list.
virtual Bool_t InitFitterData()
Initialize fitter data.
TGo4FitterConfig * fxCurrentConfig
Pointer on currently activated config object.
void AddActionAt(TGo4FitterAction *Action, Int_t indx)
Add action to action list at specified index.
Basic class for objects, which performs actions on fitter.
Fitter configuration action.
Output action.