272{
275
277
278 std::string inputFile;
280 JSplit numberOfFiles;
281 ranges_type ranges;
284
285 try {
286
287 JParser<> zap(
"Auxiliary program to split DAQ data into multiple output files.");
288
295 "Precede name of data structure by a '+' or '-' "
296 "to add or remove data types in the output, respectively."
299
300 zap(argc, argv);
301 }
302 catch(const exception& error) {
303 FATAL(error.what() << endl);
304 }
305
306
307 if ((numberOfFiles.total == 0 && ranges.empty()) ||
308 (numberOfFiles.total != 0 && !ranges.empty())) {
309 FATAL(
"Invalid splitting " << numberOfFiles <<
' ' << ranges.size() <<
"; use either option -N or -r." << endl);
310 }
311
313
314 if (pos == string::npos) {
316 }
317
320
322 FATAL(
"No (valid) summary or event data in input file " << inputFile <<
' ' << total << endl);
323 }
324
325 NOTICE(
"Total UTC time range " << total << endl);
326
327 if (!ranges.empty()) {
328
329 sort(ranges.begin(), ranges.end(), compare);
330
331 } else {
332
334
335 for (
long double t1 = total.
getLowerLimit().getTimeNanoSecond(); t1 < (
long double) total.
getUpperLimit().getTimeNanoSecond(); t1 += T_ns) {
337 }
338 }
339
340
341 JCopyMaster<JDAQTypes_t>::debug =
debug;
342
343 JCopyMaster<JDAQTypes_t> master(inputFile, selection);
344
345 const int width = (int) (log10(ranges.size() + 1) + 1);
346
347 for (size_t i = 0; i != ranges.size(); ++i) {
348
349 if (numberOfFiles.index == numberOfFiles.invalid || numberOfFiles.index == i) {
350
352
353 STATUS(
"Writing " << file_name <<
' ' << ranges[i] <<
"... " << flush);
354
355 master.open(file_name.c_str());
356
357 master.put(
JMeta(argc, argv));
358
359 try {
361 }
362 catch(const exception& error) {}
363
364 master.copy(ranges[i]);
365
366 master.close();
367
369 }
370 }
371}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_STRING(A)
Make string.
Utility class to parse command line options.
Data structure for UTC time.
static double getTick()
Get number of nano-seconds per tick.
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.
JTOOLS::JRange< JDAQUTCExtended > JDAQUTCTimeRange
Type definition for DAQ UTC time range.
JDAQUTCTimeRange getUTCTimeRange()
Get UTC time range.
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.
static const char WILDCARD
double getTimeDifference(const JDAQChronometer &first, const JDAQChronometer &second)
Get time difference between two chronometers.
Auxiliary data structure for sequence of same character.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for ROOT class selection.