#include #include #include #include #include #include "JDAQ/JDAQEventIO.hh" #include "JSupport/JMultipleFileScanner.hh" #include "JSupport/JSupport.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to count event data. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; using namespace KM3NETDAQ; JMultipleFileScanner inputFile; JLimit_t& numberOfEvents = inputFile.getLimit(); int debug; try { JParser<> zap("Example program to count event data."); zap['f'] = make_field(inputFile); zap['n'] = make_field(numberOfEvents) = JLimit::max(); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception& error) { FATAL(error.what() << endl); } struct counter_type { counter_type() : trigger (0), snapshot() {} int trigger; int snapshot; }; map counter; while (inputFile.hasNext()) { STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl); JDAQEvent* event = inputFile.next(); { typedef JDAQTriggeredHit JHit_t; for (JDAQEvent::const_iterator hit = event->begin(); hit != event->end(); ++hit) { counter[hit->getModuleID()].trigger += 1; } } { typedef JDAQSnapshotHit JHit_t; for (JDAQEvent::const_iterator hit = event->begin(); hit != event->end(); ++hit) { counter[hit->getModuleID()].snapshot += 1; } } } STATUS(endl); for (map::const_iterator i = counter.begin(); i != counter.end(); ++i) { cout << setw(10) << i->first << ' ' << setw (8) << i->second.trigger << ' ' << setw (8) << i->second.snapshot << endl; } }