20 const char*
const mackenzie_t =
"Mackenzie";
21 const char*
const coppens_t =
"Coppens";
22 const char*
const unesco_t =
"UNESCO";
23 const char*
const delgrosso_t =
"DelGrosso";
34 inline double getVelocity(
const double D,
const double S,
const double T,
const std::string&
model)
36 const double latitude = 36.0 + 16.0/60.0;
39 if (model == mackenzie_t)
41 else if (model == coppens_t)
43 else if (model == unesco_t)
45 else if (model == delgrosso_t)
58 int main(
int argc,
char **argv)
72 JParser<> zap(
"Example program to plot UNESCO sound velocity.");
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;
83 catch(
const exception &error) {
84 FATAL(error.what() << endl);
88 const double Z[] = { 2000.0, 3450.0 };
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);
98 TH1D h1(
MAKE_CSTRING(
"h1 [" << model <<
"]"), NULL, 1000, 2000.0, 3500);
99 TH2D h2(
MAKE_CSTRING(
"h2 [" << model <<
"]"), NULL, 1000, 10.0, 20.0, 1000, 25.0, 40.0);
101 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
103 const Double_t D = h1.GetXaxis()->GetBinCenter(ix);
104 const double V = getVelocity(D, S, T, model);
106 h1.SetBinContent(ix, V);
109 for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
110 for (Int_t iy = 1; iy <= h2.GetXaxis()->GetNbins(); ++iy) {
112 const Double_t T = h2.GetXaxis()->GetBinCenter(ix);
113 const Double_t S = h2.GetYaxis()->GetBinCenter(iy);
115 const double V = getVelocity(D, S, T, model);
117 h2.SetBinContent(ix, iy, V);
Utility class to parse command line options.
int main(int argc, char *argv[])
double getPressure(const double z, const double phi, const bool option=true)
Get pressure.
#define MAKE_CSTRING(A)
Make C-string.
Auxiliary data structure for floating point format specification.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
double getVelocityCoppens(const double D, const double S, const double T)
Get sound velocity.
I/O formatting auxiliaries.
double getVelocityMackenzie(const double D, const double S, const double T)
Get sound velocity.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
do set_variable OUTPUT_DIRECTORY $WORKDIR T
double getVelocityDelGrosso(const double p, const double S, const double T)
Get sound velocity.
General purpose messaging.
Sound velocity according UNESCO equation.
Utility class to parse command line options.
do set_variable MODULE getModule a $WORKDIR detector_a datx L $STRING JEditDetector a $WORKDIR detector_a datx M $MODULE setz o $WORKDIR detector_a datx JEditDetector a $WORKDIR detector_b datx M $MODULE setz o $WORKDIR detector_b datx done echo Output stored at $WORKDIR detector_a datx and $WORKDIR tripod_a txt JDrawDetector2D a $WORKDIR detector_a datx a $WORKDIR detector_b datx L BL o detector $FORMAT $BATCH JDrawDetector2D T $WORKDIR tripod_a txt T $WORKDIR tripod_b txt L BL o tripod $FORMAT $BATCH JCompareDetector a $WORKDIR detector_a datx b $WORKDIR detector_b datx o $WORKDIR abc root &dev null for KEY in X Y Z
Auxiliary data structure for floating point format specification.
do echo Generating $dir eval D
double getVelocityUNESCO(const double P, const double S, const double T)
Get sound velocity.