ROOT  6.06/09
Reference Guide
VavilovTest.h
Go to the documentation of this file.
1 // @(#)root/mathmore:$Id$
2 // Authors: B. List 29.4.2010
3 
4  /**********************************************************************
5  * *
6  * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT *
7  * *
8  * This library is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU General Public License *
10  * as published by the Free Software Foundation; either version 2 *
11  * of the License, or (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16  * General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this library (see file COPYING); if not, write *
20  * to the Free Software Foundation, Inc., 59 Temple Place, Suite *
21  * 330, Boston, MA 02111-1307 USA, or contact the author. *
22  * *
23  **********************************************************************/
24 
25 // Header file for class VavilovTest
26 //
27 // Created by: blist at Thu Apr 29 11:19:00 2010
28 //
29 // Last update: Thu Apr 29 11:19:00 2010
30 //
31 #ifndef ROOT_Math_VavilovTest
32 #define ROOT_Math_VavilovTest
33 
34 
35 #include <iostream>
36 
37 namespace ROOT {
38 namespace Math {
39 
40 class Vavilov;
41 
42 //____________________________________________________________________________
43 /**
44  Test class for class Vavilov and its subclasses
45 
46  For test purposes,
47  the class contains a number of static function that return the tabulated
48  values of the Vavilov pdf given by
49  S.M. Seltzer and M.J. Berger: Energy loss stragglin of protons and mesons:
50  Tabulation of the Vavilov distribution, pp 187-203
51  in: National Research Council (U.S.), Committee on Nuclear Science:
52  Studies in penetration of charged particles in matter,
53  Nat. Akad. Sci. Publication 1133,
54  Nucl. Sci. Series Report No. 39,
55  Washington (Nat. Akad. Sci.) 1964, 388 pp.
56  Available from
57  <A HREF="http://books.google.de/books?id=kmMrAAAAYAAJ&lpg=PP9&pg=PA187#v=onepage&q&f=false">Google books</A>
58 
59  B. List 24.6.2010
60 
61  */
62 
63 
64 class VavilovTest {
65 
66 public:
67 
68 
69  /**
70  Test the pdf values against the tables of Seltzer and Berger.
71  Returns 0 if the test is passed
72 
73  @param v The Vavilov test object
74  @param os Output stream
75  */
76  static int PdfTest (Vavilov& v, std::ostream& os,
77  double maxabsdiff, double maxdiffmantissa,
78  double agreefraction, double agreediffmantissa);
79 
80  /**
81  Test the pdf values against the tables of Seltzer and Berger.
82  Returns 0 if the test is passed
83 
84  @param v The Vavilov test object
85  @param os Output stream
86  */
87  static int PdfTest (Vavilov& v, std::ostream& os);
88 
89  /**
90  Test the cdf values against the integral of the pdf
91  Returns 0 if the test is passed
92 
93  @param v The Vavilov test object
94  @param os Output stream
95  */
96  static int CdfTest (Vavilov& v, std::ostream& os,
97  double maxabsdiff, double maxcdfdiff);
98 
99  /**
100  Test the cdf values against the integral of the pdf
101  Returns 0 if the test is passed
102 
103  @param v The Vavilov test object
104  @param os Output stream
105  */
106  static int CdfTest (Vavilov& v, std::ostream& os);
107 
108  /**
109  Test the quantile values against the cdf
110  Returns 0 if the test is passed
111 
112  @param v The Vavilov test object
113  @param os Output stream
114  */
115  static int QuantileTest (Vavilov& v, std::ostream& os, double maxabsdiff);
116 
117  /**
118  Test the quantile values against the cdf
119  Returns 0 if the test is passed
120 
121  @param v The Vavilov test object
122  @param os Output stream
123  */
124  static int QuantileTest (Vavilov& v, std::ostream& os);
125 
126  /**
127  Print a table of the pdf values to stream os
128 
129  @param v The Vavilov object
130  @param os Output stream
131  @param digits: Number of digits to be printed
132  */
133  static void PrintPdfTable (Vavilov& v, std::ostream& os, int digits = 3);
134 
135 
136  /**
137  Return the number of \f$\kappa\f$ values in the tables of Seltzer and Berger
138  */
139  static int GetSBNKappa ();
140 
141  /**
142  Return the \f$\kappa\f$ value for ikappa in the tables of Seltzer and Berger
143  */
144  static double GetSBKappa (int ikappa);
145 
146  /**
147  Return the number of \f$\beta^2\f$ values in the tables of Seltzer and Berger
148  */
149  static int GetSBNBeta2 ();
150 
151  /**
152  Return the \f$\beta^2\f$ value in the tables of Seltzer and Berger
153  */
154  static double GetSBBeta2 (int ibeta2);
155 
156  /**
157  Return the number of \f$\lambda\f$ values in the tables of Seltzer and Berger
158  */
159  static int GetSBNLambda (int ikappa);
160 
161  /**
162  Return the \f$\lambda\f$ value in the tables of Seltzer and Berger
163  */
164  static double GetSBLambda (int ikappa, int ilambda);
165 
166  /**
167  Return the value of \f$p(\lambda)\f$ in the tables of Seltzer and Berger
168  */
169  static double GetSBVavilovPdf (int ikappa, int ibeta2, int ilambda);
170 
171  static void GetPdfTestParams (const Vavilov& v, double& maxabsdiff, double& maxdiffmantissa, double& agreefraction, double& agreediffmantissa);
172 
173  static void GetCdfTestParams (const Vavilov& v, double& maxabsdiff, double& maxcdfdiff);
174 
175  static void GetQuantileTestParams (const Vavilov& v, double& maxabsdiff);
176 
177 
178 };
179 
180 } // namespace Math
181 } // namespace ROOT
182 
183 #endif /* ROOT_Math_VavilovTest */
Base class describing a Vavilov distribution.
Definition: Vavilov.h:121
static void GetCdfTestParams(const Vavilov &v, double &maxabsdiff, double &maxcdfdiff)
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
static int PdfTest(Vavilov &v, std::ostream &os, double maxabsdiff, double maxdiffmantissa, double agreefraction, double agreediffmantissa)
Test the pdf values against the tables of Seltzer and Berger.
static int GetSBNKappa()
Return the number of values in the tables of Seltzer and Berger.
static double GetSBLambda(int ikappa, int ilambda)
Return the value in the tables of Seltzer and Berger.
static void PrintPdfTable(Vavilov &v, std::ostream &os, int digits=3)
Print a table of the pdf values to stream os.
static void GetPdfTestParams(const Vavilov &v, double &maxabsdiff, double &maxdiffmantissa, double &agreefraction, double &agreediffmantissa)
static double GetSBVavilovPdf(int ikappa, int ibeta2, int ilambda)
Return the value of in the tables of Seltzer and Berger.
static int GetSBNBeta2()
Return the number of values in the tables of Seltzer and Berger.
static void GetQuantileTestParams(const Vavilov &v, double &maxabsdiff)
SVector< double, 2 > v
Definition: Dict.h:5
static int QuantileTest(Vavilov &v, std::ostream &os, double maxabsdiff)
Test the quantile values against the cdf Returns 0 if the test is passed.
static int CdfTest(Vavilov &v, std::ostream &os, double maxabsdiff, double maxcdfdiff)
Test the cdf values against the integral of the pdf Returns 0 if the test is passed.
Namespace for new Math classes and functions.
static double GetSBKappa(int ikappa)
Return the value for ikappa in the tables of Seltzer and Berger.
static int GetSBNLambda(int ikappa)
Return the number of values in the tables of Seltzer and Berger.
static double GetSBBeta2(int ibeta2)
Return the value in the tables of Seltzer and Berger.
Test class for class Vavilov and its subclasses.
Definition: VavilovTest.h:64
Double_t Vavilov(Double_t x, Double_t kappa, Double_t beta2)
Returns the value of the Vavilov density function Parameters: 1st - the point were the density functi...
Definition: TMath.cxx:2620