Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JBase.hh
Go to the documentation of this file.
1 #ifndef __JDETECTOR__JBASE__
2 #define __JDETECTOR__JBASE__
3 
5 #include "JDetector/JLocation.hh"
8 #include "JLang/JMultiEquals.hh"
9 
10 
11 /**
12  * \file
13  *
14  * Data structure for base module.
15  * \author mdejong
16  */
17 namespace JDETECTOR {}
18 namespace JPP { using namespace JDETECTOR; }
19 
20 namespace JDETECTOR {
21 
23  using JLANG::JMultiEquals;
24 
25  /**
26  * Type definition of base module.
27  */
28  struct JBase :
29  public JModuleIdentifier,
30  public JLocation,
31  public JPosition3D,
32  public JCalibration,
33  public JMultiEquals<JBase, JModuleIdentifier>
34  {
35  /**
36  * Default constructor.
37  */
39  {}
40 
41 
42  /**
43  * Constructor.
44  *
45  * \param id identifier
46  * \param location location
47  * \param position position
48  * \param calibration calibration
49  */
50  JBase(const int id,
51  const JLocation& location,
52  const JPosition3D& position,
53  const JCalibration& calibration = JCalibration())
54  {
55  setID(id);
56  setLocation(location);
57  setPosition(position);
58  setCalibration(calibration);
59  }
60 
61 
62  /**
63  * Get reference to unique instance of this class object.
64  *
65  * This method returns a base module with the default configuration of the base module.
66  *
67  * \return reference to this class object
68  */
69  static const JBase& getInstance()
70  {
71  static JBase base;
72 
73  return base;
74  }
75 
76 
77  /**
78  * Read base from input.
79  *
80  * \param in input stream
81  * \param base base
82  * \return input stream
83  */
84  friend inline std::istream& operator>>(std::istream& in, JBase& base)
85  {
86  using namespace std;
87 
88  in >> static_cast<JModuleIdentifier&>(base);
89  in >> static_cast<JLocation&> (base);
90  in >> static_cast<JPosition3D&> (base);
91  in >> static_cast<JCalibration&> (base);
92 
93  return in;
94  }
95 
96 
97  /**
98  * Write base to output.
99  *
100  * \param out output stream
101  * \param base base
102  * \return output stream
103  */
104  friend inline std::ostream& operator<<(std::ostream& out, const JBase& base)
105  {
106  using namespace std;
107 
108  out << static_cast<const JModuleIdentifier&>(base);
109  out << ' ';
110  out << static_cast<const JLocation&> (base);
111  out << ' ';
112  out << static_cast<const JPosition3D&> (base);
113  out << ' ';
114  out << static_cast<const JCalibration&> (base);
115 
116  return out;
117  }
118  };
119 }
120 
121 #endif
JBase(const int id, const JLocation &location, const JPosition3D &position, const JCalibration &calibration=JCalibration())
Constructor.
Definition: JBase.hh:50
PMT calibration (including definition of sign of time offset).
void setLocation(const JLocation &location)
Set location.
Definition: JLocation.hh:91
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
Data structure for PMT calibration.
Template definition of auxiliary base class for data structures composed of multiple base classes wit...
Definition: JMultiEquals.hh:32
static const JBase & getInstance()
Get reference to unique instance of this class object.
Definition: JBase.hh:69
Logical location of module.
Definition: JLocation.hh:37
JBase()
Default constructor.
Definition: JBase.hh:38
Logical location of module.
friend std::ostream & operator<<(std::ostream &out, const JBase &base)
Write base to output.
Definition: JBase.hh:104
friend std::istream & operator>>(std::istream &in, JBase &base)
Read base from input.
Definition: JBase.hh:84
Auxiliary class for object identification.
Definition: JObjectID.hh:27
void setCalibration(const JCalibration &cal)
Set calibration.
void setID(const int id)
Set identifier.
Definition: JObjectID.hh:66
Type definition of base module.
Definition: JBase.hh:28
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
void setPosition(const JVector3D &pos)
Set position.
Definition: JPosition3D.hh:151
JCalibration()
Default constructor.