59{
62
64 double D;
65 double S;
66 double T;
69
70 try {
71
72 JParser<> zap(
"Example program to plot UNESCO sound velocity.");
73
76 zap[
'S'] =
make_field(S,
"Salinity [ppk]") = 38.7;
77 zap[
'T'] =
make_field(T,
"Temperature [C]") = 14.0;
78 zap[
'M'] =
make_field(
model,
"model") = mackenzie_t, coppens_t, unesco_t, delgrosso_t;
80
81 zap(argc, argv);
82 }
83 catch(const exception &error) {
84 FATAL(error.what() << endl);
85 }
86
87
88 const double Z[] = { 2000.0, 3450.0 };
89
91 << setw(10) << left <<
model << right <<
' '
92 <<
FIXED(9,2) << getVelocity(Z[0], S, T,
model) <<
' '
93 <<
SCIENTIFIC(12,3) << (getVelocity(Z[0], S, T,
model) - getVelocity(Z[1], S, T,
model)) / (Z[1] - Z[0]) <<
' '
94 <<
FIXED(9,2) << -Z[0] << endl);
95
97
99 TH2D h2(
MAKE_CSTRING(
"h2 [" <<
model <<
"]"), NULL, 1000, 10.0, 20.0, 1000, 25.0, 40.0);
100
101 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
102
103 const Double_t D = h1.GetXaxis()->GetBinCenter(ix);
104 const double V = getVelocity(D, S, T,
model);
105
106 h1.SetBinContent(ix, V);
107 }
108
109 for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
110 for (Int_t iy = 1; iy <= h2.GetXaxis()->GetNbins(); ++iy) {
111
112 const Double_t T = h2.GetXaxis()->GetBinCenter(ix);
113 const Double_t S = h2.GetYaxis()->GetBinCenter(iy);
114
115 const double V = getVelocity(D, S, T,
model);
116
117 h2.SetBinContent(ix, iy, V);
118 }
119 }
120
121 out.Write();
122 out.Close();
123}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
Utility class to parse command line options.
void model(JModel_t &value)
Auxiliary function to constrain model during fit.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Auxiliary data structure for floating point format specification.