#include #include #include #include #include "JDAQ/JDAQSummarysliceIO.hh" #include "JSupport/JSingleFileScanner.hh" #include "JSummaryslice/JSummaryslice.hh" #include "JSupport/JSupport.hh" #include "JTools/JQuantile.hh" #include "Jeep/JPrint.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to monitor summary data. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; using namespace KM3NETDAQ; JSingleFileScanner inputFile; JLimit_t& numberOfEvents = inputFile.getLimit(); int qaqc; int highRateThreshold; int debug; try { JParser<> zap("Auxiliary program to monitor summary data."); zap['f'] = make_field(inputFile); zap['n'] = make_field(numberOfEvents) = JLimit::max(); zap['Q'] = make_field(qaqc) = 0; zap['t'] = make_field(highRateThreshold) = 50000; zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } JQuantile Q1("DAQ "); JQuantile Q2("WR "); JQuantile Q3("High-rate veto"); JQuantile Q4("FIFO "); JQuantile Q5("PMT "); JQuantile Q6("Rate [Hz] "); std::set frameIndexCounter; int nbOfHighRateNotFiltered = 0; int nbOfDuplicated = 0; while (inputFile.hasNext()) { STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl); JDAQSummaryslice* summaryslice = inputFile.next(); int frameIndex = summaryslice->getFrameIndex(); if (!frameIndexCounter.insert(frameIndex).second) { nbOfDuplicated += 1; } int numberOfPTMs = 0; for (JDAQSummaryslice::const_iterator frame = summaryslice->begin(); frame != summaryslice->end(); ++frame) { Q1.put(frame->testDAQStatus() ? 1.0 : 0.0); Q2.put(frame->testWhiteRabbitStatus() ? 1.0 : 0.0); Q3.put((double) frame->countHighRateVeto() / (double) NUMBER_OF_PMTS); Q4.put((double) frame->countFIFOStatus() / (double) NUMBER_OF_PMTS); for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) { if ((*frame)[pmt].is_valid()) { ++numberOfPTMs; } if (!frame->testHighRateVeto(pmt) && !frame->testFIFOStatus (pmt)) { Q6.put(frame->getRate(pmt)); // Number of PMT/Timeslices with an unfiltered rate > 50 kHz if (frame->getRate(pmt) > highRateThreshold){ nbOfHighRateNotFiltered += 1; } } } } Q5.put((double) numberOfPTMs); } STATUS(endl); for (const JQuantile* p : { &Q1, &Q2, &Q3, &Q4, &Q5, &Q6}) { STATUS(*p); } QAQC("" << FIXED(7,5) << Q1.getMean() << ' ' << FIXED(7,5) << Q2.getMean() << ' ' << FIXED(7,5) << Q3.getMean() << ' ' << FIXED(7,5) << Q4.getMean() << ' ' << FIXED(8,1) << Q5.getMean() << ' ' << FIXED(7,0) << Q6.getMean() << ' ' << FIXED(7,0) << Q6.getSTDev() << ' ' << FIXED(7,0) << nbOfHighRateNotFiltered << ' ' << FIXED(7,0) << nbOfDuplicated << endl); }