Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
Functions
JConvert.cc File Reference

Auxiliary program to convert data formats and/or to select data. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <type_traits>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/MultiHead.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "km3net-dataformat/online/JDAQHeader.hh"
#include "km3net-dataformat/online/JDAQUTCExtended.hh"
#include "JDAQ/JDAQTimesliceIO.hh"
#include "JDAQ/JDAQEventIO.hh"
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JTrigger/JTriggerParameters.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JMonteCarloFileSupportkit.hh"
#include "JSupport/JTriggerParametersSupportkit.hh"
#include "JSupport/JMeta.hh"
#include "JSupport/JSupport.hh"
#include "JLang/JPipe.hh"
#include "JLang/JObjectSelector.hh"
#include "JROOT/JROOTClassSelector.hh"
#include "JTools/JRange.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 formats and/or to select data.

Possible file name extensions include ".evt" (ASCII), ".root" (ROOT) and ".dat" (binary).
The following data structures and file name extensions are supported:

type evt root dat
KM3NETDAQ::JDAQEvent I/O I/O
KM3NETDAQ::JDAQTimeslice I/O I/O
KM3NETDAQ::JDAQSummaryslice I/O I/O
Head I I/O
Evt I I/O

The name of the data structure following option -C should be preceded by a '+' or '-' to add or remove data types in the output, respectively.
In this, ROOT wildcards are accepted (e.g. -C -\.\* will remove all data types).

Author
mdejong

Definition in file JConvert.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 126 of file JConvert.cc.

127 {
128  using namespace std;
129  using namespace JPP;
130 
131  typedef JAllTypes_t typelist;
132 
135  JLimit_t& numberOfEvents = inputFile.getLimit();
136  JROOTClassSelection selection = getROOTClassSelection<typelist>();
137  bool& merge = JMultipleFileScanner<Head>::merge;
138  JSelector<typelist> selector;
139  int debug;
140 
141  try {
142 
143  JParser<> zap("Auxiliary program to convert data formats and/or to select data.");
144 
145  zap['f'] = make_field(inputFile);
146  zap['o'] = make_field(outputFile);
147  zap['n'] = make_field(numberOfEvents) = JLimit::max();
148  zap['C'] = make_field(selection,
149  "Precede name of data structure by a '+' or '-' "
150  "to add or remove data types in the output, respectively."
151  "\nROOT wildcards are accepted.") = JPARSER::initialised();
152  zap['m'] = make_field(merge, "Allow merging of files w/o Monte Carlo headers");
153  zap['r'] = make_field(selector) = JPARSER::initialised();
154  zap['d'] = make_field(debug) = 1;
155 
156  zap(argc, argv);
157  }
158  catch(const exception& error) {
159  FATAL(error.what() << endl);
160  }
161 
162 
163  outputFile.open();
164 
165  outputFile.put(JMeta(argc,argv));
166 
167  inputFile | JValve<typelist>(selection) | selector | outputFile;
168 
169  outputFile.close();
170 }
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
Auxiliary class for specifying selection of database data.
Auxiliary class for selection of data type.
Definition: JValve.hh:23
Utility class to parse command line options.
Definition: JParser.hh:1698
Object writing to file.
General purpose class for object reading from a list of file names.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
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
Auxiliary class for ROOT class selection.
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:45
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:72