TGo4FitDependency.cxx

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

Generated on Thu Oct 28 15:54:12 2010 for Go4-Fitpackagev4.04-2 by  doxygen 1.5.1