#include #include #include #include "km3net-dataformat/offline/MultiHead.hh" #include "JAAnet/JHead.hh" #include "JAAnet/JAAnetDictionary.hh" #include "JSupport/JSingleFileScanner.hh" #include "JSupport/JSupport.hh" #include "JROOT/JRootPrinter.hh" #include "JROOT/JSonObjectOutput.hh" #include "JLang/JStreamObjectOutput.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * Auxiliary program to print Monte Carlo run headers. * * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; JSingleFileScanner inputFile; bool print_as_head; bool print_as_json; int debug; try { JParser<> zap("Auxiliary program to print Monte Carlo run headers."); zap['f'] = make_field(inputFile); zap['H'] = make_field(print_as_head); zap['J'] = make_field(print_as_json); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } typedef JTYPELIST::typelist typelist; typedef JObjectOutput* output_type; output_type out = (print_as_json ? (output_type) new JSonObjectOutput (cout) : (output_type) new JStreamObjectOutput(cout)); while (inputFile.hasNext()) { const MultiHead* head = inputFile.next(); for (MultiHead::const_iterator i = head->begin(); i != head->end(); ++i) { if (print_as_head) out->put(*i); else out->put(JHead(*i)); } } delete out; }