Tests the classes in ChiSquareAccumulator.h
More...
#include "boost/test/unit_test.hpp"
#include "lardata/Utilities/ChiSquareAccumulator.h"
#include <type_traits>
Go to the source code of this file.
Tests the classes in ChiSquareAccumulator.h
- Author
- Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.slac..nosp@m.stan.nosp@m.ford..nosp@m.edu)
- Date
- July 26, 2018
- Version
- 1.0
- See Also
lardata/Utilities/ChiSquareAccumulator.h
See http://www.boost.org/libs/test for the Boost test library home page.
Timing: not given yet
Definition in file ChiSquareAccumulator_test.cc.
#define BOOST_TEST_MODULE ( ChiSquareAccumulator_test ) |
BOOST_AUTO_TEST_CASE |
( |
ChiSquareAccumulatorTestCase |
| ) |
|
Definition at line 149 of file ChiSquareAccumulator_test.cc.
void testChiSquareAccumulator()
void testChiSquareAccumulator_documentation()
void testMakeChiSquareAccumulator_documentation2()
void testMakeChiSquareAccumulator_documentation1()
void testChiSquareAccumulator |
( |
| ) |
|
Definition at line 29 of file ChiSquareAccumulator_test.cc.
31 auto one = [](double){
return 1.0; };
34 BOOST_TEST(chiSquare.expected(1.0) == 1.0);
35 BOOST_TEST(chiSquare.expected(2.0) == 1.0);
36 BOOST_TEST(chiSquare.expected(3.0) == 1.0);
38 BOOST_TEST(chiSquare.N() == 0U);
39 BOOST_TEST(chiSquare() == 0.0);
40 BOOST_TEST(
double(chiSquare) == 0.0);
41 BOOST_TEST(chiSquare.chiSquare() == 0.0);
43 chiSquare.add(1.0, 1.0);
44 BOOST_TEST(chiSquare.N() == 1U);
45 BOOST_TEST(chiSquare() == 0, 1
e-5%
tolerance());
46 BOOST_TEST(
double(chiSquare) == 0, 1
e-5%
tolerance());
47 BOOST_TEST(chiSquare.chiSquare() == 0, 1
e-5%
tolerance());
49 chiSquare.add(2.0, 0.5);
50 BOOST_TEST(chiSquare.N() == 2U);
51 BOOST_TEST(chiSquare() == 0.25, 1
e-4%
tolerance());
52 BOOST_TEST(
double(chiSquare) == 0.25, 1
e-4%
tolerance());
53 BOOST_TEST(chiSquare.chiSquare() == 0.25, 1
e-4%
tolerance());
55 chiSquare.add(3.0, 2.0, 0.5);
56 BOOST_TEST(chiSquare.N() == 3U);
57 BOOST_TEST(chiSquare() == 4.25, 1
e-4%
tolerance());
58 BOOST_TEST(
double(chiSquare) == 4.25, 1
e-4%
tolerance());
59 BOOST_TEST(chiSquare.chiSquare() == 4.25, 1
e-4%
tolerance());
auto makeChiSquareAccumulator(F &&e)
Creates a ChiSquareAccumulator object with the specified function.
then echo Cowardly refusing to create a new FHiCL file with the same name as the original one('${SourceName}')." >&2 exit 1 fi echo "'$
void testChiSquareAccumulator_documentation |
( |
| ) |
|
Definition at line 65 of file ChiSquareAccumulator_test.cc.
83 double const b = -1.0;
84 auto f = [
a,b](
double x){
return a + b *
x; };
87 chiSquare.add(0.0, 1.0, 0.5);
88 chiSquare.add(1.0, 1.0, 0.5);
89 chiSquare.add(2.0, 1.0, 0.5);
91 double const chi2value = chiSquare();
92 int degreesOfFreedom = chiSquare.N() - 3;
94 BOOST_TEST(chi2value == 8.0, 0.001%
tolerance());
95 BOOST_TEST(degreesOfFreedom == 0U);
Computes a χ from expectation function and data points.
process_name opflash particleana ie x
void testMakeChiSquareAccumulator_documentation1 |
( |
| ) |
|
Definition at line 101 of file ChiSquareAccumulator_test.cc.
111 auto zero = [](double){
return 0.0; };
114 BOOST_TEST(chiSquare.expected(-2.0) == 0.0);
115 BOOST_TEST(chiSquare.expected(0.0) == 0.0);
116 BOOST_TEST(chiSquare.expected(2.0) == 0.0);
117 static_assert(std::is_same<decltype(chiSquare()),
double>::
value,
118 "makeChiSquareAccumulator() returned an unexpected type!"
auto makeChiSquareAccumulator(F &&e)
Creates a ChiSquareAccumulator object with the specified function.
void testMakeChiSquareAccumulator_documentation2 |
( |
| ) |
|
Definition at line 125 of file ChiSquareAccumulator_test.cc.
135 auto zero = [](float){
return 0.0F; };
136 auto chiSquare = lar::util::makeChiSquareAccumulator<float>(zero);
138 BOOST_TEST(chiSquare.expected(-2.0F) == 0.0F);
139 BOOST_TEST(chiSquare.expected(0.0F) == 0.0F);
140 BOOST_TEST(chiSquare.expected(2.0F) == 0.0F);
141 static_assert(std::is_same<decltype(chiSquare()),
float>::
value,
142 "makeChiSquareAccumulator<float>() returned an unexpected type!"