GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
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
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
52void 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}
#define __ARRAYSIZE__
Central class of Go4Fit package.
Definition TGo4Fitter.h:38
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.
Definition TGo4Log.cxx:294
static void Error(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 3.
Definition TGo4Log.cxx:320
static void PrintLine(const char *text,...)
Print single line of debug output with appropriate indent.
TGo4Fitter * fxFitArray[__ARRAYSIZE__]
Bool_t UpdateFrom(TGo4Parameter *) override
Update contents of parameter class with external object.
void Print(Option_t *opt="") const override
Int_t fiDataArray[__ARRAYSIZE__]
virtual ~TYYYParameter()