Jpp  16.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JDetectorToNTuple.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
6 #include "JDetector/JDetector.hh"
10 #include "JIO/JFileStreamIO.hh"
11 
12 #include "Jeep/JParser.hh"
13 #include "Jeep/JMessage.hh"
14 
15 
16 /**
17  * \file
18  *
19  * Program to convert detector to ntuples.
20  * \author mdejong
21  */
22 int main(int argc, char **argv)
23 {
24  using namespace std;
25 
26  string detectorFile;
27  string outputFile;
28  int debug;
29 
30  try {
31 
32  JParser<> zap("Program to convert detector to ntuples.");
33 
34  zap['a'] = make_field(detectorFile);
35  zap['o'] = make_field(outputFile);
36  zap['d'] = make_field(debug) = 0;
37 
38  zap(argc, argv);
39  }
40  catch(const exception &error) {
41  FATAL(error.what() << endl);
42  }
43 
44 
45  using namespace JPP;
46 
47 
49 
50  try {
51  load(detectorFile, detector);
52  }
53  catch(const JException& error) {
54  FATAL(error);
55  }
56 
57 
58  JFileStreamWriter out(outputFile.c_str());
59 
60  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
61 
62  const JEstimator<JPoint3D> center(module->begin(), module->end());
63 
64  JModuleGeometry geometry(JDAQUTCExtended(), module->getID(), center, JEulerAngle3D());
65 
66  out.store(geometry);
67  }
68 
69  out.close();
70 }
Utility class to parse command line options.
Definition: JParser.hh:1500
General exception.
Definition: JException.hh:23
Data structure for Euler angles in three dimensions.
int main(int argc, char *argv[])
Definition: Main.cc:15
Detector data structure.
Definition: JDetector.hh:89
string outputFile
Data structure for UTC time.
Data structure for detector geometry and calibration.
Detector file.
Definition: JHead.hh:224
#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.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
do set_variable DETECTOR_TXT $WORKDIR detector
Binary buffered file output.
Linear fit of crossing point (position) between axes (objects with position and direction).