Jpp  15.0.1-rc.1-highQE
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JConvert.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
8 
10 #include "JDAQ/JDAQEventIO.hh"
12 
14 
19 #include "JSupport/JMeta.hh"
20 #include "JSupport/JSupport.hh"
21 #include "JLang/JPipe.hh"
23 
24 #include "Jeep/JParser.hh"
25 #include "Jeep/JMessage.hh"
26 
27 
28 /**
29  * \file
30  * Auxiliary program to convert data formats.
31  * Possible file name extensions include ".evt" (ASCII), ".root" (ROOT) and ".dat" (binary).\n
32  * The following data structures and file name extensions are supported:
33  *
34  * <table>
35  * <tr><th> type </th><th> evt </th><th> root </th><th> dat </th></tr>
36  * <tr><td> KM3NETDAQ::JDAQEvent </td><td> </td><td> I/O </td><td> I/O </td></tr>
37  * <tr><td> KM3NETDAQ::JDAQTimeslice </td><td> </td><td> I/O </td><td> I/O </td></tr>
38  * <tr><td> KM3NETDAQ::JDAQSummaryslice </td><td> </td><td> I/O </td><td> I/O </td></tr>
39  * <tr><td> Head </td><td> I </td><td> I/O </td><td> </td></tr>
40  * <tr><td> Evt </td><td> I </td><td> I/O </td><td> </td></tr>
41  * </table>
42  *
43  * The name of the data structure following option -C should be preceded by a '+' or '-'
44  * to add or remove data types in the output, respectively.\n
45  * In this, ROOT wildcards are accepted (e.g. <pre>-C -\\.\\*</pre> will remove all data types).
46  *
47  * \author mdejong
48  */
49 int main(int argc, char **argv)
50 {
51  using namespace std;
52  using namespace JPP;
53 
54  typedef JAllTypes_t typelist;
55 
58  JLimit_t& numberOfEvents = inputFile.getLimit();
59  JROOTClassSelection selection = getROOTClassSelection<typelist>();
61  int debug;
62 
63  try {
64 
65  JParser<> zap("Auxiliary program to convert data formats.");
66 
67  zap['f'] = make_field(inputFile);
68  zap['o'] = make_field(outputFile);
69  zap['n'] = make_field(numberOfEvents) = JLimit::max();
70  zap['C'] = make_field(selection,
71  "Precede name of data structure by a '+' or '-' "
72  "to add or remove data types in the output, respectively."
73  "\nROOT wildcards are accepted.") = JPARSER::initialised();
74  zap['m'] = make_field(merge, "Allow merging of files w/o headers");
75  zap['d'] = make_field(debug) = 1;
76 
77  zap(argc, argv);
78  }
79  catch(const exception& error) {
80  FATAL(error.what() << endl);
81  }
82 
83 
84  outputFile.open();
85 
86  outputFile.put(JMeta(argc,argv));
87 
88  inputFile | JValve<typelist>(selection) | outputFile;
89 
90  outputFile.close();
91 }
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
ROOT TTree parameter settings of various packages.
Recording of objects on file according a format that follows from the file name extension.
Auxiliary class for ROOT class selection.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
string outputFile
Auxiliary class for selection of data type.
Type list.
Definition: JTypeList.hh:22
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
Implementation of pipe operation for object iterators.
ROOT I/O of application specific meta data.
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Scanning of objects from multiple files according a format that follows from the extension of each fi...
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73