Jpp  debug
the software that should make you happy
Functions
JAttenuationLength.cc File Reference

Auxiliary program to plot attenuation length. More...

#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JAcoustics/JAcousticsSupportkit.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

Auxiliary program to plot attenuation length.

See Figure 4.1 in reference: Robert Lahmann: "Ultra-High-Energy Neutrinos and Their Acoustic Detection in the Sea" Habilitation Thesis, University of Erlangen

Author
mdejong

Definition in file JAttenuationLength.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 25 of file JAttenuationLength.cc.

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 }
string outputFile
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
Utility class to parse command line options.
Definition: JParser.hh:1714
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
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14