1 #include <io/ArtificialShowerFile.h>
3 #include <evt/ShowerSimData.h>
4 #include <utl/AugerException.h>
10 #include <io/IoCodes.h>
11 #include <evt/Event.h>
12 #include <evt/ShowerSimData.h>
13 #include <utl/AugerUnits.h>
14 #include <utl/Particle.h>
15 #include <utl/ShowerParticleIterator.h>
16 #include <fwk/CentralConfig.h>
17 #include <det/Detector.h>
19 #include <tst/Verify.h>
20 #include <cppunit/extensions/HelperMacros.h>
38 CPPUNIT_TEST(testConstruct);
40 CPPUNIT_TEST(testOpen);
43 CPPUNIT_TEST(testClose);
44 CPPUNIT_TEST(testCloseClose);
46 CPPUNIT_TEST(testFindEvent);
47 CPPUNIT_TEST(testGotoPosition);
48 CPPUNIT_TEST(testGetNEvents);
49 CPPUNIT_TEST(testRead);
50 CPPUNIT_TEST(testParticleRead);
51 CPPUNIT_TEST_EXCEPTION(testGetNEventsClosedException,
53 CPPUNIT_TEST_SUITE_END();
92 { f->Open(
"BLAHBLAH"); }
126 CPPUNIT_ASSERT(Verify<Equal>(f->FindEvent(0),
io::eFail));
148 CPPUNIT_ASSERT(Verify<Equal>(f->GetNEvents(), 1));
162 int nEventsInFile = f->GetNEvents();
164 while (f->Read(event) !=
io::eEOF) {
169 const CoordinateSystemPtr refCS = det::Detector::GetInstance().GetReferenceCoordinateSystem();
174 CPPUNIT_ASSERT(Verify<CloseTo>(shower.
GetEnergy(), 1e19*
eV));
177 const double zenith = (-shower.
GetDirection()).GetTheta(localCS);
178 const double azimuth = (-shower.
GetDirection()).GetPhi(localCS);
180 CPPUNIT_ASSERT(Verify<CloseTo>(zenith, 45.0*
deg));
181 CPPUNIT_ASSERT(Verify<CloseTo>(azimuth, 0.0*
deg));
184 CPPUNIT_ASSERT(Verify<Equal>(shower.
GetShowerRunId(), std::string(
"1")));
186 CPPUNIT_ASSERT(Verify<Equal>(nEventsInFile, nEventsSeen));
192 f->Open(
"irrelevant.com");
193 for (
int i = 0; i < f->GetNEvents(); ++i) {
199 Point(0,0,0, det::Detector::GetInstance().GetSiteCoordinateSystem())
202 long double nParticles = 0;
205 nParticles +=
p->GetWeight();
207 CPPUNIT_ASSERT(Verify<Greater>(nParticles, 8e7L));
208 CPPUNIT_ASSERT(Verify<Less>(nParticles, 9e7L));
void testGetNEventsClosedException()
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.
Iterator to retrieve particles from utl::VShowerParticlList.
utl::ShowerParticleIterator GroundParticlesEnd() const
void testConstructException()
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
Base class to report exceptions in IO.
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.
Artificial shower generator: uniform particle density, direction.
const utl::Vector & GetDirection() const
Get the direction of the shower axis. This is the true direction of shower movement.
bool Verify(const Predicate &pred, const T &lhs, const T &rhs)
Test condition by evaluating a predicate and print on failure.
void Expected()
Print `Expected' for expected failures.
double GetEnergy() const
Get the energy of the shower primary particle.
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