GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TYYYParameter.cxx
Go to the documentation of this file.
1 // $Id: TYYYParameter.cxx 2768 2020-04-16 14:49:34Z 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 "TYYYParameter.h"
15 
16 #include "TGo4Log.h"
17 #include "TGo4Fitter.h"
18 
20  TGo4Parameter("YYYParameter")
21 {
22  frP1=0;
23  frP2=0;
24 
25  for(Int_t ix=0;ix<__ARRAYSIZE__;ix++) {
26  fiDataArray[ix]=0;
27  fxFitArray[ix]=0;
28  }
29 }
30 
31 TYYYParameter::TYYYParameter(const char* name) :
32  TGo4Parameter(name)
33 {
34  frP1 = 10;
35  frP2 = 20;
36  for(Int_t ix=0;ix<__ARRAYSIZE__;ix++) {
37  fiDataArray[ix]=ix+30;
38  fxFitArray[ix] = new TGo4Fitter();
39  }
40 }
41 
43 {
44  for(Int_t ix=0;ix<__ARRAYSIZE__;++ix)
45  if(fxFitArray[ix]) {
46  delete fxFitArray[ix];
47  fxFitArray[ix] = 0;
48  }
49 }
50 
51 Int_t TYYYParameter::PrintParameter(Text_t * n, Int_t)
52 {
53  std::cout << "Parameter " << GetName()<<":" <<std::endl;
54  std::cout << " P1="<<frP1<<std::endl;
55  std::cout << " P2="<<frP2<< std::endl;
56  for(Int_t ix=0;ix<__ARRAYSIZE__;++ix) {
57  std::cout << "fiDataArray["<<ix<<"]="<<fiDataArray[ix]<<std::endl;
58  if (fxFitArray[ix]) fxFitArray[ix]->PrintLines();
59  }
60  return 0;
61 }
62 
64 {
65  TYYYParameter* from = dynamic_cast<TYYYParameter*> (source);
66  if (from==0) {
67  TGo4Log::Error("Wrong parameter class: %s", source->ClassName());
68  return kFALSE;
69  }
70 
71  TGo4Log::Info("Parameter %s: P1=%f P2=%f", GetName(), frP1, frP2);
72  frP1 = from->frP1;
73  frP2 = from->frP2;
74  for(Int_t ix=0;ix<__ARRAYSIZE__;++ix) {
75  fiDataArray[ix] = from->fiDataArray[ix];
76  // replace old fitters by copy of source fitter:
77  if(fxFitArray[ix]) {
78  delete fxFitArray[ix];
79  fxFitArray[ix] = 0;
80  }
81  if (from->fxFitArray[ix])
82  fxFitArray[ix] = (TGo4Fitter*) from->fxFitArray[ix]->Clone();
83  }
84  return kTRUE;
85 }
void PrintLines() const
virtual Int_t PrintParameter(Text_t *n, Int_t)
Int_t fiDataArray[__ARRAYSIZE__]
Definition: TYYYParameter.h:33
TGo4Fitter * fxFitArray[__ARRAYSIZE__]
Definition: TYYYParameter.h:34
virtual ~TYYYParameter()
virtual Bool_t UpdateFrom(TGo4Parameter *)
static void Error(const char *text,...)
Definition: TGo4Log.cxx:313
static void Info(const char *text,...)
Definition: TGo4Log.cxx:287
#define __ARRAYSIZE__
Definition: TXXXParameter.h:19