Jpp  15.0.1-rc.1-highqe
the software that should make you happy
 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 "JROOT/JRootFileReader.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 25 of file JPrintDAQHeader.cc.

26 {
27  using namespace std;
28  using namespace JPP;
29  using namespace KM3NETDAQ;
30 
32  counter_type numberOfEvents;
33  int debug;
34 
35  try {
36 
37  JParser<> zap("Auxiliary program to print DAQ header data.");
38 
39  zap['f'] = make_field(inputFile, "input file.");
40  zap['n'] = make_field(numberOfEvents) = 1;
41  zap['d'] = make_field(debug, "debug flag.") = 1;
42 
43  zap(argc, argv);
44  }
45  catch(const exception &error) {
46  FATAL(error.what() << endl);
47  }
48 
49 
50  JDAQHeader header;
51  int numberOfErrors = 0;
52  counter_type counter = 0;
53 
54  for (JObjectMultiplexer<JDAQTypes_t, JDAQHeader> in(inputFile); in.hasNext() && counter != numberOfEvents; ++counter) {
55 
56  const JDAQHeader* p = in.next();
57 
58  if (counter == 0)
59  header = *p;
60  else if (header.getDetectorID() != p->getDetectorID() ||
61  header.getRunNumber () != p->getRunNumber ())
62  ++numberOfErrors;
63  }
64 
65  for (JMultipleFileScanner_t::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) {
66 
67  for (JRootFileReader<JDAQHeader> in(i->c_str()); in.hasNext() && counter != numberOfEvents; ++counter) {
68 
69  const JDAQHeader* p = in.next();
70 
71  if (counter == 0)
72  header = *p;
73  else if (header.getDetectorID() != p->getDetectorID() ||
74  header.getRunNumber () != p->getRunNumber ())
75  ++numberOfErrors;
76  }
77  }
78 
79  if (numberOfErrors != 0) {
80  FATAL("Number of errors/counts " << numberOfErrors << "/" << counter << endl);
81  }
82 
83  if (counter != 0)
84  cout << header << endl;
85  else
86  FATAL("No header.");
87 
88  return 0;
89 }
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.
#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.
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 CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
ROOT file reader.