Logo ROOT  
Reference Guide
VavilovAccurateCdf.cxx
Go to the documentation of this file.
1 // @(#)root/mathmore:$Id$
2 // Authors: B. List 29.4.2010
3 
4 
5  /**********************************************************************
6  * *
7  * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT *
8  * *
9  * This library is free software; you can redistribute it and/or *
10  * modify it under the terms of the GNU General Public License *
11  * as published by the Free Software Foundation; either version 2 *
12  * of the License, or (at your option) any later version. *
13  * *
14  * This library is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
17  * General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License *
20  * along with this library (see file COPYING); if not, write *
21  * to the Free Software Foundation, Inc., 59 Temple Place, Suite *
22  * 330, Boston, MA 02111-1307 USA, or contact the author. *
23  * *
24  **********************************************************************/
25 
26 // Implementation file for class VavilovAccurateCdf
27 //
28 // Created by: blist at Thu Apr 29 11:19:00 2010
29 //
30 // Last update: Thu Apr 29 11:19:00 2010
31 //
32 
34 #include "Math/VavilovAccurate.h"
35 
36 namespace ROOT {
37 namespace Math {
38 
39 
41  fP[0] = 1;
42  fP[1] = 0;
43  fP[2] = 1;
44  fP[3] = 1;
45  fP[4] = 1;
46 }
47 
49  if (p)
50  for (int i = 0; i < 5; ++i)
51  fP[i] = p[i];
52  else {
53  fP[0] = 1;
54  fP[1] = 0;
55  fP[2] = 1;
56  fP[3] = 1;
57  fP[4] = 1;
58  }
59 }
60 
62 {}
63 
64 const double * VavilovAccurateCdf::Parameters() const {
65  return fP;
66 }
67 
68 void VavilovAccurateCdf::SetParameters(const double * p ) {
69  if (p)
70  for (int i = 0; i < 5; ++i)
71  fP[i] = p[i];
72 }
73 
74 unsigned int VavilovAccurateCdf::NPar() const {
75  return 5;
76 }
77 
78 std::string VavilovAccurateCdf::ParameterName(unsigned int i) const {
79  switch (i) {
80  case 0: return "Norm"; break;
81  case 1: return "x0"; break;
82  case 2: return "xi"; break;
83  case 3: return "kappa"; break;
84  case 4: return "beta2"; break;
85  }
86  return "???";
87 }
88 
89 double VavilovAccurateCdf::DoEval(double x) const {
90  VavilovAccurate v(fP[3], fP[4]);
91  return fP[0]*v.Cdf ((x-fP[1])/fP[2]);
92 }
93 
94 double VavilovAccurateCdf::DoEvalPar(double x, const double * p) const {
95  if (!p) return 0;
96  // p[0]: norm, p[1]: x0, p[2]: width, p[3]: kappa, p[4]: beta2
97  VavilovAccurate v(p[3], p[4]);
98  return p[0]*v.Cdf ((x-p[1])/p[2]);
99 }
100 
102  return new VavilovAccurateCdf (*this);
103 }
104 
105 } // namespace Math
106 } // namespace ROOT
ROOT::Math::VavilovAccurateCdf::ParameterName
virtual std::string ParameterName(unsigned int i) const
Return the name of the i-th parameter (starting from zero) Overwrite if want to avoid the default nam...
Definition: VavilovAccurateCdf.cxx:116
ROOT::Math::VavilovAccurateCdf::Clone
virtual IBaseFunctionOneDim * Clone() const
Return a clone of the object.
Definition: VavilovAccurateCdf.cxx:139
x
Double_t x[n]
Definition: legend1.C:17
v
@ v
Definition: rootcling_impl.cxx:3635
ROOT::Math::VavilovAccurateCdf::VavilovAccurateCdf
VavilovAccurateCdf()
Default constructor.
Definition: VavilovAccurateCdf.cxx:78
VavilovAccurateCdf.h
ROOT::Math::IBaseFunctionOneDim
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Definition: IFunction.h:135
ROOT::Math::VavilovAccurateCdf::SetParameters
virtual void SetParameters(const double *p)
Set the parameter values.
Definition: VavilovAccurateCdf.cxx:106
ROOT::Math::VavilovAccurateCdf::fP
double fP[5]
Definition: VavilovAccurateCdf.h:193
ROOT::Math::VavilovAccurate
Class describing a Vavilov distribution.
Definition: VavilovAccurate.h:169
ROOT::Math::VavilovAccurateCdf::~VavilovAccurateCdf
virtual ~VavilovAccurateCdf()
Destructor.
Definition: VavilovAccurateCdf.cxx:99
ROOT::Math::VavilovAccurateCdf::DoEval
virtual double DoEval(double x) const
Evaluate the function.
Definition: VavilovAccurateCdf.cxx:127
VavilovAccurate.h
ROOT::Math::VavilovAccurateCdf::DoEvalPar
virtual double DoEvalPar(double x, const double *p) const
Evaluate the function, using parameters p.
Definition: VavilovAccurateCdf.cxx:132
ROOT::Math::VavilovAccurateCdf::NPar
virtual unsigned int NPar() const
Return the number of Parameters.
Definition: VavilovAccurateCdf.cxx:112
ROOT
VSD Structures.
Definition: StringConv.hxx:21
Math
ROOT::Math::VavilovAccurateCdf::Parameters
virtual const double * Parameters() const
Access the parameter values.
Definition: VavilovAccurateCdf.cxx:102