00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TGO4FITDATA_H
00017 #define TGO4FITDATA_H
00018
00019 #include "TGo4FitComponent.h"
00020
00021 #include "TArrayI.h"
00022 #include "TArrayD.h"
00023
00024 class TH1;
00025 class TGraph;
00026 class TGo4FitSlot;
00027
00028 class TGo4FitAxisTrans;
00029 class TGo4FitDataIter;
00030
00034 class TGo4FitData : public TGo4FitComponent {
00035 public:
00036 enum { dtHistogram = 1, dtGraph = 2 };
00037
00041 TGo4FitData();
00042
00049 TGo4FitData(const char* iName, const char* iTitle, Int_t iDataType = dtHistogram, Bool_t AddAmpl = kFALSE);
00050
00054 virtual ~TGo4FitData();
00055
00059 const Int_t GetDataType() { return fiDataType; }
00060
00064 Bool_t GetUseBinScale() { return fbUseBinScale; }
00065
00069 void SetUseBinScale(Bool_t iUseBinScale) { fbUseBinScale=iUseBinScale; }
00070
00076 virtual Bool_t CanAmplTouch() { return kTRUE; }
00077
00085 Int_t GetSigmaSource() const { return fiTakeSigmasFrom; }
00086
00091 Double_t GetSigmaValue() const { return fdSigmaValue; }
00092
00097 void SetSigmaSource(Int_t TakeFrom, Double_t SigmaValue = 1.)
00098 { fiTakeSigmasFrom = TakeFrom; if ((TakeFrom==2) && (SigmaValue>0)) fdSigmaValue = SigmaValue; }
00099
00104 void SetSigmaValue(Double_t SigmaValue) { fdSigmaValue = SigmaValue; }
00105
00109 void SetExcludeLessThen(Double_t limit = 0.) { fdExcludeLessThen = limit; }
00110
00114 Double_t GetExcludeLessThen() const { return fdExcludeLessThen; }
00115
00123 Bool_t SetNumberOfTransSlots(Int_t nslots);
00124
00128 Int_t GetNumberOfTransSlots() { return fxAxisTrans.GetLast()+1; }
00129
00133 TGo4FitSlot* GetAxisTransSlot(Int_t nslot);
00134
00138 TGo4FitAxisTrans* GetAxisTrans(Int_t nslot);
00139
00144 void SetAxisTrans(Int_t nslot, TGo4FitAxisTrans* Trans, Bool_t TransOwned = kFALSE);
00145
00150 void AddAxisTrans(TGo4FitAxisTrans* Trans, Bool_t TransOwned = kFALSE);
00151
00155 void SetAxisTransNeeded(Int_t nslot, Bool_t iNeeded = kFALSE);
00156
00161 virtual Bool_t IsAnyDataTransform();
00162
00167 virtual TGo4FitDataIter* MakeIter() { return 0; }
00168
00173 TObject* CreateDrawObject(const char* ObjName);
00174
00179 Bool_t DefineScaleMinMax(Int_t naxis, Double_t& min, Double_t& max);
00180
00185 Int_t DefineDimensions();
00186
00191 Int_t DefineBinsSize();
00192
00198 Bool_t IsCompatibleData(TGo4FitData* data);
00199
00206 void ApplyRangesForModelMask(TGo4FitComponent* model, Char_t* ModelMask);
00207
00211 virtual void FillSlotList(TSeqCollection* list);
00212
00216 virtual void Print(Option_t* option) const;
00217
00218 protected:
00219
00220 friend class TGo4FitModel;
00221 friend class TGo4Fitter;
00222
00230 virtual Bool_t Initialize(Int_t UseBuffers = -1);
00231
00235 virtual void Finalize();
00236
00240 Bool_t BuffersAllocated() const { return (fxValues!=0) && (fxFullScale!=0); }
00241
00245 Int_t GetBinsSize() const { return fiBinsSize; }
00246
00251 Int_t GetScalesSize() const { return fiScalesSize; }
00252
00257 Double_t* GetBinsValues() { return fxValues; }
00258
00263 Double_t* GetBinsDevs() { return fxStandDev; }
00264
00269 Double_t* GetBinsResult() { return fxBinsResult; }
00270
00275 const Double_t* GetScaleValues(const Int_t nbin);
00276
00281 const Double_t* GetWidthValues(const Int_t nbin);
00282
00287 const Int_t* GetFullIndex(Int_t nbin);
00288
00293 Int_t GetIndexesSize() const { return fiIndexesSize; }
00294
00299 Int_t fiDataType;
00300
00305 Bool_t fbUseBinScale;
00306
00311 Int_t fiTakeSigmasFrom;
00312
00316 Double_t fdSigmaValue;
00317
00321 Double_t fdExcludeLessThen;
00322
00323
00327 TObjArray fxAxisTrans;
00328
00334 private:
00335
00339 void ResetAllPoinetrs();
00340
00344 void ReleaseAllPointers();
00345
00349 Int_t fiBinsSize;
00350
00354 Int_t fiIndexesSize;
00355
00359 Int_t fiScalesSize;
00360
00364 Double_t* fxValues;
00365
00369 Double_t* fxStandDev;
00370
00374 Double_t* fxBinsResult;
00375
00381 Double_t* fxFullScale;
00382
00388 Double_t* fxFullWidth;
00389
00395 Int_t* fxFullIndex;
00396
00399
00400
00404
00405
00406
00407 ClassDef(TGo4FitData,1)
00408 };
00409
00426 class TGo4FitDataIter : public TObject {
00427 public:
00428
00432 TGo4FitDataIter();
00433
00437 virtual ~TGo4FitDataIter();
00438
00444 virtual Bool_t Reset(Bool_t UseRanges = kTRUE);
00445
00452 virtual Bool_t Next(Bool_t UseRanges = kTRUE);
00453
00457 Bool_t HasIndexes() const { return IndexesSize() > 0; }
00458
00462 Int_t IndexesSize() const { return fxIndexes.GetSize(); }
00463
00467 const Int_t* Indexes() const { return fxIndexes.GetArray(); }
00468
00472 Bool_t DefineIndexesLimits(TArrayI& Limits);
00473
00477 Int_t ScalesSize() const { return fxScales.GetSize(); }
00478
00482 const Double_t* Scales() const { return fxScales.GetSize() > 0 ? fxScales.GetArray() : 0; }
00483
00487 Double_t x() const { return fxScales.GetSize() > 0 ? fxScales[0] : 0.; }
00488
00492 Double_t y() const { return fxScales.GetSize() > 1 ? fxScales[1] : 0.; }
00493
00497 Double_t z() const { return fxScales.GetSize() > 2 ? fxScales[2] : 0.; }
00498
00502 Bool_t HasWidths() const { return fxWidths.GetSize() > 0; }
00503
00507 const Double_t* Widths() const { return fxWidths.GetSize() > 0 ? fxWidths.GetArray() : 0; }
00508
00512 Double_t xWidths() const;
00513
00517 Double_t Value() const { return fdValue; }
00518
00522 Double_t StandardDeviation() const { return fdStandardDeviation; }
00523
00527 Int_t Point() const { return fiNumPoint; }
00528
00532 Bool_t CheckPointForRange();
00533
00538 Int_t CountPoints(Bool_t UseRanges = kTRUE);
00539
00544 Bool_t ReachEnd() const { return fbReachEnd; }
00545
00551 TH1* CreateHistogram(const char* HistoName, Bool_t UseRanges = kFALSE, Bool_t SetBins = kFALSE);
00552
00560 TGraph* CreateGraph(const char* GraphName, Bool_t UseRanges = kFALSE, Bool_t SetBins = kFALSE);
00561
00565 TObject* CreateDrawObject(const char* ObjName);
00566
00567 protected:
00568
00573 virtual TGo4FitData* GetData() const = 0;
00574
00579 virtual Bool_t StartReset() = 0;
00580
00585 virtual Bool_t ReadCurrentPoint() = 0;
00586
00591 virtual Bool_t ShiftToNextPoint() = 0;
00592
00597 Bool_t ReserveArrays(Int_t NumDimen, Int_t NumOwnAxis, Bool_t HasWidth);
00598
00602 void TransformScales(Double_t* scales);
00603
00608 Bool_t ProduceScales(const Int_t* index, const Double_t* ownscales, const Double_t* ownwidths);
00609
00613 Bool_t NextIndex(TArrayI& Index, TArrayI& Limits);
00614
00618 Bool_t GetDeviation();
00619
00620 TArrayI fxIndexes;
00621
00622 TArrayD fxScales;
00623 TArrayD fxWidths;
00624 Double_t fdValue;
00625 Double_t fdStandardDeviation;
00626
00627 Int_t fiNumPoint;
00628
00629 Bool_t fbReachEnd;
00630
00631 ClassDef(TGo4FitDataIter,1)
00632 };
00633
00634
00635 #endif // TGO4FITDATA_H
00636
00637