Jpp  15.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JSummaryMonitor.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
9 #include "JSupport/JSupport.hh"
10 #include "JTools/JQuantile.hh"
11 
12 #include "Jeep/JPrint.hh"
13 #include "Jeep/JParser.hh"
14 #include "Jeep/JMessage.hh"
15 
16 
17 /**
18  * \file
19  *
20  * Auxiliary program to monitor summary data.
21  * \author mdejong
22  */
23 int main(int argc, char **argv)
24 {
25  using namespace std;
26  using namespace JPP;
27  using namespace KM3NETDAQ;
28 
30  JLimit_t& numberOfEvents = inputFile.getLimit();
31  int qaqc;
32  int debug;
33 
34  try {
35 
36  JParser<> zap("Auxiliary program to monitor summary data.");
37 
38  zap['f'] = make_field(inputFile);
39  zap['n'] = make_field(numberOfEvents) = JLimit::max();
40  zap['Q'] = make_field(qaqc) = 0;
41  zap['d'] = make_field(debug) = 1;
42 
43  zap(argc, argv);
44  }
45  catch(const exception &error) {
46  FATAL(error.what() << endl);
47  }
48 
49 
50  JQuantile Q1("DAQ ");
51  JQuantile Q2("WR ");
52  JQuantile Q3("High-rate veto");
53  JQuantile Q4("FIFO ");
54  JQuantile Q5("PMT ");
55  JQuantile Q6("Rate [Hz] ");
56 
57  while (inputFile.hasNext()) {
58 
59  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
60 
61  JDAQSummaryslice* summaryslice = inputFile.next();
62 
63  int numberOfPTMs = 0;
64 
65  for (JDAQSummaryslice::const_iterator frame = summaryslice->begin(); frame != summaryslice->end(); ++frame) {
66 
67  Q1.put(frame->testDAQStatus() ? 1.0 : 0.0);
68  Q2.put(frame->testWhiteRabbitStatus() ? 1.0 : 0.0);
69 
70  Q3.put((double) frame->countHighRateVeto() / (double) NUMBER_OF_PMTS);
71  Q4.put((double) frame->countFIFOStatus() / (double) NUMBER_OF_PMTS);
72 
73  for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
74 
75  if (frame->getValue(pmt) != 0) {
76  ++numberOfPTMs;
77  }
78 
79  if (!frame->testHighRateVeto(pmt) &&
80  !frame->testFIFOStatus (pmt)) {
81  Q6.put(frame->getRate(pmt));
82  }
83  }
84  }
85 
86  Q5.put((double) numberOfPTMs);
87  }
88  STATUS(endl);
89 
90  for (const JQuantile* p : { &Q1, &Q2, &Q3, &Q4, &Q5, &Q6}) {
91  STATUS(*p);
92  }
93 
94  QAQC(""
95  << FIXED(7,5) << Q1.getMean() << ' '
96  << FIXED(7,5) << Q2.getMean() << ' '
97  << FIXED(7,5) << Q3.getMean() << ' '
98  << FIXED(7,5) << Q4.getMean() << ' '
99  << FIXED(8,1) << Q5.getMean() << ' '
100  << FIXED(7,0) << Q6.getMean() << ' '
101  << FIXED(7,0) << Q6.getSTDev() << endl);
102 }
Utility class to parse command line options.
Definition: JParser.hh:1500
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings of various packages.
double getSTDev() const
Get standard deviation.
Definition: JQuantile.hh:266
Auxiliary data structure for running average, standard deviation and quantiles.
Definition: JQuantile.hh:43
#define STATUS(A)
Definition: JMessage.hh:63
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
double getMean() const
Get mean value.
Definition: JQuantile.hh:252
Scanning of objects from a single file according a format that follows from the extension of each fil...
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
I/O formatting auxiliaries.
Auxiliaries for creation of summary data.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
void put(const double x, const double w=1.0)
Put value.
Definition: JQuantile.hh:133
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
#define QAQC(A)
QA/QC output macro.
Definition: JMessage.hh:100
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
Object reading from a list of files.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
int qaqc
QA/QC file descriptor.