37{
40
45
46 try {
47
48 JParser<> zap(
"Auxiliary program to merge detector files.");
49
52 zap[
'@'] =
make_field(calset,
"import calibration sets \"<key> = <file name>[; <key> = <file name>]\"" << endl
55
56 zap(argc, argv);
57 }
58 catch(const exception &error) {
59 FATAL(error.what() << endl);
60 }
61
62
64
65 for (vector<JEquation_t>::const_iterator i = calset.begin(); i != calset.end(); ++i) {
66
67 if (keys.count(i->getKey()) == 0)
68 FATAL(
"Invalid calibration set \"" << i->getKey() <<
"\"" << endl);
69 else
71 }
72
73
75
76 for (vector<string>::const_iterator i = detectorFile.begin(); i != detectorFile.end(); ++i) {
77
79
80 try {
82 }
85 }
86
89 else
90 copy(buffer.begin(), buffer.end(), back_inserter(
detector));
91 }
92
93
95
97
98 try {
100 }
103 }
104
106
107 for (const auto& module : buffer) {
108 for (const auto& pmt : module) {
109 if (router.hasPMT(pmt.getID()))
110 detector.getPMT(router.getAddress(pmt.getID())).setCalibration(pmt.getCalibration());
111 else
112 FATAL(
"Missing PMT " << pmt.getID() << endl);
113 }
114 }
115 }
116
117
119
121
122 try {
124 }
127 }
128
130
131 for (const auto& module : buffer) {
132 if (router.hasModule(module.getID())) {
133
134 if (module.getFloor() != 0)
135 detector.getModule(router.getAddress(module.getID())).set(module.getCenter());
136 else
137 detector.getModule(router.getAddress(module.getID())).set(module.getPosition());
138
139 } else
140 FATAL(
"Missing module " << module.getID() << endl);
141 }
142 }
143
144
146
148
149 try {
151 }
154 }
155
157
158 for (const auto& module : buffer) {
159 if (router.hasModule(module.getID())) {
160
161 if (module.getFloor() != 0) {
162
163 JModule&
object =
detector.getModule(router.getAddress(module.getID()));
164
167
169 object.rotate(R);
171 }
172
173 } else
174 FATAL(
"Missing module " << module.getID() << endl);
175 }
176 }
177
178
180
182
183 try {
185 }
188 }
189
191
192 for (const auto& module : buffer) {
193 if (router.hasModule(module.getID())) {
194
195 detector.getModule(router.getAddress(module.getID())).setT0(module.getT0());
196
197 } else
198 FATAL(
"Missing module " << module.getID() << endl);
199 }
200 }
201
202
204
206
207 try {
209 }
212 }
213
215
216 for (const auto& module : buffer) {
217 if (router.hasModule(module.getID())) {
218
219 detector.getModule(router.getAddress(module.getID())).setQuaternion(module.getQuaternion());
220
221 } else
222 FATAL(
"Missing module " << module.getID() << endl);
223 }
224 }
225
226
228
230
231 try {
233 }
236 }
237 {
239
240 for (const auto& module : buffer) {
241 if (router.hasModule(module.getID()))
242 detector.getModule(router.getAddress(module.getID())).setStatus(module.getStatus());
243 else
244 FATAL(
"Missing module " << module.getID() << endl);
245 }
246 }
247 {
249
250 for (const auto& module : buffer) {
251 for (const auto& pmt : module) {
252 if (router.hasPMT(pmt.getID()))
253 detector.getPMT(router.getAddress(pmt.getID())).setStatus(pmt.getStatus());
254 else
255 FATAL(
"Missing PMT " << pmt.getID() << endl);
256 }
257 }
258 }
259 }
260
261
263
264 try {
266 }
269 }
270}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Router for direct addressing of module data in detector data structure.
Data structure for a composite optical module.
Router for direct addressing of PMT data in detector data structure.
Data structure for position in three dimensions.
JVector3D & add(const JVector3D &vector)
Add vector.
JVector3D & sub(const JVector3D &vector)
Subtract vector.
Utility class to parse command line options.
void copy(const Head &from, JHead &to)
Copy header from from to to.
static JRotation getRotation
Function object to get rotation matrix to go from first to second module.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
std::string trim(const std::string &buffer)
Trim string.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static const std::string TCAL
PMT time offsets.
static const std::string PCAL
(optical|base) module positions
static const std::string SCAL
(module|PMT) status
static const std::string RCAL
optical module orientations
static const std::string ACAL
acoustic time offsets (piezo sensor or hydrophone)
static const std::string CCAL
compass alignment (a.k.a. quaternion calibration)
Auxiliary data structure for streaming of STL containers.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...