GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
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 
23 class TVirtualPad;
24 class TGo4FitterConfig;
25 class TGo4FitterAction;
26 class TGo4FitterOutput;
27 
36  public:
37 
42 
48  TGo4FitterAbstract(const char *iName, const char *iTitle);
49 
53  virtual ~TGo4FitterAbstract();
54 
59  void Clear(Option_t *option = "") override;
60 
65  Int_t NumPars() override
66  {
68  return TGo4FitParsList::NumPars();
69  }
70 
75  void SetParsListChange() { fbParsChange = kTRUE; }
76 
81 
86  Bool_t GetParFixed(const char *ParName) override;
87 
92  Bool_t GetParRange(const char *ParName, Double_t& RangeMin, Double_t& RangeMax) override;
93 
98  Bool_t GetParEpsilon(const char *ParName, Double_t& Epsilon) override;
99 
103  Bool_t IsSuitableConfig(TGo4FitterConfig* Config);
104 
109  Bool_t ApplyConfig(TGo4FitterConfig* Config);
110 
116  Double_t CalculateFitFunction(Double_t *pars = nullptr);
117 
123  void AddAction(TGo4FitterAction* Action);
124 
128  void AddActionAt(TGo4FitterAction* Action, Int_t indx);
129 
133  Int_t GetNumActions() const { return fxActions.GetLast()+1; }
134 
138  TGo4FitterAction* GetAction(Int_t num);
139 
143  void DeleteActions() { fxActions.Delete(); }
144 
148  void DeleteAction(TGo4FitterAction* action);
149 
153  void ReplaceAction(TGo4FitterAction* action, Int_t dir);
154 
163  void DoActions(Bool_t AllowFitterChange = kFALSE, TObjArray *Actions = nullptr);
164 
168  void DoAction(TGo4FitterAction* Action);
169 
173  void DoAction(Int_t indx);
174 
175 
176  TObjArray *ProcessObjects(TObjArray *objs, Bool_t CloneFitter = kTRUE, Bool_t OnlyRequired = kTRUE, TObjArray *rownames = nullptr, TObjArray *colnames = nullptr);
177 
183  void AddSimpleMinuit();
184 
188  TGo4FitterOutput* AddOutputAction(const char *Action, const char *Option = nullptr);
189 
193  void DeleteOutputActions();
194 
199  Int_t NeedPadsNumber();
200 
206  void SetPad(Int_t indx, TVirtualPad *pad);
207 
211  Bool_t IsParsAsResults() const { return fbParsAsResults; }
212 
216  Int_t GetNumResults() const { return fxResults.GetSize() > 2 ? fxResults.GetSize() - 2 : 0; }
217 
224  Double_t GetResultValue(Int_t n) const;
225 
229  Double_t GetResultFF() const;
230 
234  Int_t GetResultNDF() const;
235 
239  const TArrayD* GetResults() { return &fxResults; }
240 
244  void PrintResults() const;
245 
249  void Print(Option_t *option = "") const override;
250 
251  protected:
252 
257  virtual Bool_t Initialize();
258 
262  Bool_t IsInitialized() const { return fbInitializationDone; }
263 
267  virtual void Finalize();
268 
273  virtual void CollectAllPars();
274 
279  TGo4FitParameter *Get(Int_t n) override
280  {
282  return TGo4FitParsList::Get(n);
283  }
284 
289 
294  virtual Double_t DoCalculation() { return 0.; }
295 
300  virtual Int_t DoNDFCalculation() { return 0; }
301 
305  Bool_t InitializeDependencies(TObjArray& Dependencies, Bool_t BlockPars, Bool_t DoInit);
306 
310  void RunDependenciesList(TObjArray& Dependencies, Double_t *pars);
311 
315  void FinalizeDependencies(TObjArray& Dependencies);
316 
320  void ExecuteDependencies(Double_t *pars);
321 
327  virtual Bool_t InitFitterData() { return kTRUE; }
328 
334  virtual void FinalizeFitterData() {}
335 
339  TObjArray fxActions;
340 
346  TArrayD fxResults;
347 
352 
356  Bool_t fbParsChange{kFALSE};
357 
361  Bool_t fbInitializationDone{kFALSE};
362 
366  Bool_t fbNeedToFinalize{kFALSE};
367 
368  Bool_t fbParsAsResults{kFALSE};
369 
370  ClassDefOverride(TGo4FitterAbstract,1)
371 };
372 
373 #endif // TGO4FITTERABSTRACT_H
virtual void FinalizeFitterData()
void Print(Option_t *option="") const override
void DoAction(TGo4FitterAction *Action)
void DeleteAction(TGo4FitterAction *action)
virtual Double_t DoCalculation()
void AddAction(TGo4FitterAction *Action)
const TArrayD * GetResults()
virtual Bool_t InitFitterData()
void ReplaceAction(TGo4FitterAction *action, Int_t dir)
Bool_t IsParsAsResults() const
void CopyParsValuesFrom(TGo4FitterAbstract *fitter)
void RunDependenciesList(TObjArray &Dependencies, Double_t *pars)
void FinalizeDependencies(TObjArray &Dependencies)
Int_t NumPars() override
Bool_t IsInitialized() const
virtual Int_t NumPars()
virtual void CollectAllPars()
Bool_t GetParEpsilon(const char *ParName, Double_t &Epsilon) override
TGo4FitterConfig * fxCurrentConfig
Double_t GetResultFF() const
Bool_t GetParFixed(const char *ParName) override
Bool_t InitializeDependencies(TObjArray &Dependencies, Bool_t BlockPars, Bool_t DoInit)
TGo4FitParameter * Get(Int_t n) override
TGo4FitterAction * GetAction(Int_t num)
Int_t GetNumResults() const
virtual Bool_t Initialize()
TGo4FitterOutput * AddOutputAction(const char *Action, const char *Option=nullptr)
Double_t CalculateFitFunction(Double_t *pars=nullptr)
void Clear(Option_t *option="") override
TObjArray * ProcessObjects(TObjArray *objs, Bool_t CloneFitter=kTRUE, Bool_t OnlyRequired=kTRUE, TObjArray *rownames=nullptr, TObjArray *colnames=nullptr)
virtual TGo4FitParameter * Get(Int_t n)
void SetPad(Int_t indx, TVirtualPad *pad)
Double_t GetResultValue(Int_t n) const
Bool_t GetParRange(const char *ParName, Double_t &RangeMin, Double_t &RangeMax) override
void AddActionAt(TGo4FitterAction *Action, Int_t indx)
Int_t GetNumActions() const
Bool_t IsSuitableConfig(TGo4FitterConfig *Config)
void DoActions(Bool_t AllowFitterChange=kFALSE, TObjArray *Actions=nullptr)
Bool_t ApplyConfig(TGo4FitterConfig *Config)
virtual Int_t DoNDFCalculation()
void ExecuteDependencies(Double_t *pars)