00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TGO4FITMODELFUNCTION_H
00017 #define TGO4FITMODELFUNCTION_H
00018
00019 #include "TGo4FitModel.h"
00020
00021 typedef Double_t (*TUserFunction)(Double_t*, Double_t*);
00022
00045 class TGo4FitModelFunction : public TGo4FitModel {
00046 public:
00047
00051 TGo4FitModelFunction();
00052
00059 TGo4FitModelFunction(const char* iName, TUserFunction iUserFunction, Int_t iNPars, Bool_t AddAmplitude = kFALSE);
00060
00065 TGo4FitModelFunction(const char* iName, const char* iLibraryName = "libName.so", const char* iFunctionName = "Funcname", Int_t iNPars = 0, Bool_t AddAmplitude = kFALSE);
00066
00070 virtual ~TGo4FitModelFunction();
00071
00075 virtual Bool_t CanAmplTouch() { return kTRUE; }
00076
00080 void SetUserFunction(TUserFunction iUserFunction);
00081
00086 void SetUserFunction(const char* iLibraryName, const char* iFunctionName);
00087
00091 const char* GetLibraryName() { return fxLibraryName.Data(); }
00092
00096 void SetLibraryName(const char* name) { fxLibraryName = name; }
00097
00101 const char* GetFunctionName() { return fxFunctionName.Data(); }
00102
00106 void SetFunctionName(const char* name) { fxFunctionName = name; }
00107
00111 Int_t GetNumberOfFuncPar();
00112
00116 Bool_t SetNumberOfFuncPar(Int_t num);
00117
00118 void SetPosParIndex(Int_t naxis, Int_t indx = -1);
00119 void SetWidthParIndex(Int_t naxis, Int_t indx = -1);
00120
00125 virtual Bool_t BeforeEval(Int_t ndim);
00126 virtual void AfterEval();
00127
00128 virtual void Print(Option_t* option) const;
00129
00130 protected:
00131
00136 virtual Bool_t Initialize(Int_t UseBuffers = -1);
00137
00142 virtual void Finalize();
00143
00144 virtual TString GetFuncParName(Int_t n);
00145 TGo4FitParameter* GetFuncPar(Int_t n);
00146
00147 virtual Int_t GetPosParIndex(Int_t naxis);
00148 virtual Int_t GetWidthParIndex(Int_t naxis);
00149
00150 virtual Double_t UserFunction(Double_t* Coordinates, Double_t* Parameters);
00151
00152 Bool_t LoadLibrary(Bool_t CloseFirst);
00153 void CloseLibrary();
00154
00158 TString fxLibraryName;
00159
00163 TString fxFunctionName;
00164
00165 TArrayI fxPosIndex;
00166
00167 TArrayI fxWidthIndex;
00168
00169 private:
00170
00174 TUserFunction fxUserFunction;
00175
00179 void* fxLibrary;
00180
00181 ClassDef(TGo4FitModelFunction,1)
00182 };
00183 #endif // TGO4FITMODELFUNCTION_H
00184
00185