Logo ROOT   6.13/01
Reference Guide
VavilovAccuratePdf.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 VavilovAccuratePdf
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 * VavilovAccuratePdf::Parameters() const {
65  return fP;
66 }
67 
68 void VavilovAccuratePdf::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 VavilovAccuratePdf::NPar() const {
75  return 5;
76 }
77 
78 std::string VavilovAccuratePdf::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 VavilovAccuratePdf::DoEval(double x) const {
90  VavilovAccurate v(fP[3], fP[4]);
91  return fP[0]/fP[2]*v.Pdf ((x-fP[1])/fP[2]);
92 }
93 
94 double VavilovAccuratePdf::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]/p[2]*v.Pdf ((x-p[1])/p[2]);
99 }
100 
102  return new VavilovAccuratePdf (*this);
103 }
104 
105 
106 } // namespace Math
107 } // namespace ROOT
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Definition: IFunction.h:135
virtual std::string ParameterName(unsigned int i) const
Return the name of the i-th parameter (starting from zero)
virtual double DoEvalPar(double x, const double *p) const
Evaluate the function, using parameters p.
Namespace for new ROOT classes and functions.
Definition: TFoamSampler.h:19
virtual ~VavilovAccuratePdf()
Destructor.
virtual double DoEval(double x) const
Evaluate the function.
virtual unsigned int NPar() const
Return the number of Parameters.
virtual void SetParameters(const double *p)
Set the parameter values.
virtual IBaseFunctionOneDim * Clone() const
Return a clone of the object.
SVector< double, 2 > v
Definition: Dict.h:5
virtual const double * Parameters() const
Access the parameter values.
* x
Deprecated and error prone model selection interface.
Definition: TRolke.cxx:630
VavilovAccuratePdf()
Default constructor.
Class describing a Vavilov distribution.
Namespace for new Math classes and functions.
double Pdf(double x) const
Evaluate the Vavilov probability density function.