Jpp  master_rocky-43-ge265d140c
the software that should make you happy
Functions
JConvertDB.cc File Reference

Auxiliary program to convert data from data base into ROOT format. More...

#include <iostream>
#include <iomanip>
#include "dbclient/KM3NeTDBClient.h"
#include "JDB/JDB.hh"
#include "JDB/JDBToolkit.hh"
#include "JDB/JSelector.hh"
#include "JDB/JSupport.hh"
#include "JDB/JDBincludes.hh"
#include "JDB/JDatabaseObjectIterator.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JMeta.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to convert data from data base into ROOT format.

Author
mdejong

Definition in file JConvertDB.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 25 of file JConvertDB.cc.

26 {
27  using namespace std;
28  using namespace JPP;
29 
30  typedef JDBTypes_t typelist;
31 
33  JServer server;
34  string usr;
35  string pwd;
36  string cookie;
37  string query;
38  JSelector selection;
39  int debug;
40 
41  try {
42 
43  JParser<> zap("Auxiliary program to convert data from data base into ROOT format.");
44 
45  zap['o'] = make_field(outputFile);
46  zap['s'] = make_field(server) = getServernames();
47  zap['u'] = make_field(usr) = "";
48  zap['!'] = make_field(pwd) = "";
49  zap['C'] = make_field(cookie) = "";
50  zap['q'] = make_field(query) = getQueries<typelist>();
51  zap['@'] = make_field(selection) = JPARSER::initialised();
52  zap['d'] = make_field(debug) = 1;
53 
54  zap['q'] = JPARSER::not_initialised();
55 
56  zap(argc, argv);
57  }
58  catch(const exception &error) {
59  FATAL(error.what() << endl);
60  }
61 
62 
63  try {
64 
65  JDB::reset(usr, pwd, cookie);
66 
67  JDBToolkit::initialise(getDetector);
68 
69  JDatabaseObjectIterator<typelist> in(query, selection);
70 
71  outputFile.open();
72 
73  outputFile.put(JMeta(argc, argv));
74 
75  in >> outputFile;
76 
77  outputFile.close();
78  }
79  catch(const exception& error) {
80  FATAL(error.what() << endl);
81  }
82 }
string outputFile
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Object iteration from database.
Auxiliary class for specifying selection of database data.
Utility class to parse command line options.
Definition: JParser.hh:1698
Object writing to file.
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
Definition: JDBToolkit.hh:378
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition: JDB.hh:107
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
void reset(T &value)
Reset value.
Definition: JSTDTypes.hh:14
Wrapper class for server name.
Definition: JDB.hh:53
Type list.
Definition: JTypeList.hh:23
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:68
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
Definition: JParser.hh:74
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:72