11 #include <utl/ErrorLogger.h>
13 #include <evt/Event.h>
16 #include <det/Detector.h>
17 #include <sdet/SDetector.h>
18 #include <sdet/Station.h>
19 #include <fdet/FDetector.h>
21 #include <utl/TimeStamp.h>
22 #include <utl/UTCDateTime.h>
24 #include <fwk/LocalCoordinateSystem.h>
25 #include <fwk/CoordinateSystemRegistry.h>
26 #include <utl/MathConstants.h>
27 #include <utl/CoordinateSystemPtr.h>
28 #include <utl/UTMPoint.h>
29 #include <utl/AxialVector.h>
30 #include <utl/Vector.h>
31 #include <utl/Point.h>
32 #include <utl/PhysicalConstants.h>
33 #include <utl/AugerUnits.h>
34 #include <utl/ReferenceEllipsoid.h>
35 #include <boost/tuple/tuple.hpp>
36 #include <boost/tuple/tuple_io.hpp>
47 using namespace GeometryExampleNS;
69 Detector::GetInstance().Update(times);
70 const SDetector& sDetector = Detector::GetInstance().GetSDetector();
71 const FDetector& fDetector = Detector::GetInstance().GetFDetector();
72 INFO(
"GeometryExample::Run()");
74 cout <<
"\nCreating a Coordinate System from scratch\n"
75 "-----------------------------------------\n";
77 const char band =
'H';
78 const string ellipsoidName(
"WGS84");
80 const double northing = 6081459*
m;
81 const double easting = 460373*
m;
82 const double altitude = 1391*
m;
85 const UTMPoint utmposition(northing, easting, altitude, zone, band, ellipsoid);
87 cout <<
"the origin of Coordinate System 1 will be: " << utmposition.
GetCoordinates() <<
"\n";
89 UTMPoint utmposition2(6081479*
m, 460363*
m, 1400*
m, 19,
'H', ReferenceEllipsoid::GetEllipsoidIDFromString(
"WGS84"));
90 cout <<
"the origin of Coordinate System 2 will be: " << utmposition2.
GetCoordinates() <<
"\n";
97 cout <<
"CS 1 origin relative to CS 2: " << cs1_origin.GetCoordinates(cs2) <<
"\n";
103 const double zenith = 30*
deg;
104 const double azimuth = 270*
deg;
106 CoordinateSystem::RotationY(
108 CoordinateSystem::RotationZ(
110 LocalCoordinateSystem::Create(cs1_origin)
115 cout <<
"CS 1 origin relative to CS 3: " << cs1_origin.GetCoordinates(cs3) <<
"\n";
125 const Point pointInPampa =
Point(0., 0., 2.*
km, pampaCS);
127 cout <<
"latitude, longitude, height " << latLonHeight << endl;
131 const Point point1(0,10,20, cs1);
132 const Point point3(-10,10,10, cs1);
133 const Point point2(10,
kPi/3,0, cs1, Point::kCylindrical);
134 const Vector vector1(1,0,0, cs1);
135 const Vector vector2(0,1,0, cs1);
139 cout <<
"\nPoints and vectors in different coordinate systems\n"
140 "--------------------------------------------------\n"
141 "coordinate System 1 \t\tCoordinate System 2\n"
142 << point1.GetCoordinates(cs1) <<
" \t\t" << point1.GetCoordinates(cs2) <<
"\n"
143 << point2.GetCoordinates(cs1) <<
" \t" << point3.GetCoordinates(cs2) <<
"\n"
144 << point3.GetCoordinates(cs1) <<
" \t\t\t" << point2.GetCoordinates(cs2) <<
"\n"
145 << vector1.GetCoordinates(cs1) <<
" \t" << vector1.GetCoordinates(cs2) <<
"\n"
146 << vector2.GetCoordinates(cs1) <<
" \t" << vector2.GetCoordinates(cs2) <<
"\n" ;
148 cout <<
"NOTE that the vector's components don't depend on the coordinate system!\n";
152 cout <<
"\nUsing the Coordinate systems provided by the framework\n"
153 "------------------------------------------------------\n";
165 const Point corePosition(0,0,0, pampaCs);
166 cout <<
"setting a 'core' position at:\n"
167 " " << corePosition.GetCoordinates(pampaCs) <<
", in 'Pampa Amarilla' coordinate system, \n"
168 " " << corePosition.GetCoordinates(coihuecoCs) <<
" relative to Coihueco\n"
169 " " << corePosition.GetCoordinates(siteCs) <<
" in the site's cs\n";
171 const Vector direction(1,2*
kPi/3,
kPi/6, pampaCs, Vector::kSpherical);
172 cout <<
"with direction \n "
173 << direction.GetCoordinates(pampaCs) <<
" in 'Pampa Amarilla' cartesian system, \n "
174 <<
"(" << direction.
GetR(pampaCs) <<
", " << direction.
GetTheta(pampaCs)/
deg <<
", " << direction.
GetPhi(pampaCs)/
deg
175 <<
") in 'Pampa Amarilla' spherical coordinates \n "
176 << direction.GetCoordinates(coihuecoCs) <<
"cartesian coordinates relative to Coihueco \n";
178 cout <<
"Note (again) how the direction's component didn't change much, as expected. "
179 "The direction is a Vector, whereas the position is Point. The slight changes are due to the earth curvature.\n";
183 const double ll_core = (fDetector.
GetEye(
"Los Leones").
GetPosition() - corePosition).GetMag();
186 cout <<
"\nDistance from Los Leones to the core: " << ll_core/
km <<
" km\n"
187 "Distance from LLancanelo (Local Station #221) to the core: " << llancanelo_core/
km <<
" km\n";
194 cout <<
"SEP plane: the equation for the Shower Eye Plane is "
195 "(" << sdp.
GetX(losLeonesCs) <<
") x + (" << sdp.
GetY(losLeonesCs) <<
") y + (" << sdp.
GetZ(losLeonesCs) <<
") z = 0\n";
199 const Vector coihuecoVertical(0,0,1, coihuecoCs);
200 const Vector moradosVertical(0,0,1, moradosCs);
202 cout <<
"the angle between the vertical line at Coihueco and Los Morados: "
203 <<
Angle(coihuecoVertical, moradosVertical)/
deg <<
" degrees. The earth is curved!\n"
204 <<
"same number, measuring the zenithal angle of the Morados vertical in Coihueco's CS: "
205 << moradosVertical.
GetTheta(coihuecoCs)/
deg <<
" degrees\n";
212 GeometryExample::Finish()
AxialVector Cross(const Vector &l, const Vector &r)
double Angle(const double theta1, const double phi1, const double theta2, const double phi2)
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
boost::tuple< double, double, double, int, char > GetCoordinates() const
Get norting, easting, height, zone, and band.
double GetR(const CoordinateSystemPtr &coordinateSystem) const
radius r in spherical coordinates coordinates (distance to origin)
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
Class to hold and convert a point in geodetic coordinates.
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
const Eye & GetEye(const unsigned int eyeId) const
Find eye by numerical Id.
Detector description interface for FDetector-related data.
A TimeStamp holds GPS second and nanosecond for some event.
utl::Point GetPosition() const
Tank position.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Reference ellipsoids for UTM transformations.
double GetX(const CoordinateSystemPtr &coordinateSystem) const
utl::CoordinateSystemPtr GetEyeCoordinateSystem() const
Returns the Eye Coordinate system.
Triple PointToLatitudeLongitudeHeight(const Point &thePoint) const
Convert Point to Lat/Long/Height.
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger reference system centered on the tank.
double GetY(const CoordinateSystemPtr &coordinateSystem) const
ResultFlag
Flag returned by module methods to the RunController.
Detector description interface for SDetector-related data.
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
EllipsoidID
ID's of known reference ellipsoid's.
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
const Station & GetStation(const int stationId) const
Get station by Station Id.
Point GetPoint(const CoordinateSystemPtr &theCS=CoordinateSystemPtr()) const
Get a cartesian point from an UTMPoint.
TimeStamp GetTimeStamp() const
utl::Point GetPosition() const
Eye position.