Jpp 20.0.0-rc.8
the software that should make you happy
Loading...
Searching...
No Matches
JPMT.hh
Go to the documentation of this file.
1#ifndef __JDETECTOR__JPMT__
2#define __JDETECTOR__JPMT__
3
4#include <istream>
5#include <ostream>
6#include <iomanip>
7
8#include "JLang/JObjectID.hh"
9#include "JLang/JStatus.hh"
10#include "JLang/JMultiEquals.hh"
14#include "JIO/JSerialisable.hh"
15
16
17/**
18 * \file
19 *
20 * Data structure for PMT geometry and calibration.
21 * \author mdejong
22 */
23namespace JDETECTOR {}
24namespace JPP { using namespace JDETECTOR; }
25
26namespace JDETECTOR {
27
28 using JLANG::JObjectID;
29 using JLANG::JStatus;
32 using JIO::JReader;
33 using JIO::JWriter;
34
35
36 /**
37 * Data structure for PMT geometry, calibration and status.
38 *
39 * The I/O of the status of the PMT depends on the detector version.\n
40 * Note that the axis of the PMT points in the direction of the field of view of the photo-cathode.\n
41 * Note also that the comparison between PMTs is based on the identifier only.
42 */
43 class JPMT :
44 public JObjectID,
45 public JAxis3D,
46 public JCalibration,
47 public JStatus,
48 public JMultiEquals<JPMT, JObjectID>
49 {
50 public:
51 /**
52 * Default constructor.
53 */
54 JPMT() :
55 JObjectID(),
56 JAxis3D(),
58 JStatus()
59 {}
60
61
62 /**
63 * Constructor.
64 *
65 * \param id identifier
66 * \param axis axis
67 * \param status status
68 */
69 JPMT(const int id,
70 const JAxis3D& axis,
71 const JStatus& status = JStatus()) :
72 JObjectID(id),
73 JAxis3D(axis),
76 {}
77
78
79 /**
80 * Constructor.
81 *
82 * \param id identifier
83 * \param axis axis
84 * \param cal calibration
85 * \param status status
86 */
87 JPMT(const int id,
88 const JAxis3D& axis,
89 const JCalibration& cal,
90 const JStatus& status = JStatus()) :
91 JObjectID(id),
92 JAxis3D(axis),
93 JCalibration(cal),
95 {}
96
97
98 /**
99 * Get detector version.
100 */
102 {
103 static JDetectorVersion version;
104
105 return version;
106 }
107
108
109 /**
110 * Set detector version.
111 *
112 * \param version version
113 */
114 static void setVersion(const JVersion& version)
115 {
116 getVersion() = JDetectorVersion(version);
117 }
118
119
120 /**
121 * Dot product.
122 *
123 * The dot product is evaluated for the PMT orientation.
124 *
125 * \param pmt PMT
126 * \return dot product
127 */
128 inline double getDot(const JPMT& pmt) const
129 {
130 return this->getDirection().getDot(pmt.getDirection());
131 }
132
133
134 /**
135 * Read PMT from input.
136 *
137 * \param in input stream
138 * \param pmt PMT
139 * \return input stream
140 */
141 friend inline std::istream& operator>>(std::istream& in, JPMT& pmt)
142 {
143 in >> static_cast<JObjectID&> (pmt);
144 in >> static_cast<JAxis3D&> (pmt);
145 in >> static_cast<JCalibration&>(pmt);
146
148 in >> static_cast<JStatus&>(pmt);
149 }
150
151 return in;
152 }
153
154
155 /**
156 * Write PMT to output.
157 *
158 * \param out output stream
159 * \param pmt PMT
160 * \return output stream
161 */
162 friend inline std::ostream& operator<<(std::ostream& out, const JPMT& pmt)
163 {
164 using namespace std;
165
166 out << setw(8);
167 out << static_cast<const JObjectID&> (pmt);
168 out << ' ';
169 out << static_cast<const JAxis3D&> (pmt);
170 out << ' ';
171 out << static_cast<const JCalibration&>(pmt);
172
174 out << ' ';
175 out << static_cast<const JStatus&>(pmt);
176 }
177
178 return out;
179 }
180
181
182 /**
183 * Read PMT from input.
184 *
185 * \param in reader
186 * \param pmt PMT
187 * \return reader
188 */
189 friend inline JReader& operator>>(JReader& in, JPMT& pmt)
190 {
191 in >> static_cast<JObjectID&> (pmt);
192 in >> static_cast<JAxis3D&> (pmt);
193 in >> static_cast<JCalibration&>(pmt);
194
196 in >> static_cast<JStatus&>(pmt);
197 }
198
199 return in;
200 }
201
202
203 /**
204 * Write PMT to output.
205 *
206 * \param out writer
207 * \param pmt PMT
208 * \return writer
209 */
210 friend inline JWriter& operator<<(JWriter& out, const JPMT& pmt)
211 {
212 out << static_cast<const JObjectID&> (pmt);
213 out << static_cast<const JAxis3D&> (pmt);
214 out << static_cast<const JCalibration&>(pmt);
215
217 out << static_cast<const JStatus&>(pmt);
218 }
219
220 return out;
221 }
222 };
223}
224
225#endif
Data structure for detector version.
Time calibration (including definition of sign of time offset).
Data structure for time calibration.
Data structure for PMT geometry, calibration and status.
Definition JPMT.hh:49
JPMT(const int id, const JAxis3D &axis, const JStatus &status=JStatus())
Constructor.
Definition JPMT.hh:69
static void setVersion(const JVersion &version)
Set detector version.
Definition JPMT.hh:114
friend JWriter & operator<<(JWriter &out, const JPMT &pmt)
Write PMT to output.
Definition JPMT.hh:210
JPMT(const int id, const JAxis3D &axis, const JCalibration &cal, const JStatus &status=JStatus())
Constructor.
Definition JPMT.hh:87
friend JReader & operator>>(JReader &in, JPMT &pmt)
Read PMT from input.
Definition JPMT.hh:189
JPMT()
Default constructor.
Definition JPMT.hh:54
friend std::istream & operator>>(std::istream &in, JPMT &pmt)
Read PMT from input.
Definition JPMT.hh:141
static JDetectorVersion & getVersion()
Get detector version.
Definition JPMT.hh:101
friend std::ostream & operator<<(std::ostream &out, const JPMT &pmt)
Write PMT to output.
Definition JPMT.hh:162
double getDot(const JPMT &pmt) const
Dot product.
Definition JPMT.hh:128
Axis object.
Definition JAxis3D.hh:41
const JDirection3D & getDirection() const
Get direction.
double getDot(const JAngle3D &angle) const
Get dot product.
Interface for binary input.
Interface for binary output.
Auxiliary class for object identification.
Definition JObjectID.hh:25
file Auxiliary data structures and methods for detector calibration.
Definition JAnchor.hh:12
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
@ V3
Version with PMT status field and comments.
Auxiliary class for version identifier.
Template definition of auxiliary base class for data structures composed of multiple base classes wit...
Auxiliary class for handling status.
Definition JStatus.hh:31
status_type status
Definition JStatus.hh:252
JStatus()
Default constructor.
Definition JStatus.hh:40