00001 // @(#)root/mathmore:$Id: VavilovTest.h 34123 2010-06-25 08:21:13Z moneta $ 00002 // Authors: B. List 29.4.2010 00003 00004 /********************************************************************** 00005 * * 00006 * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT * 00007 * * 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU General Public License * 00010 * as published by the Free Software Foundation; either version 2 * 00011 * of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this library (see file COPYING); if not, write * 00020 * to the Free Software Foundation, Inc., 59 Temple Place, Suite * 00021 * 330, Boston, MA 02111-1307 USA, or contact the author. * 00022 * * 00023 **********************************************************************/ 00024 00025 // Header file for class VavilovTest 00026 // 00027 // Created by: blist at Thu Apr 29 11:19:00 2010 00028 // 00029 // Last update: Thu Apr 29 11:19:00 2010 00030 // 00031 #ifndef ROOT_Math_VavilovTest 00032 #define ROOT_Math_VavilovTest 00033 00034 00035 #include <iostream> 00036 00037 namespace ROOT { 00038 namespace Math { 00039 00040 class Vavilov; 00041 00042 //____________________________________________________________________________ 00043 /** 00044 Test class for class Vavilov and its subclasses 00045 00046 For test purposes, 00047 the class contains a number of static function that return the tabulated 00048 values of the Vavilov pdf given by 00049 S.M. Seltzer and M.J. Berger: Energy loss stragglin of protons and mesons: 00050 Tabulation of the Vavilov distribution, pp 187-203 00051 in: National Research Council (U.S.), Committee on Nuclear Science: 00052 Studies in penetration of charged particles in matter, 00053 Nat. Akad. Sci. Publication 1133, 00054 Nucl. Sci. Series Report No. 39, 00055 Washington (Nat. Akad. Sci.) 1964, 388 pp. 00056 Available from 00057 <A HREF="http://books.google.de/books?id=kmMrAAAAYAAJ&lpg=PP9&pg=PA187#v=onepage&q&f=false">Google books</A> 00058 00059 B. List 24.6.2010 00060 00061 */ 00062 00063 00064 class VavilovTest { 00065 00066 public: 00067 00068 00069 /** 00070 Test the pdf values against the tables of Seltzer and Berger. 00071 Returns 0 if the test is passed 00072 00073 @param v The Vavilov test object 00074 @param os Output stream 00075 */ 00076 static int PdfTest (Vavilov& v, std::ostream& os, 00077 double maxabsdiff, double maxdiffmantissa, 00078 double agreefraction, double agreediffmantissa); 00079 00080 /** 00081 Test the pdf values against the tables of Seltzer and Berger. 00082 Returns 0 if the test is passed 00083 00084 @param v The Vavilov test object 00085 @param os Output stream 00086 */ 00087 static int PdfTest (Vavilov& v, std::ostream& os); 00088 00089 /** 00090 Test the cdf values against the integral of the pdf 00091 Returns 0 if the test is passed 00092 00093 @param v The Vavilov test object 00094 @param os Output stream 00095 */ 00096 static int CdfTest (Vavilov& v, std::ostream& os, 00097 double maxabsdiff, double maxcdfdiff); 00098 00099 /** 00100 Test the cdf values against the integral of the pdf 00101 Returns 0 if the test is passed 00102 00103 @param v The Vavilov test object 00104 @param os Output stream 00105 */ 00106 static int CdfTest (Vavilov& v, std::ostream& os); 00107 00108 /** 00109 Test the quantile values against the cdf 00110 Returns 0 if the test is passed 00111 00112 @param v The Vavilov test object 00113 @param os Output stream 00114 */ 00115 static int QuantileTest (Vavilov& v, std::ostream& os, double maxabsdiff); 00116 00117 /** 00118 Test the quantile values against the cdf 00119 Returns 0 if the test is passed 00120 00121 @param v The Vavilov test object 00122 @param os Output stream 00123 */ 00124 static int QuantileTest (Vavilov& v, std::ostream& os); 00125 00126 /** 00127 Print a table of the pdf values to stream os 00128 00129 @param v The Vavilov object 00130 @param os Output stream 00131 @param digits: Number of digits to be printed 00132 */ 00133 static void PrintPdfTable (Vavilov& v, std::ostream& os, int digits = 3); 00134 00135 00136 /** 00137 Return the number of \f$\kappa\f$ values in the tables of Seltzer and Berger 00138 */ 00139 static int GetSBNKappa (); 00140 00141 /** 00142 Return the \f$\kappa\f$ value for ikappa in the tables of Seltzer and Berger 00143 */ 00144 static double GetSBKappa (int ikappa); 00145 00146 /** 00147 Return the number of \f$\beta^2\f$ values in the tables of Seltzer and Berger 00148 */ 00149 static int GetSBNBeta2 (); 00150 00151 /** 00152 Return the \f$\beta^2\f$ value in the tables of Seltzer and Berger 00153 */ 00154 static double GetSBBeta2 (int ibeta2); 00155 00156 /** 00157 Return the number of \f$\lambda\f$ values in the tables of Seltzer and Berger 00158 */ 00159 static int GetSBNLambda (int ikappa); 00160 00161 /** 00162 Return the \f$\lambda\f$ value in the tables of Seltzer and Berger 00163 */ 00164 static double GetSBLambda (int ikappa, int ilambda); 00165 00166 /** 00167 Return the value of \f$p(\lambda)\f$ in the tables of Seltzer and Berger 00168 */ 00169 static double GetSBVavilovPdf (int ikappa, int ibeta2, int ilambda); 00170 00171 static void GetPdfTestParams (const Vavilov& v, double& maxabsdiff, double& maxdiffmantissa, double& agreefraction, double& agreediffmantissa); 00172 00173 static void GetCdfTestParams (const Vavilov& v, double& maxabsdiff, double& maxcdfdiff); 00174 00175 static void GetQuantileTestParams (const Vavilov& v, double& maxabsdiff); 00176 00177 00178 }; 00179 00180 } // namespace Math 00181 } // namespace ROOT 00182 00183 #endif /* ROOT_Math_VavilovTest */