testSDenseDetectorZenith.cc
Go to the documentation of this file.
1 #include <det/Detector.h>
2 #include <sdet/SDetector.h>
3 #include <fwk/CentralConfig.h>
4 #include <utl/TimeStamp.h>
5 #include <utl/UTCDateTime.h>
6 #include <utl/TabulatedFunction.h>
7 #include <utl/Reader.h>
8 #include <utl/CoordinateSystem.h>
9 #include <utl/Point.h>
10 #include <utl/AugerException.h>
11 #include <utl/ErrorLogger.h>
12 
13 #include <fwk/CoordinateSystemRegistry.h>
14 #include <fwk/RunController.h>
15 
16 #include <evt/Event.h>
17 #include <evt/ShowerSimData.h>
18 #include <evt/DefaultShowerGeometryProducer.h>
19 
20 #include <sevt/SEvent.h>
21 #include <sevt/Station.h>
22 
23 #include <tst/Verify.h>
24 
25 #include <cppunit/extensions/HelperMacros.h>
26 
27 #include <map>
28 #include <sstream>
29 #include <iostream>
30 #include <string>
31 #include <vector>
32 
33 using namespace det;
34 using namespace std;
35 using namespace fwk;
36 using namespace utl;
37 using namespace tst;
38 using namespace sdet;
39 using namespace evt;
40 
41 
42 // This file contains a few additional tests of the dense array
43 // geometry. These tests are run separately from the other geometry
44 // tests as the SDenseArrayXMLManager accesses
45 // shower info through RunController::GetCurrentEvent(), and the
46 // RunController is a singleton. There are probably other ways to
47 // deal with this, but this was convenient and quick to implement.
48 
49 class SDenseDetectorTestZenith : public CppUnit::TestFixture {
50 
51  CPPUNIT_TEST_SUITE(SDenseDetectorTestZenith);
52  CPPUNIT_TEST(testBasicZenith);
53  CPPUNIT_TEST_SUITE_END();
54 
55 public:
56  void
58  {
59  ErrorLogger::GetInstance().SetVerbosity(Verbosity::eVerbose);
60 
61  // CentralConfig must be created first.
62  CentralConfig::GetInstance(BOOTSTRAPFILE);
63 
64  // Create a detector
65  Detector::GetInstance().Update(UTCDateTime(2005,1,1).GetTimeStamp());
66  }
67 
68  void tearDown() { }
69 
70  void
72  {
73  const auto& det = Detector::GetInstance();
74 
75  // get reference coordinate system of detector (usually PampaAmarilla)
76  const utl::CoordinateSystemPtr pampaCS = det.GetReferenceCoordinateSystem();
77 
78  // Set a sim shower data so that dense station position can
79  // be computed relative to it
80  Event& evt = RunController::GetInstance().GetCurrentEvent();
81  if (!evt.HasSimShower())
83 
84  ShowerSimData& simShower = evt.GetSimShower();
86  const double theta = 45*degree;
88  const double x = -10*km;
89  const double y = 17*km;
90  const double z = 0;
91  const Point core(x, y, z, pampaCS);
92  simShower.MakeGeometry(core);
93 
94  const auto& sDet = det.GetSDetector();
95  const int refStationId = 860;
96  const auto& ref = sDet.GetStation(refStationId).GetPosition();
97 
98  const double xyTol = 3*m;
99  const double zTol = 0.8*m;
100  // dense in the center
101  const Point& p0 = sDet.GetStation(99999).GetPosition();
102  CPPUNIT_ASSERT(Verify<CloseTo>(p0.GetX(pampaCS), core.GetX(pampaCS), xyTol));
103  CPPUNIT_ASSERT(Verify<CloseTo>(p0.GetY(pampaCS), core.GetY(pampaCS), xyTol));
104  CPPUNIT_ASSERT(Verify<CloseTo>(p0.GetZ(pampaCS), ref.GetZ(pampaCS), zTol));
105 
106 #define DUMP(_x_) #_x_ " (" << (_x_.GetX(pampaCS) - core.GetX(pampaCS)) << ", " \
107  << (_x_.GetY(pampaCS) - core.GetY(pampaCS)) << ", " \
108  << (_x_.GetZ(pampaCS) - ref.GetZ(pampaCS)) << ")\n"
109 
110  cout << DUMP(core)
111  << DUMP(ref)
112  << DUMP(p0);
113 
114  // dense in the 1000m ring
115  for (int i = 1; i < 10; ++i) {
116  const int id = 99999 - i;
117  const double phi = 45 * i * degree;
118  const double x = 1000 * cos(phi) / cos(theta);
119  const double y = 1000 * sin(phi);
120  const Point& p1 = sDet.GetStation(id).GetPosition();
121  cout << "dense " << id << " (" << (p1.GetX(pampaCS) - core.GetX(pampaCS) - x)/m << ", "
122  << (p1.GetY(pampaCS) - core.GetY(pampaCS) - y)/m << ", "
123  << (p1.GetZ(pampaCS) - ref.GetZ(pampaCS))/m << ")\n";
124  CPPUNIT_ASSERT(Verify<CloseTo>(p1.GetX(pampaCS) - core.GetX(pampaCS), x, xyTol));
125  CPPUNIT_ASSERT(Verify<CloseTo>(p1.GetY(pampaCS) - core.GetY(pampaCS), y, xyTol));
126  CPPUNIT_ASSERT(Verify<CloseTo>(p1.GetZ(pampaCS), ref.GetZ(pampaCS), zTol));
127  }
128  cout << flush;
129  }
130 
131 };
132 
133 
const double degree
Point object.
Definition: Point.h:32
bool HasSimShower() const
void SetGroundParticleCoordinateSystemAzimuth(const double azimuth)
Set the azimuth angle of the shower. Angle in x-y plane wrt. to the x axis (0 is from east)...
Traditional name.
Definition: Verbosity.h:17
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
Interface class to access Shower Simulated parameters.
Definition: ShowerSimData.h:49
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
double GetX(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:206
ShowerSimData & GetSimShower()
const double km
double GetY(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:209
void SetGroundParticleCoordinateSystemZenith(const double zenith)
Set the zenith angle of the shower. Room angle between z-axis and direction from where the shower is ...
void MakeGeometry(const utl::Point &pointOnShowerAxis)
initialize the shower geometry. Pos is a point on the shower axis, but not necessarily the core ...
void MakeSimShower(const evt::VShowerGeometryProducer &p)
#define DUMP(_x_)
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:212
constexpr double m
Definition: AugerUnits.h:121

, generated on Tue Sep 26 2023.