Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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"
7 #include "JDetector/JLocation.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 JLocation,
31  public JPMTReadoutAddress
32  {
33  public:
34  /**
35  * Default constructor.
36  */
38  JObjectID(),
39  JLocation(),
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 JLocation& location,
53  const JPMTReadoutAddress& tdc) :
54  JObjectID (id),
55  JLocation (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<JLocation&> (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 JLocation&> (object) << ' ';
103  out << static_cast<const JPMTReadoutAddress&>(object);
104 
105  return out;
106  }
107  };
108 }
109 
110 #endif
Auxiliary class to uniquely identify PMT readout channel.
Definition: JPMTChannel.hh:28
JPMTChannel(const JObjectID &id, const JLocation &location, const JPMTReadoutAddress &tdc)
Constructor.
Definition: JPMTChannel.hh:51
std::string toString() const
Convert PMT channel to string.
Definition: JPMTChannel.hh:65
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
friend std::ostream & operator<<(std::ostream &out, const JPMTChannel &object)
Write PMT channel.
Definition: JPMTChannel.hh:99
Logical location of module.
Definition: JLocation.hh:37
JPMTChannel()
Default constructor.
Definition: JPMTChannel.hh:37
Logical location of module.
Auxiliary class for object identification.
Definition: JObjectID.hh:27
Data structure for PMT readout address.
friend std::istream & operator>>(std::istream &in, JPMTChannel &object)
Read PMT channel.
Definition: JPMTChannel.hh:82