Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JCalibrateMuon.hh
Go to the documentation of this file.
1#ifndef __JCALIBRATE_JCALIBRATEMUON__
2#define __JCALIBRATE_JCALIBRATEMUON__
3
4
8
9/**
10 * \author mdejong
11 */
12
13namespace JCALIBRATE {}
14namespace JPP { using namespace JCALIBRATE; }
15
16namespace JCALIBRATE {
17
21
22 /**
23 * Interface for routing module identifier to index and vice versa.
24 */
25 struct JRouter_t {
26 /**
27 * Virtual destructor.
28 */
29 virtual ~JRouter_t()
30 {}
31
32
33 /**
34 * Get number of indices.
35 *
36 * \return number of indices.
37 */
38 virtual size_t getN() const = 0;
39
40
41 /**
42 * Get index.
43 *
44 * \param id module identifier
45 * \return index
46 */
47 virtual int getIndex(const int id) const = 0;
48
49
50 /**
51 * Get identifier.
52 *
53 * \param index index
54 * \return identifier
55 */
56 virtual int getID(const int index) const = 0;
57 };
58
59
60 /**
61 * Module router.
62 */
64 public JRouter_t
65 {
66 /**
67 * Constructor.
68 *
69 * \param detector detector
70 */
71 JModuleRouter_t(const JDetector& detector) :
72 router(detector)
73 {}
74
75
76 /**
77 * Get number of indices.
78 *
79 * \return number of indices.
80 */
81 virtual size_t getN() const override
82 {
83 return router.getReference().size();
84 }
85
86
87 /**
88 * Get index.
89 *
90 * \param id module identifier
91 * \return index
92 */
93 virtual int getIndex(const int id) const override
94 {
95 return router.getIndex(id);
96 }
97
98
99 /**
100 * Get identifier.
101 *
102 * \param index index
103 * \return identifier
104 */
105 virtual int getID(const int index) const override
106 {
107 return router.getReference()[index].getID();
108 }
109
110 private:
112 };
113
114
115 /**
116 * String router.
117 */
119 public JRouter_t
120 {
121 /**
122 * Constructor.
123 *
124 * \param detector detector
125 */
126 JStringRouter_t(const JDetector& detector) :
127 moduleRouter(detector),
128 stringRouter(detector)
129 {}
130
131
132 /**
133 * Get number of indices.
134 *
135 * \return number of indices.
136 */
137 virtual size_t getN() const override
138 {
139 return stringRouter.size();
140 }
141
142
143 /**
144 * Get index.
145 *
146 * \param id module identifier
147 * \return index
148 */
149 virtual int getIndex(const int id) const override
150 {
152 }
153
154
155 /**
156 * Get identifier.
157 *
158 * \param index index
159 * \return identifier
160 */
161 virtual int getID(const int index) const override
162 {
163 return stringRouter.at(index);
164 }
165
166 private:
169 };
170
171
172 const char* const module_t = "module"; //!< routing by module
173 const char* const string_t = "string"; //!< routing by string
174}
175
176#endif
Data structure for detector geometry and calibration.
Direct access to module in detector data structure.
Direct access to string in detector data structure.
Detector data structure.
Definition JDetector.hh:96
int getString() const
Get string number.
Definition JLocation.hh:135
Router for direct addressing of module data in detector data structure.
const int getIndex(const JObjectID &id) const
Get index of module.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
const JClass_t & getReference() const
Get reference to object.
Definition JReference.hh:38
int getIndex(const T &value) const
Get index of given value.
Auxiliary classes and methods for PMT calibration.
const char *const module_t
routing by module
const char *const string_t
routing by string
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
virtual int getIndex(const int id) const override
Get index.
virtual int getID(const int index) const override
Get identifier.
JModuleRouter_t(const JDetector &detector)
Constructor.
virtual size_t getN() const override
Get number of indices.
Interface for routing module identifier to index and vice versa.
virtual int getIndex(const int id) const =0
Get index.
virtual int getID(const int index) const =0
Get identifier.
virtual size_t getN() const =0
Get number of indices.
virtual ~JRouter_t()
Virtual destructor.
virtual int getIndex(const int id) const override
Get index.
virtual size_t getN() const override
Get number of indices.
JStringRouter_t(const JDetector &detector)
Constructor.
virtual int getID(const int index) const override
Get identifier.
Router for mapping of string identifier to index.