Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JModule.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 #include <utility>
6 
7 #include "JDetector/JModule.hh"
8 
10 
11 #include "Jeep/JPrint.hh"
12 #include "Jeep/JParser.hh"
13 #include "Jeep/JMessage.hh"
14 
15 
16 /**
17  * \file
18  *
19  * Example for determination of center of optical module.
20  * \author mdejong
21  */
22 int main(int argc, char **argv)
23 {
24  using namespace std;
25  using namespace JPP;
26 
28 
29  pair_type precision;
30  int debug;
31 
32  try {
33 
34  JParser<> zap("Example for determination of center of optical module.");
35 
36  zap['e'] = make_field(precision, "precision of fit comparison and centering") = pair_type(1.0e-12, 1.0e-4);
37  zap['d'] = make_field(debug, "debug.") = 3;
38 
39  zap(argc, argv);
40  }
41  catch(const exception &error) {
42  FATAL(error.what() << endl);
43  }
44 
45  const JModule module = JModule::getInstance();
46  const JEstimator<JPoint3D> position(module.begin(), module.end());
47  const JPosition3D center = module.getCenter();
48 
49  DEBUG("position " << position << endl);
50  DEBUG("center " << center << endl);
51 
52  ASSERT(center.equals(position, precision.first));
53  ASSERT(center.equals(JVector3D(0.0, 0.0, 0.0), precision.second));
54 
55  return 0;
56 }
Utility class to parse command line options.
Definition: JParser.hh:1500
JCombinatorics::pair_type pair_type
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
I/O formatting auxiliaries.
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Linear fit of JFIT::JPoint3D.
Utility class to parse command line options.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
Data structure for a composite optical module.
int main(int argc, char *argv[])
Definition: Main.cpp:15