Logo ROOT   6.12/07
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
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Definition: IFunction.h:135
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
virtual double DoEval(double x) const
Evaluate the function.
virtual const double * Parameters() const
Access the parameter values.
virtual ~VavilovAccurateCdf()
Destructor.
double Cdf(double x) const
Evaluate the Vavilov cumulative probability density function.
Double_t x[n]
Definition: legend1.C:17
virtual unsigned int NPar() const
Return the number of Parameters.
virtual double DoEvalPar(double x, const double *p) const
Evaluate the function, using parameters p.
virtual void SetParameters(const double *p)
Set the parameter values.
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...
SVector< double, 2 > v
Definition: Dict.h:5
VavilovAccurateCdf()
Default constructor.
Class describing a Vavilov distribution.
Namespace for new Math classes and functions.
virtual IBaseFunctionOneDim * Clone() const
Return a clone of the object.