Jpp  debug
the software that should make you happy
Functions
JPrintLargestOverlay.cc File Reference

Example program to find the largest event in a file. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDAQ/JDAQEventIO.hh"
#include "JSupport/JSingleFileScanner.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

Example program to find the largest event in a file.

Author
lnauta

Definition in file JPrintLargestOverlay.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 21 of file JPrintLargestOverlay.cc.

22 {
23  using namespace std;
24  using namespace JPP;
25  using namespace KM3NETDAQ;
26 
28  int debug;
29 
30  try {
31 
32  JParser<> zap("Example program to find the largest event in a file.");
33 
34  zap['f'] = make_field(inputFile);
35  zap['d'] = make_field(debug) = 1;
36 
37  zap(argc, argv);
38  }
39  catch(const exception& error) {
40  FATAL(error.what() << endl);
41  }
42 
43 
44  unsigned int overlays = 0;
45  counter_type index = -1;
46 
47  while (inputFile.hasNext()) {
48 
49  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
50 
51  const JDAQEvent* event = inputFile.next();
52 
53  if (event->getOverlays() > overlays) {
54  overlays = event->getOverlays();
55  index = inputFile.getCounter() - 1;
56  }
57 
58  }
59  STATUS(endl);
60 
61  cout << "Largest number of overlays " << overlays << endl;
62  cout << "JConvert -f " << inputFile.getFilename() << " -n " << index << ":1" << endl;
63 }
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#define STATUS(A)
Definition: JMessage.hh:63
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
Utility class to parse command line options.
Definition: JParser.hh:1714
Object reading from a list of files.
virtual const pointer_type & next() override
Get next element.
virtual bool hasNext() override
Check availability of next element.
counter_type getCounter() const
Get counter.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Long64_t counter_type
Type definition for counter.
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
Definition: JSTDTypes.hh:14