GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
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
19typedef Double_t (*TUserFunction)(Double_t *, Double_t *);
20
52 public:
53
58
65 TGo4FitModelFunction(const char *iName, TUserFunction iUserFunction, Int_t iNPars, Bool_t AddAmplitude = kFALSE);
66
71 TGo4FitModelFunction(const char *iName, const char *iLibraryName = "libName.so", const char *iFunctionName = "Funcname", Int_t iNPars = 0, Bool_t AddAmplitude = kFALSE);
72
76 virtual ~TGo4FitModelFunction();
77
81 Bool_t CanAmplTouch() override { return kTRUE; }
82
86 void SetUserFunction(TUserFunction iUserFunction);
87
92 void SetUserFunction(const char *iLibraryName, const char *iFunctionName);
93
97 const char *GetLibraryName() const { return fxLibraryName.Data(); }
98
102 void SetLibraryName(const char *name) { fxLibraryName = name; }
103
107 const char *GetFunctionName() const { return fxFunctionName.Data(); }
108
112 void SetFunctionName(const char *name) { fxFunctionName = name; }
113
117 Int_t GetNumberOfFuncPar();
118
122 Bool_t SetNumberOfFuncPar(Int_t num);
123
124 void SetPosParIndex(Int_t naxis, Int_t indx = -1);
125 void SetWidthParIndex(Int_t naxis, Int_t indx = -1);
126
131 Bool_t BeforeEval(Int_t ndim) override;
132 void AfterEval() override;
133
134 void Print(Option_t *option = "") const override;
135
136 protected:
137
142 Bool_t Initialize(Int_t UseBuffers = -1) override;
143
148 void Finalize() override;
149
150 virtual TString GetFuncParName(Int_t n);
152
153 Int_t GetPosParIndex(Int_t naxis) override;
154 Int_t GetWidthParIndex(Int_t naxis) override;
155
156 Double_t UserFunction(Double_t *Coordinates, Double_t *Parameters) override;
157
158 Bool_t LoadLibrary(Bool_t CloseFirst);
159 void CloseLibrary();
160
165
170
171 TArrayI fxPosIndex;
172
174
175 private:
176
181
185 void *fxLibrary{nullptr};
186
187 ClassDefOverride(TGo4FitModelFunction,1)
188};
189
190#endif // TGO4FITMODELFUNCTION_H
Double_t(* TUserFunction)(Double_t *, Double_t *)
Model objects, which uses external user function to calculate model values.
void Finalize() override
Finalize object.
const char * GetFunctionName() const
Returns function name in library.
Bool_t LoadLibrary(Bool_t CloseFirst)
virtual TString GetFuncParName(Int_t n)
Int_t GetWidthParIndex(Int_t naxis) override
Return index of parameter (if exist), which represent width of model component for given axis.
TString fxFunctionName
Function name.
void SetUserFunction(TUserFunction iUserFunction)
Set address to user function.
virtual ~TGo4FitModelFunction()
Destroys TGo4FitModelFunction object.
TString fxLibraryName
String with library name, where function is situated.
void SetWidthParIndex(Int_t naxis, Int_t indx=-1)
void SetFunctionName(const char *name)
Sets function name in library.
TGo4FitParameter * GetFuncPar(Int_t n)
Int_t GetPosParIndex(Int_t naxis) override
Return index of parameter (if exist), which represent position of model for given axis.
void * fxLibrary
Pointer on loaded library descriptor.
Bool_t CanAmplTouch() override
Signals, that amplitude parameter can be removed from or introduced to object.
void AfterEval() override
Clear buffers, which were created by BeforeEval() method.
TUserFunction fxUserFunction
Direct pointer on function.
Bool_t Initialize(Int_t UseBuffers=-1) override
Initialize object.
const char * GetLibraryName() const
Returns library name.
Bool_t SetNumberOfFuncPar(Int_t num)
Sets number of parameters, which can be used by function.
void SetPosParIndex(Int_t naxis, Int_t indx=-1)
Double_t UserFunction(Double_t *Coordinates, Double_t *Parameters) override
Another place, where user specific code can be placed for model values calculation.
Int_t GetNumberOfFuncPar()
Returns number of parameter, which can be used by function.
void Print(Option_t *option="") const override
TGo4FitModelFunction()
Default constructor.
void SetLibraryName(const char *name)
Sets library name.
Bool_t BeforeEval(Int_t ndim) override
Prepare object to evaluations.
TGo4FitModel()
Default constructor.
Model and data objects parameter.