Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JDAQEvaluator.cc File Reference

Program to print DAQ value used for sorting entries in ROOT TTree. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <iterator>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/MultiHead.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JDAQ/JDAQEventIO.hh"
#include "JDAQ/JDAQTimesliceIO.hh"
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JDAQ/JDAQEvaluator.hh"
#include "JTrigger/JTriggerParameters.hh"
#include "JSupport/JTreeScanner.hh"
#include "JSupport/JSupport.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

Program to print DAQ value used for sorting entries in ROOT TTree.

Author
mdejong

Definition in file JDAQEvaluator.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 32 of file JDAQEvaluator.cc.

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}
#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
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
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.
JTriggerCounter_t next()
Increment 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