Jpp
JConvertDB.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 
4 #include "KM3NeTDBClient.h"
5 #include "JDB/JDB.hh"
6 #include "JDB/JDBToolkit.hh"
7 #include "JDB/JSelector.hh"
8 #include "JDB/JSupport.hh"
9 
10 #include "JDB/JDBincludes.hh"
13 
14 #include "Jeep/JParser.hh"
15 #include "Jeep/JMessage.hh"
16 
17 
18 /**
19  * \file
20  *
21  * Auxiliary program to convert data from data base into ROOT format.
22  * \author mdejong
23  */
24 int main(int argc, char **argv)
25 {
26  using namespace std;
27  using namespace JPP;
28 
29  typedef JDBTypes_t typelist;
30 
31  JFileRecorder<typelist> outputFile;
32  string usr;
33  string pwd;
34  string cookie;
35  string query;
36  JSelector selection;
37  int debug;
38 
39  try {
40 
41  JParser<> zap("Auxiliary program to convert data from data base into ROOT format.");
42 
43  zap['o'] = make_field(outputFile);
44  zap['u'] = make_field(usr) = "";
45  zap['!'] = make_field(pwd) = "";
46  zap['C'] = make_field(cookie) = "";
47  zap['q'] = make_field(query) = getQueries<typelist>();
48  zap['@'] = make_field(selection) = JPARSER::initialised();
49  zap['d'] = make_field(debug) = 1;
50 
51  zap['q'] = JPARSER::not_initialised();
52 
53  zap(argc, argv);
54  }
55  catch(const exception &error) {
56  FATAL(error.what() << endl);
57  }
58 
59  outputFile.open();
60 
61  try {
62 
63  JDB::reset(usr, pwd, cookie);
64 
65  JDetectorsHelper::initialise();
66 
67  JDatabaseObjectIterator<typelist> in(query, selection);
68 
69  in >> outputFile;
70  }
71  catch(const exception& error) {
72  FATAL(error.what() << endl);
73  }
74 
75  outputFile.close();
76 }
JFileRecorder.hh
JMessage.hh
JSelector.hh
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:63
JDBToolkit.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
JDB.hh
debug
int debug
debug level
Definition: JSirene.cc:59
main
int main(int argc, char **argv)
Definition: JConvertDB.cc:24
JSupport.hh
JLANG::JTypeList
Type list.
Definition: JTypeList.hh:22
JDBincludes.hh
JDETECTOR::reset
void reset(JCLBInput &data, size_t size)
Reset CLB buffers.
Definition: JCLBSimulator.hh:41
JParser.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
JDatabaseObjectIterator.hh
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37
JPARSER::not_initialised
Empty structure for specification of parser element that is not initialised (i.e.
Definition: JParser.hh:69