Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JSuperEvt.hh
Go to the documentation of this file.
1#ifndef __JACOUSTICS__JSUPEREVT__
2#define __JACOUSTICS__JSUPEREVT__
3
4#include <string>
5#include <ostream>
6#include <iomanip>
7#include <vector>
8
9#include <TObject.h>
10
11#include "JLang/JManip.hh"
12#include "JIO/JSerialisable.hh"
13#include "JIO/JSTDIO.hh"
14#include "JAcoustics/JEvt.hh"
15
16
17/**
18 * \file
19 *
20 * Acoustic event fit.
21 * \author mdejong
22 */
23namespace JACOUSTICS {}
24namespace JPP { using namespace JACOUSTICS; }
25
26namespace JACOUSTICS {
27
29 using JIO::JReader;
30 using JIO::JWriter;
31
32 /**
33 * Acoustic super event fit.
34 */
35 struct JSuperEvt :
36 public virtual JSerialisable,
37 public JEvt
38 {
39 /**
40 * Default constructor.
41 */
43 JEvt()
44 {}
45
46
47 /**
48 * Constructor.
49 *
50 * \param event event
51 */
52 JSuperEvt(const JEvt& event) :
53 JEvt(event)
54 {}
55
56
57 /**
58 * Acoustics emission.
59 */
60 struct tx_t {
61 tx_t() :
62 id (-1),
63 counter(-1),
64 toe (0.0)
65 {}
66
67 tx_t(const int id,
68 const int counter,
69 const double toe) :
70 id (id),
72 toe (toe)
73 {}
74
75
76 /**
77 * Read emission from input.
78 *
79 * \param in reader
80 * \param object emission
81 * \return reader
82 */
83 friend inline JReader& operator>>(JReader& in, tx_t& object)
84 {
85 in >> object.id;
86 in >> object.counter;
87 in >> object.toe;
88
89 return in;
90 }
91
92
93 /**
94 * Write emission to output.
95 *
96 * \param out writer
97 * \param object emission
98 * \return writer
99 */
100 friend inline JWriter& operator<<(JWriter& out, const tx_t& object)
101 {
102 out << object.id;
103 out << object.counter;
104 out << object.toe;
105
106 return out;
107 }
108
109 int id;
111 double toe;
112 };
113
114 /**
115 * Acoustics transmission.
116 */
117 struct rx_t {
119 id (-1),
120 counter(-1),
121 string (-1),
122 floor (-1),
123 toa (0.0),
124 weight (0.0)
125 {}
126
127 rx_t(const int id,
128 const int counter,
129 const int string,
130 const int floor,
131 const double toa,
132 const double weight) :
133 id (id),
135 string (string),
136 floor (floor),
137 toa (toa),
138 weight (weight)
139 {}
140
141
142 /**
143 * Read transmission from input.
144 *
145 * \param in reader
146 * \param object transmission
147 * \return reader
148 */
149 friend inline JReader& operator>>(JReader& in, rx_t& object)
150 {
151 in >> object.id;
152 in >> object.counter;
153 in >> object.string;
154 in >> object.floor;
155 in >> object.toa;
156 in >> object.weight;
157
158 return in;
159 }
160
161
162 /**
163 * Write transmission to output.
164 *
165 * \param out writer
166 * \param object transmission
167 * \return writer
168 */
169 friend inline JWriter& operator<<(JWriter& out, const rx_t& object)
170 {
171 out << object.id;
172 out << object.counter;
173 out << object.string;
174 out << object.floor;
175 out << object.toa;
176 out << object.weight;
177
178 return out;
179 }
180
181 int id;
184 int floor;
185 double toa;
186 double weight;
187 };
188
191
194
195 /**
196 * Write super event to output.
197 *
198 * \param out output stream
199 * \param event super event
200 * \return output stream
201 */
202 friend inline std::ostream& operator<<(std::ostream& out, const JSuperEvt& event)
203 {
204 using namespace std;
205
206 out << static_cast<const JEvt&>(event);
207
208 for (JSuperEvt::tx_type::const_iterator i = event.tx.begin(); i != event.tx.end(); ++i) {
209 out << setw(2) << i->id << ' '
210 << setw(6) << i->counter << ' '
211 << FIXED(20,6) << i->toe << endl;
212 }
213
214 for (JSuperEvt::rx_type::const_iterator i = event.rx.begin(); i != event.rx.end(); ++i) {
215 out << setw(2) << i->id << ' '
216 << setw(6) << i->counter << ' '
217 << setw(4) << i->string << ' '
218 << setw(2) << i->floor << ' '
219 << FIXED(20,6) << i->toa << ' '
220 << FIXED( 5,2) << i->weight << endl;
221 }
222
223 return out;
224 }
225
226
227 /**
228 * Read from input.
229 *
230 * \param in reader
231 * \return reader
232 */
233 virtual JReader& read(JReader& in) override
234 {
235 JEvt::read(in);
236
237 in >> this->rx;
238 in >> this->tx;
239
240 return in;
241 }
242
243
244 /**
245 * Write to output.
246 *
247 * \param out writer
248 * \return writer
249 */
250 virtual JWriter& write(JWriter& out) const override
251 {
252 JEvt::write(out);
253
254 out << this->rx;
255 out << this->tx;
256
257 return out;
258 }
259
261 };
262}
263
264#endif
Acoustic event fit.
I/O manipulators.
STD extensions for binary I/O.
Interface for binary input.
Forward declaration of binary output.
Interface for binary output.
Auxiliary classes and methods for acoustic position calibration.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Acoustic event fit.
virtual JReader & read(JReader &in) override
Read from input.
virtual JWriter & write(JWriter &out) const override
Write to output.
Acoustics transmission.
Definition JSuperEvt.hh:117
friend JReader & operator>>(JReader &in, rx_t &object)
Read transmission from input.
Definition JSuperEvt.hh:149
friend JWriter & operator<<(JWriter &out, const rx_t &object)
Write transmission to output.
Definition JSuperEvt.hh:169
rx_t(const int id, const int counter, const int string, const int floor, const double toa, const double weight)
Definition JSuperEvt.hh:127
Acoustics emission.
Definition JSuperEvt.hh:60
friend JWriter & operator<<(JWriter &out, const tx_t &object)
Write emission to output.
Definition JSuperEvt.hh:100
friend JReader & operator>>(JReader &in, tx_t &object)
Read emission from input.
Definition JSuperEvt.hh:83
tx_t(const int id, const int counter, const double toe)
Definition JSuperEvt.hh:67
Acoustic super event fit.
Definition JSuperEvt.hh:38
virtual JWriter & write(JWriter &out) const override
Write to output.
Definition JSuperEvt.hh:250
virtual JReader & read(JReader &in) override
Read from input.
Definition JSuperEvt.hh:233
std::vector< tx_t > tx_type
Definition JSuperEvt.hh:189
std::vector< rx_t > rx_type
Definition JSuperEvt.hh:190
JSuperEvt()
Default constructor.
Definition JSuperEvt.hh:42
friend std::ostream & operator<<(std::ostream &out, const JSuperEvt &event)
Write super event to output.
Definition JSuperEvt.hh:202
JSuperEvt(const JEvt &event)
Constructor.
Definition JSuperEvt.hh:52
ClassDefOverride(JSuperEvt, 1)