Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4FitDependency.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4FitDependency.h"
00017 
00018 #include "Riostream.h"
00019 
00020 #include "TFormula.h"
00021 
00022 TGo4FitDependency::TGo4FitDependency() :
00023     TObject(), fxParameter(), fxExpression(), fdInitValue(0.), fiNumPar(0), fxFormula(0)  {
00024 }
00025 
00026 
00027 TGo4FitDependency::TGo4FitDependency(const char* iParameter, const char* iExpression) :
00028     TObject(), fxParameter(iParameter), fxExpression(iExpression), fdInitValue(0.), fiNumPar(0), fxFormula(0) {
00029 }
00030 
00031 TGo4FitDependency::TGo4FitDependency(const char* iParameter, Double_t InitValue) :
00032     TObject(), fxParameter(iParameter), fxExpression(), fdInitValue(InitValue), fiNumPar(0), fxFormula(0) {
00033 }
00034 
00035 TGo4FitDependency::~TGo4FitDependency() {
00036     if (fxFormula) delete fxFormula;
00037 }
00038 
00039 void TGo4FitDependency::SetParameter(const char* iParameter) {
00040   fxParameter = iParameter;
00041 }
00042 
00043 void TGo4FitDependency::SetInitValue(Double_t InitValue) 
00044 {
00045   fxExpression.Remove(0);
00046   fdInitValue = InitValue;
00047 
00048 }
00049 void TGo4FitDependency::SetExpression(const char* iExpression) 
00050 {
00051   fxExpression = iExpression;
00052 }
00053 
00054 void TGo4FitDependency::Initialize(Int_t iNumPar, const char* iFormula) 
00055 {
00056     fiNumPar = iNumPar;
00057     if (iFormula) {
00058        if (fxFormula) delete fxFormula;
00059        fxFormula = new TFormula("", iFormula);
00060     } else fxFormula=0;
00061 }
00062 
00063 Double_t TGo4FitDependency::ExecuteDependency(Double_t* Params) 
00064 {
00065     Double_t res = (fxFormula!=0) ? fxFormula->EvalPar(0,Params) : fdInitValue;
00066     if (fiNumPar>=0) Params[fiNumPar] = res;
00067     return res;
00068 }
00069 
00070 void TGo4FitDependency::Finalize() {
00071     if (fxFormula) { delete fxFormula; fxFormula=0; }
00072 }
00073 
00074 void TGo4FitDependency::Print(Option_t* option) const
00075 {
00076    cout << "Pars dependency:   " << fxParameter << "  =  ";
00077    if (fxExpression.Length()>0) cout << fxExpression << endl;
00078                            else cout << fdInitValue << endl;
00079 }
00080 
00081 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:12 2008 for Go4-v3.04-1 by  doxygen 1.4.2