Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JGizmo/JEvt.cc File Reference

Auxiliary program for time sorting of Monte-Carlo events. More...

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/MultiHead.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JSupport/JMeta.hh"
#include "JSupport/JSupport.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JSingleFileScanner.hh"
#include "JSupport/JMonteCarloFileSupportkit.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

Auxiliary program for time sorting of Monte-Carlo events.

Author
mdejong

Definition in file JGizmo/JEvt.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 52 of file JGizmo/JEvt.cc.

53 {
54  using namespace std;
55  using namespace JPP;
56 
57  typedef typename JTYPELIST<Head, MultiHead, Evt, JMeta>::typelist typelist;
58 
59  string inputFile;
60  JLimit_t numberOfEvents;
62  int debug;
63 
64  try {
65 
66  JParser<> zap("Auxiliary program for time sorting of Monte-Carlo events.");
67 
68  zap['f'] = make_field(inputFile);
69  zap['n'] = make_field(numberOfEvents) = JLimit::max();
70  zap['o'] = make_field(outputFile);
71  zap['d'] = make_field(debug) = 1;
72 
73  zap(argc, argv);
74  }
75  catch(const exception& error) {
76  FATAL(error.what() << endl);
77  }
78 
79 
80  outputFile.open();
81 
82  outputFile.put(JMeta(argc, argv));
83 
84  vector<Evt> buffer;
85 
86  for (JSingleFileScanner<Evt> in(inputFile, numberOfEvents); in.hasNext(); ) {
87  buffer.push_back(*in.next());
88  }
89 
90  sort(buffer.begin(), buffer.end(), compare);
91 
92  for (vector<Evt>::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
93  outputFile.put(*i);
94  }
95 
97 
98  io >> outputFile;
99 
100  outputFile.close();
101 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
Object writing to file.
Utility class to parse command line options.
Definition: JParser.hh:1517
string outputFile
Type list.
Definition: JTypeList.hh:22
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
static struct JACOUSTICS::@4 compare
Auxiliary data structure to sort transmissions.
#define FATAL(A)
Definition: JMessage.hh:67
Object reading from a list of files.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
int debug
debug level