Jpp
Functions
JChecksum.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include <limits>
#include <deque>
#include "JDAQ/JDAQTimesliceIO.hh"
#include "JMath/JRandom.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JSupport.hh"
#include "JROOT/JROOTClassSelector.hh"
#include "JLang/JObjectMultiplexer.hh"
#include "JTrigger/JChecksum.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

Example program to histogram KM3NETDAQ::JDAQTimeslice.

Author
mdejong

Definition in file JChecksum.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 42 of file JChecksum.cc.

43 {
44  using namespace std;
45  using namespace JPP;
46  using namespace KM3NETDAQ;
47 
49  JLimit_t & numberOfEvents = inputFile.getLimit();
50  JROOTClassSelector selector;
51  int N;
52  int debug;
53 
54  try {
55 
56  JParser<> zap("Example program to histogram timeslice data.");
57 
58  zap['f'] = make_field(inputFile);
59  zap['n'] = make_field(numberOfEvents) = JLimit::max();
60  zap['C'] = make_field(selector) = getROOTClassSelection<JDAQTimesliceTypes_t>();
61  zap['N'] = make_field(N) = 10;
62  zap['d'] = make_field(debug) = 1;
63 
64  zap(argc, argv);
65  }
66  catch(const exception& error) {
67  FATAL(error.what() << endl);
68  }
69 
70  cout.tie(&cerr);
71 
73 
74  for (counter_type counter = 0; in.hasNext(); ++counter) {
75 
76  STATUS("event: " << setw(10) << counter << '\r'); DEBUG(endl);
77 
78  JDAQTimeslice* timeslice = in.next();
79 
80  for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
81 
82  const JChecksum::result_type result = checksum.get(*frame);
83 
84  for (JChecksum::const_iterator error = result.begin(); error != result.end(); ++error) {
85 
86  const int pmt = (*frame)[error->pos].getPMT();
87 
88  cerr << "Module "
89  << setw(10) << frame->getModuleID() << " "
90  << setw(1) << frame->testHighRateVeto(pmt) << ""
91  << setw(1) << frame->testFIFOStatus (pmt) << " "
92  << setw(2) << frame->getUDPNumberOfReceivedPackets() << "/"
93  << setw(2) << frame->getUDPMaximalSequenceNumber() << endl;
94  cerr << "Error at "
95  << setw(6) << error->pos << '/'
96  << setw(6) << frame->size() << ' '
97  << error->type << endl;
98 
99  deque<JDAQHit> buffer;
100 
101  for (int i = error->pos - 1, n = 0; i >= 0 && n <= N; --i) {
102  if ((*frame)[i].getPMT() == (*frame)[error->pos].getPMT()) {
103  buffer.push_front((*frame)[i]);
104  ++n;
105  }
106  }
107 
108  for (deque<JDAQHit>::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
109  print(cerr, *i); cerr << endl;
110  }
111 
112  print(cerr, (*frame)[error->pos]); cerr << " ***" << endl;
113 
114  for (int i = error->pos + 1, n = 0; i < frame->size() && n <= N; ++i) {
115  if ((*frame)[i].getPMT() == (*frame)[error->pos].getPMT()) {
116  print(cerr, (*frame)[i]); cerr << endl;
117  ++n;
118  }
119  }
120  }
121  }
122  }
123  STATUS(endl);
124 }
JTRIGGER::JChecksum::const_iterator
result_type::const_iterator const_iterator
Definition: JChecksum.hh:79
JSUPPORT::JLimit
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
JTOOLS::n
const int n
Definition: JPolint.hh:628
std::vector< error >
KM3NETDAQ::JDAQTimeslice
Data time slice.
Definition: JDAQTimeslice.hh:30
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JROOT::JROOTClassSelector
Auxiliary class to select ROOT class based on class name.
Definition: JROOTClassSelector.hh:32
debug
int debug
debug level
Definition: JSirene.cc:59
JTOOLS::result
return result
Definition: JPolint.hh:695
JTRIGGER::JChecksum::get
const result_type & get(const JDAQSuperFrame &frame) const
Check sum.
Definition: JChecksum.hh:98
JLANG::JObjectMultiplexer
Auxiliary class for multiplexing object iterators.
Definition: JObjectIterator.hh:35
STATUS
#define STATUS(A)
Definition: JMessage.hh:63
JTRIGGER::checksum
static const JChecksum checksum
Function object to perform check-sum of raw data.
Definition: JChecksum.hh:161
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
JSUPPORT::JMultipleFileScanner
General purpose class for object reading from a list of file names.
Definition: JMultipleFileScanner.hh:167
DEBUG
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std
Definition: jaanetDictionary.h:36
KM3NETDAQ
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
print
void print(const TH1 &h1, std::ostream &out)
Print histogram parameters.
Definition: JTriggerMonitor.cc:38
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JROOT::counter_type
Long64_t counter_type
Type definition for counter.
Definition: JCounter.hh:24