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

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 }
Utility class to parse command line options.
Definition: JParser.hh:1514
#define STATUS(A)
Definition: JMessage.hh:63
Long64_t counter_type
Type definition for counter.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
#define FATAL(A)
Definition: JMessage.hh:67
Object reading from a list of files.
int debug
debug level
JTriggerCounter_t next()
Increment trigger counter.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62