Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JDynamics.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <iomanip>
4#include <limits>
5
8
10#include "JSupport/JMeta.hh"
11
13
14#include "Jeep/JPrint.hh"
15#include "Jeep/JParser.hh"
16#include "Jeep/JMessage.hh"
17
18
19/**
20 * \file
21 *
22 * Example program to apply dynamic position and orientation calibration.
23 * \author mdejong
24 */
25int main(int argc, char **argv)
26{
27 using namespace std;
28 using namespace JPP;
29
31 JLimit_t& numberOfEvents = calibrationFile.getLimit();
32 string detectorFile;
33 string outputFile;
34 double Tmax_s;
35 double t1_s;
36 int debug;
37
38 try {
39
40 JParser<> zap("Example program to apply dynamic position and orientation calibration.");
41
42 zap['f'] = make_field(calibrationFile, "output of JBallarat[.sh] / JKatoomba[.sh]");
43 zap['n'] = make_field(numberOfEvents) = JLimit::max();
44 zap['a'] = make_field(detectorFile);
45 zap['o'] = make_field(outputFile);
46 zap['M'] = make_field(getMechanics, "mechanics data") = JPARSER::initialised();
47 zap['T'] = make_field(Tmax_s) = 0.0;
48 zap['t'] = make_field(t1_s);
49 zap['d'] = make_field(debug) = 2;
50
51 zap(argc, argv);
52 }
53 catch(const exception &error) {
54 FATAL(error.what() << endl);
55 }
56
57
59
60 try {
61 load(detectorFile, detector);
62 }
63 catch(const JException& error) {
64 FATAL(error);
65 }
66
67 detector.comment.add(JMeta(argc, argv));
68
69 JDynamics dynamics(detector, Tmax_s);
70
71 STATUS("loading calibration from file(s)" << endl);
72
73 for (JMultipleFileScanner<>::const_iterator i = calibrationFile.begin(); i != calibrationFile.end(); ++i) {
74 STATUS(*i << endl);
75 }
76
77 dynamics.load(calibrationFile);
78
79 STATUS("OK" << endl);
80
81 STATUS("Coverage position " << FIXED(5,1) << 100.0 * dynamics.position .getCoverage(detector, t1_s) << "%" << endl);
82 STATUS("Coverage orientation " << FIXED(5,1) << 100.0 * dynamics.orientation.getCoverage(detector, t1_s) << "%" << endl);
83
84 dynamics.update(t1_s);
85
86 store(outputFile.c_str(), dynamics);
87}
string outputFile
Data structure for detector geometry and calibration.
int main(int argc, char **argv)
Definition JDynamics.cc:25
Dynamic detector calibration.
General purpose messaging.
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
ROOT I/O of application specific meta data.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
I/O formatting auxiliaries.
Detector data structure.
Definition JDetector.hh:96
General exception.
Definition JException.hh:24
Utility class to parse command line options.
Definition JParser.hh:1698
General purpose class for object reading from a list of file names.
static JDetectorMechanics getMechanics
Function object to get string mechanics.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Detector file.
Definition JHead.hh:227
double getCoverage(const JDetector &detector, const double t1_s) const
Get coverage.
Definition JDynamics.hh:223
double getCoverage(const JDetector &detector, const double t1_s) const
Get coverage.
Definition JDynamics.hh:391
Dynamic detector calibration.
Definition JDynamics.hh:86
JPosition position
position calibration
Definition JDynamics.hh:613
JOrientation orientation
orientation calibration
Definition JDynamics.hh:612
bool update(const double t1_s)
Get detector calibrated at given time.
Definition JDynamics.hh:545
void load(JObjectIterator_t &input)
Load calibration data.
Definition JDynamics.hh:530
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72