Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4FITMODEL_H
00015 #define TGO4FITMODEL_H
00016
00017 #include "TNamed.h"
00018 #include "TGo4FitComponent.h"
00019
00020 class TGo4FitParameter;
00021 class TGo4FitData;
00022 class TGo4FitDataIter;
00023
00027 class TGo4FitAssignment : public TNamed {
00028 public:
00029
00033 TGo4FitAssignment();
00034
00038 TGo4FitAssignment(const char* DataName);
00039
00043 virtual ~TGo4FitAssignment();
00044
00045 Double_t RatioValue();
00046
00050 virtual void Print(Option_t* option) const;
00051
00055 TGo4FitParameter* fxRatio;
00056
00060 TGo4FitData* fxData;
00061
00065 Char_t* fxModelMask;
00066
00072 Double_t* fxModelBins;
00073
00074 ClassDef(TGo4FitAssignment,1);
00075 };
00076
00077
00081 class TGo4FitModel : public TGo4FitComponent {
00082 public:
00083
00087 TGo4FitModel();
00088
00094 TGo4FitModel(const char* iName, const char* iTitle, Bool_t MakeAmplitude = kFALSE);
00095
00099 virtual ~TGo4FitModel();
00100
00109 void SetGroupIndex(Int_t index = -1) { fiGroupIndex = index; }
00110
00114 void SetBackgroundGroupIndex() { fiGroupIndex = 0; }
00115
00119 Int_t GetGroupIndex() const { return fiGroupIndex; }
00120
00124 Int_t NumAssigments() const { return fxAssigments.GetLast()+1; }
00125
00129 const char* AssignmentName(Int_t n) { return GetAssigment(n) ? GetAssigment(n)->GetName() : 0; }
00130
00136 void AssignToData(const char* DataName, Double_t RatioValue = 1., Bool_t FixRatio = kFALSE);
00137
00141 Bool_t IsAssignTo(const char* DataName) const { return FindAssigment(DataName) != 0; }
00142
00146 void ChangeDataNameInAssignments(const char* oldname, const char* newname);
00147
00151 void ClearAssignmentTo(const char* DataName);
00152 void ClearAssigmentTo(const char* DataName) { ClearAssignmentTo(DataName); }
00153
00157 void ClearAssignments();
00158
00162 void ConnectToDataIfAssigned(TGo4FitData* data);
00163
00168 Double_t GetRatioValueFor(const char* DataName);
00169
00173 virtual void Print(Option_t* option) const;
00174
00178 virtual Double_t Evaluate(Double_t x);
00179
00183 virtual Double_t Evaluate(Double_t x, Double_t y);
00184
00188 virtual Double_t Evaluate(Double_t x, Double_t y, Double_t z);
00189
00193 virtual Double_t Evaluate(Double_t* v, Int_t ndim);
00194
00198 virtual Double_t Integral();
00199
00203 virtual Bool_t GetPosition(Int_t naxis, Double_t& pos);
00204
00208 virtual Bool_t SetPosition(Int_t naxis, Double_t pos);
00209
00213 virtual Bool_t GetWidth(Int_t naxis, Double_t& width);
00214
00218 virtual Bool_t SetWidth(Int_t naxis, Double_t width);
00219
00231 void SetIntegrationsProperty(Int_t iMinIntegrDepth, Int_t iMaxIntegrDepth = 0, Double_t iIntegrEps = 0., Bool_t iAbsoluteEps = kFALSE, Bool_t iIntegrScaling = kFALSE);
00232
00236 Bool_t NeedIntegration() { return (fiMinIntegrDepth>0) || (fiMaxIntegrDepth>0); }
00237
00242 virtual Bool_t BeforeEval(Int_t ndim);
00243
00248 virtual Double_t EvalN(const Double_t* v);
00249
00253 virtual void AfterEval() { return; }
00254
00259 virtual Double_t EvaluateAtPoint(TGo4FitData* data, Int_t nbin, Bool_t UseRanges = kTRUE);
00260
00264 virtual Double_t EvaluateAtPoint(TGo4FitDataIter* iter, Bool_t UseRanges = kTRUE);
00265
00270 Bool_t AddModelToDataResult(TGo4FitData* data);
00271
00272 virtual Int_t NumPars();
00273
00274 protected:
00275
00276 friend class TGo4Fitter;
00277
00278
00279 virtual TGo4FitParameter* Get(Int_t n);
00280
00284 Double_t EvaluateAndIntegrate(Int_t NumScales, const Double_t* Scales, const Double_t* Widths);
00285
00291 virtual Bool_t Initialize(Int_t UseBuffers = -1);
00292
00296 virtual void Finalize();
00297
00301 TGo4FitData* GetAssignedConnection(Int_t n);
00302
00306 Bool_t BuffersAllocated() const;
00307
00311 void RebuildShape(Bool_t ForceBuild = kFALSE);
00312
00316 Double_t* GetModelBins(const char* DataName) const;
00317
00321 void SetNeedToRebuild() { fbNeedToRebuild = kTRUE; }
00322
00328 virtual Double_t UserFunction(Double_t*, Double_t*) { return 0; }
00329
00333 virtual Int_t GetPosParIndex(Int_t) { return -1; }
00334
00338 virtual Int_t GetWidthParIndex(Int_t) { return -1; }
00339
00343 virtual TGo4FitParameter* GetPosPar(Int_t naxis = 0)
00344 { return Get(GetPosParIndex(naxis)); }
00345
00349 virtual TGo4FitParameter* GetWidthPar(Int_t naxis = 0)
00350 { return Get(GetWidthParIndex(naxis)); }
00351
00352 const Int_t* GetDataFullIndex(TGo4FitData* data, Int_t nbin);
00353 Int_t GetDataIndexesSize(TGo4FitData* data);
00354
00358 Int_t fiMinIntegrDepth;
00359
00363 Int_t fiMaxIntegrDepth;
00364
00368 Double_t fdIntegrEps;
00369
00373 Bool_t fbAbsoluteEps;
00374
00378 Bool_t fbIntegrScaling;
00379
00380 private:
00381
00385 void RemoveAllPars();
00386
00390 TGo4FitAssignment* GetAssigment(Int_t n) { return (TGo4FitAssignment*) fxAssigments[n]; }
00391 TGo4FitAssignment* GetAssigment(Int_t n) const { return (TGo4FitAssignment*) fxAssigments[n]; }
00392
00396 TGo4FitAssignment* FindAssigment(const char* DataName) const;
00397
00401 TString GetRatioName(Int_t n);
00402
00406 TObjArray fxAssigments;
00407
00411 Int_t fiGroupIndex;
00412
00416 TArrayD fxCurrentPars;
00417
00421 Double_t* fxCurrentParsArray;
00422
00426 Bool_t fbNeedToRebuild;
00427
00431 TGo4FitParsList* fxAllPars;
00432
00433 TArrayD* fxAllParsValues;
00434
00437
00438
00439 ClassDef(TGo4FitModel,1)
00440 };
00441 #endif // TGO4FITMODEL_H