GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitterEnvelope.cxx
Go to the documentation of this file.
1 // $Id: TGo4FitterEnvelope.cxx 3078 2021-03-13 13:32:14Z 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 fuer 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 
17 : TGo4Parameter("Fitter envelope"), fxFitter(0)
18 {
19 }
20 
22 : TGo4Parameter(name)
23 {
24  fxFitter=fitter;
25 }
26 
28 {
29  if(fxFitter) delete fxFitter;
30 }
31 
32 Int_t TGo4FitterEnvelope::PrintParameter(Text_t * buffer, Int_t buflen)
33 {
34  Text_t localbuf[128000];
35  if(buflen<0 && buffer!=0)
36  return 0;
37  Int_t size = TGo4Parameter::PrintParameter(localbuf, sizeof(localbuf)-1);
38  if(fxFitter)
39  size += snprintf(localbuf+size, sizeof(localbuf) - size, " \t This object contains the fitter: %s \n",fxFitter->GetName());
40  else
41  size += snprintf(localbuf + size, sizeof(localbuf) - size, " \t This object contains no fitter\n");
42  // here we optionally might put printout of fitter if we like...
43  if(buffer==0)
44  {
45  std::cout << localbuf << std::endl;
46  }
47  else
48  {
49  if(size > buflen-1)
50  size = buflen-1;
51  strncpy(buffer,localbuf,size);
52  }
53  return size;
54 }
55 
57 {
58  TGo4FitterEnvelope * from = dynamic_cast<TGo4FitterEnvelope *> (pp);
59 
60  if(!from) return kFALSE;
61 
62  if(fxFitter!=0) delete fxFitter;
63  fxFitter = from->GetFitter(kTRUE);// change ownership to us
64  return kTRUE;
65 }
66 
67 void TGo4FitterEnvelope::Clear(Option_t* opt)
68 {
69  if(fxFitter) fxFitter->Clear(opt);
70 }
71 
73 {
74  TGo4Fitter* rev=fxFitter;
75  if(chown) fxFitter=0;
76  return rev;
77 }
78 
80 {
81  if(fxFitter!=0) delete fxFitter;
82  fxFitter=fitter;
83 }
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:94