Jpp 19.3.0
the software that should make you happy
Loading...
Searching...
No Matches
getGeographicalLocation.cc File Reference

Example program to print geographical data for given detector. More...

#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#include "JLang/JManip.hh"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JCompass/JCompassSupportkit.hh"
#include "JLang/JException.hh"
#include "JAstronomy/JAstronomy.hh"
#include "LatLong-UTMconversion.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to print geographical data for given detector.

Author
mdejong

Definition in file getGeographicalLocation.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 120 of file getGeographicalLocation.cc.

121{
122 using namespace std;
123 using namespace JPP;
124
125 string detectorFile;
126 int debug;
127
128 try {
129
130 JParser<> zap("Example program to print geographical data for given detector.");
131
132 zap['a'] = make_field(detectorFile);
133 zap['d'] = make_field(debug) = 2;
134
135 zap(argc, argv);
136 }
137 catch(const exception &error) {
138 FATAL(error.what() << endl);
139 }
140
141
143
144 try {
145 load(detectorFile, detector);
146 }
147 catch(const JException& error) {
148 FATAL(error);
149 }
150
151
152 string name;
153 double meridian;
154 JGeographicalLocation location;
155
157
158 name = "ORCA";
159 meridian = ORCA_MERIDIAN_CONVERGENCE_ANGLE_DEG;
160 location = ORCA;
161
162 } else if (isARCADetector(detector)) {
163
164 name = "ARCA";
165 meridian = ARCA_MERIDIAN_CONVERGENCE_ANGLE_DEG;
166 location = ARCA;
167
168 } else {
169
170 FATAL("No location" << endl);
171 }
172
173 cout << "Detector " << name << endl;
174 cout << detector.getUTMGrid() << endl;
175 cout << detector.getUTMPosition() << endl;
176
177 JGeographicalLocation geo = getGeographicalLocation(detector.getUTMGrid(), detector.getUTMPosition());
178
179 cout << "Latitude [deg]: " << FIXED(9,5) << getDegrees(location.getLatitude()) << " " << FIXED(9,5) << getDegrees(geo.getLatitude()) << endl;
180 cout << "Longitude [deg]: " << FIXED(9,5) << getDegrees(location.getLongitude()) << " " << FIXED(9,5) << getDegrees(geo.getLongitude()) << endl;
181 cout << "Latitude [rad]: " << FIXED(9,5) << location.getLatitude() << " " << FIXED(9,5) << geo.getLatitude() << endl;
182 cout << "Longitude [rad]: " << FIXED(9,5) << location.getLongitude() << " " << FIXED(9,5) << geo.getLongitude() << endl;
183
184 cout << "Zone: " << detector.getUTMZone() << " " << getUTMZone(geo.getLongitude()) << endl;
185
186 cout << "Meridian convergence angle [deg]: " << FIXED(9,5) << meridian << " " << FIXED(9,5) << getDegrees(getMeridianConvergenceAngle(detector.getUTMGrid(), detector.getUTMPosition())) << endl;
187 cout << "Meridian convergence angle [deg]: " << FIXED(9,5) << getDegrees(getMeridianConvergenceAngle(location)) << " (approximate)" << endl;
188}
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Detector data structure.
Definition JDetector.hh:96
General exception.
Definition JException.hh:24
Utility class to parse command line options.
Definition JParser.hh:1698
double getMeridianConvergenceAngle(const JGeographicalLocation &location)
Get Meridian convergence angle.
double getDegrees(const double angle)
Convert angle to degrees.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
bool isORCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with that of ORCA.
bool isARCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with tat of ARCA.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Detector file.
Definition JHead.hh:227
double getLongitude() const
Get longitude.
double getLatitude() const
Get latitude.