Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JPMTAddress.hh
Go to the documentation of this file.
1#ifndef __JDETECTOR__JPMTADDRESS__
2#define __JDETECTOR__JPMTADDRESS__
3
4#include <istream>
5#include <ostream>
6
9
10
11/**
12 * \author mdejong
13 */
14
15namespace JDETECTOR {}
16namespace JPP { using namespace JDETECTOR; }
17
18namespace JDETECTOR {
19
21
22
23 /**
24 * Address of PMT in detector data structure.
25 *
26 * The address of a PMT consists of a pair of integer values, where
27 * - JPMTAddress::first refers to the index of the parent module in the detector data structure; and
28 * - JPMTAddress::second refers to the index of the PMT in the corresponding module data structure.
29 *
30 * This class implements the JLANG::JComparable interface.
31 */
33 public JModuleAddress,
34 public JComparable<JPMTAddress>
35 {
36 public:
37 /**
38 * Default constructor.
39 */
42 second(-1)
43 {}
44
45
46 /**
47 * Constructor.
48 *
49 * \param module module address
50 * \param pmt PMT index
51 */
53 const int pmt) :
54 JModuleAddress(module),
55 second(pmt)
56 {}
57
58
59 /**
60 * Less than method.
61 *
62 * \param address PMT address
63 * \result true if this PMT address is less than given PMT address; else false
64 */
65 inline bool less(const JPMTAddress& address) const
66 {
67 if (this->first == address.first)
68 return this->second < address.second;
69 else
70 return this->first < address.first;
71 }
72
73
74 /**
75 * Read PMT address from input.
76 *
77 * \param in input stream
78 * \param object PMT address
79 * \return input stream
80 */
81 friend inline std::istream& operator>>(std::istream& in, JPMTAddress& object)
82 {
83 return in >> static_cast<JModuleAddress&>(object) >> object.second;
84 }
85
86
87 /**
88 * Write PMT address to output.
89 *
90 * \param out output stream
91 * \param object PMT address
92 * \return output stream
93 */
94 friend inline std::ostream& operator<<(std::ostream& out, const JPMTAddress& object)
95 {
96 return out << static_cast<const JModuleAddress&>(object) << ' ' << object.second;
97 }
98
99
100 int second; //!< index of PMT in module data structure.
101 };
102}
103
104#endif
Address of module in detector data structure.
int first
index of module in detector data structure
Address of PMT in detector data structure.
JPMTAddress(const JModuleAddress &module, const int pmt)
Constructor.
bool less(const JPMTAddress &address) const
Less than method.
int second
index of PMT in module data structure.
friend std::istream & operator>>(std::istream &in, JPMTAddress &object)
Read PMT address from input.
JPMTAddress()
Default constructor.
friend std::ostream & operator<<(std::ostream &out, const JPMTAddress &object)
Write PMT address to output.
file Auxiliary data structures and methods for detector calibration.
Definition JAnchor.hh:12
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Template definition of auxiliary base class for comparison of data structures.