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

/Go4Fit/TGo4FitModelGauss1.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 "TGo4FitModelGauss1.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "TMath.h"
00021 
00022 #include "TGo4FitParameter.h"
00023 
00024 TGo4FitModelGauss1::TGo4FitModelGauss1() : TGo4FitModel(), fiNaxis(0) {
00025 }
00026 
00027 TGo4FitModelGauss1::TGo4FitModelGauss1(const char* iName, Double_t iPosition, Double_t iWidth, Int_t iNaxis) :
00028    TGo4FitModel(iName,"1-dimensional Gaussian", kTRUE), fiNaxis(iNaxis) {
00029    NewParameter("Pos","Gaussian position",iPosition);
00030    NewParameter("Width","Gaussian width",iWidth);
00031 }
00032 
00033 TGo4FitModelGauss1::~TGo4FitModelGauss1() {
00034 }
00035 
00036 Bool_t TGo4FitModelGauss1::BeforeEval(Int_t ndim) {
00037    Par_x0 = GetPar(1)->GetValue();
00038    Double_t w = GetPar(2)->GetValue();
00039    if (w==0.)
00040      { cout << "TGo4FitModelGauss1::   Invalid sigma value " << endl; return kFALSE; }
00041    Par_k = -0.5/w/w;
00042 
00043    if (fiNaxis>=ndim)
00044      { cout << "TGo4FitModelGauss1:   invalid index "; return kFALSE; }
00045    return kTRUE;
00046 }
00047 
00048 Double_t TGo4FitModelGauss1::EvalN(const Double_t* v) {
00049    return TMath::Exp(Par_k*(v[fiNaxis]-Par_x0)*(v[fiNaxis]-Par_x0));
00050 }
00051 
00052 void TGo4FitModelGauss1::Print(Option_t* option) const {
00053     TGo4FitModel::Print(option);
00054     cout << "   1-dimensional Gauss for axis " << fiNaxis << endl;
00055 }
00056 
00057 Double_t TGo4FitModelGauss1::Integral() {
00058    return GetAmplValue() * sqrt(2*TMath::Pi()) * GetPar(2)->GetValue();
00059 }
00060 
00061 ClassImp(TGo4FitModelGauss1)
00062 
00063 //----------------------------END OF GO4 SOURCE FILE ---------------------

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