GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitData.h
Go to the documentation of this file.
1 // $Id: TGo4FitData.h 2627 2019-10-01 08:02:45Z 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 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 TGO4FITDATA_H
15 #define TGO4FITDATA_H
16 
17 #include "TGo4FitComponent.h"
18 
19 #include "TArrayI.h"
20 #include "TArrayD.h"
21 
22 class TH1;
23 class TGraph;
24 class TGo4FitSlot;
25 
26 class TGo4FitAxisTrans;
27 class TGo4FitDataIter;
28 
32 class TGo4FitData : public TGo4FitComponent {
33  public:
34  enum { dtHistogram = 1, dtGraph = 2 };
35 
39  TGo4FitData();
40 
47  TGo4FitData(const char* iName, const char* iTitle, Int_t iDataType = dtHistogram, Bool_t AddAmpl = kFALSE);
48 
52  virtual ~TGo4FitData();
53 
57  Int_t GetDataType() const { return fiDataType; }
58 
62  Bool_t GetUseBinScale() const { return fbUseBinScale; }
63 
67  void SetUseBinScale(Bool_t iUseBinScale) { fbUseBinScale=iUseBinScale; }
68 
74  virtual Bool_t CanAmplTouch() { return kTRUE; }
75 
83  Int_t GetSigmaSource() const { return fiTakeSigmasFrom; }
84 
89  Double_t GetSigmaValue() const { return fdSigmaValue; }
90 
95  void SetSigmaSource(Int_t TakeFrom, Double_t SigmaValue = 1.)
96  { fiTakeSigmasFrom = TakeFrom; if ((TakeFrom==2) && (SigmaValue>0)) fdSigmaValue = SigmaValue; }
97 
102  void SetSigmaValue(Double_t SigmaValue) { fdSigmaValue = SigmaValue; }
103 
107  void SetExcludeLessThen(Double_t limit = 0.) { fdExcludeLessThen = limit; }
108 
112  Double_t GetExcludeLessThen() const { return fdExcludeLessThen; }
113 
121  Bool_t SetNumberOfTransSlots(Int_t nslots);
122 
126  Int_t GetNumberOfTransSlots() { return fxAxisTrans.GetLast()+1; }
127 
131  TGo4FitSlot* GetAxisTransSlot(Int_t nslot);
132 
136  TGo4FitAxisTrans* GetAxisTrans(Int_t nslot);
137 
142  void SetAxisTrans(Int_t nslot, TGo4FitAxisTrans* Trans, Bool_t TransOwned = kFALSE);
143 
148  void AddAxisTrans(TGo4FitAxisTrans* Trans, Bool_t TransOwned = kFALSE);
149 
153  void SetAxisTransNeeded(Int_t nslot, Bool_t iNeeded = kFALSE);
154 
159  virtual Bool_t IsAnyDataTransform();
160 
165  virtual TGo4FitDataIter* MakeIter() { return 0; }
166 
171  TObject* CreateDrawObject(const char* ObjName);
172 
177  Bool_t DefineScaleMinMax(Int_t naxis, Double_t& min, Double_t& max);
178 
183  Int_t DefineDimensions();
184 
189  Int_t DefineBinsSize();
190 
196  Bool_t IsCompatibleData(TGo4FitData* data);
197 
204  void ApplyRangesForModelMask(TGo4FitComponent* model, Char_t* ModelMask);
205 
209  virtual void FillSlotList(TSeqCollection* list);
210 
214  virtual void Print(Option_t* option) const;
215 
216  protected:
217 
218  friend class TGo4FitModel;
219  friend class TGo4Fitter;
220 
228  virtual Bool_t Initialize(Int_t UseBuffers = -1);
229 
233  virtual void Finalize();
234 
238  Bool_t BuffersAllocated() const { return (fxValues!=0) && (fxFullScale!=0); }
239 
243  Int_t GetBinsSize() const { return fiBinsSize; }
244 
249  Int_t GetScalesSize() const { return fiScalesSize; }
250 
255  Double_t* GetBinsValues() { return fxValues; }
256 
261  Double_t* GetBinsDevs() { return fxStandDev; }
262 
267  Double_t* GetBinsResult() { return fxBinsResult; }
268 
273  const Double_t* GetScaleValues(const Int_t nbin);
274 
279  const Double_t* GetWidthValues(const Int_t nbin);
280 
285  const Int_t* GetFullIndex(Int_t nbin);
286 
291  Int_t GetIndexesSize() const { return fiIndexesSize; }
292 
297  Int_t fiDataType;
298 
304 
310 
314  Double_t fdSigmaValue;
315 
320 
324  TObjArray fxAxisTrans;
325 
331  private:
332 
336  void ResetAllPoinetrs();
337 
341  void ReleaseAllPointers();
342 
346  Int_t fiBinsSize;
347 
352 
356  Int_t fiScalesSize;
357 
361  Double_t* fxValues;
362 
366  Double_t* fxStandDev;
367 
371  Double_t* fxBinsResult;
372 
378  Double_t* fxFullScale;
379 
385  Double_t* fxFullWidth;
386 
392  Int_t* fxFullIndex;
393 
396  /*# TGo4FitAxisTrans AxisTrans; */
397 
401  /*# TGo4FitSlot lnkTGo4FitData; */
402 
403 
405 };
406 
423 class TGo4FitDataIter : public TObject {
424  public:
425 
429  TGo4FitDataIter();
430 
434  virtual ~TGo4FitDataIter();
435 
441  virtual Bool_t Reset(Bool_t UseRanges = kTRUE);
442 
449  virtual Bool_t Next(Bool_t UseRanges = kTRUE);
450 
454  Bool_t HasIndexes() const { return IndexesSize() > 0; }
455 
459  Int_t IndexesSize() const { return fxIndexes.GetSize(); }
460 
464  const Int_t* Indexes() const { return fxIndexes.GetArray(); }
465 
469  Bool_t DefineIndexesLimits(TArrayI& Limits);
470 
474  Int_t ScalesSize() const { return fxScales.GetSize(); }
475 
479  const Double_t* Scales() const { return fxScales.GetSize() > 0 ? fxScales.GetArray() : 0; }
480 
484  Double_t x() const { return fxScales.GetSize() > 0 ? fxScales[0] : 0.; }
485 
489  Double_t y() const { return fxScales.GetSize() > 1 ? fxScales[1] : 0.; }
490 
494  Double_t z() const { return fxScales.GetSize() > 2 ? fxScales[2] : 0.; }
495 
499  Bool_t HasWidths() const { return fxWidths.GetSize() > 0; }
500 
504  const Double_t* Widths() const { return fxWidths.GetSize() > 0 ? fxWidths.GetArray() : 0; }
505 
509  Double_t xWidths() const;
510 
514  Double_t Value() const { return fdValue; }
515 
519  Double_t StandardDeviation() const { return fdStandardDeviation; }
520 
524  Int_t Point() const { return fiNumPoint; }
525 
529  Bool_t CheckPointForRange();
530 
535  Int_t CountPoints(Bool_t UseRanges = kTRUE);
536 
541  Bool_t ReachEnd() const { return fbReachEnd; }
542 
548  TH1* CreateHistogram(const char* HistoName, Bool_t UseRanges = kFALSE, Bool_t SetBins = kFALSE);
549 
557  TGraph* CreateGraph(const char* GraphName, Bool_t UseRanges = kFALSE, Bool_t SetBins = kFALSE);
558 
562  TObject* CreateDrawObject(const char* ObjName);
563 
564  protected:
565 
570  virtual TGo4FitData* GetData() const = 0;
571 
576  virtual Bool_t StartReset() = 0;
577 
582  virtual Bool_t ReadCurrentPoint() = 0;
583 
588  virtual Bool_t ShiftToNextPoint() = 0;
589 
594  Bool_t ReserveArrays(Int_t NumDimen, Int_t NumOwnAxis, Bool_t HasWidth);
595 
599  void TransformScales(Double_t* scales);
600 
605  Bool_t ProduceScales(const Int_t* index, const Double_t* ownscales, const Double_t* ownwidths);
606 
610  Bool_t NextIndex(TArrayI& Index, TArrayI& Limits);
611 
615  Bool_t GetDeviation();
616 
617  TArrayI fxIndexes;
618 
619  TArrayD fxScales;
620  TArrayD fxWidths;
621  Double_t fdValue;
623 
624  Int_t fiNumPoint;
625 
626  Bool_t fbReachEnd;
627 
628  ClassDef(TGo4FitDataIter,1)
629 };
630 
631 
632 #endif // TGO4FITDATA_H
Bool_t DefineScaleMinMax(Int_t naxis, Double_t &min, Double_t &max)
Int_t fiBinsSize
Definition: TGo4FitData.h:346
Double_t xWidths() const
TArrayD fxWidths
Definition: TGo4FitData.h:620
TH1 * CreateHistogram(const char *HistoName, Bool_t UseRanges=kFALSE, Bool_t SetBins=kFALSE)
Bool_t ProduceScales(const Int_t *index, const Double_t *ownscales, const Double_t *ownwidths)
TArrayI fxIndexes
Definition: TGo4FitData.h:617
Double_t fdStandardDeviation
Definition: TGo4FitData.h:622
Bool_t HasWidths() const
Definition: TGo4FitData.h:499
virtual Bool_t IsAnyDataTransform()
Double_t fdSigmaValue
Definition: TGo4FitData.h:314
virtual void Print(Option_t *option) const
Double_t x() const
Definition: TGo4FitData.h:484
Double_t * fxBinsResult
Definition: TGo4FitData.h:371
Double_t * GetBinsValues()
Definition: TGo4FitData.h:255
Double_t * fxFullScale
Definition: TGo4FitData.h:378
Bool_t SetNumberOfTransSlots(Int_t nslots)
Definition: TGo4FitData.cxx:52
void SetSigmaValue(Double_t SigmaValue)
Definition: TGo4FitData.h:102
Int_t fiScalesSize
Definition: TGo4FitData.h:356
const Int_t * GetFullIndex(Int_t nbin)
virtual TGo4FitDataIter * MakeIter()
Definition: TGo4FitData.h:165
virtual void Finalize()
Double_t fdValue
Definition: TGo4FitData.h:621
Int_t fiDataType
Definition: TGo4FitData.h:297
void SetExcludeLessThen(Double_t limit=0.)
Definition: TGo4FitData.h:107
Int_t fiTakeSigmasFrom
Definition: TGo4FitData.h:309
void SetSigmaSource(Int_t TakeFrom, Double_t SigmaValue=1.)
Definition: TGo4FitData.h:95
TObject * CreateDrawObject(const char *ObjName)
void ReleaseAllPointers()
Bool_t DefineIndexesLimits(TArrayI &Limits)
Int_t GetSigmaSource() const
Definition: TGo4FitData.h:83
void TransformScales(Double_t *scales)
TGraph * CreateGraph(const char *GraphName, Bool_t UseRanges=kFALSE, Bool_t SetBins=kFALSE)
Bool_t NextIndex(TArrayI &Index, TArrayI &Limits)
Int_t GetNumberOfTransSlots()
Definition: TGo4FitData.h:126
TGo4FitSlot * GetAxisTransSlot(Int_t nslot)
Definition: TGo4FitData.cxx:73
virtual Bool_t Initialize(Int_t UseBuffers=-1)
Double_t GetSigmaValue() const
Definition: TGo4FitData.h:89
Double_t z() const
Definition: TGo4FitData.h:494
Double_t y() const
Definition: TGo4FitData.h:489
void ResetAllPoinetrs()
virtual Bool_t Reset(Bool_t UseRanges=kTRUE)
Int_t DefineBinsSize()
const Double_t * Widths() const
Definition: TGo4FitData.h:504
virtual Bool_t CanAmplTouch()
Definition: TGo4FitData.h:74
Bool_t IsCompatibleData(TGo4FitData *data)
Bool_t GetUseBinScale() const
Definition: TGo4FitData.h:62
Int_t Point() const
Definition: TGo4FitData.h:524
Double_t * GetBinsResult()
Definition: TGo4FitData.h:267
virtual ~TGo4FitDataIter()
virtual Bool_t StartReset()=0
Bool_t BuffersAllocated() const
Definition: TGo4FitData.h:238
virtual ~TGo4FitData()
Definition: TGo4FitData.cxx:47
const Double_t * GetScaleValues(const Int_t nbin)
Double_t * GetBinsDevs()
Definition: TGo4FitData.h:261
Int_t CountPoints(Bool_t UseRanges=kTRUE)
Double_t * fxStandDev
Definition: TGo4FitData.h:366
Int_t GetBinsSize() const
Definition: TGo4FitData.h:243
virtual Bool_t Next(Bool_t UseRanges=kTRUE)
virtual TGo4FitData * GetData() const =0
TObject * CreateDrawObject(const char *ObjName)
Int_t GetDataType() const
Definition: TGo4FitData.h:57
ClassDef(TGo4FitSlotList, 1)
Bool_t ReserveArrays(Int_t NumDimen, Int_t NumOwnAxis, Bool_t HasWidth)
virtual void FillSlotList(TSeqCollection *list)
TGo4FitAxisTrans * GetAxisTrans(Int_t nslot)
Definition: TGo4FitData.cxx:78
Int_t DefineDimensions()
void SetAxisTrans(Int_t nslot, TGo4FitAxisTrans *Trans, Bool_t TransOwned=kFALSE)
Definition: TGo4FitData.cxx:84
Bool_t GetDeviation()
Bool_t fbUseBinScale
Definition: TGo4FitData.h:303
Bool_t HasIndexes() const
Definition: TGo4FitData.h:454
Int_t fiIndexesSize
Definition: TGo4FitData.h:351
Double_t Value() const
Definition: TGo4FitData.h:514
void SetUseBinScale(Bool_t iUseBinScale)
Definition: TGo4FitData.h:67
const Int_t * Indexes() const
Definition: TGo4FitData.h:464
Double_t fdExcludeLessThen
Definition: TGo4FitData.h:319
const Double_t * Scales() const
Definition: TGo4FitData.h:479
void AddAxisTrans(TGo4FitAxisTrans *Trans, Bool_t TransOwned=kFALSE)
Definition: TGo4FitData.cxx:92
Bool_t ReachEnd() const
Definition: TGo4FitData.h:541
virtual Bool_t ShiftToNextPoint()=0
Int_t GetScalesSize() const
Definition: TGo4FitData.h:249
virtual Bool_t ReadCurrentPoint()=0
Double_t GetExcludeLessThen() const
Definition: TGo4FitData.h:112
Int_t IndexesSize() const
Definition: TGo4FitData.h:459
Double_t StandardDeviation() const
Definition: TGo4FitData.h:519
Bool_t CheckPointForRange()
TObjArray fxAxisTrans
Definition: TGo4FitData.h:324
void ApplyRangesForModelMask(TGo4FitComponent *model, Char_t *ModelMask)
Int_t GetIndexesSize() const
Definition: TGo4FitData.h:291
Int_t * fxFullIndex
Definition: TGo4FitData.h:392
Double_t * fxValues
Definition: TGo4FitData.h:361
const Double_t * GetWidthValues(const Int_t nbin)
TArrayD fxScales
Definition: TGo4FitData.h:619
Double_t * fxFullWidth
Definition: TGo4FitData.h:385
void SetAxisTransNeeded(Int_t nslot, Bool_t iNeeded=kFALSE)
Definition: TGo4FitData.cxx:98
Int_t ScalesSize() const
Definition: TGo4FitData.h:474