// $Id$ //----------------------------------------------------------------------- // The GSI Online Offline Object Oriented (Go4) Project // Experiment Data Processing at EE department, GSI //----------------------------------------------------------------------- // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH // Planckstr. 1, 64291 Darmstadt, Germany // Contact: http://go4.gsi.de //----------------------------------------------------------------------- // This software can be used under the license agreements as stated // in Go4License.txt file which is part of the distribution. //----------------------------------------------------------------------- #include "TGo4FitModelGaussN.h" #include "Riostream.h" #include "TMath.h" #include "TGo4FitParameter.h" TGo4FitModelGaussN::TGo4FitModelGaussN() : TGo4FitModel(), fxIndexes(), Vect_mu(0),Matr_sig(0), Vect_x(0), Vect_dx(0) { } TGo4FitModelGaussN::TGo4FitModelGaussN(const char* iName, Int_t iNDimension) : TGo4FitModel(iName,"N-dimensional Gaussian", kTRUE), fxIndexes(iNDimension), Vect_mu(0),Matr_sig(0), Vect_x(0), Vect_dx(0) { for(Int_t n=0;n=naxis) || (n2>=naxis)) RemovePar(GetCovarParName(n1,n2)); fxIndexes.Set(naxis); } else { Int_t lastindx = 0; for(Int_t n=oldnaxis;n=0;n--) { if (n==leaveaxis) continue; Int_t test = fxIndexes[n]; Bool_t find, first = kTRUE; do { find = kFALSE; for (Int_t n1=0;n1GetValue(); } void TGo4FitModelGaussN::FillSigmaMatrix(TMatrixD& Sigma) { Int_t ndim = fxIndexes.GetSize(); Sigma.ResizeTo(ndim,ndim); for(Int_t n=0;nGetValue() * GetPar(1+ndim+n)->GetValue(); Int_t indx = 1+2*ndim; for(Int_t n1=0;n1GetValue(); Sigma(n1,n2) = zn; Sigma(n2,n1) = zn; } } Bool_t TGo4FitModelGaussN::BeforeEval(Int_t NDimension) { Par_ndim = fxIndexes.GetSize(); Par_indx = fxIndexes.GetArray(); for (Int_t i=0;i=NDimension) { std::cout << "TGo4FitModelGaussN:: invalid index " << std::endl; return kFALSE; } Vect_mu = new TVectorD(Par_ndim); Matr_sig = new TMatrixD(Par_ndim,Par_ndim); Vect_x = new TVectorD(Par_ndim); Vect_dx = new TVectorD(Par_ndim); FillMuVector(*Vect_mu); FillSigmaMatrix(*Matr_sig); Double_t determ; Matr_sig->Invert(&determ); if (determ==0.) { std::cout << "TGo4FitModelGaussN:: Invalid sigma matrice " << std::endl; AfterEval(); return kFALSE; } return kTRUE; } Double_t TGo4FitModelGaussN::EvalN(const Double_t* v) { for (Int_t n=0;n