Jpp
JPrintDAQHeader.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
6 #include "JDAQ/JDAQHeader.hh"
7 #include "JDAQ/JDAQTimeslice.hh"
8 #include "JDAQ/JDAQEvent.hh"
12 #include "JSupport/JSupport.hh"
13 
14 #include "Jeep/JPrint.hh"
15 #include "Jeep/JParser.hh"
16 #include "Jeep/JMessage.hh"
17 
18 /**
19  * \file
20  *
21  * Auxiliary program to print DAQ header data.
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<JDAQTypes_t> inputFile;
31  JLimit_t& numberOfEvents = inputFile.getLimit();
32  int debug;
33 
34  try {
35 
36  JParser<> zap("Auxiliary program to print DAQ header data.");
37 
38  zap['f'] = make_field(inputFile, "input file.");
39  zap['n'] = make_field(numberOfEvents) = 1;
40  zap['d'] = make_field(debug, "debug flag.") = 1;
41 
42  zap(argc, argv);
43  }
44  catch(const exception &error) {
45  FATAL(error.what() << endl);
46  }
47 
48 
49  JObjectMultiplexer<JDAQTypes_t, JDAQHeader> in(inputFile);
50 
51  JDAQHeader header;
52 
53  int numberOfErrors = 0;
54  counter_type counter = 0;
55 
56  for ( ; in.hasNext() && counter != inputFile.getLimit(); ++counter) {
57 
58  const JDAQHeader* p = in.next();
59 
60  if (counter == 0)
61  header = *p;
62  else if (header.getDetectorID() != p->getDetectorID() ||
63  header.getRunNumber () != p->getRunNumber ())
64  ++numberOfErrors;
65  }
66 
67  if (inputFile.getLimit() > 1) {
68  ASSERT(numberOfErrors == 0);
69  }
70 
71  if (counter > 0)
72  cout << header << endl;
73  else
74  FATAL("No header.");
75 
76  return 0;
77 }
JMessage.hh
ASSERT
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
JPrint.hh
KM3NETDAQ::JDAQHeader
DAQ header.
Definition: JDAQHeader.hh:24
JSUPPORT::JLimit_t
JLimit JLimit_t
Type definition of limit.
Definition: JLimit.hh:215
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JDAQTimeslice.hh
KM3NETDAQ::JDAQChronometer::getDetectorID
int getDetectorID() const
Get detector identifier.
Definition: JDAQChronometer.hh:110
JDAQSummaryslice.hh
JSupport.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
JSUPPORT::JLimit::getLimit
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
JDAQHeader.hh
JObjectMultiplexer.hh
JMultipleFileScanner.hh
JParser.hh
KM3NETDAQ::JDAQChronometer::getRunNumber
int getRunNumber() const
Get run number.
Definition: JDAQChronometer.hh:121
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
KM3NETDAQ
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
main
int main(int argc, char **argv)
Definition: JPrintDAQHeader.cc:24
JDAQEvent.hh
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JROOT::counter_type
Long64_t counter_type
Type definition for counter.
Definition: JCounter.hh:24