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 "TGo4FitterEnvelope.h" 00017 00018 #include "Riostream.h" 00019 00020 TGo4FitterEnvelope::TGo4FitterEnvelope() 00021 : TGo4Parameter("Fitter envelope"), fxFitter(0) 00022 { 00023 } 00024 00025 TGo4FitterEnvelope::TGo4FitterEnvelope(const char* name, TGo4Fitter* fitter) 00026 : TGo4Parameter(name) 00027 { 00028 fxFitter=fitter; 00029 } 00030 00031 TGo4FitterEnvelope::~TGo4FitterEnvelope() 00032 { 00033 if(fxFitter) delete fxFitter; 00034 } 00035 00036 Int_t TGo4FitterEnvelope::PrintParameter(Text_t * buffer, Int_t buflen){ 00037 Int_t locallen=128000; 00038 Text_t localbuf[128000]; 00039 if(buflen<0 && buffer!=0) 00040 return 0; 00041 Int_t size=0; 00042 Text_t* current=localbuf; 00043 size+=TGo4Parameter::PrintParameter(current,locallen-size-1); 00044 current= localbuf + size; 00045 if(fxFitter) 00046 size+=sprintf(current," \t This object contains the fitter: %s \n",fxFitter->GetName()); 00047 else 00048 size+=sprintf(current," \t This object contains no fitter\n"); 00049 current=localbuf+size; 00050 // here we optionally might put printout of fitter if we like... 00051 if(buffer==0) 00052 { 00053 cout << localbuf << endl; 00054 } 00055 else 00056 { 00057 if(size>buflen-1) 00058 size=buflen-1; 00059 strncpy(buffer,localbuf,size); 00060 } 00061 return size; 00062 } 00063 00064 Bool_t TGo4FitterEnvelope::UpdateFrom(TGo4Parameter *pp) 00065 { 00066 TGo4FitterEnvelope * from = dynamic_cast<TGo4FitterEnvelope *> (pp); 00067 00068 if(from==0) return kFALSE; 00069 00070 if(fxFitter!=0) delete fxFitter; 00071 fxFitter = from->GetFitter(kTRUE);// change ownership to us 00072 return kTRUE; 00073 } 00074 00075 void TGo4FitterEnvelope::Clear(Option_t* opt) 00076 { 00077 if(fxFitter) fxFitter->Clear(opt); 00078 } 00079 00080 TGo4Fitter* TGo4FitterEnvelope::GetFitter(Bool_t chown) 00081 { 00082 TGo4Fitter* rev=fxFitter; 00083 if(chown) fxFitter=0; 00084 return rev; 00085 } 00086 00087 void TGo4FitterEnvelope::SetFitter(TGo4Fitter* fitter) 00088 { 00089 if(fxFitter!=0) delete fxFitter; 00090 fxFitter=fitter; 00091 } 00092 00093 //----------------------------END OF GO4 SOURCE FILE ---------------------