Jpp  19.1.0-rc.1
the software that should make you happy
JDAQStatus.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 #include <limits>
6 
8 
10 #include "JSupport/JSupport.hh"
11 #include "JTools/JQuantile.hh"
12 
13 #include "Jeep/JPrint.hh"
14 #include "Jeep/JParser.hh"
15 #include "Jeep/JMessage.hh"
16 
17 
18 /**
19  * \file
20  *
21  * Example program to histogram KM3NETDAQ::JDAQSummaryslice.
22  * \author mdejong
23  */
24 int main(int argc, char **argv)
25 {
26  using namespace std;
27  using namespace JPP;
28  using namespace KM3NETDAQ;
29 
30  JMultipleFileScanner<> inputFile;
31  JLimit_t& numberOfEvents = inputFile.getLimit();
32  int debug;
33 
34  try {
35 
36  JParser<> zap("Example program to histogram summary data.");
37 
38  zap['f'] = make_field(inputFile);
39  zap['n'] = make_field(numberOfEvents) = JLimit::max();
40  zap['d'] = make_field(debug) = 2;
41 
42  zap(argc, argv);
43  }
44  catch(const exception& error) {
45  FATAL(error.what() << endl);
46  }
47 
48 
49  for (JMultipleFileScanner<>::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) {
50 
51  int run = -1;
52  JQuantile Q[2];
53 
54  for (JMultipleFileScanner<JDAQSummaryslice> in(*i); in.hasNext(); ) {
55 
56  STATUS("event: " << setw(10) << in.getCounter() << '\r'); DEBUG(endl);
57 
58  JDAQSummaryslice* summary = in.next();
59 
60  if (run == -1) {
61  run = summary->getRunNumber();
62  }
63 
64  for (JDAQSummaryslice::const_iterator frame = summary->begin(); frame != summary->end(); ++frame) {
65 
66  if (!frame->testHighRateVeto() && !frame->testFIFOStatus()) {
67  Q[0].put(frame->getUDPNumberOfReceivedPackets() == (frame->getUDPMaximalSequenceNumber() + 1) ? 1.0 : 0.0);
68  Q[1].put(frame->hasUDPTrailer() ? 1.0 : 0.0);
69  }
70  }
71  }
72 
73  cout << setw(8) << run << ' '
74  << FIXED(6,4) << Q[0].getMean() << ' '
75  << FIXED(6,4) << Q[1].getMean() << endl;
76  }
77  STATUS(endl);
78 }
int main(int argc, char **argv)
Definition: JDAQStatus.cc:24
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#define STATUS(A)
Definition: JMessage.hh:63
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
I/O formatting auxiliaries.
ROOT TTree parameter settings of various packages.
Utility class to parse command line options.
Definition: JParser.hh:1714
virtual bool hasNext() override
Check availability of next element.
int getRunNumber() const
Get run number.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
Definition: JSTDTypes.hh:14
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:448
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:45
Auxiliary data structure for running average, standard deviation and quantiles.
Definition: JQuantile.hh:46
void put(const double x, const double w=1.0)
Put value.
Definition: JQuantile.hh:133
double getMean() const
Get mean value.
Definition: JQuantile.hh:252