GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitModel.h
Go to the documentation of this file.
1 // $Id: TGo4FitModel.h 1927 2016-06-30 08:03:38Z linev $
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 für 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 TGO4FITMODEL_H
15 #define TGO4FITMODEL_H
16 
17 #include "TNamed.h"
18 #include "TGo4FitComponent.h"
19 
20 class TGo4FitParameter;
21 class TGo4FitData;
22 class TGo4FitDataIter;
23 
27 class TGo4FitAssignment : public TNamed {
28  public:
29 
34 
38  TGo4FitAssignment(const char* DataName);
39 
43  virtual ~TGo4FitAssignment();
44 
45  Double_t RatioValue();
46 
50  virtual void Print(Option_t* option) const;
51 
56 
61 
65  Char_t* fxModelMask;
66 
72  Double_t* fxModelBins;
73 
75 };
76 
77 
82  public:
83 
87  TGo4FitModel();
88 
94  TGo4FitModel(const char* iName, const char* iTitle, Bool_t MakeAmplitude = kFALSE);
95 
99  virtual ~TGo4FitModel();
100 
109  void SetGroupIndex(Int_t index = -1) { fiGroupIndex = index; }
110 
115 
119  Int_t GetGroupIndex() const { return fiGroupIndex; }
120 
124  Int_t NumAssigments() const { return fxAssigments.GetLast()+1; }
125 
129  const char* AssignmentName(Int_t n) { return GetAssigment(n) ? GetAssigment(n)->GetName() : 0; }
130 
136  void AssignToData(const char* DataName, Double_t RatioValue = 1., Bool_t FixRatio = kFALSE);
137 
141  Bool_t IsAssignTo(const char* DataName) const { return FindAssigment(DataName) != 0; }
142 
146  void ChangeDataNameInAssignments(const char* oldname, const char* newname);
147 
151  void ClearAssignmentTo(const char* DataName);
152  void ClearAssigmentTo(const char* DataName) { ClearAssignmentTo(DataName); }
153 
157  void ClearAssignments();
158 
163 
168  Double_t GetRatioValueFor(const char* DataName);
169 
173  virtual void Print(Option_t* option) const;
174 
178  virtual Double_t Evaluate(Double_t x);
179 
183  virtual Double_t Evaluate(Double_t x, Double_t y);
184 
188  virtual Double_t Evaluate(Double_t x, Double_t y, Double_t z);
189 
193  virtual Double_t Evaluate(Double_t* v, Int_t ndim);
194 
198  virtual Double_t Integral();
199 
203  virtual Bool_t GetPosition(Int_t naxis, Double_t& pos);
204 
208  virtual Bool_t SetPosition(Int_t naxis, Double_t pos);
209 
213  virtual Bool_t GetWidth(Int_t naxis, Double_t& width);
214 
218  virtual Bool_t SetWidth(Int_t naxis, Double_t width);
219 
231  void SetIntegrationsProperty(Int_t iMinIntegrDepth, Int_t iMaxIntegrDepth = 0, Double_t iIntegrEps = 0., Bool_t iAbsoluteEps = kFALSE, Bool_t iIntegrScaling = kFALSE);
232 
236  Bool_t NeedIntegration() { return (fiMinIntegrDepth>0) || (fiMaxIntegrDepth>0); }
237 
242  virtual Bool_t BeforeEval(Int_t ndim);
243 
248  virtual Double_t EvalN(const Double_t* v);
249 
253  virtual void AfterEval() { return; }
254 
259  virtual Double_t EvaluateAtPoint(TGo4FitData* data, Int_t nbin, Bool_t UseRanges = kTRUE);
260 
264  virtual Double_t EvaluateAtPoint(TGo4FitDataIter* iter, Bool_t UseRanges = kTRUE);
265 
270  Bool_t AddModelToDataResult(TGo4FitData* data);
271 
272  virtual Int_t NumPars();
273 
274  protected:
275 
276  friend class TGo4Fitter;
277 
278 
279  virtual TGo4FitParameter* Get(Int_t n);
280 
284  Double_t EvaluateAndIntegrate(Int_t NumScales, const Double_t* Scales, const Double_t* Widths);
285 
291  virtual Bool_t Initialize(Int_t UseBuffers = -1);
292 
296  virtual void Finalize();
297 
302 
306  Bool_t BuffersAllocated() const;
307 
311  void RebuildShape(Bool_t ForceBuild = kFALSE);
312 
316  Double_t* GetModelBins(const char* DataName) const;
317 
321  void SetNeedToRebuild() { fbNeedToRebuild = kTRUE; }
322 
328  virtual Double_t UserFunction(Double_t*, Double_t*) { return 0; }
329 
333  virtual Int_t GetPosParIndex(Int_t) { return -1; }
334 
338  virtual Int_t GetWidthParIndex(Int_t) { return -1; }
339 
343  virtual TGo4FitParameter* GetPosPar(Int_t naxis = 0)
344  { return Get(GetPosParIndex(naxis)); }
345 
349  virtual TGo4FitParameter* GetWidthPar(Int_t naxis = 0)
350  { return Get(GetWidthParIndex(naxis)); }
351 
352  const Int_t* GetDataFullIndex(TGo4FitData* data, Int_t nbin);
353  Int_t GetDataIndexesSize(TGo4FitData* data);
354 
359 
364 
368  Double_t fdIntegrEps;
369 
374 
379 
380  private:
381 
385  void RemoveAllPars();
386 
392 
396  TGo4FitAssignment* FindAssigment(const char* DataName) const;
397 
401  TString GetRatioName(Int_t n);
402 
406  TObjArray fxAssigments;
407 
412 
416  TArrayD fxCurrentPars;
417 
421  Double_t* fxCurrentParsArray;
422 
427 
432 
433  TArrayD* fxAllParsValues;
434 
436 };
437 
438 #endif // TGO4FITMODEL_H
TString GetRatioName(Int_t n)
TArrayD fxCurrentPars
Definition: TGo4FitModel.h:416
Bool_t fbAbsoluteEps
Definition: TGo4FitModel.h:373
Int_t fiMaxIntegrDepth
Definition: TGo4FitModel.h:363
Int_t GetDataIndexesSize(TGo4FitData *data)
Double_t RatioValue()
virtual Double_t Evaluate(Double_t x)
Double_t * fxCurrentParsArray
Definition: TGo4FitModel.h:421
void ClearAssigmentTo(const char *DataName)
Definition: TGo4FitModel.h:152
virtual void Finalize()
Int_t fiGroupIndex
Definition: TGo4FitModel.h:411
virtual Int_t GetWidthParIndex(Int_t)
Definition: TGo4FitModel.h:338
void ClearAssignments()
Bool_t fbIntegrScaling
Definition: TGo4FitModel.h:378
Char_t * fxModelMask
Definition: TGo4FitModel.h:65
virtual ~TGo4FitAssignment()
TGo4FitAssignment * FindAssigment(const char *DataName) const
Int_t GetGroupIndex() const
Definition: TGo4FitModel.h:119
TGo4FitData * fxData
Definition: TGo4FitModel.h:60
TGo4FitAssignment * GetAssigment(Int_t n) const
Definition: TGo4FitModel.h:391
virtual TGo4FitParameter * GetWidthPar(Int_t naxis=0)
Definition: TGo4FitModel.h:349
void AssignToData(const char *DataName, Double_t RatioValue=1., Bool_t FixRatio=kFALSE)
Double_t * GetModelBins(const char *DataName) const
virtual Bool_t SetPosition(Int_t naxis, Double_t pos)
void RemoveAllPars()
virtual Double_t Integral()
void ClearAssignmentTo(const char *DataName)
const char * AssignmentName(Int_t n)
Definition: TGo4FitModel.h:129
virtual Double_t EvaluateAtPoint(TGo4FitData *data, Int_t nbin, Bool_t UseRanges=kTRUE)
TObjArray fxAssigments
Definition: TGo4FitModel.h:406
Double_t fdIntegrEps
Definition: TGo4FitModel.h:368
virtual Bool_t GetPosition(Int_t naxis, Double_t &pos)
Bool_t fbNeedToRebuild
Definition: TGo4FitModel.h:426
virtual TGo4FitParameter * Get(Int_t n)
void ChangeDataNameInAssignments(const char *oldname, const char *newname)
TGo4FitData * GetAssignedConnection(Int_t n)
virtual Double_t UserFunction(Double_t *, Double_t *)
Definition: TGo4FitModel.h:328
Double_t * fxModelBins
Definition: TGo4FitModel.h:72
virtual ~TGo4FitModel()
void SetNeedToRebuild()
Definition: TGo4FitModel.h:321
virtual void Print(Option_t *option) const
virtual Bool_t Initialize(Int_t UseBuffers=-1)
TGo4FitAssignment * GetAssigment(Int_t n)
Definition: TGo4FitModel.h:390
virtual Int_t GetPosParIndex(Int_t)
Definition: TGo4FitModel.h:333
virtual Bool_t BeforeEval(Int_t ndim)
TGo4FitParameter * fxRatio
Definition: TGo4FitModel.h:55
ClassDef(TGo4FitSlotList, 1)
void ConnectToDataIfAssigned(TGo4FitData *data)
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)
ClassDef(TGo4FitAssignment, 1)
virtual void AfterEval()
Definition: TGo4FitModel.h:253
void SetGroupIndex(Int_t index=-1)
Definition: TGo4FitModel.h:109
virtual Bool_t GetWidth(Int_t naxis, Double_t &width)
Bool_t NeedIntegration()
Definition: TGo4FitModel.h:236
TGo4FitParsList * fxAllPars
Definition: TGo4FitModel.h:431
Int_t NumAssigments() const
Definition: TGo4FitModel.h:124
virtual void Print(Option_t *option) const
Double_t EvaluateAndIntegrate(Int_t NumScales, const Double_t *Scales, const Double_t *Widths)
virtual TGo4FitParameter * GetPosPar(Int_t naxis=0)
Definition: TGo4FitModel.h:343
Bool_t BuffersAllocated() const
Int_t fiMinIntegrDepth
Definition: TGo4FitModel.h:358
void RebuildShape(Bool_t ForceBuild=kFALSE)
void SetBackgroundGroupIndex()
Definition: TGo4FitModel.h:114
Bool_t IsAssignTo(const char *DataName) const
Definition: TGo4FitModel.h:141
Bool_t AddModelToDataResult(TGo4FitData *data)
TArrayD * fxAllParsValues
Definition: TGo4FitModel.h:433
Double_t GetRatioValueFor(const char *DataName)
const Int_t * GetDataFullIndex(TGo4FitData *data, Int_t nbin)
virtual Double_t EvalN(const Double_t *v)
virtual Int_t NumPars()