Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JModuleGeometry.hh
Go to the documentation of this file.
1#ifndef __JDETECTOR__JMODULEGEOMETRY__
2#define __JDETECTOR__JMODULEGEOMETRY__
3
9
10
11/**
12 * \author mdejong
13 */
14
15namespace JDETECTOR {}
16namespace JPP { using namespace JDETECTOR; }
17
18namespace JDETECTOR {
19
20 using JIO::JReader;
21 using JIO::JWriter;
25
26
27 /**
28 * Module geometry.
29 */
31 public JDAQUTCExtended,
32 public JModuleIdentifier,
33 public JPosition3D,
34 public JEulerAngle3D
35 {
36 public:
37 /**
38 * Default constructor.
39 */
46
47
48 /**
49 * Constructor.
50 *
51 * \param utc UTC
52 * \param id module identifier
53 * \param pos module position
54 * \param angle module orientation
55 */
57 const JModuleIdentifier& id,
58 const JPosition3D& pos,
59 const JEulerAngle3D& angle) :
60 JDAQUTCExtended (utc),
62 JPosition3D (pos),
63 JEulerAngle3D (angle)
64 {}
65
66
67 /**
68 * Read module geometry from input.
69 *
70 * \param in input stream
71 * \param geometry module geometry
72 * \return input stream
73 */
74 friend inline std::istream& operator>>(std::istream& in, JModuleGeometry& geometry)
75 {
76 in >> static_cast<JDAQUTCExtended&> (geometry);
77 in >> static_cast<JModuleIdentifier&>(geometry);
78 in >> static_cast<JPosition3D&> (geometry);
79 in >> static_cast<JEulerAngle3D&> (geometry);
80
81 return in;
82 }
83
84
85 /**
86 * Write module geometry to output.
87 *
88 * \param out output stream
89 * \param geometry module geometry
90 * \return output stream
91 */
92 friend inline std::ostream& operator<<(std::ostream& out, const JModuleGeometry& geometry)
93 {
94 out << static_cast<const JDAQUTCExtended&> (geometry);
95 out << ' ';
96 out << static_cast<const JModuleIdentifier&>(geometry);
97 out << ' ';
98 out << static_cast<const JPosition3D&> (geometry);
99 out << ' ';
100 out << static_cast<const JEulerAngle3D&> (geometry);
101
102 return out;
103 }
104
105
106 /**
107 * Read module geometry from input.
108 *
109 * \param in reader
110 * \param geometry module geometry
111 * \return reader
112 */
113 friend inline JReader& operator>>(JReader& in, JModuleGeometry& geometry)
114 {
115 in >> static_cast<JDAQUTCExtended&> (geometry);
116 in >> static_cast<JModuleIdentifier&>(geometry);
117 in >> static_cast<JPosition3D&> (geometry);
118 in >> static_cast<JEulerAngle3D&> (geometry);
119
120 return in;
121 }
122
123
124 /**
125 * Write module geometry to output.
126 *
127 * \param out writer
128 * \param geometry module geometry
129 * \return writer
130 */
131 friend inline JWriter& operator<<(JWriter& out, const JModuleGeometry& geometry)
132 {
133 out << static_cast<const JDAQUTCExtended&> (geometry);
134 out << static_cast<const JModuleIdentifier&>(geometry);
135 out << static_cast<const JPosition3D&> (geometry);
136 out << static_cast<const JEulerAngle3D&> (geometry);
137
138 return out;
139 }
140 };
141
142
143 /**
144 * Auxiliary class for distance beteen UTC times.
145 */
147 /**
148 * Get distance between UTC.
149 *
150 * \param first first value
151 * \param second second value
152 * \return time difference [ns]
153 */
154 inline double operator()(const JDAQUTCExtended& first, const JDAQUTCExtended& second) const
155 {
156 return second.getTimeNanoSecond() - first.getTimeNanoSecond();
157 }
158 };
159}
160
161#endif
friend std::istream & operator>>(std::istream &in, JModuleGeometry &geometry)
Read module geometry from input.
friend JWriter & operator<<(JWriter &out, const JModuleGeometry &geometry)
Write module geometry to output.
friend JReader & operator>>(JReader &in, JModuleGeometry &geometry)
Read module geometry from input.
friend std::ostream & operator<<(std::ostream &out, const JModuleGeometry &geometry)
Write module geometry to output.
JModuleGeometry(const JDAQUTCExtended &utc, const JModuleIdentifier &id, const JPosition3D &pos, const JEulerAngle3D &angle)
Constructor.
JModuleGeometry()
Default constructor.
Data structure for Euler angles in three dimensions.
Data structure for position in three dimensions.
Interface for binary input.
Interface for binary output.
Auxiliary class for object identification.
Definition JObjectID.hh:25
Data structure for UTC time.
double getTimeNanoSecond() const
Get time (limited to 16 ns cycles).
file Auxiliary data structures and methods for detector calibration.
Definition JAnchor.hh:12
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for distance beteen UTC times.
double operator()(const JDAQUTCExtended &first, const JDAQUTCExtended &second) const
Get distance between UTC.