GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
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
24
25TGo4FitModelGauss1::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
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
47Double_t TGo4FitModelGauss1::EvalN(const Double_t *v)
48{
49 return TMath::Exp(Par_k*(v[fiNaxis]-Par_x0)*(v[fiNaxis]-Par_x0));
50}
51
52void 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 GetAmplValue()
Return value of amplitude parameter.
TGo4FitParameter * NewParameter(const char *Name, const char *Title, Double_t iValue=0., Bool_t Fixed=kFALSE, Int_t AtIndx=-1)
Create new parameter with provided properties and add to parameters list.
Bool_t BeforeEval(Int_t ndim) override
Prepares (if necessary) some intermediate variables to be able calculate values of model via EvalN() ...
TGo4FitModelGauss1()
Default constructor.
Int_t fiNaxis
Number of selected axis, where gaussian will be build.
Double_t Integral() override
Calculates integral of model component.
virtual ~TGo4FitModelGauss1()
Destroys TGo4FitModelGauss1 object.
Double_t EvalN(const Double_t *v) override
Calculates value of model according current parameters values and provided axes values.
void Print(Option_t *option="") const override
Print information to standard output.
Double_t Par_x0
Temporary variable for EvalN() function.
Double_t Par_k
Temporary variable for EvalN() function.
void Print(Option_t *option="") const override
Print information about model object on standard output.
TGo4FitModel()
Default constructor.
Double_t GetValue() const
Return parameter value.
TGo4FitParameter * GetPar(Int_t n)
Return parameter according given index.