Jpp 20.0.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 124 of file getGeographicalLocation.cc.

125{
126 using namespace std;
127 using namespace JPP;
128
129 string detectorFile;
130 string option;
131 int debug;
132
133 try {
134
135 JParser<> zap("Example program to print geographical data for given detector.");
136
137 zap['a'] = make_field(detectorFile);
138 zap['O'] = make_field(option) = calculated_t, fixed_t;
139 zap['d'] = make_field(debug) = 2;
140
141 zap(argc, argv);
142 }
143 catch(const exception &error) {
144 FATAL(error.what() << endl);
145 }
146
147
149
150 try {
151 load(detectorFile, detector);
152 }
153 catch(const JException& error) {
154 FATAL(error);
155 }
156
157
158 string name;
159 double meridian;
160 JGeographicalLocation location;
161
162 if (option == calculated_t) {
163
164 meridian = getDegrees(getMeridianConvergenceAngle(detector.getUTMGrid(), detector.getUTMPosition()));
165 location = getGeographicalLocation(detector.getUTMGrid(), detector.getUTMPosition());
166
167 } else if (option == fixed_t) {
168
170
171 meridian = ORCA_MERIDIAN_CONVERGENCE_ANGLE_DEG;
172 location = ORCA;
173
174 } else if (isARCADetector(detector)) {
175
176 meridian = ARCA_MERIDIAN_CONVERGENCE_ANGLE_DEG;
177 location = ARCA;
178
179 } else {
180
181 FATAL("No location" << endl);
182 }
183
184 } else {
185
186 FATAL("Invalid option " << option << endl);
187 }
188
189 if (debug >= debug_t) {
190
191 cout << "grid: " << detector.getUTMGrid() << endl;
192 cout << "UTM: " << detector.getUTMPosition() << endl;
193 cout << "zone: " << detector.getUTMZone() << ' ' << getUTMZone(location.getLongitude()) << endl;
194
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;
197 }
198
199 cout << "Latitude [deg]: " << FIXED(9,5) << getDegrees(location.getLatitude()) << endl;
200 cout << "Longitude [deg]: " << FIXED(9,5) << getDegrees(location.getLongitude()) << endl;
201 cout << "Latitude [rad]: " << FIXED(9,5) << location.getLatitude() << endl;
202 cout << "Longitude [rad]: " << FIXED(9,5) << 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;
205}
#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.
double getRadians(const double angle)
Convert angle to radians.
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.