testSDenseDetectorAzimuth.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 SDenseDetectorTestAzimuth : public CppUnit::TestFixture {
50 
51  CPPUNIT_TEST_SUITE(SDenseDetectorTestAzimuth);
52  CPPUNIT_TEST(testBasicAzimuth);
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  Detector& theDetector = Detector::GetInstance();
74 
75  // get reference coordinate system of detector (usually PampaAmarilla)
76  const utl::CoordinateSystemPtr referenceCS = theDetector.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();
87  const double x = 8*km;
88  const double y = -12*km;
89  const double z = 0;
90  const utl::Point core(x, y, z, referenceCS);
91  simShower.MakeGeometry(core);
92 
93  /*
94  RU Do 27. Jul 12:22:46 CEST 2017
95 
96  interesting observation:
97 
98  in the new ShowerSimData logic, where the shower azimuth is obtained from the utl::Vector of the axis,
99  for the special case of zenith==0 the azimuth is not well defined and not stored in the axis.
100  It is always zero (and in fact irrelevant)
101 
102  Thus, in this test the symmetry around z is perfect and the azimuth doesn't matter. I modify the
103  test in a way to only check for the radial distance, not the exact location of stations...
104  */
105 
106  const Station& stat1 = theDetector.GetSDetector().GetStation(99998);
107  const Point& pos1 = stat1.GetPosition();
108  const double distance1 = (pos1 - core).GetMag();
109  CPPUNIT_ASSERT(Verify<CloseTo>(distance1, 1000*m, 1*m));
110 
111  //CPPUNIT_ASSERT(Verify<CloseTo>(pos1.GetX(referenceCS), 0.*m));
112  //CPPUNIT_ASSERT(Verify<CloseTo>(pos1.GetY(referenceCS), 1000.*m));
113  //CPPUNIT_ASSERT(Verify<CloseTo>(pos1.GetZ(referenceCS), 1400.*m));
114 
115  const Station& stat2 = theDetector.GetSDetector().GetStation(99997);
116  const Point& pos2 = stat2.GetPosition();
117  const double distance2 = (pos2 - core).GetMag();
118  CPPUNIT_ASSERT(Verify<CloseTo>(distance2, 1000*m, 1*m));
119 
120  //CPPUNIT_ASSERT(Verify<CloseTo>(pos2.GetX(referenceCS), -1000.*m));
121  //CPPUNIT_ASSERT(Verify<CloseTo>(pos2.GetY(referenceCS), 0.));
122  //CPPUNIT_ASSERT(Verify<CloseTo>(pos2.GetZ(referenceCS), 1400.*m));
123  }
124 
125 };
126 
127 
const double degree
Point object.
Definition: Point.h:32
Detector description interface for Station-related data.
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)
utl::Point GetPosition() const
Tank position.
Interface class to access Shower Simulated parameters.
Definition: ShowerSimData.h:49
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Top of the hierarchy of the detector description interface.
Definition: Detector.h:81
const sdet::SDetector & GetSDetector() const
Definition: Detector.cc:119
ShowerSimData & GetSimShower()
const double km
void SetGroundParticleCoordinateSystemZenith(const double zenith)
Set the zenith angle of the shower. Room angle between z-axis and direction from where the shower is ...
utl::CoordinateSystemPtr GetReferenceCoordinateSystem() const
Get the reference coordinate system used for analysis (usually PampaAmarilla for Auger) ...
Definition: Detector.h:141
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)
const Station & GetStation(const int stationId) const
Get station by Station Id.
Definition: SDetector.cc:192
constexpr double m
Definition: AugerUnits.h:121

, generated on Tue Sep 26 2023.