Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JDAQEvaluator.cc
Go to the documentation of this file.
1
2#include <string>
3#include <iostream>
4#include <iomanip>
5#include <vector>
6#include <algorithm>
7#include <iterator>
8
12
13#include "JDAQ/JDAQEventIO.hh"
16#include "JDAQ/JDAQEvaluator.hh"
18
20#include "JSupport/JSupport.hh"
21
22#include "Jeep/JParser.hh"
23#include "Jeep/JMessage.hh"
24
25
26/**
27 * \file
28 *
29 * Program to print DAQ value used for sorting entries in ROOT TTree.
30 * \author mdejong
31 */
32int main(int argc, char **argv)
33{
34 using namespace std;
35 using namespace JPP;
36 using namespace KM3NETDAQ;
37
38 std::string inputFile;
39 JLimit numberOfEvents;
40 bool option;
41 int debug;
42
43 try {
44
45 JParser<> zap("Program to print DAQ value used for sorting entries in ROOT TTree.");
46
47 zap['f'] = make_field(inputFile);
48 zap['n'] = make_field(numberOfEvents) = JLimit();
49 zap['O'] = make_field(option);
50 zap['d'] = make_field(debug) = 2;
51
52 zap(argc, argv);
53 }
54 catch(const exception& error) {
55 FATAL(error.what() << endl);
56 }
57
58
60
61 JTreeScanner<JDAQEvent, JDAQEvaluator> in(inputFile, numberOfEvents);
62
64
65 while (in.hasNext()) {
66
67 const JDAQEvent* tev = in.next();
68
69 DEBUG(*tev);
70
71 if (in.getCounter() > 1) {
72
73 cout << "event "
74 << setw(8) << in.getCounter() << ' '
75 << setw(6) << tev->getFrameIndex() << ' '
76 << setw(6) << tev->getCounter() << ' '
77 << FIXED(20,10) << (getDAQValue(*tev) - getDAQValue(h0)) << endl;
78
79 if (option) {
80 ASSERT(tev->getDetectorID() == h0.getDetectorID());
81 ASSERT(tev->getRunNumber() == h0.getRunNumber());
82 ASSERT((tev->getFrameIndex() > h0.getFrameIndex()) ||
83 (tev->getFrameIndex() == h0.getFrameIndex() && tev->getCounter() > h0.getCounter()));
84 }
85 }
86
87 h0 = tev->getDAQEventHeader();
88 }
89}
int main(int argc, char **argv)
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define ASSERT(A,...)
Assert macro.
Definition JMessage.hh:90
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
ROOT TTree parameter settings of various packages.
Utility class to parse command line options.
Definition JParser.hh:1698
Template definition for direct access of elements in ROOT TChain.
int getDetectorID() const
Get detector identifier.
int getRunNumber() const
Get run number.
int getFrameIndex() const
Get frame index.
const JDAQEventHeader & getDAQEventHeader() const
Get DAQ event header.
JTriggerCounter_t getCounter() const
Get trigger counter.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
static const JDAQEvaluator getDAQValue
Function object for evaluation of DAQ objects.
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45