9 #include <tst/Verify.h>
11 #include <utl/AugerUnits.h>
12 #include <utl/AugerException.h>
18 #include <cppunit/extensions/HelperMacros.h>
19 #include <boost/tuple/tuple.hpp>
21 #include <utl/NumericalErrorPropagator.h>
22 #include <utl/CovarianceMatrix.h>
23 #include <utl/AugerException.h>
29 #define ASSERT_EQUAL(x, y) CPPUNIT_ASSERT(x == y)
37 CPPUNIT_TEST(TestCovarianceMatrix);
38 CPPUNIT_TEST(TestErrorPropagatorFaster);
39 CPPUNIT_TEST(TestErrorPropagatorBetter);
40 CPPUNIT_TEST_SUITE_END();
44 template<
class Stream>
48 for (
unsigned int i=0;i<c.GetExtent();++i)
49 for (
unsigned int j=0;j<c.GetExtent();++j)
50 s <<
c(i,j) << (j<c.GetExtent()-1 ?
" " :
"\n");
60 Transform(std::vector<double>&
out,
const std::vector<double>& inp)
63 if (out.size()!=3) out = std::vector<double>(3);
64 out[0] =
m[0][0]*inp[0]+
m[0][1]*inp[1]+
m[0][2]*inp[2]+
m[0][3]*inp[3] + 10.;
65 out[1] =
m[1][0]*inp[0]+
m[1][1]*inp[1]+
m[1][2]*inp[2]+
m[1][3]*inp[3] + 20.;
66 out[2] =
m[2][0]*inp[0]+
m[2][1]*inp[1]+
m[2][2]*inp[2]+
m[2][3]*inp[3] + 30.;
120 "0 0.1 0.2 0.3 0.4 0.5\n"
121 "0.1 1 1.2 1.3 1.4 1.5\n"
122 "0.2 1.2 2 2.3 2.4 2.5\n"
123 "0.3 1.3 2.3 3 3.4 3.5\n"
124 "0.4 1.4 2.4 3.4 4 4.5\n"
125 "0.5 1.5 2.5 3.5 4.5 5\n";
134 TestErrorPropagator(NumericalErrorPropagator::eFaster);
140 TestErrorPropagator(NumericalErrorPropagator::eBetter);
146 vector<double> iVec(4);
179 vector<double> oVec(3);
181 fcn(oVec,oCov,iVec,iCov,quality);
186 for (
int i=0;i<3;++i)
187 for (
int j=0;j<4;++j)
190 for (
int k=0;k<4;++k)
191 tmp[i][j] += fcn.
m[i][k]*iCov(k,j);
195 for (
int i=0;i<3;++i)
196 for (
int j=0;j<3;++j)
199 for (
int k=0;k<4;++k)
200 vout += tmp[i][k]*fcn.
m[j][k];
201 s1 << vout << (j<2 ?
" " :
"\n");
205 for (
int i=0;i<3;++i)
206 for (
int j=0;j<3;++j)
208 s2 << oCov(i,j) << (j<2 ?
" " :
"\n");
void TestErrorPropagatorFaster()
void TestErrorPropagatorBetter()
void TestCovarianceMatrix()
vector< t2list > out
output of the algorithm: a list of clusters
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
void OutputMatrix(Stream &s, const CovarianceMatrix &c)
#define ASSERT_EQUAL(x, y)
void TestErrorPropagator(NumericalErrorPropagator::Quality quality)