TGo4FitModelGauss1.cxx

Go to the documentation of this file.
00001 // $Id: TGo4FitModelGauss1.cxx 478 2009-10-29 12:26:09Z linev $
00002 //-----------------------------------------------------------------------
00003 //       The GSI Online Offline Object Oriented (Go4) Project
00004 //         Experiment Data Processing at EE department, GSI
00005 //-----------------------------------------------------------------------
00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
00007 //                     Planckstr. 1, 64291 Darmstadt, Germany
00008 // Contact:            http://go4.gsi.de
00009 //-----------------------------------------------------------------------
00010 // This software can be used under the license agreements as stated
00011 // in Go4License.txt file which is part of the distribution.
00012 //-----------------------------------------------------------------------
00013 
00014 #include "TGo4FitModelGauss1.h"
00015 
00016 #include "Riostream.h"
00017 
00018 #include "TMath.h"
00019 
00020 #include "TGo4FitParameter.h"
00021 
00022 TGo4FitModelGauss1::TGo4FitModelGauss1() : TGo4FitModel(), fiNaxis(0) {
00023 }
00024 
00025 TGo4FitModelGauss1::TGo4FitModelGauss1(const char* iName, Double_t iPosition, Double_t iWidth, Int_t iNaxis) :
00026    TGo4FitModel(iName,"1-dimensional Gaussian", kTRUE), fiNaxis(iNaxis) {
00027    NewParameter("Pos","Gaussian position",iPosition);
00028    NewParameter("Width","Gaussian width",iWidth);
00029 }
00030 
00031 TGo4FitModelGauss1::~TGo4FitModelGauss1() {
00032 }
00033 
00034 Bool_t TGo4FitModelGauss1::BeforeEval(Int_t ndim) {
00035    Par_x0 = GetPar(1)->GetValue();
00036    Double_t w = GetPar(2)->GetValue();
00037    if (w==0.)
00038      { cout << "TGo4FitModelGauss1::   Invalid sigma value " << endl; return kFALSE; }
00039    Par_k = -0.5/w/w;
00040 
00041    if (fiNaxis>=ndim)
00042      { cout << "TGo4FitModelGauss1:   invalid index "; return kFALSE; }
00043    return kTRUE;
00044 }
00045 
00046 Double_t TGo4FitModelGauss1::EvalN(const Double_t* v) {
00047    return TMath::Exp(Par_k*(v[fiNaxis]-Par_x0)*(v[fiNaxis]-Par_x0));
00048 }
00049 
00050 void TGo4FitModelGauss1::Print(Option_t* option) const {
00051     TGo4FitModel::Print(option);
00052     cout << "   1-dimensional Gauss for axis " << fiNaxis << endl;
00053 }
00054 
00055 Double_t TGo4FitModelGauss1::Integral() {
00056    return GetAmplValue() * TMath::Sqrt(2.*TMath::Pi()) * GetPar(2)->GetValue();
00057 }

Generated on Thu Oct 28 15:54:12 2010 for Go4-Fitpackagev4.04-2 by  doxygen 1.5.1