Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4Fit/TGo4FitMatrixTrans.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4FitMatrixTrans.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "TArrayD.h"
00021 #include "TString.h"
00022 
00023 TGo4FitMatrixTrans::TGo4FitMatrixTrans() : TGo4FitAxisTrans() {
00024 
00025 }
00026 
00027 TGo4FitMatrixTrans::TGo4FitMatrixTrans(const char* iName, const char* iTitle, Int_t NumAxis) :
00028   TGo4FitAxisTrans(iName, iTitle) {
00029    SetNumAxis(NumAxis);
00030 }
00031 
00032 TGo4FitMatrixTrans::~TGo4FitMatrixTrans() {
00033 }
00034 
00035 Int_t TGo4FitMatrixTrans::GetNumAxis() {
00036    return Int_t(sqrt(NumPars()));
00037 }
00038 
00039 
00040 void TGo4FitMatrixTrans::SetNumAxis(Int_t NumAxis) {
00041   Int_t oldnum = GetNumAxis();
00042   TArrayD oldzn(NumPars());
00043   GetParsValues(oldzn.GetArray());
00044 
00045   ClearPars();
00046 
00047   for(Int_t n1=0;n1<NumAxis;n1++)
00048     for(Int_t n2=0;n2<NumAxis;n2++) {
00049        TString name("Matr");
00050        name+="_"; name+=n1;
00051        name+="_"; name+=n2;
00052        Double_t zn = 0.;
00053        if((n1<oldnum) && (n2<oldnum)) zn = oldzn[n1*oldnum+n2];
00054        CreatePar(name.Data(),"matrix element",zn);
00055     }
00056 }
00057 
00058 void TGo4FitMatrixTrans::Transformation(Double_t* scales, Int_t naxis) {
00059   Int_t num = GetNumAxis();
00060   if ((scales==0) || (num==0) || (naxis==0)) return;
00061   Int_t limit = num<naxis ? num : naxis;
00062   TArrayD oldscales(naxis, scales);
00063   for (Int_t n1=0;n1<limit;n1++) {
00064     Double_t sum = 0.;
00065     for (Int_t n2=0;n2<limit;n2++)
00066       sum += oldscales[n2] * GetPar(n1*num + n2)->GetValue();
00067     scales[n1] = sum;
00068   }
00069 }
00070 
00071 void TGo4FitMatrixTrans::Print(Option_t* option) const {
00072    cout << "Matrix transformation of scale values " << endl;
00073    TGo4FitAxisTrans::Print(option);
00074 }
00075 
00076 ClassImp(TGo4FitMatrixTrans)
00077 
00078 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:55:56 2005 for Go4-v2.10-5 by doxygen1.2.15