Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JChecksum.cc File Reference

Example program to histogram KM3NETDAQ::JDAQTimeslice. More...

#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

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() << '.' << setw(2) << setfill('0') << pmt << setfill(' ') << ' '
90  << setw(6) << error->pos << '/' << setw(6) << frame->size() << ' '
91  << setw(2) << error->type << ' ';
92 
93  if (pmt < NUMBER_OF_PMTS) {
94  cerr << setw(1) << frame->testHighRateVeto(pmt)
95  << setw(1) << frame->testFIFOStatus (pmt) << ' '
96  << setw(2) << frame->getUDPNumberOfReceivedPackets() << '/'
97  << setw(2) << frame->getUDPMaximalSequenceNumber();
98  }
99  cerr << endl << endl;
100 
101  deque<JDAQHit> buffer;
102 
103  for (int i = error->pos - 1, n = 0; i >= 0 && n <= N; --i) {
104  if ((*frame)[i].getPMT() == (*frame)[error->pos].getPMT()) {
105  buffer.push_front((*frame)[i]);
106  ++n;
107  }
108  }
109 
110  for (deque<JDAQHit>::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
111  print(cerr, *i); cerr << endl;
112  }
113 
114  print(cerr, (*frame)[error->pos]);
115 
116  if (error->type != JChecksum::TIME_t)
117  cerr << " ***" << endl;
118  else
119  cerr << " <<<" << endl;
120 
121  for (int i = error->pos + 1, n = 0; i < frame->size() && n <= N; ++i) {
122  if ((*frame)[i].getPMT() == (*frame)[error->pos].getPMT()) {
123  print(cerr, (*frame)[i]); cerr << endl;
124  ++n;
125  }
126  }
127  }
128  }
129  }
130  STATUS(endl);
131 }
Utility class to parse command line options.
Definition: JParser.hh:1500
#define STATUS(A)
Definition: JMessage.hh:63
Auxiliary class to select ROOT class based on class name.
Long64_t counter_type
Type definition for counter.
result_type::const_iterator const_iterator
Definition: JChecksum.hh:77
Auxiliary class for multiplexing object iterators.
static const JChecksum checksum
Function object to perform check-sum of raw data.
Definition: JChecksum.hh:167
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
return result
Definition: JPolint.hh:727
Data time slice.
int debug
debug level
Definition: JSirene.cc:63
print
Definition: JConvertDusj.sh:44
#define FATAL(A)
Definition: JMessage.hh:67
General purpose class for object reading from a list of file names.
alias put_queue eval echo n
Definition: qlib.csh:19
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:36
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
const result_type & get(const JDAQSuperFrame &frame) const
Check sum.
Definition: JChecksum.hh:102