Jpp 21.0.1
the software that should make you happy
Loading...
Searching...
No Matches
JAcoustics/JTriggerParameters.hh
Go to the documentation of this file.
1#ifndef __JACOUSTICS__JTRIGGERPARAMETERS__
2#define __JACOUSTICS__JTRIGGERPARAMETERS__
3
4#include <istream>
5#include <ostream>
6#include <iomanip>
7#include <vector>
8
9#include <TROOT.h>
10#include <TObject.h>
11
12
13/**
14 * \file
15 *
16 * Acoustic trigger parameters.
17 * \author mdejong
18 */
19namespace JACOUSTICS {}
20namespace JPP { using namespace JACOUSTICS; }
21
22namespace JACOUSTICS {
23
24
25 /**
26 * Emitter parameters.
27 */
29 /**
30 * Default constructor.
31 */
33 id(-1),
34 Q(0.0),
35 TMax_s(0.0),
37 {}
38
39
40 /**
41 * Constructor.
42 *
43 * \param id emitter identifier
44 * \param Q minimal quality factor
45 * \param TMax_s maximal difference between times of emission [s]
46 * \param numberOfHits minimum number of hits
47 */
48 JEmitterParameters(const int id,
49 const double Q,
50 const double TMax_s,
51 const int numberOfHits) :
52 id(id),
53 Q(Q),
56 {}
57
58
59 /**
60 * Virtual destructor.
61 */
63 {}
64
65
66 /**
67 * Read emitter parameters from input stream.
68 *
69 * \param in input stream
70 * \param parameters parameters
71 * \return input stream
72 */
73 friend inline std::istream& operator>>(std::istream& in, JEmitterParameters& parameters)
74 {
75 return in >> parameters.id >> parameters.Q >> parameters.TMax_s >> parameters.numberOfHits;
76 }
77
78
79 /**
80 * Write emitter parameters to output stream.
81 *
82 * \param out output stream
83 * \param parameters parameters
84 * \return output stream
85 */
86 friend inline std::ostream& operator<<(std::ostream& out, const JEmitterParameters& parameters)
87 {
88 return out << parameters.id << ' ' << parameters.Q << ' ' << parameters.TMax_s << ' ' << parameters.numberOfHits;
89 }
90
91
92 int id; ///< emitter identifier
93 double Q; ///< minimal quality if larger than one; else minimal normalised quality
94 double TMax_s; ///< maximal difference between times of emission [s]
95 int numberOfHits; ///< minimal number of hits to trigger event
96
98 };
99
100
101 /**
102 * Trigger parameters.
103 */
105 public TObject
106 {
107 /**
108 * Default constructor.
109 */
111 Q(0.0),
112 TMax_s(0.0),
113 numberOfHits(0)
114 {}
115
116
117 /**
118 * Virtual destructor.
119 */
121 {}
122
123
124 /**
125 * Get emitter parameters.
126 *
127 * \param id emitter identifier
128 * \return parameters
129 */
130 JEmitterParameters operator[](const int id) const
131 {
132 for (const auto& i : emitter) {
133 if (i.id == id) {
134 return i;
135 }
136 }
137
138 return JEmitterParameters(id, this->Q, this->TMax_s, this->numberOfHits);
139 }
140
142
143 double Q; ///< minimal quality if larger than one; else minimal normalised quality
144 double TMax_s; ///< maximal difference between times of emission [s]
145 int numberOfHits; ///< minimal number of hits to trigger event
146
148 };
149}
150
151
152/**
153 * Read parameters from input stream.
154 *
155 * \param in input stream
156 * \param parameters parameters
157 * \return input stream
158 */
159std::istream& operator>>(std::istream& in, JACOUSTICS::JTriggerParameters& parameters);
160
161
162/**
163 * Write parameters to output stream.
164 *
165 * \param out output stream
166 * \param parameters parameters
167 * \return output stream
168 */
169std::ostream& operator<<(std::ostream& out, const JACOUSTICS::JTriggerParameters& parameters);
170
171#endif
std::ostream & operator<<(std::ostream &out, const JACOUSTICS::JTriggerParameters &parameters)
Write parameters to output stream.
std::istream & operator>>(std::istream &in, JACOUSTICS::JTriggerParameters &parameters)
Read parameters from input stream.
Auxiliary classes and methods for acoustic position calibration.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double Q
minimal quality if larger than one; else minimal normalised quality
friend std::istream & operator>>(std::istream &in, JEmitterParameters &parameters)
Read emitter parameters from input stream.
virtual ~JEmitterParameters()
Virtual destructor.
ClassDef(JEmitterParameters, 1)
friend std::ostream & operator<<(std::ostream &out, const JEmitterParameters &parameters)
Write emitter parameters to output stream.
double TMax_s
maximal difference between times of emission [s]
JEmitterParameters(const int id, const double Q, const double TMax_s, const int numberOfHits)
Constructor.
int numberOfHits
minimal number of hits to trigger event
std::vector< JEmitterParameters > emitter
emitter parameters
virtual ~JTriggerParameters()
Virtual destructor.
double Q
minimal quality if larger than one; else minimal normalised quality
JEmitterParameters operator[](const int id) const
Get emitter parameters.
double TMax_s
maximal difference between times of emission [s]
ClassDef(JTriggerParameters, 4)
int numberOfHits
minimal number of hits to trigger event