GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4FitModelGauss1.cxx
Go to the documentation of this file.
1 // $Id$
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 fuer 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 <iostream>
17 
18 #include "TMath.h"
19 
20 #include "TGo4FitParameter.h"
21 
23 }
24 
25 TGo4FitModelGauss1::TGo4FitModelGauss1(const char *iName, Double_t iPosition, Double_t iWidth, Int_t iNaxis) :
26  TGo4FitModel(iName,"1-dimensional Gaussian", kTRUE), fiNaxis(iNaxis) {
27  NewParameter("Pos","Gaussian position",iPosition);
28  NewParameter("Width","Gaussian width",iWidth);
29 }
30 
32 }
33 
35 {
36  Par_x0 = GetPar(1)->GetValue();
37  Double_t w = GetPar(2)->GetValue();
38  if (w == 0.)
39  { std::cout << "TGo4FitModelGauss1:: Invalid sigma value " << std::endl; return kFALSE; }
40  Par_k = -0.5/w/w;
41 
42  if (fiNaxis>=ndim)
43  { std::cout << "TGo4FitModelGauss1: invalid index " << std::endl; return kFALSE; }
44  return kTRUE;
45 }
46 
47 Double_t TGo4FitModelGauss1::EvalN(const Double_t *v)
48 {
49  return TMath::Exp(Par_k*(v[fiNaxis]-Par_x0)*(v[fiNaxis]-Par_x0));
50 }
51 
52 void TGo4FitModelGauss1::Print(Option_t *option) const
53 {
54  TGo4FitModel::Print(option);
55  std::cout << " 1-dimensional Gauss for axis " << fiNaxis << std::endl;
56 }
57 
59 {
60  return GetAmplValue() * TMath::Sqrt(2.*TMath::Pi()) * GetPar(2)->GetValue();
61 }
Double_t GetValue() const
void Print(Option_t *option="") const override
Double_t EvalN(const Double_t *v) override
TGo4FitParameter * GetPar(Int_t n)
TGo4FitParameter * NewParameter(const char *Name, const char *Title, Double_t iValue=0., Bool_t Fixed=kFALSE, Int_t AtIndx=-1)
Double_t Integral() override
void Print(Option_t *option="") const override
Bool_t BeforeEval(Int_t ndim) override