Jpp  16.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JSummaryFileRouter.cc File Reference

Program to test JSUPPORT::JSummaryFileRouter. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include "JDAQ/JDAQEventIO.hh"
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JSupport/JSingleFileScanner.hh"
#include "JSupport/JSummaryFileRouter.hh"
#include "JSupport/JSupport.hh"
#include "JTools/JQuantile.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 test JSUPPORT::JSummaryFileRouter.

Author
mdejong

Definition in file JSummaryFileRouter.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 26 of file JSummaryFileRouter.cc.

27 {
28  using namespace std;
29  using namespace JPP;
30  using namespace KM3NETDAQ;
31 
33  JLimit_t& numberOfEvents = inputFile.getLimit();
34  double rate_Hz;
35  int debug;
36 
37  try {
38 
39  JParser<> zap("Program to test router of summary data.");
40 
41  zap['f'] = make_field(inputFile);
42  zap['n'] = make_field(numberOfEvents) = JLimit::max();
43  zap['B'] = make_field(rate_Hz) = 0.0;
44  zap['d'] = make_field(debug) = 2;
45 
46  zap(argc, argv);
47  }
48  catch(const exception& error) {
49  FATAL(error.what() << endl);
50  }
51 
52  JSummaryFileRouter router(inputFile.getFilename(), rate_Hz);
53 
55 
56  while (inputFile.hasNext()) {
57 
58  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
59 
60  JDAQEvent* event = inputFile.next();
61 
62  router.update(*event);
63 
64  for (JDAQEvent::const_iterator<JDAQSnapshotHit> hit = event->begin<JDAQSnapshotHit>(); hit != event->end<JDAQSnapshotHit>(); ++hit) {
65 
66  const JDAQPMTIdentifier id(hit->getModuleID(), hit->getPMT());
67 
68  const double R = router.getRate(id);
69 
70  zmap[id].put(R);
71  }
72  }
73 
74  for (map<JDAQPMTIdentifier, JQuantile>::const_iterator i = zmap.begin(); i != zmap.end(); ++i) {
75  cout << setw(10) << i->first.getModuleID() << '.'
76  << FILL(2,'0') << i->first.getPMTAddress() << FILL() << ' '
77  << FIXED(9,2) << i->second.getMean();
78  if (i->second.getCount() > 2) {
79  cout << " +/- "
80  << FIXED(9,2) << i->second.getSTDev();
81  }
82  cout << endl;
83  }
84 }
Utility class to parse command line options.
Definition: JParser.hh:1500
DAQ key hit.
Definition: JDAQKeyHit.hh:19
#define STATUS(A)
Definition: JMessage.hh:63
Template const_iterator.
Definition: JDAQEvent.hh:68
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
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
File router for fast addressing of summary data.
int debug
debug level
Definition: JSirene.cc:63
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:43
Auxiliary data structure for sequence of same character.
Definition: JManip.hh:328
#define FATAL(A)
Definition: JMessage.hh:67
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
Object reading from a list of files.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
JTriggerCounter_t next()
Increment trigger counter.