Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
JPrintLargestOverlay.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
6 #include "JDAQ/JDAQEventIO.hh"
7 
9 #include "JSupport/JSupport.hh"
10 
11 #include "Jeep/JParser.hh"
12 #include "Jeep/JMessage.hh"
13 
14 
15 /**
16  * \file
17  *
18  * Example program to find the largest event in a file.
19  * \author lnauta
20  */
21 int main(int argc, char **argv)
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 }
General purpose messaging.
#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
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
int main(int argc, char **argv)
Scanning of objects from a single file according a format that follows from the extension of each fil...
ROOT TTree parameter settings of various packages.
Utility class to parse command line options.
Definition: JParser.hh:1698
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