Jpp  17.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JAttenuationLength.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 
4 #include "TROOT.h"
5 #include "TFile.h"
6 #include "TH1D.h"
7 
9 
10 #include "Jeep/JParser.hh"
11 #include "Jeep/JMessage.hh"
12 
13 
14 /**
15  * \file
16  *
17  * Auxiliary program to plot attenuation length.
18  *
19  * See Figure 4.1 in reference:
20  * Robert Lahmann: "Ultra-High-Energy Neutrinos and Their Acoustic Detection in the Sea"
21  * <a href="https://ecap.nat.fau.de/wp-content/uploads/2017/04/habil_schrift.pdf">Habilitation Thesis</a>, University of Erlangen
22  *
23  * \author mdejong
24  */
25 int main(int argc, char **argv)
26 {
27  using namespace std;
28  using namespace JPP;
29 
30  string outputFile;
31  double D_m;
32  int debug;
33 
34  try {
35 
36  JParser<> zap("Auxiliary program to plot attenuation length.");
37 
38  zap['o'] = make_field(outputFile) = "attenuation_length.root";
39  zap['D'] = make_field(D_m, "depth [m]");
40  zap['d'] = make_field(debug) = 1;
41 
42  zap(argc, argv);
43  }
44  catch(const exception &error) {
45  FATAL(error.what() << endl);
46  }
47 
48 
49  TFile out(outputFile.c_str(), "recreate");
50 
51  TH1D h0("h0", NULL, 1000, 0.0, 3.0);
52 
53  for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
54 
55  const double x = h0.GetBinCenter(ix);
56  const double f_kHz = pow(10.0, x);
57  const double y = getAttenuationLength(D_m, f_kHz);
58 
59  h0.SetBinContent(ix, y * 1.0e-3);
60  }
61 
62  out.Write();
63  out.Close();
64 }
Utility class to parse command line options.
Definition: JParser.hh:1517
int main(int argc, char *argv[])
Definition: Main.cc:15
string outputFile
Acoustics support kit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
static const JAttenuationLength getAttenuationLength(13.2, 38.0, 8.0)
Function object to calculate attenutation length.
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
int debug
debug level