Jpp  19.1.0-rc.1
the software that should make you happy
Functions
JAAnetPreprocessor.cc File Reference

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

#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/MultiHead.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

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file JAAnetPreprocessor.cc.

25 {
26  using namespace std;
27  using namespace JPP;
28 
31  JLimit_t& numberOfEvents = inputFile.getLimit();
32  int debug;
33  bool filterEmptyMCH;
34  double timeOffset_ms;
35 
36  try {
37 
38  JParser<> zap("Auxiliary program to preprocess aanet files.");
39 
40  zap['f'] = make_field(inputFile);
41  zap['o'] = make_field(outputFile);
42  zap['n'] = make_field(numberOfEvents) = JLimit::max();
43  zap['d'] = make_field(debug) = 1;
44  zap['H'] = make_field(filterEmptyMCH, "Filter events without hits.");
45  zap['T'] = make_field(timeOffset_ms, "Add time offset [ms] to events.") = 0;
46 
47  zap(argc, argv);
48  }
49  catch(const exception& error) {
50  FATAL(error.what() << endl);
51  }
52 
53  outputFile.open();
54 
55  // put header
56  Head header = inputFile.getHeader();
57 
58  JMultipleFileScanner<Evt> in = inputFile;
59 
60  outputFile.put(header);
61 
62  while (in.hasNext()) {
63 
64  Evt* cur = in.next();
65 
66  if (filterEmptyMCH and cur->mc_hits.empty()) { continue; }
67 
68  if (timeOffset_ms != 0) { add_time_offset (*cur, 1.0e6 * timeOffset_ms); }
69 
70  outputFile.put(*cur);
71 
72  } // while
73 
74  outputFile.close();
75 }
string outputFile
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
Utility class to parse command line options.
Definition: JParser.hh:1714
Object writing to file.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
virtual const pointer_type & next() override
Get next element.
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...
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:21
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition: Evt.hh:48
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition: Head.hh:65
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:45