74{
77
78 struct {
84 int scal = 0xFFFFFFFF;
85 } precision;
86
91
92 try {
93
95
96 properties[
TCAL] = precision.tcal;
97 properties[
PCAL] = precision.pcal;
98 properties[
RCAL] = precision.rcal;
99 properties[
ACAL] = precision.acal;
100 properties[
CCAL] = precision.ccal;
101 properties[
SCAL] = precision.scal;
102
103 JParser<> zap(
"Auxiliary program to find differences between two detector files.");
104
110
112 }
113 catch(const exception &error) {
115 }
116
117
120
121 try {
123 }
126 }
127
128 try {
130 }
133 }
134
136
137 bool is_equal = true;
138
141
143
144
145
147
148 DEBUG(
"* Different detector identifiers "
152
153 is_equal = false;
154 }
155
156
157
159
160 DEBUG(
" * different UTM position: "
164
165 is_equal = false;
166 }
167
168
172 }
173 }
174
175
176
178
180
182
183 is_equal = false;
184 }
185 }
186
188
190
192
193 is_equal = false;
194 }
195 }
197
198
199
200
201 DEBUG(
"Comparing module by module." <<
endl);
202
204
206
207 continue;
208
209 is_equal = false;
210 }
211
213
215
216
217
219
221
222 } else {
223
225 DEBUG(
" * different location: "
228
229 is_equal = false;
230 }
231
232
233
235
236 DEBUG(
" * different T0: "
240
241 is_equal = false;
242 }
243
244
245
249
250 DEBUG(
" * different quaternion calibration: "
251 <<
module_a->getQuaternion() <<
" (A), "
252 <<
module_b->getQuaternion() <<
" (B) "
254
255 is_equal = false;
256 }
257
258
259
261
262 DEBUG(
" * different position: "
263 <<
module_a->getPosition() <<
" (A), "
264 <<
module_b->getPosition() <<
" (B)"
266
267 is_equal = false;
268 }
269
270
271
273
274 DEBUG(
" * different number of PMTs: "
277
278 is_equal = false;
279 }
280
281
282
285
287
288 if (fabs(q.
getMean()) > precision.tcal) {
289
290 DEBUG(
" * different average t0: "
293
294 is_equal = false;
295 }
296 }
297
298
299
301
302 DEBUG(
" * different status module " <<
module_a->getID() <<
": "
303 <<
module_a->getStatus() <<
" (A), "
306
307 is_equal = false;
308 }
309
310
311
312
313
314 for (
unsigned int pmt = 0; pmt !=
module_a->size() && pmt !=
module_b->size(); ++pmt) {
315
318
320
321 DEBUG(
" * different identifier PMT " <<
setw(2) << pmt <<
": "
324 <<
", B - A " <<
pmt_b.getID() -
pmt_a.getID()
326
327 is_equal = false;
328 }
329 }
330
331
332
333 for (
unsigned int pmt = 0; pmt !=
module_a->size() && pmt !=
module_b->size(); ++pmt) {
334
337
338 if (fabs(
pmt_a.getT0() -
pmt_b.getT0()) > precision.tcal) {
339
340 DEBUG(
" * different T0 PMT " <<
setw(2) << pmt <<
": "
343 <<
", B - A " <<
pmt_b.getT0() -
pmt_a.getT0()
345
346 is_equal = false;
347 }
348 }
349
350
351
352 for (
unsigned int pmt = 0; pmt !=
module_a->size() && pmt !=
module_b->size(); ++pmt) {
353
356
357
358
359 if (
pmt_a.getPosition().getDistance(
pmt_b.getPosition()) > precision.pcal) {
360
361 DEBUG(
" * different PMT position: "
362 <<
pmt_a.getPosition() <<
" (A" <<
FILL(2,
'0') << pmt <<
"), " <<
FILL()
363 <<
pmt_b.getPosition() <<
" (B" <<
FILL(2,
'0') << pmt <<
")" <<
FILL()
365
366 is_equal = false;
367 }
368 }
369
370
371
372 for (
unsigned int pmt = 0; pmt !=
module_a->size() && pmt !=
module_b->size(); ++pmt) {
373
376
377
378
379 const double dot =
pmt_a.getDirection().getDot(
pmt_b.getDirection());
380
381 if ((1.0 - dot) > precision.rcal) {
382
383 DEBUG(
" * different PMT direction: "
384 <<
pmt_a.getDirection() <<
" (A" <<
FILL(2,
'0') << pmt <<
"), " <<
FILL()
385 <<
pmt_b.getDirection() <<
" (B" <<
FILL(2,
'0') << pmt <<
")" <<
FILL()
387
388 is_equal = false;
389 }
390 }
391
392
393
394 for (
unsigned int pmt = 0; pmt !=
module_a->size() && pmt !=
module_b->size(); ++pmt) {
395
398
399 if (
pmt_a.getAND(precision.scal) !=
pmt_b.getAND(precision.scal)) {
400
401 DEBUG(
" * different status PMT " <<
setw(2) << pmt <<
": "
402 <<
pmt_a.getStatus() <<
" (A" <<
FILL(2,
'0') << pmt <<
"), " <<
FILL()
403 <<
pmt_b.getStatus() <<
" (B" <<
FILL(2,
'0') << pmt <<
")" <<
FILL()
405
406 is_equal = false;
407 }
408 }
409 }
411
412
414
417
421 }
422
426 }
427
429
431 string.size(), -0.5, string.size() - 0.5,
432 floor .size(), -0.5, floor .size() - 0.5);
433
436 }
437
440 }
441
453
456 M2.Fill(
module->getString(),
module->getFloor(), -1.0);
457 }
458 }
459
462 M2.Fill(
module->getString(),
module->getFloor(), +1.0);
463 }
464 }
465
466
468
470 continue;
471 }
472
474
476
479 }
480 }
481
485
488
491
493
494 const double phi = (
JVector3Z_t.getDot(
q1.twist) >= 0.0 ? +1.0 : -1.0) *
q1.twist.getAngle();
495
504 }
505 }
506
507
509
510 for (
TH2D* h2 : { &
M2,
X2,
Y2,
Z2,
T2,
RMS, R2,
QA,
QB,
QC,
QD,
Q2 }) {
511 out << *h2;
512 }
513
515
516 out.Write();
517 out.Close();
518 }
519
521
522 return 0;
523}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
Router for direct addressing of module data in detector data structure.
Data structure for a composite optical module.
Data structure for PMT geometry, calibration and status.
Utility class to parse parameter values.
Data structure for position in three dimensions.
Data structure for unit quaternion in three dimensions.
double getAngle() const
Get rotation angle.
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
Template definition of a multi-dimensional oscillation probability interpolation table.
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
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.
double getAngle(const JQuaternion3D &first, const JQuaternion3D &second)
Get space angle between quanternions.
static const JVector3D JVector3Z_t(0, 0, 1)
unit z-vector
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
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 sequence of same character.
Auxiliary data structure for floating point format specification.
Auxiliary data structure for decomposition of quaternion in twist and swing quaternions.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...