GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4FitModelFunction.h
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4FITMODELFUNCTION_H
15 #define TGO4FITMODELFUNCTION_H
16 
17 #include "TGo4FitModel.h"
18 
19 typedef Double_t (*TUserFunction)(Double_t *, Double_t *);
20 
44  public:
45 
50 
57  TGo4FitModelFunction(const char *iName, TUserFunction iUserFunction, Int_t iNPars, Bool_t AddAmplitude = kFALSE);
58 
63  TGo4FitModelFunction(const char *iName, const char *iLibraryName = "libName.so", const char *iFunctionName = "Funcname", Int_t iNPars = 0, Bool_t AddAmplitude = kFALSE);
64 
68  virtual ~TGo4FitModelFunction();
69 
73  Bool_t CanAmplTouch() override { return kTRUE; }
74 
78  void SetUserFunction(TUserFunction iUserFunction);
79 
84  void SetUserFunction(const char *iLibraryName, const char *iFunctionName);
85 
89  const char *GetLibraryName() const { return fxLibraryName.Data(); }
90 
94  void SetLibraryName(const char *name) { fxLibraryName = name; }
95 
99  const char *GetFunctionName() const { return fxFunctionName.Data(); }
100 
104  void SetFunctionName(const char *name) { fxFunctionName = name; }
105 
109  Int_t GetNumberOfFuncPar();
110 
114  Bool_t SetNumberOfFuncPar(Int_t num);
115 
116  void SetPosParIndex(Int_t naxis, Int_t indx = -1);
117  void SetWidthParIndex(Int_t naxis, Int_t indx = -1);
118 
123  Bool_t BeforeEval(Int_t ndim) override;
124  void AfterEval() override;
125 
126  void Print(Option_t *option = "") const override;
127 
128  protected:
129 
134  Bool_t Initialize(Int_t UseBuffers = -1) override;
135 
140  void Finalize() override;
141 
142  virtual TString GetFuncParName(Int_t n);
143  TGo4FitParameter *GetFuncPar(Int_t n);
144 
145  Int_t GetPosParIndex(Int_t naxis) override;
146  Int_t GetWidthParIndex(Int_t naxis) override;
147 
148  Double_t UserFunction(Double_t *Coordinates, Double_t *Parameters) override;
149 
150  Bool_t LoadLibrary(Bool_t CloseFirst);
151  void CloseLibrary();
152 
156  TString fxLibraryName;
157 
161  TString fxFunctionName;
162 
163  TArrayI fxPosIndex;
164 
165  TArrayI fxWidthIndex;
166 
167  private:
168 
173 
177  void *fxLibrary{nullptr};
178 
179  ClassDefOverride(TGo4FitModelFunction,1)
180 };
181 
182 #endif // TGO4FITMODELFUNCTION_H
Int_t GetWidthParIndex(Int_t naxis) override
void SetUserFunction(TUserFunction iUserFunction)
Bool_t SetNumberOfFuncPar(Int_t num)
void SetFunctionName(const char *name)
const char * GetLibraryName() const
virtual TString GetFuncParName(Int_t n)
Bool_t BeforeEval(Int_t ndim) override
Bool_t CanAmplTouch() override
Bool_t LoadLibrary(Bool_t CloseFirst)
Double_t UserFunction(Double_t *Coordinates, Double_t *Parameters) override
void SetLibraryName(const char *name)
Int_t GetPosParIndex(Int_t naxis) override
const char * GetFunctionName() const
Bool_t Initialize(Int_t UseBuffers=-1) override
void SetPosParIndex(Int_t naxis, Int_t indx=-1)
Double_t(* TUserFunction)(Double_t *, Double_t *)
TGo4FitParameter * GetFuncPar(Int_t n)
void Print(Option_t *option="") const override
void SetWidthParIndex(Int_t naxis, Int_t indx=-1)