00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4FITMODELFUNCTION_H
00015 #define TGO4FITMODELFUNCTION_H
00016
00017 #include "TGo4FitModel.h"
00018
00019 typedef Double_t (*TUserFunction)(Double_t*, Double_t*);
00020
00043 class TGo4FitModelFunction : public TGo4FitModel {
00044 public:
00045
00049 TGo4FitModelFunction();
00050
00057 TGo4FitModelFunction(const char* iName, TUserFunction iUserFunction, Int_t iNPars, Bool_t AddAmplitude = kFALSE);
00058
00063 TGo4FitModelFunction(const char* iName, const char* iLibraryName = "libName.so", const char* iFunctionName = "Funcname", Int_t iNPars = 0, Bool_t AddAmplitude = kFALSE);
00064
00068 virtual ~TGo4FitModelFunction();
00069
00073 virtual Bool_t CanAmplTouch() { return kTRUE; }
00074
00078 void SetUserFunction(TUserFunction iUserFunction);
00079
00084 void SetUserFunction(const char* iLibraryName, const char* iFunctionName);
00085
00089 const char* GetLibraryName() { return fxLibraryName.Data(); }
00090
00094 void SetLibraryName(const char* name) { fxLibraryName = name; }
00095
00099 const char* GetFunctionName() { return fxFunctionName.Data(); }
00100
00104 void SetFunctionName(const char* name) { fxFunctionName = name; }
00105
00109 Int_t GetNumberOfFuncPar();
00110
00114 Bool_t SetNumberOfFuncPar(Int_t num);
00115
00116 void SetPosParIndex(Int_t naxis, Int_t indx = -1);
00117 void SetWidthParIndex(Int_t naxis, Int_t indx = -1);
00118
00123 virtual Bool_t BeforeEval(Int_t ndim);
00124 virtual void AfterEval();
00125
00126 virtual void Print(Option_t* option) const;
00127
00128 protected:
00129
00134 virtual Bool_t Initialize(Int_t UseBuffers = -1);
00135
00140 virtual void Finalize();
00141
00142 virtual TString GetFuncParName(Int_t n);
00143 TGo4FitParameter* GetFuncPar(Int_t n);
00144
00145 virtual Int_t GetPosParIndex(Int_t naxis);
00146 virtual Int_t GetWidthParIndex(Int_t naxis);
00147
00148 virtual Double_t UserFunction(Double_t* Coordinates, Double_t* Parameters);
00149
00150 Bool_t LoadLibrary(Bool_t CloseFirst);
00151 void CloseLibrary();
00152
00156 TString fxLibraryName;
00157
00161 TString fxFunctionName;
00162
00163 TArrayI fxPosIndex;
00164
00165 TArrayI fxWidthIndex;
00166
00167 private:
00168
00172 TUserFunction fxUserFunction;
00173
00177 void* fxLibrary;
00178
00179 ClassDef(TGo4FitModelFunction,1)
00180 };
00181 #endif // TGO4FITMODELFUNCTION_H