Jpp  17.2.1-pre0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JModuleGeometry.hh
Go to the documentation of this file.
1 #ifndef __JDETECTOR__JMODULEGEOMETRY__
2 #define __JDETECTOR__JMODULEGEOMETRY__
3 
4 #include "JIO/JSerialisable.hh"
9 
10 
11 /**
12  * \author mdejong
13  */
14 
15 namespace JDETECTOR {}
16 namespace JPP { using namespace JDETECTOR; }
17 
18 namespace 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  */
41  JDAQUTCExtended (),
43  JPosition3D (),
44  JEulerAngle3D ()
45  {}
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  */
146  struct JUTCDistance {
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::ostream & operator<<(std::ostream &out, const JModuleGeometry &geometry)
Write module geometry to output.
Data structure for Euler angles in three dimensions.
Interface for binary output.
double operator()(const JDAQUTCExtended &first, const JDAQUTCExtended &second) const
Get distance between UTC.
Data structure for UTC time.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
friend JReader & operator>>(JReader &in, JModuleGeometry &geometry)
Read module geometry from input.
Auxiliary class for distance beteen UTC times.
Interface for binary input.
friend JWriter & operator<<(JWriter &out, const JModuleGeometry &geometry)
Write module geometry to output.
JModuleGeometry(const JDAQUTCExtended &utc, const JModuleIdentifier &id, const JPosition3D &pos, const JEulerAngle3D &angle)
Constructor.
Auxiliary class for object identification.
Definition: JObjectID.hh:22
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
JModuleGeometry()
Default constructor.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
double getTimeNanoSecond() const
Get time (limited to 16 ns cycles).
friend std::istream & operator>>(std::istream &in, JModuleGeometry &geometry)
Read module geometry from input.