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