Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4FitMatrixTrans.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE 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 "Riostream.h"
00019 
00020 #include "TArrayD.h"
00021 #include "TString.h"
00022 #include "TMath.h"
00023 
00024 #include "TGo4FitParameter.h"
00025 
00026 TGo4FitMatrixTrans::TGo4FitMatrixTrans() : TGo4FitAxisTrans() {
00027 
00028 }
00029 
00030 TGo4FitMatrixTrans::TGo4FitMatrixTrans(const char* iName, const char* iTitle, Int_t NumAxis) :
00031   TGo4FitAxisTrans(iName, iTitle)
00032 {
00033    SetNumAxis(NumAxis);
00034 }
00035 
00036 TGo4FitMatrixTrans::~TGo4FitMatrixTrans()
00037 {
00038 }
00039 
00040 Int_t TGo4FitMatrixTrans::GetNumAxis()
00041 {
00042    return Int_t(TMath::Sqrt(1.*NumPars()));
00043 }
00044 
00045 
00046 void TGo4FitMatrixTrans::SetNumAxis(Int_t NumAxis) {
00047   Int_t oldnum = GetNumAxis();
00048   TArrayD oldzn(NumPars());
00049   GetParsValues(oldzn.GetArray());
00050 
00051   ClearPars();
00052 
00053   for(Int_t n1=0;n1<NumAxis;n1++)
00054     for(Int_t n2=0;n2<NumAxis;n2++) {
00055        TString name("Matr");
00056        name+="_"; name+=n1;
00057        name+="_"; name+=n2;
00058        Double_t zn = 0.;
00059        if((n1<oldnum) && (n2<oldnum)) zn = oldzn[n1*oldnum+n2];
00060        CreatePar(name.Data(),"matrix element",zn);
00061     }
00062 }
00063 
00064 void TGo4FitMatrixTrans::Transformation(Double_t* scales, Int_t naxis) {
00065   Int_t num = GetNumAxis();
00066   if ((scales==0) || (num==0) || (naxis==0)) return;
00067   Int_t limit = num<naxis ? num : naxis;
00068   TArrayD oldscales(naxis, scales);
00069   for (Int_t n1=0;n1<limit;n1++) {
00070     Double_t sum = 0.;
00071     for (Int_t n2=0;n2<limit;n2++)
00072       sum += oldscales[n2] * GetPar(n1*num + n2)->GetValue();
00073     scales[n1] = sum;
00074   }
00075 }
00076 
00077 void TGo4FitMatrixTrans::Print(Option_t* option) const {
00078    cout << "Matrix transformation of scale values " << endl;
00079    TGo4FitAxisTrans::Print(option);
00080 }
00081 
00082 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:12 2008 for Go4-v3.04-1 by  doxygen 1.4.2