GSI Object Oriented Online Offline (Go4) GO4-6.4.5
Loading...
Searching...
No Matches
TGo4FitModelFormula.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 TGO4FITMODELFORMULA_H
15#define TGO4FITMODELFORMULA_H
16
17#include "TGo4FitModel.h"
18
19class TFormula;
20
35class TGo4FitModelFormula : public TGo4FitModel {
36 public:
37
42
47 TGo4FitModelFormula(const char *iName, const char *iExpressionStr = "", Int_t iNPars = 0, Bool_t AddAmplitude = kFALSE);
48
53
57 Bool_t CanAmplTouch() override { return kTRUE; }
58
62 const char *GetExpression() const { return fxExpression.Data(); }
63
67 void SetExpression(const char *expr) { fxExpression = expr; }
68
73
77 Bool_t SetNumberOfExprPar(Int_t num);
78
79 void SetPosParIndex(Int_t naxis, Int_t indx = -1);
80 void SetWidthParIndex(Int_t naxis, Int_t indx = -1);
81
82 Bool_t BeforeEval(Int_t ndim) override;
83 Double_t EvalN(const Double_t *v) override;
84 void AfterEval() override;
85
89 void Print(Option_t *option = "") const override;
90
91 protected:
92
93 Bool_t Initialize(Int_t UseBuffers = -1) override;
94 void Finalize() override;
95
97 TString GetExprParName(Int_t n);
98
101
102 Int_t GetPosParIndex(Int_t naxis) override;
103 Int_t GetWidthParIndex(Int_t naxis) override;
104
108 TString fxExpression;
109
110 TArrayI fxPosIndex;
111
112 TArrayI fxWidthIndex;
113
117 TFormula *fxFormula{nullptr};
118 private:
119
123 Int_t Par_ndim{0};
124
125 ClassDefOverride(TGo4FitModelFormula,1)
126};
127
128#endif // TGO4FITMODELFORMULA_H
Model object, which uses ROOT TFormula class facility.
Bool_t CanAmplTouch() override
Signals that amplitude parameter can be removed from or introduced to object.
TString fxExpression
String, containing formula expression.
TFormula * fxFormula
formula for evaluation expression in EvalN() method.
void Print(Option_t *option="") const override
Print information on standard output.
Int_t Par_ndim
temporary variable for formula calculation in EvalN() method.
void SetWidthParIndex(Int_t naxis, Int_t indx=-1)
Bool_t Initialize(Int_t UseBuffers=-1) override
Initialize model object.
void Finalize() override
Deletes all buffers, created during initialization.
Bool_t SetNumberOfExprPar(Int_t num)
Sets number of parameters, which can be used in expression.
TGo4FitModelFormula(const char *iName, const char *iExpressionStr="", Int_t iNPars=0, Bool_t AddAmplitude=kFALSE)
Create TGo4FitModelFormula object with given names.
TGo4FitParameter * GetExprPar(Int_t n)
virtual ~TGo4FitModelFormula()
Destroys TGo4FitModelFormula object.
TString GetExprParName(Int_t n)
void SetPosParIndex(Int_t naxis, Int_t indx=-1)
Int_t GetNumberOfExprPar()
Get number of parameters, which can be used in expression.
Int_t GetWidthParIndex(Int_t naxis) override
Return index of parameter (if exist), which represent width of model component for given axis.
Double_t EvalN(const Double_t *v) override
Calculates value of model according current parameters values and provided axes values.
const char * GetExpression() const
Return formula expression.
TGo4FitModelFormula()
Default constructor.
void SetExpression(const char *expr)
Sets formula expression.
Int_t GetPosParIndex(Int_t naxis) override
Return index of parameter (if exist), which represent position of model for given axis.
Bool_t BeforeEval(Int_t ndim) override
Prepares (if necessary) some intermediate variables to be able calculate values of model via EvalN() ...
void AfterEval() override
Clear buffers, which were created by BeforeEval() method.
Basic abstract class for representing model components of fitted data.
Model and data objects parameter.