Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JDynamics.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <iomanip>
4 #include <limits>
5 
6 #include "JDetector/JDetector.hh"
8 
10 #include "JSupport/JMeta.hh"
11 
12 #include "JDynamics/JDynamics.hh"
13 
14 #include "JCompass/JEvt.hh"
15 #include "JCompass/JSupport.hh"
16 
17 #include "JAcoustics/JEvt.hh"
18 #include "JAcoustics/JSupport.hh"
19 
20 #include "Jeep/JPrint.hh"
21 #include "Jeep/JParser.hh"
22 #include "Jeep/JMessage.hh"
23 
24 
25 /**
26  * \file
27  *
28  * Example program to plot orientation data.
29  * \author mdejong
30  */
31 int main(int argc, char **argv)
32 {
33  using namespace std;
34  using namespace JPP;
35 
37  JLimit_t& numberOfEvents = inputFile.getLimit();
38  string detectorFile;
39  string outputFile;
40  double Tmax_s;
41  double t1_s;
42  int debug;
43 
44  try {
45 
46  JParser<> zap("Example program to plot orientation data.");
47 
48  zap['f'] = make_field(inputFile, "output of JBallarat / JKatoomba");
49  zap['n'] = make_field(numberOfEvents) = JLimit::max();
50  zap['a'] = make_field(detectorFile);
51  zap['o'] = make_field(outputFile);
52  zap['T'] = make_field(Tmax_s);
53  zap['t'] = make_field(t1_s);
54  zap['d'] = make_field(debug) = 2;
55 
56  zap(argc, argv);
57  }
58  catch(const exception &error) {
59  FATAL(error.what() << endl);
60  }
61 
62 
64 
65  try {
66  load(detectorFile, detector);
67  }
68  catch(const JException& error) {
69  FATAL(error);
70  }
71 
72  detector.comment.add(JMeta(argc, argv));
73 
74  JDynamics dynamics(detector, Tmax_s);
75 
76  STATUS("loading input from file(s)" << endl);
77 
78  for (JMultipleFileScanner<>::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) {
79  STATUS(*i << endl);
80  }
81 
82  dynamics.load(inputFile);
83 
84  STATUS("OK" << endl);
85 
86  STATUS("time " << ' ' << FIXED(16,1) << t1_s << endl);
87  STATUS("position " << dynamics.position << endl);
88  STATUS("orientation " << dynamics.orientation << endl);
89 
90  store(outputFile.c_str(), dynamics(t1_s));
91 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
Utility class to parse command line options.
Definition: JParser.hh:1500
General exception.
Definition: JException.hh:23
#define STATUS(A)
Definition: JMessage.hh:63
ROOT TTree parameter settings.
Detector data structure.
Definition: JDetector.hh:80
JOrientation orientation
Definition: JDynamics.hh:535
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:445
string outputFile
Data structure for detector geometry and calibration.
ROOT TTree parameter settings.
void load(JObjectIterator_t &input)
Load calibration data.
Definition: JDynamics.hh:510
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
I/O formatting auxiliaries.
Detector file.
Definition: JHead.hh:196
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
ROOT I/O of application specific meta data.
Dynamic detector calibration.
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Dynamic detector calibration.
Definition: JDynamics.hh:52
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
Compass event data types.
do set_variable DETECTOR_TXT $WORKDIR detector
Acoustic event fit.
int main(int argc, char *argv[])
Definition: Main.cpp:15