318{
321
324 double precision;
326
327 try {
328
329 JParser<> zap(
"Example program for sound ray tracing.");
330
335
337 }
338 catch(const exception &error) {
340 }
341
342
344
345 const JBellhop
bellhop(V, precision);
346
348
349 double x0, z0;
351
352
353
354
355
356
357
358 for ( ; ; ) {
359
360 cout <<
"> " << flush;
361 cin >> x0 >> z0 >> x1 >>
z1;
362
363
364 try {
365
366 const double D =
hypot(x1 - x0,
z1 - z0);
369
379
380
381 const double v0 = V(z0);
382 const double v1 = V(
z1);
383 const double b = (
v1 -
v0) / (
z1 - z0);
384 const double c =
v1 /
v0;
385 const double u = (
v0 +
v1) /
v1;
386 const double v = (
v0 -
v1) /
v1;
387 const double st =
s0.value;
388
391
393
395
396 dx = (sqrt(2.0 +
st) * sqrt(0.0 -
st) - sqrt(1.0 + c + c *
st) * sqrt(1.0 - c - c *
st)) *
v0 / (1.0 +
st) / b;
397
398 } else {
399
400 dx = (sqrt(1.0 +
st) * sqrt(1.0 -
st) - sqrt(1.0 + c *
st) * sqrt(1.0 - c *
st)) *
v0 / (
st ) / b;
401 }
402
404
405 const double x =
s0.getc();
406 const double y = (
s0.option ? c * sqrt(
u +
st) * sqrt(v -
st) : sqrt(1.0 + c *
st) * sqrt(1.0 - c *
st));
407
409 }
410 catch(const exception& error) {
412 }
413 }
414
415 } else {
416
417 const double x0 = 0.0;
418 const double z0 = 0.0;
419
422
424
425 TH2D h2(
"h2",
NULL, 50, 1.0, 3.5, 50, -1.0, 3.0);
426
429
430 const double x1 =
pow(10.0, h2.GetXaxis()->GetBinCenter(
ix));
431 const double z1 =
pow(10.0, h2.GetYaxis()->GetBinCenter(
iy));
432
435
436 try {
437
438 const double D =
hypot(x1 - x0,
z1 - z0);
441
444
446 }
447 catch(const exception& error) {
449 }
450 }
451 }
452
455
456 out.Write();
457 out.Close();
458 }
459}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
T pow(const T &x, const double y)
Power .
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Implementation for depth dependend velocity of sound.
virtual double getTime(const double D_m, const double z1, const double z2) const override
Get propagation time of sound.
JSoundVelocity & set(const double z0)
Set depth.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.