Jpp
 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 #include <limits>
6 #include <set>
7 
8 #include "TROOT.h"
9 #include "TFile.h"
10 #include "TH1D.h"
11 
12 #include "JDAQ/JDAQEventIO.hh"
13 
15 #include "JSupport/JSupport.hh"
16 
17 #include "Jeep/JParser.hh"
18 #include "Jeep/JMessage.hh"
19 
20 
21 /**
22  * \file
23  *
24  * Example program to find the largest event in a file.
25  * \author lnauta
26  */
27 int main(int argc, char **argv)
28 {
29  using namespace std;
30  using namespace JPP;
31  using namespace KM3NETDAQ;
32 
34  int debug;
35 
36  try {
37 
38  JParser<> zap("Example program to find largest event in data.");
39 
40  zap['f'] = make_field(inputFile);
41  zap['d'] = make_field(debug) = 1;
42 
43  zap(argc, argv);
44  }
45  catch(const exception& error) {
46  FATAL(error.what() << endl);
47  }
48 
49 
50  cout.tie(&cerr);
51 
52  int overlay = 0;
53  int treeIndex = 0;
54 
55  while (inputFile.hasNext()) {
56 
57  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
58 
59  JDAQEvent* event = inputFile.next();
60 
61  int currentOverlay = event->getOverlays();
62 
63  if (currentOverlay > overlay) {
64  overlay = currentOverlay;
65  treeIndex = inputFile.getCounter();
66  }
67 
68  }
69  STATUS(endl);
70 
71  NOTICE("Largest overlay is at tree index " << treeIndex << " with overlay of " << overlay);
72  NOTICE("In JConvert use the tree index " << treeIndex-1 << " to fetch the proper event.");
73 
74 }
Utility class to parse command line options.
Definition: JParser.hh:1500
ROOT TTree parameter settings of various packages.
#define STATUS(A)
Definition: JMessage.hh:63
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
#define NOTICE(A)
Definition: JMessage.hh:64
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Scanning of objects from multiple files according a format that follows from the extension of each fi...
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
JTriggerCounter_t next()
Increment trigger counter.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
int main(int argc, char *argv[])
Definition: Main.cpp:15