#include #include #include #include "TROOT.h" #include "TFile.h" #include "TH2D.h" #include "JAcoustics/JUNESCO.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to plot UNESCO sound velocity. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string outputFile; double D; double S; double T; int debug; try { JParser<> zap("Example program to plot UNESCO sound velocity."); zap['o'] = make_field(outputFile); zap['D'] = make_field(D, "Depth [m]"); zap['S'] = make_field(S, "Salinity [ppk]") = 25.0; zap['T'] = make_field(T, "Temperature [C]") = 14.3; zap['d'] = make_field(debug) = 2; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } TFile out(outputFile.c_str(), "recreate"); TH1D h1("h1", NULL, 1000, 0.0, 3500); TH2D h2("h2", NULL, 1000, 10.0, 20.0, 1000, 25.0, 40.0); for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) { const Double_t D = h1.GetXaxis()->GetBinCenter(ix); const double V = getVelocity(D, S, T); h1.SetBinContent(ix, V); } for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) { for (Int_t iy = 1; iy <= h2.GetXaxis()->GetNbins(); ++iy) { const Double_t T = h2.GetXaxis()->GetBinCenter(ix); const Double_t S = h2.GetYaxis()->GetBinCenter(iy); const double V = getVelocity(D, S, T); //const double vs = getVelocity(D, S, T) - getVelocity(D + 1, S, T); h2.SetBinContent(ix, iy, V); } } out.Write(); out.Close(); }