Jpp  18.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JDynamics.cc File Reference

Example program to apply dynamic position and orientation calibration. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <limits>
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JMeta.hh"
#include "JDynamics/JDynamics.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to apply dynamic position and orientation calibration.

Author
mdejong

Definition in file JDynamics.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 25 of file JDynamics.cc.

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 }
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:1514
General exception.
Definition: JException.hh:24
static JDetectorMechanics getMechanics
Function object to get string mechanics.
Definition: JMechanics.hh:242
#define STATUS(A)
Definition: JMessage.hh:63
Detector data structure.
Definition: JDetector.hh:89
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
string outputFile
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
Detector file.
Definition: JHead.hh:226
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
#define FATAL(A)
Definition: JMessage.hh:67
Dynamic detector calibration.
Definition: JDynamics.hh:81
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.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:84
do set_variable DETECTOR_TXT $WORKDIR detector
int debug
debug level