Jpp  19.0.0
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 
9 
10 #include "JDAQ/JDAQTimesliceIO.hh"
11 #include "JDAQ/JDAQEventIO.hh"
13 
15 
20 #include "JSupport/JMeta.hh"
21 #include "JSupport/JSupport.hh"
22 #include "JLang/JPipe.hh"
24 
25 #include "Jeep/JParser.hh"
26 #include "Jeep/JMessage.hh"
27 
28 
29 /**
30  * \file
31  * Auxiliary program to convert data formats and/or to select data.
32  * Possible file name extensions include ".evt" (ASCII), ".root" (ROOT) and ".dat" (binary).\n
33  * The following data structures and file name extensions are supported:
34  *
35  * <table>
36  * <tr><th> type </th><th> evt </th><th> root </th><th> dat </th></tr>
37  * <tr><td> KM3NETDAQ::JDAQEvent </td><td> </td><td> I/O </td><td> I/O </td></tr>
38  * <tr><td> KM3NETDAQ::JDAQTimeslice </td><td> </td><td> I/O </td><td> I/O </td></tr>
39  * <tr><td> KM3NETDAQ::JDAQSummaryslice </td><td> </td><td> I/O </td><td> I/O </td></tr>
40  * <tr><td> Head </td><td> I </td><td> I/O </td><td> </td></tr>
41  * <tr><td> Evt </td><td> I </td><td> I/O </td><td> </td></tr>
42  * </table>
43  *
44  * The name of the data structure following option -C should be preceded by a '+' or '-'
45  * to add or remove data types in the output, respectively.\n
46  * In this, ROOT wildcards are accepted (e.g. <tt>-C -\\\.\\*</tt> will remove all data types).
47  *
48  * \author mdejong
49  */
50 int main(int argc, char **argv)
51 {
52  using namespace std;
53  using namespace JPP;
54 
55  typedef JAllTypes_t typelist;
56 
59  JLimit_t& numberOfEvents = inputFile.getLimit();
60  JROOTClassSelection selection = getROOTClassSelection<typelist>();
62  int debug;
63 
64  try {
65 
66  JParser<> zap("Auxiliary program to convert data formats and/or to select data.");
67 
68  zap['f'] = make_field(inputFile);
69  zap['o'] = make_field(outputFile);
70  zap['n'] = make_field(numberOfEvents) = JLimit::max();
71  zap['C'] = make_field(selection,
72  "Precede name of data structure by a '+' or '-' "
73  "to add or remove data types in the output, respectively."
74  "\nROOT wildcards are accepted.") = JPARSER::initialised();
75  zap['m'] = make_field(merge, "Allow merging of files w/o Monte Carlo headers");
76  zap['d'] = make_field(debug) = 1;
77 
78  zap(argc, argv);
79  }
80  catch(const exception& error) {
81  FATAL(error.what() << endl);
82  }
83 
84 
85  outputFile.open();
86 
87  outputFile.put(JMeta(argc,argv));
88 
89  inputFile | JValve<typelist>(selection) | outputFile;
90 
91  outputFile.close();
92 }
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:1711
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:84
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:2158
Implementation of pipe operation for object iterators.
ROOT I/O of application specific meta data.
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:84
int debug
debug level