9 #include <io/CorsikaShowerFile.h>
10 #include <io/CorsikaBlock.h>
11 #include <io/CorsikaIOException.h>
12 #include <io/IoCodes.h>
13 #include <evt/Event.h>
14 #include <evt/ShowerSimData.h>
15 #include <utl/AugerUnits.h>
16 #include <utl/Particle.h>
17 #include <utl/ShowerParticleIterator.h>
18 #include <utl/UTCDateTime.h>
21 #include <fwk/CentralConfig.h>
23 #include <det/Detector.h>
25 #include <tst/Verify.h>
26 #include <cppunit/extensions/HelperMacros.h>
45 CPPUNIT_TEST(testConstruct);
47 CPPUNIT_TEST(testOpen);
51 CPPUNIT_TEST(testClose);
52 CPPUNIT_TEST(testCloseClose);
54 CPPUNIT_TEST(testFindEvent);
55 CPPUNIT_TEST(testGotoPosition);
56 CPPUNIT_TEST(testGetNEvents);
57 CPPUNIT_TEST(testRead);
58 CPPUNIT_TEST(testParticleRead);
59 CPPUNIT_TEST(testCherenkovShower);
60 CPPUNIT_TEST_EXCEPTION(testGetNEventsClosedException,
62 CPPUNIT_TEST_SUITE_END();
105 f->Open(
"NoSuchCorsikaShowerFile.part");
136 CPPUNIT_ASSERT(f->FindEvent(2) !=
io::eFail);
137 CPPUNIT_ASSERT(f->FindEvent(0) ==
io::eFail);
143 CPPUNIT_ASSERT(f->GotoPosition(0) !=
io::eFail);
144 CPPUNIT_ASSERT(f->GotoPosition(2) ==
io::eFail);
157 CPPUNIT_ASSERT(f->GetNEvents() == 2);
169 int nEventsInFile = f->GetNEvents();
171 while (f->Read(event) !=
io::eEOF) {
176 const CoordinateSystemPtr refCS = det::Detector::GetInstance().GetReferenceCoordinateSystem();
181 CPPUNIT_ASSERT(Verify<CloseTo>(shower.
GetEnergy()/
eV, 1.e20));
184 const double zenith = (-shower.
GetDirection()).GetTheta(localCS);
185 const double azimuth = (-shower.
GetDirection()).GetPhi(localCS);
191 CPPUNIT_ASSERT(Verify<CloseTo>(zenith/
deg, 32.42));
192 CPPUNIT_ASSERT(Verify<CloseTo>(azimuth/
deg, 325.59+90.-4.233-360));
197 CPPUNIT_ASSERT(Verify<Equal>(shower.
GetShowerRunId(), std::string(
"1")));
202 CPPUNIT_ASSERT(Verify<Equal>(nEventsInFile, nEventsSeen));
209 for (
int i = 0; i < f->GetNEvents(); ++i) {
215 det::Detector::GetInstance().GetSiteCoordinateSystem()));
217 long double nParticles = 0;
221 nParticles +=
p->GetWeight();
223 CPPUNIT_ASSERT(nParticles > 1e11);
224 CPPUNIT_ASSERT(nParticles < 1e12);
231 int nEventsInFile = f->GetNEvents();
234 f->SetReadLongFile(
false);
236 while (f->Read(event) !=
io::eEOF) {
241 const CoordinateSystemPtr refCS = det::Detector::GetInstance().GetReferenceCoordinateSystem();
246 CPPUNIT_ASSERT(Verify<CloseTo>(shower.
GetEnergy()/
GeV, 6952381.7620710116));
249 const double zenith = (-shower.
GetDirection()).GetTheta(localCS);
250 const double azimuth = (-shower.
GetDirection()).GetPhi(localCS);
256 CPPUNIT_ASSERT(Verify<CloseTo>(zenith/
deg, 25.291737580210896));
258 CPPUNIT_ASSERT(Verify<CloseTo>(azimuth/
deg, 239.904454153400025+90-4.233-360));
264 CPPUNIT_ASSERT(Verify<Equal>(nEventsInFile, nEventsSeen));
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger coordinate system associated to the shower core position.
int GetPrimaryParticle() const
Get the type of the shower primary particle.
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.
Iterator to retrieve particles from utl::VShowerParticlList.
utl::ShowerParticleIterator GroundParticlesEnd() const
double GetMinRadiusCut() const
Get the minimum radius from shower axis for which there are valid particles in the shower...
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
void testOpenNonExisting()
void testConstructException()
Interface class to access Shower Simulated parameters.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
int GetShowerNumber() const
Get the number of the shower in the file.
const utl::Vector & GetDirection() const
Get the direction of the shower axis. This is the true direction of shower movement.
Base for exceptions in the CORSIKA reader.
Top of the hierarchy of the detector description interface.
void testCherenkovShower()
void Expected()
Print `Expected' for expected failures.
Read data from the output of CORSIKA.
double GetEnergy() const
Get the energy of the shower primary particle.
void testGetNEventsClosedException()
BasicBlock< ParticleData, CherenkovData, kParticlesInBlock, 39 > Block
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
std::string GetShowerRunId() const
Get the run id for the shower.
void MakeGeometry(const utl::Point &pointOnShowerAxis)
initialize the shower geometry. Pos is a point on the shower axis, but not necessarily the core ...
utl::ShowerParticleIterator GroundParticlesBegin() const