Jpp 20.0.0-rc.9-29-gccc23c492-D
the software that should make you happy
Loading...
Searching...
No Matches
JToA.cc
Go to the documentation of this file.
1#include <iomanip>
2#include <iostream>
3
4#include "JAcoustics/JToA.hh"
6#include "JDB/JDB.hh"
7#include "JDB/JDBToolkit.hh"
8#include "JDB/JDatabaseObjectIterator.hh"
9#include "JDB/JSelector.hh"
10#include "JDB/JSupport.hh"
11#include "JDB/JToAshort.hh"
12#include "JSupport/JFileRecorder.hh"
13#include "JSupport/JMeta.hh"
14#include "Jeep/JMessage.hh"
15#include "Jeep/JParser.hh"
16#include "dbclient/KM3NeTDBClient.h"
17
18namespace JROOT {
19
20 // make ROOT output file flat
21
22 template<> class JRootCreateFlatTree<JACOUSTICS::JToA> : public std::true_type {};
23}
24
25/**
26 * \file
27 *
28 * Auxiliary program to convert acoustics data from data base into ROOT format.
29 *
30 * Example usage :
31 * <pre>
32 * JToA -@ "minrun = 16514" \
33 * -@ "maxrun = 16514" \
34 * -@ "detid = D1ORCA015" \
35 * -o KM3NeT_00000146_00016514_toa.root
36 * </pre>
37 * \author mdejong
38 */
39int main(int argc, char** argv)
40{
41 using namespace std;
42 using namespace JPP;
43
44 JFileRecorder<JTYPELIST<JToA, JMeta>::typelist> outputFile;
45
46 JServer server;
47 string usr;
48 string pwd;
49 string cookie;
50 JSelector selection;
51 int debug;
52
53 try {
54
55 JParser<> zap("Auxiliary program to convert acoustics data from data base into ROOT format.");
56
57 // clang-format off
58 zap['o'] = make_field(outputFile);
59 zap['s'] = make_field(server) = getServernames();
60 zap['u'] = make_field(usr) = "";
61 zap['!'] = make_field(pwd) = "";
62 zap['C'] = make_field(cookie) = "";
63 zap['@'] = make_field(selection) = JPARSER::initialised();
64 zap['d'] = make_field(debug) = 1;
65 // clang-format on
66
67 zap(argc, argv);
68 }
69 catch (const exception& error) {
70 FATAL(error.what() << endl);
71 }
72
73
74 try {
75
76 JDB::reset(usr, pwd, cookie);
77
78 JDBToolkit::initialise(getDetector);
79
80 outputFile.open();
81
82 outputFile.put(JMeta(argc, argv));
83
84 JToA toa;
85
86 for (JDatabaseObjectIterator<JToAshort> in(JToAshort::getName(), selection); in.hasNext();) {
87
88 const JToAshort* p = in.next();
89
90 toa.DETID = getDetector(p->DETID);
91 toa.RUN = p->RUN;
92 toa.DOMID = p->DOMID;
93 toa.WAVEFORMID = p->EMITTERID;
94 toa.TOA_NS = p->getAbsoluteToA_ns();
95 toa.SECONDS = p->getDAQFrameSeconds();
96 toa.TICKS = p->getDAQFrameTicks();
97 toa.QUALITYFACTOR = p->QUALITYFACTOR;
98 toa.QUALITYNORMALISATION = p->QUALITYNORMALISATION;
99
100 outputFile.put(toa);
101 }
102
103 outputFile.close();
104 }
105 catch (const exception& error) {
106 FATAL(error.what() << endl);
107 }
108}
ROOT TTree parameter settings.
int main(int argc, char **argv)
Definition JToA.cc:39
Acoustic event.
Auxiliary classes and methods for acoustic position calibration.
Definition JToA.cc:18
Time-of-arrival data from acoustic piezo sensor or hydrophone.
Definition JToA.hh:28
uint32_t SECONDS
Time of Arrival, in ns (relative to Unix epoch, 1 January 1970 00:00:00 UTC)
Definition JToA.hh:37
uint32_t DOMID
DAQ run number.
Definition JToA.hh:34
int64_t TOA_NS
Unique ID of the waveform that best described the signal around TOA_NS.
Definition JToA.hh:36
uint32_t QUALITYFACTOR
The ticks (16ns) part of the DAQ frame timestamp.
Definition JToA.hh:39
uint32_t QUALITYNORMALISATION
A measure of how good the waveform match was to the signal.
Definition JToA.hh:40
int32_t WAVEFORMID
DOM unique identifeir.
Definition JToA.hh:35
int32_t DETID
Definition JToA.hh:32
int32_t RUN
detector identifier
Definition JToA.hh:33
uint32_t TICKS
The seconds part of the DAQ frame timestamp.
Definition JToA.hh:38