00001 // $Id: TYYYParameter.cxx 930 2013-01-24 16:10:10Z 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 "TYYYParameter.h" 00015 00016 #include "Riostream.h" 00017 00018 #include "TGo4Log.h" 00019 #include "TGo4Fitter.h" 00020 00021 TYYYParameter::TYYYParameter() : 00022 TGo4Parameter("YYYParameter") 00023 { 00024 frP1=0; 00025 frP2=0; 00026 00027 for(Int_t ix=0;ix<__ARRAYSIZE__;ix++) { 00028 fiDataArray[ix]=0; 00029 fxFitArray[ix]=0; 00030 } 00031 } 00032 00033 TYYYParameter::TYYYParameter(const char* name) : 00034 TGo4Parameter(name) 00035 { 00036 frP1 = 10; 00037 frP2 = 20; 00038 for(Int_t ix=0;ix<__ARRAYSIZE__;ix++) { 00039 fiDataArray[ix]=ix+30; 00040 fxFitArray[ix] = new TGo4Fitter(); 00041 } 00042 } 00043 00044 TYYYParameter::~TYYYParameter() 00045 { 00046 for(Int_t ix=0;ix<__ARRAYSIZE__;++ix) 00047 if(fxFitArray[ix]) { 00048 delete fxFitArray[ix]; 00049 fxFitArray[ix] = 0; 00050 } 00051 } 00052 00053 Int_t TYYYParameter::PrintParameter(Text_t * n, Int_t) 00054 { 00055 std::cout << "Parameter " << GetName()<<":" <<std::endl; 00056 std::cout << " P1="<<frP1<<std::endl; 00057 std::cout << " P2="<<frP2<< std::endl; 00058 for(Int_t ix=0;ix<__ARRAYSIZE__;++ix) { 00059 std::cout << "fiDataArray["<<ix<<"]="<<fiDataArray[ix]<<std::endl; 00060 if (fxFitArray[ix]) fxFitArray[ix]->PrintLines(); 00061 } 00062 return 0; 00063 } 00064 00065 Bool_t TYYYParameter::UpdateFrom(TGo4Parameter *source) 00066 { 00067 TYYYParameter* from = dynamic_cast<TYYYParameter*> (source); 00068 if (from==0) { 00069 TGo4Log::Error("Wrong parameter class: %s", source->ClassName()); 00070 return kFALSE; 00071 } 00072 00073 TGo4Log::Info("Parameter %s: P1=%f P2=%f", GetName(), frP1, frP2); 00074 frP1 = from->frP1; 00075 frP2 = from->frP2; 00076 for(Int_t ix=0;ix<__ARRAYSIZE__;++ix) { 00077 fiDataArray[ix] = from->fiDataArray[ix]; 00078 // replace old fitters by copy of source fitter: 00079 if(fxFitArray[ix]) { 00080 delete fxFitArray[ix]; 00081 fxFitArray[ix] = 0; 00082 } 00083 if (from->fxFitArray[ix]) 00084 fxFitArray[ix] = (TGo4Fitter*) from->fxFitArray[ix]->Clone(); 00085 } 00086 return kTRUE; 00087 }