GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitModelGauss1.cxx
Go to the documentation of this file.
1 // $Id: TGo4FitModelGauss1.cxx 2769 2020-04-16 14:54:23Z 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 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 
34 Bool_t TGo4FitModelGauss1::BeforeEval(Int_t ndim) {
35  Par_x0 = GetPar(1)->GetValue();
36  Double_t w = GetPar(2)->GetValue();
37  if (w==0.)
38  { std::cout << "TGo4FitModelGauss1:: Invalid sigma value " << std::endl; return kFALSE; }
39  Par_k = -0.5/w/w;
40 
41  if (fiNaxis>=ndim)
42  { std::cout << "TGo4FitModelGauss1: invalid index " << std::endl; return kFALSE; }
43  return kTRUE;
44 }
45 
46 Double_t TGo4FitModelGauss1::EvalN(const Double_t* v) {
47  return TMath::Exp(Par_k*(v[fiNaxis]-Par_x0)*(v[fiNaxis]-Par_x0));
48 }
49 
50 void TGo4FitModelGauss1::Print(Option_t* option) const {
51  TGo4FitModel::Print(option);
52  std::cout << " 1-dimensional Gauss for axis " << fiNaxis << std::endl;
53 }
54 
56  return GetAmplValue() * TMath::Sqrt(2.*TMath::Pi()) * GetPar(2)->GetValue();
57 }
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()