Jpp  16.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JAAnetPreprocessor.cc File Reference

Auxiliary program to preprocess an aanet file. More...

#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JAAnet/JAAnetToolkit.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JMonteCarloFileSupportkit.hh"
#include "JSupport/JSupport.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JSupport/JMeta.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to preprocess an aanet file.


Currently it provide support for the suppression of empty events from a file, but implementation of other options is encouraged.

Author
mlincetto

Definition in file JAAnetPreprocessor.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 23 of file JAAnetPreprocessor.cc.

24 {
25  using namespace std;
26  using namespace JPP;
27 
30  JLimit_t& numberOfEvents = inputFile.getLimit();
31  int debug;
32  bool filterEmptyMCH;
33  double timeOffset_ms;
34 
35  try {
36 
37  JParser<> zap("Auxiliary program to preprocess aanet files.");
38 
39  zap['f'] = make_field(inputFile);
40  zap['o'] = make_field(outputFile);
41  zap['n'] = make_field(numberOfEvents) = JLimit::max();
42  zap['d'] = make_field(debug) = 1;
43  zap['H'] = make_field(filterEmptyMCH, "Filter events without hits.");
44  zap['T'] = make_field(timeOffset_ms, "Add time offset [ms] to events.") = 0;
45 
46  zap(argc, argv);
47  }
48  catch(const exception& error) {
49  FATAL(error.what() << endl);
50  }
51 
52  outputFile.open();
53 
54  // put header
55  Head header = inputFile.getHeader();
56 
57  JMultipleFileScanner<Evt> in = inputFile;
58 
59  outputFile.put(header);
60 
61  while (in.hasNext()) {
62 
63  Evt* cur = in.next();
64 
65  if (filterEmptyMCH and cur->mc_hits.empty()) { continue; }
66 
67  if (timeOffset_ms != 0) { add_time_offset (*cur, 1.0e6 * timeOffset_ms); }
68 
69  outputFile.put(*cur);
70 
71  } // while
72 
73  outputFile.close();
74 }
Object writing to file.
Utility class to parse command line options.
Definition: JParser.hh:1500
void add_time_offset(Evt &evt, const double tOff)
Add time offset to mc event; according to current definition, the absolute time of the event is defin...
string outputFile
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:1961
int debug
debug level
Definition: JSirene.cc:63
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition: Head.hh:67
#define FATAL(A)
Definition: JMessage.hh:67
General purpose class for object reading from a list of file names.
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition: Evt.hh:45
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19