Jpp  18.0.0-rc.1
the software that should make you happy
 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 <istream>
5 #include <ostream>
6 
7 #include "JLang/JComparable.hh"
8 
9 #include "JDetector/JLocation.hh"
11 
12 
13 /**
14  * \file
15  *
16  * Data structure to uniquely identify PMT readout channel.
17  * \author mdejong
18  */
19 namespace JDETECTOR {}
20 namespace JPP { using namespace JDETECTOR; }
21 
22 namespace JDETECTOR {
23 
24  using JLANG::JComparable;
25 
26 
27  /**
28  * Auxiliary class to uniquely identify PMT readout channel.
29  */
30  class JPMTChannel :
31  public JLocation,
32  public JPMTReadoutAddress
33  {
34  public:
35  /**
36  * Default constructor.
37  */
39  JLocation(),
41  {}
42 
43 
44  /**
45  * Constructor.
46  *
47  * \param location module location
48  * \param tdc PMT readout address
49  */
50  JPMTChannel(const JLocation& location,
51  const JPMTReadoutAddress& tdc) :
52  JLocation (location),
54  {}
55 
56 
57  /**
58  * Less than method.
59  *
60  * \param channel PMT channel
61  * \result true if first channel before second channel; else false
62  */
63  bool less(const JPMTChannel& channel) const
64  {
65  if (this->getLocation() == channel.getLocation())
66  return this->getTDC() < channel.getTDC();
67  else
68  return this->getLocation() < channel.getLocation();
69  }
70 
71 
72  /**
73  * Read PMT channel.
74  *
75  * \param in input stream
76  * \param object PMT channel
77  * \return input stream
78  */
79  friend inline std::istream& operator>>(std::istream& in, JPMTChannel& object)
80  {
81  in >> static_cast<JLocation&> (object);
82  in >> static_cast<JPMTReadoutAddress&>(object);
83 
84  return in;
85  }
86 
87 
88  /**
89  * Write PMT channel.
90  *
91  * \param out output stream
92  * \param object PMT channel
93  * \return output stream
94  */
95  friend inline std::ostream& operator<<(std::ostream& out, const JPMTChannel& object)
96  {
97  out << static_cast<const JLocation&> (object) << ' ';
98  out << static_cast<const JPMTReadoutAddress&>(object);
99 
100  return out;
101  }
102  };
103 }
104 
105 #endif
Auxiliary class to uniquely identify PMT readout channel.
Definition: JPMTChannel.hh:30
friend std::ostream & operator<<(std::ostream &out, const JPMTChannel &object)
Write PMT channel.
Definition: JPMTChannel.hh:95
JPMTChannel(const JLocation &location, const JPMTReadoutAddress &tdc)
Constructor.
Definition: JPMTChannel.hh:50
bool less(const JPMTChannel &channel) const
Less than method.
Definition: JPMTChannel.hh:63
Logical location of module.
Definition: JLocation.hh:37
const JLocation & getLocation() const
Get location.
Definition: JLocation.hh:69
JPMTChannel()
Default constructor.
Definition: JPMTChannel.hh:38
Template definition of auxiliary base class for comparison of data structures.
Definition: JComparable.hh:24
Logical location of module.
Data structure for PMT readout address.
friend std::istream & operator>>(std::istream &in, JPMTChannel &object)
Read PMT channel.
Definition: JPMTChannel.hh:79
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