Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JPinnacles.cc
Go to the documentation of this file.
1#include <iostream>
2#include <iomanip>
3#include <vector>
4
5#include "TROOT.h"
6#include "TFile.h"
7
8#include "JAcoustics/JEvt.hh"
10
13#include "JSupport/JMeta.hh"
14
15#include "JTools/JRange.hh"
16
17#include "Jeep/JContainer.hh"
18#include "Jeep/JParser.hh"
19#include "Jeep/JMessage.hh"
20
21/**
22 * \file
23 *
24 * Auxiliary program to filter acoustic fit results.
25 * \author mdejong
26 */
27int main(int argc, char **argv)
28{
29 using namespace std;
30 using namespace JPP;
31
32 /**
33 * Auxiliary data structure for veto of acoustics events.
34 */
35 struct veto_type :
36 public vector< JRange<double> >
37 {
38 /**
39 * Apply veto to given acoustics event.
40 *
41 * \param evt acoustics event
42 * \return true if vetoed; else false
43 */
44 bool operator()(const JEvt& evt) const
45 {
46 for (const_iterator i = this->begin(); i != this->end(); ++i) {
47 if ((*i)(evt.UNIXTimeStart) || (*i)(evt.UNIXTimeStop)) {
48 return true;
49 }
50 }
51
52 return false;
53 }
54 };
55
56
58 JLimit_t& numberOfEvents = inputFile.getLimit();
61 int debug;
62
63 try {
64
65 JParser<> zap("Auxiliary program to filter acoustic fit results.");
66
67 zap['f'] = make_field(inputFile, "input file (output of JKatoomba[.sh])");
68 zap['n'] = make_field(numberOfEvents) = JLimit::max();
69 zap['o'] = make_field(outputFile) = "pinnacles.root";
70 zap['V'] = make_field(veto, "veto acoustics events by UTC time ranges [s]");
71 zap['d'] = make_field(debug) = 2;
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 while (inputFile.hasNext()) {
85
86 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
87
88 const JEvt* evt = inputFile.next();
89
90 if (!veto(*evt)) {
91 outputFile.put(*evt);
92 }
93 }
94
95 outputFile.close();
96}
Acoustic event fit.
ROOT TTree parameter settings.
Container I/O.
string outputFile
Recording of objects on file according a format that follows from the file name extension.
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
ROOT I/O of application specific meta data.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
int main(int argc, char **argv)
Definition JPinnacles.cc:27
Auxiliary class to define a range between two values.
Utility class to parse command line options.
Definition JParser.hh:1698
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.
counter_type getCounter() const
Get counter.
virtual const pointer_type & next() override
Get next element.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Acoustic event fit.
double UNIXTimeStop
stop time
double UNIXTimeStart
start time
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition JContainer.hh:42
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72