Jpp 20.0.0-27-g39925593c-D
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
21namespace {
22
23 using JTOOLS::JRange;
24 using JACOUSTICS::JEvt;
25
26 /**
27 * Auxiliary data structure for veto of acoustics events.
28 */
29 struct veto_type :
30 public std::vector< JRange<double> >
31 {
32 /**
33 * Apply veto to given acoustics event.
34 *
35 * \param evt acoustics event
36 * \return true if vetoed; else false
37 */
38 bool operator()(const JEvt& evt) const
39 {
40 for (const_iterator i = this->begin(); i != this->end(); ++i) {
41 if ((*i)(evt.UNIXTimeStart) || (*i)(evt.UNIXTimeStop)) {
42 return true;
43 }
44 }
45
46 return false;
47 }
48 };
49}
50
51/**
52 * \file
53 *
54 * Auxiliary program to filter acoustic fit results.
55 * \author mdejong
56 */
57int main(int argc, char **argv)
58{
59 using namespace std;
60 using namespace JPP;
61
62
64 JLimit_t& numberOfEvents = inputFile.getLimit();
67 int debug;
68
69 try {
70
71 JParser<> zap("Auxiliary program to filter acoustic fit results.");
72
73 zap['f'] = make_field(inputFile, "input file (output of JKatoomba[.sh])");
74 zap['n'] = make_field(numberOfEvents) = JLimit::max();
75 zap['o'] = make_field(outputFile) = "pinnacles.root";
76 zap['V'] = make_field(veto, "veto acoustics events by UTC time ranges [s]");
77 zap['d'] = make_field(debug) = 2;
78
79 zap(argc, argv);
80 }
81 catch(const exception &error) {
82 FATAL(error.what() << endl);
83 }
84
85
86 outputFile.open();
87
89
90 while (inputFile.hasNext()) {
91
92 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
93
94 const JEvt* evt = inputFile.next();
95
96 if (!veto(*evt)) {
97 outputFile.put(*evt);
98 }
99 }
100
101 outputFile.close();
102}
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:57
Auxiliary class to define a range between two values.
Template definition of a multi-dimensional oscillation probability interpolation table.
Range of values.
Definition JRange.hh:42
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 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