Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
software/JAcoustics/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"
9#include "JDB/JSelector.hh"
10#include "JDB/JSupport.hh"
11#include "JDB/JToAshort.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
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
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
79
80 outputFile.open();
81
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();
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.
string outputFile
ROOT TTree parameter settings.
Recording of objects on file according a format that follows from the file name extension.
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
ROOT I/O of application specific meta data.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Acoustic event.
Auxiliary class for specifying selection of database data.
Template definition of a multi-dimensional oscillation probability interpolation table.
Auxiliary classes and methods for acoustic position calibration.
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition JDB.hh:108
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for ROOT I/O.
int main(int argc, char **argv)
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
static void initialise(JHelper_t &helper, const Args &...args)
Initialise.
Wrapper class for server name.
Definition JDB.hh:54
uint32_t getDAQFrameSeconds() const
get the number of seconds (since Unix epoch) of the DAQ Frame start time
Definition JToAshort.hh:52
int EMITTERID
waveform identifier
Definition JToAshort.hh:29
uint32_t getDAQFrameTicks() const
get the number of ticks (16 ns) of the DAQ Frame start time
Definition JToAshort.hh:58
static const char *const getName()
Table name.
Definition JToAshort.hh:22
std::string DETID
constraint
Definition JToAshort.hh:24
int64_t getAbsoluteToA_ns() const
return the absolute Time Of Arrival, in nanoseconds (since Unix epoch 1 January 1970 00:00:00 UTC)
Definition JToAshort.hh:40
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72