Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
35
36namespace ROOT {
37namespace 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
64const double * VavilovAccuratePdf::Parameters() const {
65 return fP;
66}
67
68void VavilovAccuratePdf::SetParameters(const double * p ) {
69 if (p)
70 for (int i = 0; i < 5; ++i)
71 fP[i] = p[i];
72}
73
74unsigned int VavilovAccuratePdf::NPar() const {
75 return 5;
76}
77
78std::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
89double 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
94double 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
winID h TVirtualViewer3D TVirtualGLPainter p
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Definition IFunction.h:112
double DoEvalPar(double x, const double *p) const override
Evaluate the function, using parameters p.
std::string ParameterName(unsigned int i) const override
Return the name of the i-th parameter (starting from zero)
~VavilovAccuratePdf() override
Destructor.
void SetParameters(const double *p) override
Set the parameter values.
VavilovAccuratePdf()
Default constructor.
const double * Parameters() const override
Access the parameter values.
unsigned int NPar() const override
Return the number of Parameters.
IBaseFunctionOneDim * Clone() const override
Return a clone of the object.
double DoEval(double x) const override
Evaluate the function.
Class describing a Vavilov distribution.
Double_t x[n]
Definition legend1.C:17
Namespace for new Math classes and functions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...