GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitModelGauss1.cxx
Go to the documentation of this file.
1 // $Id: TGo4FitModelGauss1.cxx 933 2013-01-29 15:27:58Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4FitModelGauss1.h"
15 
16 #include "Riostream.h"
17 #include "TMath.h"
18 
19 #include "TGo4FitParameter.h"
20 
22 }
23 
24 TGo4FitModelGauss1::TGo4FitModelGauss1(const char* iName, Double_t iPosition, Double_t iWidth, Int_t iNaxis) :
25  TGo4FitModel(iName,"1-dimensional Gaussian", kTRUE), fiNaxis(iNaxis) {
26  NewParameter("Pos","Gaussian position",iPosition);
27  NewParameter("Width","Gaussian width",iWidth);
28 }
29 
31 }
32 
33 Bool_t TGo4FitModelGauss1::BeforeEval(Int_t ndim) {
34  Par_x0 = GetPar(1)->GetValue();
35  Double_t w = GetPar(2)->GetValue();
36  if (w==0.)
37  { std::cout << "TGo4FitModelGauss1:: Invalid sigma value " << std::endl; return kFALSE; }
38  Par_k = -0.5/w/w;
39 
40  if (fiNaxis>=ndim)
41  { std::cout << "TGo4FitModelGauss1: invalid index " << std::endl; return kFALSE; }
42  return kTRUE;
43 }
44 
45 Double_t TGo4FitModelGauss1::EvalN(const Double_t* v) {
46  return TMath::Exp(Par_k*(v[fiNaxis]-Par_x0)*(v[fiNaxis]-Par_x0));
47 }
48 
49 void TGo4FitModelGauss1::Print(Option_t* option) const {
50  TGo4FitModel::Print(option);
51  std::cout << " 1-dimensional Gauss for axis " << fiNaxis << std::endl;
52 }
53 
55  return GetAmplValue() * TMath::Sqrt(2.*TMath::Pi()) * GetPar(2)->GetValue();
56 }
TGo4FitParameter * GetPar(Int_t n)
virtual Bool_t BeforeEval(Int_t ndim)
virtual Double_t EvalN(const Double_t *v)
TGo4FitParameter * NewParameter(const char *Name, const char *Title, Double_t iValue=0., Bool_t Fixed=kFALSE, Int_t AtIndx=-1)
virtual void Print(Option_t *option) const
Double_t GetValue() const
virtual void Print(Option_t *option) const
virtual Double_t Integral()