Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4FitModel.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #ifndef TGO4FITMODEL_H
00017 #define TGO4FITMODEL_H
00018 
00019 #include "TNamed.h"
00020 #include "TGo4FitComponent.h"
00021 
00022 class TGo4FitParameter;
00023 class TGo4FitData;
00024 class TGo4FitDataIter;
00025 
00029 class TGo4FitAssignment : public TNamed {
00030     public:
00031 
00035        TGo4FitAssignment();
00036 
00040        TGo4FitAssignment(const char* DataName);
00041 
00045        virtual ~TGo4FitAssignment();
00046 
00047        Double_t RatioValue();
00048 
00052        virtual void Print(Option_t* option) const;
00053 
00057        TGo4FitParameter* fxRatio;
00058 
00062        TGo4FitData* fxData;         
00063 
00067        Char_t* fxModelMask;         
00068 
00074        Double_t* fxModelBins;       
00075 
00076        ClassDef(TGo4FitAssignment,1);
00077 };
00078 
00079 
00083 class TGo4FitModel : public TGo4FitComponent {
00084    public:
00085 
00089       TGo4FitModel();
00090 
00096       TGo4FitModel(const char* iName, const char* iTitle, Bool_t MakeAmplitude = kFALSE);
00097 
00101       virtual ~TGo4FitModel();
00102 
00111       void SetGroupIndex(Int_t index = -1) { fiGroupIndex = index; }
00112 
00116       void SetBackgroundGroupIndex() { fiGroupIndex = 0; }
00117 
00121       Int_t GetGroupIndex() const { return fiGroupIndex; }
00122 
00126       Int_t NumAssigments() const { return fxAssigments.GetLast()+1; }
00127 
00131       const char* AssignmentName(Int_t n) { return GetAssigment(n) ? GetAssigment(n)->GetName() : 0; }
00132 
00138       void AssignToData(const char* DataName, Double_t RatioValue = 1., Bool_t FixRatio = kFALSE);
00139 
00143       Bool_t IsAssignTo(const char* DataName) const { return FindAssigment(DataName) != 0; }
00144 
00148       void ChangeDataNameInAssignments(const char* oldname, const char* newname);
00149 
00153       void ClearAssignmentTo(const char* DataName);
00154       void ClearAssigmentTo(const char* DataName) { ClearAssignmentTo(DataName); }
00155 
00159       void ClearAssignments();
00160 
00164       void ConnectToDataIfAssigned(TGo4FitData* data);
00165 
00170       Double_t GetRatioValueFor(const char* DataName);
00171 
00175       virtual void Print(Option_t* option) const;
00176 
00180       virtual Double_t Evaluate(Double_t x);
00181 
00185       virtual Double_t Evaluate(Double_t x, Double_t y);
00186 
00190       virtual Double_t Evaluate(Double_t x, Double_t y, Double_t z);
00191 
00195       virtual Double_t Evaluate(Double_t* v, Int_t ndim);
00196 
00200       virtual Double_t Integral();
00201 
00205       virtual Bool_t GetPosition(Int_t naxis, Double_t& pos);
00206 
00210       virtual Bool_t SetPosition(Int_t naxis, Double_t pos);
00211 
00215       virtual Bool_t GetWidth(Int_t naxis, Double_t& width);
00216 
00220       virtual Bool_t SetWidth(Int_t naxis, Double_t width);
00221 
00233       void SetIntegrationsProperty(Int_t iMinIntegrDepth, Int_t iMaxIntegrDepth = 0, Double_t iIntegrEps = 0., Bool_t iAbsoluteEps = kFALSE, Bool_t iIntegrScaling = kFALSE);
00234 
00238       Bool_t NeedIntegration() { return (fiMinIntegrDepth>0) || (fiMaxIntegrDepth>0); }
00239 
00244       virtual Bool_t BeforeEval(Int_t ndim);
00245 
00250       virtual Double_t EvalN(const Double_t* v);
00251 
00255       virtual void AfterEval() { return; }
00256 
00261       virtual Double_t EvaluateAtPoint(TGo4FitData* data, Int_t nbin, Bool_t UseRanges = kTRUE);
00262 
00266       virtual Double_t EvaluateAtPoint(TGo4FitDataIter* iter, Bool_t UseRanges = kTRUE);
00267 
00272       Bool_t AddModelToDataResult(TGo4FitData* data);
00273 
00274       virtual Int_t NumPars();
00275 
00276    protected:
00277 
00278       friend class TGo4Fitter;
00279 
00280 
00281       virtual TGo4FitParameter* Get(Int_t n);
00282 
00286       Double_t EvaluateAndIntegrate(Int_t NumScales, const Double_t* Scales, const Double_t* Widths);
00287 
00293       virtual Bool_t Initialize(Int_t UseBuffers = -1);
00294 
00298       virtual void Finalize();
00299 
00303       TGo4FitData* GetAssignedConnection(Int_t n);
00304 
00308       Bool_t BuffersAllocated() const;
00309 
00313       void RebuildShape(Bool_t ForceBuild = kFALSE);
00314 
00318       Double_t* GetModelBins(const char* DataName) const;
00319 
00323       void SetNeedToRebuild() { fbNeedToRebuild = kTRUE; }
00324 
00330       virtual Double_t UserFunction(Double_t*, Double_t*) { return 0; }
00331 
00335       virtual Int_t GetPosParIndex(Int_t) { return -1; }
00336 
00340       virtual Int_t GetWidthParIndex(Int_t) { return -1; }
00341 
00345       virtual TGo4FitParameter* GetPosPar(Int_t naxis = 0)
00346         { return Get(GetPosParIndex(naxis)); }
00347 
00351       virtual TGo4FitParameter* GetWidthPar(Int_t naxis = 0)
00352         { return Get(GetWidthParIndex(naxis)); }
00353 
00354       const Int_t* GetDataFullIndex(TGo4FitData* data, Int_t nbin);
00355       Int_t GetDataIndexesSize(TGo4FitData* data);
00356 
00360       Int_t fiMinIntegrDepth;
00361 
00365       Int_t fiMaxIntegrDepth;
00366 
00370       Double_t fdIntegrEps;
00371 
00375       Bool_t fbAbsoluteEps;
00376 
00380       Bool_t fbIntegrScaling;
00381 
00382    private:
00383 
00387       void RemoveAllPars();
00388 
00392       TGo4FitAssignment* GetAssigment(Int_t n) { return (TGo4FitAssignment*) fxAssigments[n]; }
00393       TGo4FitAssignment* GetAssigment(Int_t n) const { return (TGo4FitAssignment*) fxAssigments[n]; }
00394 
00398       TGo4FitAssignment* FindAssigment(const char* DataName) const;
00399 
00403       TString GetRatioName(Int_t n);
00404 
00408       TObjArray fxAssigments;
00409 
00413       Int_t fiGroupIndex;
00414 
00418       TArrayD fxCurrentPars;            
00419 
00423       Double_t* fxCurrentParsArray;     
00424 
00428       Bool_t fbNeedToRebuild;                 
00429 
00433       TGo4FitParsList* fxAllPars;              
00434 
00435       TArrayD* fxAllParsValues;                
00436 
00439       /*#  TGo4FitAssignment lnkTGo4FitModel; */
00440 
00441    ClassDef(TGo4FitModel,1)
00442 };
00443 #endif // TGO4FITMODEL_H
00444 
00445 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:12 2008 for Go4-v3.04-1 by  doxygen 1.4.2