Jpp  18.0.0-rc.4
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JSeabed.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <iomanip>
4 #include <vector>
5 
6 #include "JDetector/JTripod.hh"
7 
8 #include "JMath/JSVD3D.hh"
9 
10 #include "Jeep/JContainer.hh"
11 #include "Jeep/JParser.hh"
12 #include "Jeep/JMessage.hh"
13 
14 
15 /**
16  * \file
17  * Auxiliary application to determine tilt angles of seabed based on tripod positions.
18  *
19  * \author mdejong
20  */
21 int main(int argc, char **argv)
22 {
23  using namespace std;
24  using namespace JPP;
25 
26  typedef JContainer< vector<JTripod> > tripods_container;
27 
29  int debug;
30 
31  try {
32 
33  JParser<> zap("Auxiliary application to determine tilt angles of seabed based on tripod positions.");
34 
35  zap['T'] = make_field(tripods);
36  zap['d'] = make_field(debug) = 1;
37 
38  zap(argc, argv);
39  }
40  catch(const exception& error) {
41  FATAL(error.what() << endl);
42  }
43 
44  // solve z(x,y) = a*x + b*y + c
45 
46  JMatrix3D A;
47  double Y[3] = { 0.0, 0.0, 0.0 };
48 
49  for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
50 
51  A.a00 += i->getX() * i->getX(); A.a01 += i->getX() * i->getY(); A.a02 += i->getX();
52  A.a10 += i->getX() * i->getY(); A.a11 += i->getY() * i->getY(); A.a12 += i->getY();
53  A.a20 += i->getX() ; A.a21 += i->getY(); A.a22 += 1.0;
54 
55  Y[0] += i->getX() * i->getZ();
56  Y[1] += i->getY() * i->getZ();
57  Y[2] += i->getZ();
58  }
59 
60  DEBUG(A);
61 
62  JSVD3D V(A);
63 
64  try {
65 
66  A = V.invert();
67 
68  const double a = A.a00 * Y[0] + A.a01 * Y[1] + A.a02 * Y[2];
69  const double b = A.a10 * Y[0] + A.a11 * Y[1] + A.a12 * Y[2];
70  //const double c = A.a20 * Y[0] + A.a21 * Y[1] + A.a22 * Y[2];
71 
72  //const double Rx = atan(+b); // rotation aroud x-axis
73  //const double Ry = atan(-a); // rotation aroud y-axis
74  const double Tx = a;
75  const double Ty = b;
76 
77  cout << showpos << FIXED(12,6) << Tx << ' '
78  << showpos << FIXED(12,6) << Ty << endl;
79  }
80  catch(const exception& error) {
81  FATAL(error.what());
82  }
83 
84  return 0;
85 }
Utility class to parse command line options.
Definition: JParser.hh:1514
int main(int argc, char *argv[])
Definition: Main.cc:15
then fatal Number of tripods
Definition: JFootprint.sh:45
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
then JCalibrateToT a
Definition: JTuneHV.sh:116
JContainer< std::vector< JTripod > > tripods_container
Definition: JSydney.cc:73
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
Data structure for tripod.
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
Container I/O.
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62