Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
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

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 
63  double v0 = numeric_limits<double>::lowest();
64  JDAQEventHeader h0;
65 
66  while (in.hasNext()) {
67 
68  const JDAQEvent* tev = in.next();
69 
70  DEBUG(*tev);
71 
72  const double v1 = getDAQValue(*tev);
73 
74  cout << "event "
75  << setw(8) << in.getCounter() << ' '
76  << setw(6) << tev->getFrameIndex() << ' '
77  << setw(6) << tev->getCounter() << ' '
78  << FIXED(20,10) << v1 << ' ';
79 
80  if (v0 != numeric_limits<double>::lowest()) {
81  cout << SCIENTIFIC(20,10) << (v1 - v0) << ' ';
82  }
83 
84  cout << endl;
85 
86  if (option) {
87 
88  if (v0 != numeric_limits<double>::lowest()) {
89  ASSERT(tev->getDetectorID() == h0.getDetectorID());
90  ASSERT(tev->getRunNumber() == h0.getRunNumber());
91  ASSERT((tev->getFrameIndex() > h0.getFrameIndex()) ||
92  (tev->getFrameIndex() == h0.getFrameIndex() && tev->getCounter() > h0.getCounter()));
93  }
94  }
95 
96  v0 = v1;
97  h0 = tev->getDAQEventHeader();
98  }
99 }
Utility class to parse command line options.
Definition: JParser.hh:1711
static const JDAQEvaluator getDAQValue
Function object for evaluation of DAQ objects.
int getDetectorID() const
Get detector identifier.
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
int getRunNumber() const
Get run number.
Template definition for direct access of elements in ROOT TChain.
int getFrameIndex() const
Get frame index.
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
#define FATAL(A)
Definition: JMessage.hh:67
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:486
const JDAQEventHeader & getDAQEventHeader() const
Get DAQ event header.
JTriggerCounter_t getCounter() const
Get trigger counter.
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62