GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitterEnvelope.cxx
Go to the documentation of this file.
1 // $Id: TGo4FitterEnvelope.cxx 934 2013-01-29 15:59:24Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4FitterEnvelope.h"
15 
16 #include "Riostream.h"
17 
19 : TGo4Parameter("Fitter envelope"), fxFitter(0)
20 {
21 }
22 
24 : TGo4Parameter(name)
25 {
26  fxFitter=fitter;
27 }
28 
30 {
31  if(fxFitter) delete fxFitter;
32 }
33 
34 Int_t TGo4FitterEnvelope::PrintParameter(Text_t * buffer, Int_t buflen)
35 {
36  Int_t locallen=128000;
37  Text_t localbuf[128000];
38  if(buflen<0 && buffer!=0)
39  return 0;
40  Int_t size=0;
41  Text_t* current=localbuf;
42  size+=TGo4Parameter::PrintParameter(current,locallen-size-1);
43  current= localbuf + size;
44  if(fxFitter)
45  size+=sprintf(current," \t This object contains the fitter: %s \n",fxFitter->GetName());
46  else
47  size+=sprintf(current," \t This object contains no fitter\n");
48  current=localbuf+size;
49  // here we optionally might put printout of fitter if we like...
50  if(buffer==0)
51  {
52  std::cout << localbuf << std::endl;
53  }
54  else
55  {
56  if(size>buflen-1)
57  size=buflen-1;
58  strncpy(buffer,localbuf,size);
59  }
60  return size;
61 }
62 
64 {
65  TGo4FitterEnvelope * from = dynamic_cast<TGo4FitterEnvelope *> (pp);
66 
67  if(from==0) return kFALSE;
68 
69  if(fxFitter!=0) delete fxFitter;
70  fxFitter = from->GetFitter(kTRUE);// change ownership to us
71  return kTRUE;
72 }
73 
74 void TGo4FitterEnvelope::Clear(Option_t* opt)
75 {
76  if(fxFitter) fxFitter->Clear(opt);
77 }
78 
80 {
81  TGo4Fitter* rev=fxFitter;
82  if(chown) fxFitter=0;
83  return rev;
84 }
85 
87 {
88  if(fxFitter!=0) delete fxFitter;
89  fxFitter=fitter;
90 }
Int_t PrintParameter(Text_t *n, Int_t)
virtual Int_t PrintParameter(Text_t *buffer=0, Int_t buflen=0)
virtual void Clear(Option_t *opt="")
void SetFitter(TGo4Fitter *fitter)
TGo4Fitter * GetFitter(Bool_t chown=kFALSE)
Bool_t UpdateFrom(TGo4Parameter *)
virtual void Clear(Option_t *option=0)
Definition: TGo4Fitter.cxx:96