Jpp
JPMTChannel.hh
Go to the documentation of this file.
1 #ifndef __JDETECTOR__JPMTCHANNEL__
2 #define __JDETECTOR__JPMTCHANNEL__
3 
4 #include <sstream>
5 
6 #include "JLang/JObjectID.hh"
9 
10 
11 /**
12  * \file
13  *
14  * Data structure to uniquely identify PMT readout channel.
15  * \author mdejong
16  */
17 namespace JDETECTOR {}
18 namespace JPP { using namespace JDETECTOR; }
19 
20 namespace JDETECTOR {
21 
22  using JLANG::JObjectID;
23 
24 
25  /**
26  * Auxiliary class to uniquely identify PMT readout channel.
27  */
28  class JPMTChannel :
29  public JObjectID,
30  public JModuleLocation,
31  public JPMTReadoutAddress
32  {
33  public:
34  /**
35  * Default constructor.
36  */
38  JObjectID(),
41  {}
42 
43 
44  /**
45  * Constructor.
46  *
47  * \param id detector identifier
48  * \param location module location
49  * \param tdc PMT readout address
50  */
52  const JModuleLocation& location,
53  const JPMTReadoutAddress& tdc) :
54  JObjectID (id),
55  JModuleLocation (location),
57  {}
58 
59 
60  /**
61  * Convert PMT channel to string.
62  *
63  * \return string
64  */
65  std::string toString() const
66  {
67  std::ostringstream os;
68 
69  os << *this;
70 
71  return os.str();
72  }
73 
74 
75  /**
76  * Read PMT channel.
77  *
78  * \param in input stream
79  * \param object PMT channel
80  * \return input stream
81  */
82  friend inline std::istream& operator>>(std::istream& in, JPMTChannel& object)
83  {
84  in >> static_cast<JObjectID&> (object);
85  in >> static_cast<JModuleLocation&> (object);
86  in >> static_cast<JPMTReadoutAddress&>(object);
87 
88  return in;
89  }
90 
91 
92  /**
93  * Write PMT channel.
94  *
95  * \param out output stream
96  * \param object PMT channel
97  * \return output stream
98  */
99  friend inline std::ostream& operator<<(std::ostream& out, const JPMTChannel& object)
100  {
101  out << static_cast<const JObjectID&> (object) << ' ';
102  out << static_cast<const JModuleLocation&> (object) << ' ';
103  out << static_cast<const JPMTReadoutAddress&>(object);
104 
105  return out;
106  }
107  };
108 }
109 
110 #endif
JDETECTOR::JPMTChannel
Auxiliary class to uniquely identify PMT readout channel.
Definition: JPMTChannel.hh:28
JDETECTOR::JPMTChannel::operator>>
friend std::istream & operator>>(std::istream &in, JPMTChannel &object)
Read PMT channel.
Definition: JPMTChannel.hh:82
JDETECTOR::JPMTChannel::operator<<
friend std::ostream & operator<<(std::ostream &out, const JPMTChannel &object)
Write PMT channel.
Definition: JPMTChannel.hh:99
JObjectID.hh
JDETECTOR::JPMTChannel::toString
std::string toString() const
Convert PMT channel to string.
Definition: JPMTChannel.hh:65
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JDETECTOR::JModuleLocation
Logical location of module.
Definition: JModuleLocation.hh:36
JDETECTOR::JPMTChannel::JPMTChannel
JPMTChannel()
Default constructor.
Definition: JPMTChannel.hh:37
JDETECTOR::JPMTReadoutAddress::tdc
int tdc
TDC channel.
Definition: JPMTReadoutAddress.hh:113
JDETECTOR::JPMTChannel::JPMTChannel
JPMTChannel(const JObjectID &id, const JModuleLocation &location, const JPMTReadoutAddress &tdc)
Constructor.
Definition: JPMTChannel.hh:51
JPMTReadoutAddress.hh
JLANG::JObjectID
Auxiliary class for object identification.
Definition: JObjectID.hh:27
JModuleLocation.hh
JDETECTOR::JPMTReadoutAddress
Data structure for PMT readout address.
Definition: JPMTReadoutAddress.hh:27
JDETECTOR
Auxiliary classes and methods for detector calibration.
Definition: JAnchor.hh:12