10 #include <tst/Verify.h>
12 #include <utl/ComplexLgAmpPhase.h>
13 #include <utl/TabulatedFunctionComplexLgAmpPhase.h>
14 #include <utl/AugerException.h>
15 #include <utl/AugerUnits.h>
17 #include <cppunit/extensions/HelperMacros.h>
29 CPPUNIT_TEST(testInterpolation);
30 CPPUNIT_TEST(testMultiplication);
31 CPPUNIT_TEST_SUITE_END();
50 const unsigned int numpoints = 10;
51 const unsigned int numcheckpoints = 100;
52 const double phasestepsize = 50.*
degree;
58 for (
unsigned int i=0; i<=numpoints; ++i)
62 CPPUNIT_ASSERT(Verify<Equal>(tfc1.
GetNPoints(),numpoints+1));
65 for (
unsigned int i=0; i<numcheckpoints; ++i) {
66 double point = double(i*numpoints/
double(numcheckpoints));
67 CPPUNIT_ASSERT(Verify<CloseTo>(tfc1.
Y(point).
GetLgAmplitude(), double(numpoints*point)));
68 CPPUNIT_ASSERT(Verify<CloseTo>(tfc1.
Y(point).
GetPhase(), double(phasestepsize*point)));
76 const unsigned int numpoints = 10;
77 const unsigned int numcheckpoints = 100;
78 const double phasestepsize = 50.*
degree;
79 const double offset = 2.0;
80 const unsigned int densityfactor = 2;
87 for (
unsigned int i=0; i<=numpoints; ++i)
89 for (
unsigned int i=0; i<=numpoints*densityfactor; ++i)
102 cout <<
"\n" << endl;
106 cout << it->X() <<
"\t" << it->Y().GetLgAmplitude() <<
"\t" << it->Y().GetPhase()/
degree << endl;
107 cout <<
"\n" << endl;
111 cout << it->X() <<
"\t" << it->Y().GetLgAmplitude() <<
"\t" << it->Y().GetPhase()/
degree << endl;
112 cout <<
"\n" << endl;
116 cout << it->X() <<
"\t" << it->Y().GetLgAmplitude() <<
"\t" << it->Y().GetPhase()/
degree << endl;
117 cout <<
"\n" << endl;
120 cout <<
"TFC3 versus manual multiplication:" << endl;
121 for (
unsigned int i=0; i<numcheckpoints; ++i) {
122 double point = double(offset+i*(numpoints-offset)/
double(numcheckpoints));
126 cout << point <<
"\t" << (tfc1.
Y(point)*tfc2.
Y(point)).GetLgAmplitude() <<
"\t" << (tfc1.
Y(point)*tfc2.
Y(point)).GetPhase()/
degree <<
"\n";
127 CPPUNIT_ASSERT(Verify<CloseTo>(tfc3.
Y(point).
GetLgAmplitude(),(tfc1.
Y(point)*tfc2.
Y(point)).GetLgAmplitude()));
128 CPPUNIT_ASSERT(Verify<CloseTo>(tfc3.
Y(point).
GetPhase(),(tfc1.
Y(point)*tfc2.
Y(point)).GetPhase()));
double GetPhase() const
Get the phase in radians, can be bigger than 2*pi.
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
Class to hold collection (x,y) points and provide interpolation between them, where y are complex num...
A class to store complex numbers which are internally represented by log10(amplitude) and phase (and ...
utl::ComplexLgAmpPhase Y(const double x) const
Get or interpolate the Y value that corresponds to parameter x.
double GetLgAmplitude() const
Get log10(amplitude)
unsigned int GetNPoints() const
void PushBack(const double x, const utl::ComplexLgAmpPhase &y)
void testMultiplication()