Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JDetectorAddressMap.hh
Go to the documentation of this file.
1#ifndef __JDETECTOR__JPMTLOGICALADDRESSTABLE__
2#define __JDETECTOR__JPMTLOGICALADDRESSTABLE__
3
4#include <vector>
5
6#include "JTools/JRouter.hh"
10
11
12/**
13 * \author mdejong
14 */
15
16namespace JDETECTOR {}
17namespace JPP { using namespace JDETECTOR; }
18
19namespace JDETECTOR {
20
21
22 /**
23 * Lookup table for PMT addresses in detector.
24 */
26 {
27 protected:
28 /**
29 * Default constructor.
30 */
32 buffer(),
33 router(-1)
34 {}
35
36 public:
37 /**
38 * Virtual destructor.
39 */
41 {}
42
43
44 /**
45 * Get default module address map.
46 *
47 * \return module address map
48 */
50
51
52 /**
53 * Get module identifier.
54 *
55 * \param location module location
56 * \return module identifier
57 */
58 virtual int getModuleID(const JLocation& location) const
59 {
60 return location.getString() * 100 + location.getFloor();
61 }
62
63
64 /**
65 * Get module address map.
66 *
67 * \param id module identifier
68 */
69 const JModuleAddressMap& get(const int id) const
70 {
71 if (router.has(id))
72 return buffer[router.get(id)];
73 else
75 }
76
77
78 /**
79 * Get module address map.
80 *
81 * \param id module identifier
82 * \return module address map
83 */
84 JModuleAddressMap& get(const int id)
85 {
86 if (!router.has(id)) {
87
89
90 router.put(id, buffer.size() - 1);
91 }
92
93 return buffer[router.get(id)];
94 }
95
96
97 /**
98 * Get PMT address translator.
99 *
100 * \param id PMY identifier
101 * \return PMT address translator
102 */
104 {
105 return get(id.getModuleID()).getAddressTranslator(id.getTDC());
106 }
107
108 protected:
111 };
112}
113
114#endif
Logical location of module.
Lookup table for PMT addresses in detector.
virtual int getModuleID(const JLocation &location) const
Get module identifier.
virtual ~JDetectorAddressMap()
Virtual destructor.
JModuleAddressMap & get(const int id)
Get module address map.
const JModuleAddressMap & get(const int id) const
Get module address map.
JDetectorAddressMap()
Default constructor.
const JPMTAddressTranslator & get(const JPMTIdentifier &id) const
Get PMT address translator.
std::vector< JModuleAddressMap > buffer
virtual const JModuleAddressMap & getDefaultModuleAddressMap() const =0
Get default module address map.
Logical location of module.
Definition JLocation.hh:40
int getFloor() const
Get floor number.
Definition JLocation.hh:146
int getString() const
Get string number.
Definition JLocation.hh:135
Lookup table for PMT addresses in optical module.
const JPMTAddressTranslator & getAddressTranslator(const int tdc) const
Get PMT address translator.
Direct addressing of elements with unique identifiers.
Definition JRouter.hh:27
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).
Data structure to translate PMT physical to readout address.