#include #include #include #include #include "km3net-dataformat/online/JDAQHit.hh" #include "JDetector/JModule.hh" #include "JDetector/JDetectorToolkit.hh" #include "JTrigger/JHit.hh" #include "JTrigger/JHitR0.hh" #include "JTrigger/JBuildL0.hh" #include "JTrigger/JDAQHitToTSelector.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to test DAQ hit selection using JTRIGGER::JBuildL0. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; using namespace KM3NETDAQ; int debug; try { JParser<> zap("Example program to test DAQ hit selection using JTRIGGER::JBuildL0."); zap['d'] = make_field(debug) = 3; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } const JModule module = getModule(1001); const JDAQHit::JTOT_t tot = 5; const JDAQHit::JTOT_t tot_min = 10; const JDAQHit::JTOT_t tot_max = 20; JDAQSuperFrame frame(JDAQSuperFrameHeader(JDAQChronometer(), module.getID())); { vector buffer; for (int i = 0; i != 100; ++i) { buffer.push_back(JDAQHit(0, 0, tot)); } frame.add(buffer.size(), buffer.data()); } ASSERT(!frame.empty()); JBuildL0 buildL0; vector buffer; buildL0(frame, module, back_inserter(buffer)); ASSERT(buffer.size() == (size_t) frame.size(), "Test of L0 hit building w/o DAQ hit selection " << buffer.size() << " ?= " << frame.size()); buildL0.setDAQHitSelector(JDAQHitToTSelector(tot_min, tot_max)); buffer.clear(); buildL0(frame, module, back_inserter(buffer)); ASSERT(buffer.size() == 0u, "Test of L0 hit building with DAQ hit selection " << buffer.size() << " ?= " << 0u); buildL0.resetDAQHitSelector(); buffer.clear(); buildL0(frame, module, back_inserter(buffer)); ASSERT(buffer.size() == (size_t) frame.size(), "Test of L0 hit building w/o DAQ hit selection " << buffer.size() << " ?= " << frame.size()); return 0; }