Jpp
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 
48  JDetector detector;
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 }
JMessage.hh
JFileStreamIO.hh
JDETECTOR::load
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
Definition: JDetectorToolkit.hh:456
main
int main(int argc, char **argv)
Definition: JDetectorToNTuple.cc:22
JPoint3DEstimator.hh
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
JParser.hh
JDetectorToolkit.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
JModuleGeometry.hh
JDetector.hh
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37