Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// @(#)root/mathmore:$Id$
// Authors: B. List 29.4.2010
/**********************************************************************
* *
* Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this library (see file COPYING); if not, write *
* to the Free Software Foundation, Inc., 59 Temple Place, Suite *
* 330, Boston, MA 02111-1307 USA, or contact the author. *
* *
**********************************************************************/
// Implementation file for class VavilovAccurateQuantile
//
// Created by: blist at Thu Apr 29 11:19:00 2010
//
// Last update: Thu Apr 29 11:19:00 2010
//
#include "Math/VavilovAccurateQuantile.h"
#include "Math/VavilovAccurate.h"
namespace ROOT {
namespace Math {
VavilovAccurateQuantile::VavilovAccurateQuantile() {
fP[0] = 1;
fP[1] = 0;
fP[2] = 1;
fP[3] = 1;
fP[4] = 1;
}
VavilovAccurateQuantile::VavilovAccurateQuantile(const double *p) {
if (p)
for (int i = 0; i < 5; ++i)
fP[i] = p[i];
else {
fP[0] = 1;
fP[1] = 0;
fP[2] = 1;
fP[3] = 1;
fP[4] = 1;
}
}
VavilovAccurateQuantile::~VavilovAccurateQuantile ()
{}
const double * VavilovAccurateQuantile::Parameters() const {
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
return fP;
}
void VavilovAccurateQuantile::SetParameters(const double * p ) {
if (p)
for (int i = 0; i < 5; ++i)
fP[i] = p[i];
}
unsigned int VavilovAccurateQuantile::NPar() const {
return 5;
}
std::string VavilovAccurateQuantile::ParameterName(unsigned int i) const {
switch (i) {
case 0: return "Norm"; break;
case 1: return "x0"; break;
case 2: return "xi"; break;
case 3: return "kappa"; break;
case 4: return "beta2"; break;
}
return "???";
}
double VavilovAccurateQuantile::DoEval(double x) const {
VavilovAccurate v(fP[3], fP[4]);
return fP[1] + fP[2]*v.Quantile (x/fP[0]);
}
double VavilovAccurateQuantile::DoEvalPar(double x, const double * p) const {
if (!p) return 0;
// p[0]: norm, p[1]: x0, p[2]: width, p[3]: kappa, p[4]: beta2
VavilovAccurate v(p[3], p[4]);
return p[1]+p[2]*v.Quantile (x/p[0]);
}
VavilovAccurateQuantile * VavilovAccurateQuantile::Clone() const {
return new VavilovAccurateQuantile (*this);
}
} // namespace Math
} // namespace ROOT