Logo ROOT   6.10/09
Reference Guide
testVavilov.cxx
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 #include <cmath>
4 #include <cstdlib>
5 #include <string>
6 #include <sstream>
7 #include "Math/VavilovAccurate.h"
8 #include "Math/VavilovFast.h"
9 #include "VavilovTest.cxx"
10 #include "TFile.h"
11 #include "TH2F.h"
12 
13 int testVavilov() {
14 
16  //bool fast = false;
17  int result = 0;
18  int result_pdf[2], result_cdf[2], result_quant[2];
19 
20  for (int i = 0; i < 2; ++i) {
21 
22  if (i) {
23  v = new ROOT::Math::VavilovFast (1, 1);
24  }
25  else {
26  v = new ROOT::Math::VavilovAccurate (1, 1);
27  }
28  result += (result_pdf[i] = ROOT::Math::VavilovTest::PdfTest (*v, std::cout));
29  result += (result_cdf[i] = ROOT::Math::VavilovTest::CdfTest (*v, std::cout));
30  result += (result_quant[i] = ROOT::Math::VavilovTest::QuantileTest (*v, std::cout));
31  }
32 
33  for (int i = 0; i < 2; ++i) {
34  if (i) {
35  std::cout << "\nResults for VavilovFast:\n";
36  }
37  else {
38  std::cout << "\nResults for VavilovAccurate:\n";
39  }
40  std::cout << "PdfTest: ";
41  if (result_pdf[i] == 0)
42  std::cout << "PASS\n";
43  else
44  std::cout << "FAIL: " << result_pdf[i] << " / 10\n";
45  std::cout << "CdfTest: ";
46  if (result_cdf[i] == 0)
47  std::cout << "PASS\n";
48  else
49  std::cout << "FAIL: " << result_cdf[i] << " / 10\n";
50  std::cout << "QuantileTest: ";
51  if (result_quant[i] == 0)
52  std::cout << "PASS\n";
53  else
54  std::cout << "FAIL: " << result_quant[i] << " / 20\n";
55  }
56  std::cout << "\n\nOverall: ";
57  if (result == 0)
58  std::cout << "PASS\n";
59  else
60  std::cout << "FAIL: " << result << " / 80\n";
61 
62  return result;
63 }
64 
65 int main() {
66  return testVavilov();
67 }
Base class describing a Vavilov distribution.
Definition: Vavilov.h:120
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.
int main()
Definition: testVavilov.cxx:65
Class describing a Vavilov distribution.
Definition: VavilovFast.h:116
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.
Class describing a Vavilov distribution.
int testVavilov()
Definition: testVavilov.cxx:13
double result[121]