Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JPrintDAQHeader.cc File Reference

Auxiliary program to print DAQ header data. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDAQ/JDAQHeaderIO.hh"
#include "JDAQ/JDAQTimesliceIO.hh"
#include "JDAQ/JDAQEventIO.hh"
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JLang/JObjectMultiplexer.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JSupport.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

Auxiliary program to print DAQ header data.

Author
mdejong

Definition in file JPrintDAQHeader.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file JPrintDAQHeader.cc.

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:1500
int getDetectorID() const
Get detector identifier.
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
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
General purpose class for object reading from a list of file names.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
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 source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:36