Jpp 21.0.0-rc.1-88-g0130508c4
the software that should make you happy
Loading...
Searching...
No Matches
JConvert.cc File Reference

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

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 129 of file JConvert.cc.

130{
131 using namespace std;
132 using namespace JPP;
133
134 typedef JAllTypes_t typelist;
135
137 JFileRecorder <typelist> outputFile;
138 JLimit_t& numberOfEvents = inputFile.getLimit();
141 JSelector<typelist> selector;
142 vector<JTreeParameters_t> parameters;
143 int debug;
144
145 try {
146
147 JParser<> zap("Auxiliary program to convert data formats and/or to select data.");
148
149 zap['f'] = make_field(inputFile);
150 zap['o'] = make_field(outputFile);
151 zap['n'] = make_field(numberOfEvents) = JLimit::max();
152 zap['C'] = make_field(selection,
153 "Precede name of data structure by a '+' or '-' "
154 "to add or remove data types in the output, respectively."
155 "\nROOT wildcards are accepted.") = JPARSER::initialised();
156 zap['m'] = make_field(merge, "Allow merging of files w/o Monte Carlo headers");
157 zap['r'] = make_field(selector,
158 "UTC time range") = JPARSER::initialised();
159 zap['T'] = make_field(parameters) = JPARSER::initialised();
160 zap['d'] = make_field(debug) = 1;
161
162 zap(argc, argv);
163 }
164 catch(const exception& error) {
165 FATAL(error.what() << endl);
166 }
167
168 for (const auto& i : parameters) {
170 }
171
172 outputFile.open();
173
174 outputFile.put(JMeta(argc,argv));
175
176 inputFile | JValve<typelist>(selection) | selector | outputFile;
177
178 outputFile.close();
179}
string outputFile
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2140
Auxiliary class for selection of data type.
Definition JValve.hh:23
Utility class to parse command line options.
Definition JParser.hh:1697
General purpose class for object reading from a list of file names.
void for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist)
For each data type method.
Definition JTypeList.hh:414
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::set< JROOTClassSelector > getROOTClassSelection(const bool option=false)
Get ROOT class selection.
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:67
Auxiliary class for ROOT class selection.
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72