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