00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4FitDependency.h"
00017 #include <iostream.h>
00018
00019 TGo4FitDependency::TGo4FitDependency() :
00020 TObject(), fxParameter(), fxExpression(), fdInitValue(0.), fiNumPar(0), fxFormula(0) {
00021 }
00022
00023
00024 TGo4FitDependency::TGo4FitDependency(const char* iParameter, const char* iExpression) :
00025 TObject(), fxParameter(iParameter), fxExpression(iExpression), fdInitValue(0.), fiNumPar(0), fxFormula(0) {
00026 }
00027
00028 TGo4FitDependency::TGo4FitDependency(const char* iParameter, Double_t InitValue) :
00029 TObject(), fxParameter(iParameter), fxExpression(), fdInitValue(InitValue), fiNumPar(0), fxFormula(0) {
00030 }
00031
00032 TGo4FitDependency::~TGo4FitDependency() {
00033 if (fxFormula) delete fxFormula;
00034 }
00035
00036 void TGo4FitDependency::SetParameter(const char* iParameter) {
00037 fxParameter = iParameter;
00038 }
00039
00040 void TGo4FitDependency::SetInitValue(Double_t InitValue) {
00041 fxExpression.Remove(0);
00042 fdInitValue = InitValue;
00043
00044 }
00045 void TGo4FitDependency::SetExpression(const char* iExpression) {
00046 fxExpression = iExpression;
00047 }
00048
00049 void TGo4FitDependency::Initialize(Int_t iNumPar, const char* iFormula) {
00050 fiNumPar = iNumPar;
00051 if (iFormula) {
00052 if (fxFormula) delete fxFormula;
00053 fxFormula = new TFormula("", iFormula);
00054 } else fxFormula=0;
00055 }
00056
00057 Double_t TGo4FitDependency::Execute(Double_t* Params) {
00058 Double_t res = (fxFormula!=0) ? fxFormula->EvalPar(0,Params) : fdInitValue;
00059 if (fiNumPar>=0) Params[fiNumPar] = res;
00060 return res;
00061 }
00062
00063 void TGo4FitDependency::Finalize() {
00064 if (fxFormula) { delete fxFormula; fxFormula=0; }
00065 }
00066
00067 void TGo4FitDependency::Print(Option_t* option) const {
00068 cout << "Pars dependency: " << fxParameter << " = ";
00069 if (fxExpression.Length()>0) cout << fxExpression << endl;
00070 else cout << fdInitValue << endl;
00071 }
00072
00073
00074
00075 ClassImp(TGo4FitDependency)
00076
00077