Jpp - the software that should make you happy
 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 apply dynamic position and orientation calibration.
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 = calibrationFile.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 apply dynamic position and orientation calibration.");
47 
48  zap['f'] = make_field(calibrationFile, "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['M'] = make_field(getMechanics, "mechanics data") = JPARSER::initialised();
53  zap['T'] = make_field(Tmax_s) = 0.0;
54  zap['t'] = make_field(t1_s);
55  zap['d'] = make_field(debug) = 2;
56 
57  zap(argc, argv);
58  }
59  catch(const exception &error) {
60  FATAL(error.what() << endl);
61  }
62 
63 
65 
66  try {
67  load(detectorFile, detector);
68  }
69  catch(const JException& error) {
70  FATAL(error);
71  }
72 
73  detector.comment.add(JMeta(argc, argv));
74 
75  JDynamics dynamics(detector, Tmax_s);
76 
77  STATUS("loading calibration from file(s)" << endl);
78 
79  for (JMultipleFileScanner<>::const_iterator i = calibrationFile.begin(); i != calibrationFile.end(); ++i) {
80  STATUS(*i << endl);
81  }
82 
83  dynamics.load(calibrationFile);
84 
85  STATUS("OK" << endl);
86 
87  STATUS("Coverage position " << FIXED(5,1) << 100.0 * dynamics.position .getCoverage(detector, t1_s) << "%" << endl);
88  STATUS("Coverage orientation " << FIXED(5,1) << 100.0 * dynamics.orientation.getCoverage(detector, t1_s) << "%" << endl);
89 
90  store(outputFile.c_str(), dynamics.update(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
int main(int argc, char *argv[])
Definition: Main.cc:15
static JDetectorMechanics getMechanics
Function object to get string mechanics.
Definition: JMechanics.hh:243
#define STATUS(A)
Definition: JMessage.hh:63
ROOT TTree parameter settings.
JPosition position
position calibration
Definition: JDynamics.hh:553
Detector data structure.
Definition: JDetector.hh:80
JOrientation orientation
orientation calibration
Definition: JDynamics.hh:552
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
string outputFile
const JDetector & update(const double t1_s)
Get detector calibrated at given time.
Definition: JDynamics.hh:477
Data structure for detector geometry and calibration.
ROOT TTree parameter settings.
void load(JObjectIterator_t &input)
Load calibration data.
Definition: JDynamics.hh:462
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
double getCoverage(const JDetector &detector, const double t1_s) const
Get coverage.
Definition: JDynamics.hh:192
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:59
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
double getCoverage(const JDetector &detector, const double t1_s) const
Get coverage.
Definition: JDynamics.hh:348
Acoustic event fit.