Jpp  18.2.1-ARCA-DF-PATCH
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 }
Utility class to parse command line options.
Definition: JParser.hh:1514
Q(UTCMax_s-UTCMin_s)-livetime_s
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings of various packages.
#define STATUS(A)
Definition: JMessage.hh:63
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
int getRunNumber() const
Get run number.
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Auxiliary data structure for average.
Definition: JKatoomba_t.hh:76
Utility class to parse command line options.
void put(const double x)
Put value.
Definition: JKatoomba_t.hh:101
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:84
long double getMean() const
Get mean value.
Definition: JKatoomba_t.hh:113
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62