Jpp 20.0.0-rc.9-29-gccc23c492-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
11#include "JSupport/JMultipleFileScanner.hh"
12#include "JSupport/JFileRecorder.hh"
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
63 JMultipleFileScanner<JEvt> inputFile;
64 JLimit_t& numberOfEvents = inputFile.getLimit();
65 JFileRecorder<JTYPELIST<JEvt, JMeta>::typelist> outputFile;
66 JContainer<veto_type, vector< JRange<double> > > veto;
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
88 outputFile.put(JMeta(argc, argv));
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.
int main(int argc, char **argv)
Definition JPinnacles.cc:57
ROOT TTree parameter settings.
Acoustic event fit.
Definition JEvt.hh:310