Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4FITDATA_H
00015 #define TGO4FITDATA_H
00016
00017 #include "TGo4FitComponent.h"
00018
00019 #include "TArrayI.h"
00020 #include "TArrayD.h"
00021
00022 class TH1;
00023 class TGraph;
00024 class TGo4FitSlot;
00025
00026 class TGo4FitAxisTrans;
00027 class TGo4FitDataIter;
00028
00032 class TGo4FitData : public TGo4FitComponent {
00033 public:
00034 enum { dtHistogram = 1, dtGraph = 2 };
00035
00039 TGo4FitData();
00040
00047 TGo4FitData(const char* iName, const char* iTitle, Int_t iDataType = dtHistogram, Bool_t AddAmpl = kFALSE);
00048
00052 virtual ~TGo4FitData();
00053
00057 const Int_t GetDataType() { return fiDataType; }
00058
00062 Bool_t GetUseBinScale() { return fbUseBinScale; }
00063
00067 void SetUseBinScale(Bool_t iUseBinScale) { fbUseBinScale=iUseBinScale; }
00068
00074 virtual Bool_t CanAmplTouch() { return kTRUE; }
00075
00083 Int_t GetSigmaSource() const { return fiTakeSigmasFrom; }
00084
00089 Double_t GetSigmaValue() const { return fdSigmaValue; }
00090
00095 void SetSigmaSource(Int_t TakeFrom, Double_t SigmaValue = 1.)
00096 { fiTakeSigmasFrom = TakeFrom; if ((TakeFrom==2) && (SigmaValue>0)) fdSigmaValue = SigmaValue; }
00097
00102 void SetSigmaValue(Double_t SigmaValue) { fdSigmaValue = SigmaValue; }
00103
00107 void SetExcludeLessThen(Double_t limit = 0.) { fdExcludeLessThen = limit; }
00108
00112 Double_t GetExcludeLessThen() const { return fdExcludeLessThen; }
00113
00121 Bool_t SetNumberOfTransSlots(Int_t nslots);
00122
00126 Int_t GetNumberOfTransSlots() { return fxAxisTrans.GetLast()+1; }
00127
00131 TGo4FitSlot* GetAxisTransSlot(Int_t nslot);
00132
00136 TGo4FitAxisTrans* GetAxisTrans(Int_t nslot);
00137
00142 void SetAxisTrans(Int_t nslot, TGo4FitAxisTrans* Trans, Bool_t TransOwned = kFALSE);
00143
00148 void AddAxisTrans(TGo4FitAxisTrans* Trans, Bool_t TransOwned = kFALSE);
00149
00153 void SetAxisTransNeeded(Int_t nslot, Bool_t iNeeded = kFALSE);
00154
00159 virtual Bool_t IsAnyDataTransform();
00160
00165 virtual TGo4FitDataIter* MakeIter() { return 0; }
00166
00171 TObject* CreateDrawObject(const char* ObjName);
00172
00177 Bool_t DefineScaleMinMax(Int_t naxis, Double_t& min, Double_t& max);
00178
00183 Int_t DefineDimensions();
00184
00189 Int_t DefineBinsSize();
00190
00196 Bool_t IsCompatibleData(TGo4FitData* data);
00197
00204 void ApplyRangesForModelMask(TGo4FitComponent* model, Char_t* ModelMask);
00205
00209 virtual void FillSlotList(TSeqCollection* list);
00210
00214 virtual void Print(Option_t* option) const;
00215
00216 protected:
00217
00218 friend class TGo4FitModel;
00219 friend class TGo4Fitter;
00220
00228 virtual Bool_t Initialize(Int_t UseBuffers = -1);
00229
00233 virtual void Finalize();
00234
00238 Bool_t BuffersAllocated() const { return (fxValues!=0) && (fxFullScale!=0); }
00239
00243 Int_t GetBinsSize() const { return fiBinsSize; }
00244
00249 Int_t GetScalesSize() const { return fiScalesSize; }
00250
00255 Double_t* GetBinsValues() { return fxValues; }
00256
00261 Double_t* GetBinsDevs() { return fxStandDev; }
00262
00267 Double_t* GetBinsResult() { return fxBinsResult; }
00268
00273 const Double_t* GetScaleValues(const Int_t nbin);
00274
00279 const Double_t* GetWidthValues(const Int_t nbin);
00280
00285 const Int_t* GetFullIndex(Int_t nbin);
00286
00291 Int_t GetIndexesSize() const { return fiIndexesSize; }
00292
00297 Int_t fiDataType;
00298
00303 Bool_t fbUseBinScale;
00304
00309 Int_t fiTakeSigmasFrom;
00310
00314 Double_t fdSigmaValue;
00315
00319 Double_t fdExcludeLessThen;
00320
00324 TObjArray fxAxisTrans;
00325
00331 private:
00332
00336 void ResetAllPoinetrs();
00337
00341 void ReleaseAllPointers();
00342
00346 Int_t fiBinsSize;
00347
00351 Int_t fiIndexesSize;
00352
00356 Int_t fiScalesSize;
00357
00361 Double_t* fxValues;
00362
00366 Double_t* fxStandDev;
00367
00371 Double_t* fxBinsResult;
00372
00378 Double_t* fxFullScale;
00379
00385 Double_t* fxFullWidth;
00386
00392 Int_t* fxFullIndex;
00393
00396
00397
00401
00402
00403
00404 ClassDef(TGo4FitData,1)
00405 };
00406
00423 class TGo4FitDataIter : public TObject {
00424 public:
00425
00429 TGo4FitDataIter();
00430
00434 virtual ~TGo4FitDataIter();
00435
00441 virtual Bool_t Reset(Bool_t UseRanges = kTRUE);
00442
00449 virtual Bool_t Next(Bool_t UseRanges = kTRUE);
00450
00454 Bool_t HasIndexes() const { return IndexesSize() > 0; }
00455
00459 Int_t IndexesSize() const { return fxIndexes.GetSize(); }
00460
00464 const Int_t* Indexes() const { return fxIndexes.GetArray(); }
00465
00469 Bool_t DefineIndexesLimits(TArrayI& Limits);
00470
00474 Int_t ScalesSize() const { return fxScales.GetSize(); }
00475
00479 const Double_t* Scales() const { return fxScales.GetSize() > 0 ? fxScales.GetArray() : 0; }
00480
00484 Double_t x() const { return fxScales.GetSize() > 0 ? fxScales[0] : 0.; }
00485
00489 Double_t y() const { return fxScales.GetSize() > 1 ? fxScales[1] : 0.; }
00490
00494 Double_t z() const { return fxScales.GetSize() > 2 ? fxScales[2] : 0.; }
00495
00499 Bool_t HasWidths() const { return fxWidths.GetSize() > 0; }
00500
00504 const Double_t* Widths() const { return fxWidths.GetSize() > 0 ? fxWidths.GetArray() : 0; }
00505
00509 Double_t xWidths() const;
00510
00514 Double_t Value() const { return fdValue; }
00515
00519 Double_t StandardDeviation() const { return fdStandardDeviation; }
00520
00524 Int_t Point() const { return fiNumPoint; }
00525
00529 Bool_t CheckPointForRange();
00530
00535 Int_t CountPoints(Bool_t UseRanges = kTRUE);
00536
00541 Bool_t ReachEnd() const { return fbReachEnd; }
00542
00548 TH1* CreateHistogram(const char* HistoName, Bool_t UseRanges = kFALSE, Bool_t SetBins = kFALSE);
00549
00557 TGraph* CreateGraph(const char* GraphName, Bool_t UseRanges = kFALSE, Bool_t SetBins = kFALSE);
00558
00562 TObject* CreateDrawObject(const char* ObjName);
00563
00564 protected:
00565
00570 virtual TGo4FitData* GetData() const = 0;
00571
00576 virtual Bool_t StartReset() = 0;
00577
00582 virtual Bool_t ReadCurrentPoint() = 0;
00583
00588 virtual Bool_t ShiftToNextPoint() = 0;
00589
00594 Bool_t ReserveArrays(Int_t NumDimen, Int_t NumOwnAxis, Bool_t HasWidth);
00595
00599 void TransformScales(Double_t* scales);
00600
00605 Bool_t ProduceScales(const Int_t* index, const Double_t* ownscales, const Double_t* ownwidths);
00606
00610 Bool_t NextIndex(TArrayI& Index, TArrayI& Limits);
00611
00615 Bool_t GetDeviation();
00616
00617 TArrayI fxIndexes;
00618
00619 TArrayD fxScales;
00620 TArrayD fxWidths;
00621 Double_t fdValue;
00622 Double_t fdStandardDeviation;
00623
00624 Int_t fiNumPoint;
00625
00626 Bool_t fbReachEnd;
00627
00628 ClassDef(TGo4FitDataIter,1)
00629 };
00630
00631
00632 #endif // TGO4FITDATA_H