#include #include #include #include "JDAQ/JDAQHeaderIO.hh" #include "JDAQ/JDAQTimesliceIO.hh" #include "JDAQ/JDAQEventIO.hh" #include "JDAQ/JDAQSummarysliceIO.hh" #include "JLang/JObjectMultiplexer.hh" #include "JSupport/JMultipleFileScanner.hh" #include "JSupport/JSupport.hh" #include "JROOT/JRootFileReader.hh" #include "Jeep/JPrint.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to print DAQ header data. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; using namespace KM3NETDAQ; JMultipleFileScanner inputFile; counter_type numberOfEvents; int debug; try { JParser<> zap("Auxiliary program to print DAQ header data."); zap['f'] = make_field(inputFile, "input file."); zap['n'] = make_field(numberOfEvents) = 1; zap['d'] = make_field(debug, "debug flag.") = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } JDAQHeader header; int numberOfErrors = 0; counter_type counter = 0; for (JObjectMultiplexer in(inputFile); in.hasNext() && counter != numberOfEvents; ++counter) { const JDAQHeader* p = in.next(); if (counter == 0) header = *p; else if (header.getDetectorID() != p->getDetectorID() || header.getRunNumber () != p->getRunNumber ()) ++numberOfErrors; } for (JMultipleFileScanner_t::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) { for (JRootFileReader in(i->c_str()); in.hasNext() && counter != numberOfEvents; ++counter) { const JDAQHeader* p = in.next(); if (counter == 0) header = *p; else if (header.getDetectorID() != p->getDetectorID() || header.getRunNumber () != p->getRunNumber ()) ++numberOfErrors; } } if (numberOfErrors != 0) { FATAL("Number of errors/counts " << numberOfErrors << "/" << counter << endl); } if (counter != 0) cout << header << endl; else FATAL("No header."); return 0; }