GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TYYYParameter.cxx
Go to the documentation of this file.
1 // $Id$
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 "TGo4Status.h"
18 #include "TGo4Fitter.h"
19 
21  TGo4Parameter("YYYParameter")
22 {
23  frP1 = 0;
24  frP2 = 0;
25 
26  for (Int_t ix = 0; ix < __ARRAYSIZE__; ix++) {
27  fiDataArray[ix] = 0;
28  fxFitArray[ix] = nullptr;
29  }
30 }
31 
32 TYYYParameter::TYYYParameter(const char *name) :
33  TGo4Parameter(name)
34 {
35  frP1 = 10;
36  frP2 = 20;
37  for (Int_t ix = 0; ix < __ARRAYSIZE__; ix++) {
38  fiDataArray[ix] = ix + 30;
39  fxFitArray[ix] = new TGo4Fitter();
40  }
41 }
42 
44 {
45  for (Int_t ix = 0; ix < __ARRAYSIZE__; ++ix)
46  if (fxFitArray[ix]) {
47  delete fxFitArray[ix];
48  fxFitArray[ix] = nullptr;
49  }
50 }
51 
52 void TYYYParameter::Print(Option_t *) const
53 {
54  TGo4Status::PrintLine("Parameter %s:", GetName());
55  TGo4Status::PrintLine(" P1 = %f", frP1);
56  TGo4Status::PrintLine(" P2= %f", frP2);
57  for (Int_t ix = 0; ix < __ARRAYSIZE__; ++ix) {
58  TGo4Status::PrintLine("fiDataArray[%d] = %d", ix, fiDataArray[ix]);
59  if (fxFitArray[ix])
60  fxFitArray[ix]->PrintLines();
61  }
62 }
63 
65 {
66  auto from = dynamic_cast<TYYYParameter*> (source);
67  if (!from) {
68  TGo4Log::Error("Wrong parameter class: %s", source->ClassName());
69  return kFALSE;
70  }
71 
72  TGo4Log::Info("Parameter %s: P1=%f P2=%f", GetName(), frP1, frP2);
73  frP1 = from->frP1;
74  frP2 = from->frP2;
75  for (Int_t ix = 0; ix < __ARRAYSIZE__; ++ix) {
76  fiDataArray[ix] = from->fiDataArray[ix];
77  // replace old fitters by copy of source fitter:
78  if(fxFitArray[ix]) {
79  delete fxFitArray[ix];
80  fxFitArray[ix] = nullptr;
81  }
82  if (from->fxFitArray[ix])
83  fxFitArray[ix] = (TGo4Fitter *) from->fxFitArray[ix]->Clone();
84  }
85  return kTRUE;
86 }
static void Info(const char *text,...) GO4_PRINTF_ARGS
Definition: TGo4Log.cxx:294
Bool_t UpdateFrom(TGo4Parameter *) override
void PrintLines() const
Int_t fiDataArray[__ARRAYSIZE__]
Definition: TYYYParameter.h:34
void Print(Option_t *opt="") const override
static void Error(const char *text,...) GO4_PRINTF_ARGS
Definition: TGo4Log.cxx:320
TGo4Fitter * fxFitArray[__ARRAYSIZE__]
Definition: TYYYParameter.h:35
virtual ~TYYYParameter()
static void PrintLine(const char *text,...)
Definition: TGo4Status.cxx:101
#define __ARRAYSIZE__
Definition: TXXXParameter.h:19