Jpp  15.0.0
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 <limits>
#include <set>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JDAQ/JDAQEventIO.hh"
#include "JSupport/JMultipleFileScanner.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 27 of file JPrintLargestOverlay.cc.

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
#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
#define FATAL(A)
Definition: JMessage.hh:67
General purpose class for object reading from a list of file names.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
JTriggerCounter_t next()
Increment trigger counter.