Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
Functions
JDAQStatus.cc File Reference

Example program to histogram KM3NETDAQ::JDAQSummaryslice. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <limits>
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JSupport.hh"
#include "JTools/JQuantile.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to histogram KM3NETDAQ::JDAQSummaryslice.

Author
mdejong

Definition in file JDAQStatus.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file JDAQStatus.cc.

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 }
#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
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Utility class to parse command line options.
Definition: JParser.hh:1698
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