37 inline const Ellipsoid& getEllipsoid(
const JUTMGrid& grid)
41 string buffer = grid.getWGS();
42 size_t pos = buffer.find_first_of(
"0123456789");
44 const string wgs = buffer.substr(0, pos);
48 istringstream(buffer.substr(pos)) >>
zone;
53 pos = buffer.find(wgs);
55 if (pos != string::npos) {
57 pos += wgs.size() + 1;
61 istringstream(buffer.substr(pos)) >> val;
69 THROW(JParseError,
"Invalid UTM grid " << grid);
80 inline JGeographicalLocation getGeographicalLocation(
const JUTMGrid& grid,
81 const JUTMPosition& position)
89 UTMtoLL(el.
id, position.getUTMNorth(), position.getUTMEast(), grid.getUTMZone().c_str(), lat, lon);
107 const Ellipsoid& el = getEllipsoid(grid);
113 const char*
const calculated_t =
"calculated";
114 const char*
const fixed_t =
"fixed";
135 JParser<> zap(
"Example program to print geographical data for given detector.");
138 zap[
'O'] =
make_field(option) = calculated_t, fixed_t;
143 catch(
const exception &error) {
144 FATAL(error.what() << endl);
162 if (option == calculated_t) {
164 meridian = getDegrees(getMeridianConvergenceAngle(
detector.getUTMGrid(),
detector.getUTMPosition()));
165 location = getGeographicalLocation(
detector.getUTMGrid(),
detector.getUTMPosition());
167 }
else if (option == fixed_t) {
171 meridian = ORCA_MERIDIAN_CONVERGENCE_ANGLE_DEG;
174 }
else if (isARCADetector(
detector)) {
176 meridian = ARCA_MERIDIAN_CONVERGENCE_ANGLE_DEG;
181 FATAL(
"No location" << endl);
186 FATAL(
"Invalid option " << option << endl);
189 if (
debug >= debug_t) {
191 cout <<
"grid: " <<
detector.getUTMGrid() << endl;
192 cout <<
"UTM: " <<
detector.getUTMPosition() << endl;
193 cout <<
"zone: " <<
detector.getUTMZone() <<
' ' << getUTMZone(location.
getLongitude()) << endl;
195 cout <<
"Meridian convergence angle [deg]: " <<
FIXED(9,5) << meridian <<
" (" << option <<
")" << endl;
196 cout <<
"Meridian convergence angle [deg]: " <<
FIXED(9,5) << getDegrees(getMeridianConvergenceAngle(location)) <<
" (calculated)" << endl;
199 cout <<
"Latitude [deg]: " <<
FIXED(9,5) << getDegrees(location.
getLatitude()) << endl;
200 cout <<
"Longitude [deg]: " <<
FIXED(9,5) << getDegrees(location.
getLongitude()) << endl;
203 cout <<
"Meridian convergence angle [deg]: " <<
FIXED(9,5) << meridian << endl;
204 cout <<
"Meridian convergence angle [rad]: " <<
FIXED(9,5) << getRadians(meridian) << endl;
Interface methods for SLALIB and auxiliary classes and methods for astronomy.
Meridian convergence angles for different sites.
Data structure for detector geometry and calibration.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static Ellipsoid ellipsoid[]
void UTMtoLL(int ReferenceEllipsoid, const double UTMNorthing, const double UTMEasting, const char *UTMZone, double &Lat, double &Long)
double eccentricitySquared
const char * ellipsoidName
Exception for parsing value.
Utility class to parse command line options.
Data structure for UTM grid.
Data structure for UTM position.
int main(int argc, char **argv)
double getMeridianConvergenceAngle(const JGeographicalLocation &location)
Get Meridian convergence angle.
double getRadians(const double angle)
Convert angle to radians.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
double getLongitude() const
Get longitude.
double getLatitude() const
Get latitude.