Jpp  17.2.1-pre0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  cout.tie(&cerr);
45 
46  unsigned int overlays = 0;
47  counter_type index = -1;
48 
49  while (inputFile.hasNext()) {
50 
51  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
52 
53  const JDAQEvent* event = inputFile.next();
54 
55  if (event->getOverlays() > overlays) {
56  overlays = event->getOverlays();
57  index = inputFile.getCounter() - 1;
58  }
59 
60  }
61  STATUS(endl);
62 
63  cout << "Largest number of overlays " << overlays << endl;
64  cout << "JConvert -f " << inputFile.getFilename() << " -n " << index << ":1" << endl;
65 }
Utility class to parse command line options.
Definition: JParser.hh:1517
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings of various packages.
#define STATUS(A)
Definition: JMessage.hh:63
Long64_t counter_type
Type definition for counter.
Scanning of objects from a single file according a format that follows from the extension of each fil...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
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