4 #include <det/Detector.h>
5 #include <fdet/FDetector.h>
7 #include <fdet/Telescope.h>
8 #include <fdet/Mirror.h>
9 #include <fdet/Filter.h>
10 #include <fdet/Corrector.h>
11 #include <fdet/Camera.h>
12 #include <fdet/Pixel.h>
13 #include <fdet/Channel.h>
14 #include <fwk/CentralConfig.h>
15 #include <utl/TimeStamp.h>
16 #include <utl/UTCDateTime.h>
17 #include <utl/TabulatedFunction.h>
18 #include <utl/Reader.h>
19 #include <utl/Point.h>
20 #include <utl/CoordinateSystem.h>
21 #include <utl/ErrorLogger.h>
22 #include <utl/AugerUnits.h>
23 #include <fwk/CoordinateSystemRegistry.h>
25 #include <cppunit/extensions/HelperMacros.h>
26 #include <tst/Verify.h>
40 CPPUNIT_TEST(testGetEyeByName);
41 CPPUNIT_TEST(testEyeList);
42 CPPUNIT_TEST(testCommissionedTelescopeList);
43 CPPUNIT_TEST(testCommissionedTelescopeListLaterTimestamp);
44 CPPUNIT_TEST(testGetPixelCalibTime1);
45 CPPUNIT_TEST(testGetPixelCalibTime2);
46 CPPUNIT_TEST(testGetPixelCalibTime3);
47 CPPUNIT_TEST(testGetPixelCalibNullEndTime);
48 CPPUNIT_TEST(testPixelStatus);
49 CPPUNIT_TEST(testReadFullTelescope);
50 CPPUNIT_TEST(testGetTimeOffset);
51 CPPUNIT_TEST(testVirtualEye);
55 CPPUNIT_TEST_SUITE_END();
65 CentralConfig::GetInstance(BOOTSTRAPFILE);
76 Detector& theDet = Detector::GetInstance();
83 const FDetector& theFDet = Detector::GetInstance().GetFDetector();
85 CPPUNIT_ASSERT(Verify<Equal>( (
int)theFDet.
GetEye(
"Los Morados").
GetId(), 2));
89 const FDetector& theFDet = Detector::GetInstance().GetFDetector();
92 theFDet.
GetEye(
"San Martin");
96 const FDetector& theFDet = Detector::GetInstance().GetFDetector();
102 eyeIt != theFDet.
EyesEnd(); ++eyeIt)
104 CPPUNIT_ASSERT(Verify<Equal>(numEyes, 5));
106 int numPhysicalEyes = 0;
110 CPPUNIT_ASSERT(Verify<Equal>(numPhysicalEyes, 5));
112 int numEyesTotal = 0;
116 CPPUNIT_ASSERT(Verify<Equal>(numEyesTotal, 7));
118 int numVirtualEyes = 0;
122 CPPUNIT_ASSERT(Verify<Equal>(numVirtualEyes, 2));
128 const Eye& eye = Detector::GetInstance().GetFDetector().GetEye(1);
135 CPPUNIT_ASSERT(Verify<Equal>(numTels, 6));
139 const Eye& eye2 = Detector::GetInstance().GetFDetector().GetEye(2);
150 Detector::GetInstance().Update(
UTCDateTime(2010,1,1,1).GetTimeStamp());
151 const Eye& theEye2 = Detector::GetInstance().GetFDetector().GetEye(2);
156 CPPUNIT_ASSERT(Verify<Equal>(numTels, 6));
161 Detector::GetInstance().Update(
UTCDateTime(2001,5,2).GetTimeStamp());
166 CPPUNIT_ASSERT(Verify<CloseTo>(calib.
Y(425.*
nanometer), 1001.));
167 CPPUNIT_ASSERT(Verify<CloseTo>(calib.
Y(450.*
nanometer), 2001.));
168 CPPUNIT_ASSERT(Verify<CloseTo>(calib.
Y(475.*
nanometer), 3001.));
172 Detector::GetInstance().Update(
UTCDateTime(2006,1,2).GetTimeStamp());
177 CPPUNIT_ASSERT(Verify<CloseTo>(calib.
Y(425.*
nanometer), 4001.));
178 CPPUNIT_ASSERT(Verify<CloseTo>(calib.
Y(450.*
nanometer), 5001.));
179 CPPUNIT_ASSERT(Verify<CloseTo>(calib.
Y(475.*
nanometer), 6001.));
181 Detector::GetInstance().Update(
UTCDateTime(2006,1,3).GetTimeStamp());
184 CPPUNIT_ASSERT(Verify<CloseTo>(calib2.
Y(425.*
nanometer), 4001.));
185 CPPUNIT_ASSERT(Verify<CloseTo>(calib2.
Y(450.*
nanometer), 5001.));
186 CPPUNIT_ASSERT(Verify<CloseTo>(calib2.
Y(475.*
nanometer), 6001.));
188 Detector::GetInstance().Update(
UTCDateTime(2006,1,3).GetTimeStamp());
193 CPPUNIT_ASSERT(Verify<CloseTo>(calib3.
Y(425.*
nanometer), 4010.));
194 CPPUNIT_ASSERT(Verify<CloseTo>(calib3.
Y(450.*
nanometer), 5010.));
195 CPPUNIT_ASSERT(Verify<CloseTo>(calib3.
Y(475.*
nanometer), 6010.));
197 Detector::GetInstance().Update(
UTCDateTime(2006,1,4).GetTimeStamp());
200 CPPUNIT_ASSERT(Verify<CloseTo>(calib4.
Y(425.*
nanometer), 4010.));
201 CPPUNIT_ASSERT(Verify<CloseTo>(calib4.
Y(450.*
nanometer), 5010.));
202 CPPUNIT_ASSERT(Verify<CloseTo>(calib4.
Y(475.*
nanometer), 6010.));
207 Detector::GetInstance().Update(
UTCDateTime(2012,1,1).GetTimeStamp());
211 const Pixel& pixHeatByName =
216 CPPUNIT_ASSERT(Verify<CloseTo>(calibHeatByName.
Y(425.*
nanometer), 98765.0));
218 const Pixel& pixHeatByNumber =
220 const TabulatedFunction& calibHeatByNumber = pixHeatByNumber.GetEndToEndCalibrationConstant();
222 CPPUNIT_ASSERT(Verify<CloseTo>(calibHeatByNumber.
Y(425.*
nanometer), 98765.0));
227 Detector::GetInstance().Update(
UTCDateTime(2006,1,2).GetTimeStamp());
231 CPPUNIT_ASSERT(Verify<CloseTo>(timeOffset, 1234.));
236 Detector::GetInstance().Update(
UTCDateTime(2001,5,2).GetTimeStamp());
238 Detector::GetInstance().GetFDetector().GetEye(
"Los Leones").GetTelescope(1);
249 Detector::GetInstance().Update(
UTCDateTime(2007,1,2).GetTimeStamp());
253 CPPUNIT_ASSERT(Verify<CloseTo>(calib1.
Y(425.*
nanometer), 7001.));
254 CPPUNIT_ASSERT(Verify<CloseTo>(calib1.
Y(450.*
nanometer), 8001.));
255 CPPUNIT_ASSERT(Verify<CloseTo>(calib1.
Y(475.*
nanometer), 9001.));
257 Detector::GetInstance().Update(
UTCDateTime(2008,1,2).GetTimeStamp());
261 CPPUNIT_ASSERT(Verify<CloseTo>(calib2.
Y(425.*
nanometer), 13002.));
262 CPPUNIT_ASSERT(Verify<CloseTo>(calib2.
Y(450.*
nanometer), 14002.));
263 CPPUNIT_ASSERT(Verify<CloseTo>(calib2.
Y(475.*
nanometer), 15002.));
265 Detector::GetInstance().Update(
UTCDateTime(2009,1,2).GetTimeStamp());
269 CPPUNIT_ASSERT(Verify<CloseTo>(calib3.
Y(425.*
nanometer), 16003.));
270 CPPUNIT_ASSERT(Verify<CloseTo>(calib3.
Y(450.*
nanometer), 17003.));
271 CPPUNIT_ASSERT(Verify<CloseTo>(calib3.
Y(475.*
nanometer), 18003.));
275 Detector::GetInstance().Update(
UTCDateTime(2006,1,2).GetTimeStamp());
277 Detector::GetInstance().GetFDetector().GetEye(
"Los Leones").GetTelescope(1);
284 CPPUNIT_ASSERT(Verify<Equal>((
bool)pix.
GetStatus(), i%100 == 1));
289 Detector::GetInstance().Update(
UTCDateTime(2009,6,2).GetTimeStamp());
290 const Eye& eye = Detector::GetInstance().GetFDetector().GetEye(
"Coihueco");
292 Detector::GetInstance().GetFDetector().GetEye(
"Los Morados").GetTelescope(3);
294 const Eye& veye = Detector::GetInstance().GetFDetector().GetEye(
"Virtual Eye 1");
307 CPPUNIT_ASSERT(Verify<Equal>(eye.
GetId(), (
unsigned int)4));
308 CPPUNIT_ASSERT(Verify<Equal>(veye.
GetId(), (
unsigned int)6));
309 CPPUNIT_ASSERT(Verify<Equal>(veye.
GetName(), string(
"Virtual Eye 1")));
319 CPPUNIT_ASSERT(Verify<Equal>(tel.
GetId(), (
unsigned int)3));
320 CPPUNIT_ASSERT(Verify<Equal>(vtel.
GetId(), (
unsigned int)1));
321 CPPUNIT_ASSERT(Verify<Equal>(tel.
GetEyeId(), (
unsigned int)2));
322 CPPUNIT_ASSERT(Verify<Equal>(vtel.
GetEyeId(), (
unsigned int)6));
Status GetStatus() const
Get the pixel status flag.
void Update(const utl::TimeStamp &time, const bool invData=true, const bool invComp=true, const bool forceRadio=false)
Update detector: deletes currently constructed stations and sets new time.
void testCommissionedTelescopeList()
void testCommissionedTelescopeListLaterTimestamp()
const utl::TabulatedFunction & GetEndToEndCalibrationConstant() const
end to end calibration function
unsigned int GetFirstPixelId() const
const std::string & GetParentPhysicalEyeIdString() const
Class to hold collection (x,y) points and provide interpolation between them.
unsigned int GetParentPhysicalEyeId() const
unsigned int GetEyeId() const
Base class for exceptions trying to access non-existing components.
const Eye & GetEye(const unsigned int eyeId) const
Find eye by numerical Id.
EyeIterator EyesBegin(const FDetComponentSelector::Type type=FDetComponentSelector::ePhysical) const
iterator pointing to first eye of given type (ePhysical, eVirtual, eAll)
Detector description interface for Eye-related data.
void testGetPixelCalibTime1()
void testGetPixelCalibNullEndTime()
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
Detector description interface for FDetector-related data.
constexpr double nanometer
const Pixel & GetPixel(const unsigned int pixelId) const
Get Pixel by id, throw utl::NonExistentComponentException if n.a.
const std::string & GetParentPhysicalIdString() const
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
unsigned int GetLastPixelId() const
boost::filter_iterator< FDetComponentSelector, AllEyeIterator > EyeIterator
double GetX(const CoordinateSystemPtr &coordinateSystem) const
unsigned int GetParentPhysicalId() const
TelescopeIterator TelescopesBegin() const
Beginning of the collection of telescopes.
bool Verify(const Predicate &pred, const T &lhs, const T &rhs)
Test condition by evaluating a predicate and print on failure.
const Telescope & GetTelescope(const unsigned int telescopeId) const
Find Telescope by numerical Id.
Top of the hierarchy of the detector description interface.
unsigned int GetId() const
Eye numerical Id.
void Expected()
Print `Expected' for expected failures.
const fdet::FDetector & GetFDetector() const
void testReadFullTelescope()
const Telescope & GetTelescope() const
Access the telescope this Pixel belongs to.
boost::filter_iterator< TelIsCommissioned, InternalConstTelescopeIterator > TelescopeIterator
An iterator over telescopes.
double GetY(const CoordinateSystemPtr &coordinateSystem) const
Detector description interface for Telescope-related data.
void testNotCommissioned()
bool IsVirtual() const
Returns whether this telescope belongs to a virtual eye.
unsigned int GetParentPhysicalId() const
utl::Point GetPosition() const
const std::string & GetParentPhysicalIdString() const
TelescopeIterator TelescopesEnd() const
End of the collection of telescopes.
double GetTimeOffset() const
pixel time offset
void testGetPixelCalibTime3()
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
void testGetPixelCalibTime2()
double Y(const double x) const
Get or interpolate the Y value that corresponds to parameter x.
unsigned int GetId() const
utl::Point GetPosition() const
Eye position.
const std::string & GetName() const
Eye name.
bool IsVirtual() const
Returns whether this eye is a virtual eye.
EyeIterator EyesEnd(const FDetComponentSelector::Type type=FDetComponentSelector::ePhysical) const
iterator pointing to end of available eyes of given type (ePhysical, eVirtual, eAll) ...