Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 #include "JDB/JDBincludes.hh"
13 #include "JSupport/JMeta.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 
61  try {
62 
63  JDB::reset(usr, pwd, cookie);
64 
65  JDBToolkit::initialise(getDetector);
66 
67  JDatabaseObjectIterator<typelist> in(query, selection);
68 
69  outputFile.open();
70 
71  outputFile.put(JMeta(argc, argv));
72 
73  in >> outputFile;
74 
75  outputFile.close();
76  }
77  catch(const exception& error) {
78  FATAL(error.what() << endl);
79  }
80 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
Object writing to file.
Utility class to parse command line options.
Definition: JParser.hh:1500
int main(int argc, char *argv[])
Definition: Main.cc:15
Object iteration from database.
Recording of objects on file according a format that follows from the file name extension.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
Auxiliary class for specifying selection of database data.
string outputFile
JDetectorsHelper getDetector
Function object for mapping serial number to object identifier of detector and vice versa...
Definition: JDBToolkit.cc:5
Type list.
Definition: JTypeList.hh:22
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
ROOT I/O of application specific meta data.
ROOT TTree parameter settings.
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
Definition: JParser.hh:72
void reset(T &value)
Reset value.
Utility class to parse command line options.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:36