Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JPrintDAQHeader.cc
Go to the documentation of this file.
1
2#include <string>
3#include <iostream>
4#include <iomanip>
5
8#include "JDAQ/JDAQEventIO.hh"
12#include "JSupport/JSupport.hh"
14
15#include "Jeep/JPrint.hh"
16#include "Jeep/JParser.hh"
17#include "Jeep/JMessage.hh"
18
19/**
20 * \file
21 *
22 * Auxiliary program to print DAQ header data.
23 * \author mdejong
24 */
25int main(int argc, char **argv)
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}
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
int main(int argc, char **argv)
I/O formatting auxiliaries.
ROOT TTree parameter settings of various packages.
Auxiliary class for multiplexing object iterators.
virtual bool hasNext() override
Check availability of next element.
Utility class to parse command line options.
Definition JParser.hh:1698
General purpose class for object reading from a list of file names.
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).
Long64_t counter_type
Type definition for counter.
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39