#include "km3net-dataformat/offline/Head.hh" #include "km3net-dataformat/offline/MultiHead.hh" #include "km3net-dataformat/offline/Evt.hh" #include "JAAnet/JAAnetToolkit.hh" #include "JSupport/JMultipleFileScanner.hh" #include "JSupport/JFileRecorder.hh" #include "JSupport/JMonteCarloFileSupportkit.hh" #include "JSupport/JSupport.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" #include "JSupport/JMeta.hh" /** * \file * Auxiliary program to preprocess an aanet file.\n * Currently it provide support for the suppression of empty events from a file, but implementation of other options is encouraged. * \author mlincetto */ int main(int argc, char **argv) { using namespace std; using namespace JPP; JMultipleFileScanner inputFile; JFileRecorder outputFile; JLimit_t& numberOfEvents = inputFile.getLimit(); int debug; bool filterEmptyMCH; double timeOffset_ms; try { JParser<> zap("Auxiliary program to preprocess aanet files."); zap['f'] = make_field(inputFile); zap['o'] = make_field(outputFile); zap['n'] = make_field(numberOfEvents) = JLimit::max(); zap['d'] = make_field(debug) = 1; zap['H'] = make_field(filterEmptyMCH, "Filter events without hits."); zap['T'] = make_field(timeOffset_ms, "Add time offset [ms] to events.") = 0; zap(argc, argv); } catch(const exception& error) { FATAL(error.what() << endl); } outputFile.open(); // put header Head header = inputFile.getHeader(); JMultipleFileScanner in = inputFile; outputFile.put(header); while (in.hasNext()) { Evt* cur = in.next(); if (filterEmptyMCH and cur->mc_hits.empty()) { continue; } if (timeOffset_ms != 0) { add_time_offset (*cur, 1.0e6 * timeOffset_ms); } outputFile.put(*cur); } // while outputFile.close(); }