GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4FitMatrixTrans.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 "TGo4FitMatrixTrans.h"
15
16#include <iostream>
17#include "TArrayD.h"
18#include "TString.h"
19#include "TMath.h"
20
21#include "TGo4FitParameter.h"
22
24
25TGo4FitMatrixTrans::TGo4FitMatrixTrans(const char *iName, const char *iTitle, Int_t NumAxis)
26 : TGo4FitAxisTrans(iName, iTitle)
27{
28 SetNumAxis(NumAxis);
29}
30
32
34{
35 return Int_t(TMath::Sqrt(1. * NumPars()));
36}
37
39{
40 Int_t oldnum = GetNumAxis();
41 TArrayD oldzn(NumPars());
42 GetParsValues(oldzn.GetArray());
43
44 ClearPars();
45
46 for (Int_t n1 = 0; n1 < NumAxis; n1++)
47 for (Int_t n2 = 0; n2 < NumAxis; n2++) {
48 TString name("Matr");
49 name += "_";
50 name += n1;
51 name += "_";
52 name += n2;
53 Double_t zn = 0.;
54 if ((n1 < oldnum) && (n2 < oldnum))
55 zn = oldzn[n1 * oldnum + n2];
56 CreatePar(name.Data(), "matrix element", zn);
57 }
58}
59
60void TGo4FitMatrixTrans::Transformation(Double_t *scales, Int_t naxis)
61{
62 Int_t num = GetNumAxis();
63 if (!scales || (num == 0) || (naxis == 0))
64 return;
65 Int_t limit = num < naxis ? num : naxis;
66 TArrayD oldscales(naxis, scales);
67 for (Int_t n1 = 0; n1 < limit; n1++) {
68 Double_t sum = 0.;
69 for (Int_t n2 = 0; n2 < limit; n2++)
70 sum += oldscales[n2] * GetPar(n1 * num + n2)->GetValue();
71 scales[n1] = sum;
72 }
73}
74
75void TGo4FitMatrixTrans::Print(Option_t *option) const
76{
77 std::cout << "Matrix transformation of scale values " << std::endl;
79}
void Print(Option_t *option="") const override
void SetNumAxis(Int_t NumAxis)
void Transformation(Double_t *scales, Int_t naxis) override
void Print(Option_t *option="") const override
Double_t GetValue() const
Return parameter value.
void GetParsValues(Double_t *pars)
Copy values of all parameters in list to provided array.
TGo4FitParameter * GetPar(Int_t n)
Return parameter according given index.
void ClearPars()
Remove all parameters from list.
TGo4FitParameter * CreatePar(const char *ParName, const char *Title, Double_t iValue=0)
Create new TGo4FitParameter object with given name, title and parameter value, and put this object to...
virtual Int_t NumPars()
Return number of parameters in list.