Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JPrintDAQHeader.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
6 #include "JDAQ/JDAQHeaderIO.hh"
8 #include "JDAQ/JDAQEventIO.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 
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 
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 }
Utility class to parse command line options.
Definition: JParser.hh:1493
ROOT TTree parameter settings.
int getDetectorID() const
Get detector identifier.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
Long64_t counter_type
Type definition for counter.
Auxiliary class for multiplexing object iterators.
int getRunNumber() const
Get run number.
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
virtual const pointer_type & next()
Get next element.
int debug
debug level
Definition: JSirene.cc:61
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...
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
virtual bool hasNext()
Check availability of next element.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
int main(int argc, char *argv[])
Definition: Main.cpp:15