Jpp  17.2.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JNOAA.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 #include <vector>
4 #include <map>
5 
6 #include "TROOT.h"
7 #include "TFile.h"
8 #include "TH1D.h"
9 #include "TGraph.h"
10 
11 #include "JCompass/JNOAA.hh"
12 
13 #include "Jeep/JParser.hh"
14 #include "Jeep/JMessage.hh"
15 
16 
17 
18 /**
19  * \file
20  *
21  * Example program to plot NOAA functions.
22  * \author mdejong
23  */
24 int main(int argc, char **argv)
25 {
26  using namespace std;
27  using namespace JPP;
28 
29  string outputFile;
30  int debug;
31 
32  try {
33 
34  JParser<> zap("Example program to plot NOAA functions.");
35 
36  zap['o'] = make_field(outputFile) = "noaa.root";
37  zap['d'] = make_field(debug) = 2;
38 
39  zap(argc, argv);
40  }
41  catch(const exception &error) {
42  FATAL(error.what() << endl);
43  }
44 
45 
46  TFile out(outputFile.c_str(), "recreate");
47 
48  TH1D h1("[ARCA]", NULL, 1000, getARCAMagneticDeclination.getXmin(), getARCAMagneticDeclination.getXmax());
49  TH1D h2("[ORCA]", NULL, 1000, getARCAMagneticDeclination.getXmin(), getARCAMagneticDeclination.getXmax());
50 
51  for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
52 
53  const double x = h1.GetBinCenter(ix);
54  const double y1 = getARCAMagneticDeclination(x);
55  const double y2 = getORCAMagneticDeclination(x);
56 
57  h1.SetBinContent(ix, y1);
58  h2.SetBinContent(ix, y2);
59  }
60 
61  out.Write();
62  out.Close();
63 }
Utility class to parse command line options.
Definition: JParser.hh:1517
static JARCAMagneticDeclination getARCAMagneticDeclination
Function object for magnetic declination at ARCA site.
Definition: JNOAA.hh:730
int main(int argc, char *argv[])
Definition: Main.cc:15
string outputFile
static JORCAMagneticDeclination getORCAMagneticDeclination
Function object for magnetic declination at ORCA site.
Definition: JNOAA.hh:731
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
int debug
debug level