Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
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

◆ main()

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 ())
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 ())
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}
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Template definition of a multi-dimensional oscillation probability interpolation table.
int getDetectorID() const
Get detector identifier.
int getRunNumber() const
Get run number.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39