73int main(
int argc,
char **argv)
84 int scal = 0xFFFFFFFF;
87 string detectorFile_a;
88 string detectorFile_b;
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;
103 JParser<> zap(
"Auxiliary program to find differences between two detector files.");
113 catch(
const exception &error) {
114 FATAL(error.what() << endl);
122 load(detectorFile_a, detector_a);
129 load(detectorFile_b, detector_b);
135 size_t numberOfPMTs = 0;
137 bool is_equal =
true;
146 if (detector_a.
getID() != detector_b.
getID()) {
148 DEBUG(
"* Different detector identifiers "
149 << setw(5) << detector_a.
getID() <<
" (A) and " << endl
150 << setw(5) << detector_b.
getID() <<
" (B)." << endl
160 DEBUG(
" * different UTM position: "
169 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
170 if (module->size() > numberOfPMTs) {
171 numberOfPMTs =
module->size();
177 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
179 if (!module_router_b.
hasModule(module->getID())) {
181 DEBUG(
"* Module " << setw(10) << module->getID() <<
" is in A " <<
getLabel(*module) <<
" but not in B" << endl);
187 for (JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
189 if (!module_router_a.
hasModule(module->getID())) {
191 DEBUG(
"* Module " << setw(10) << module->getID() <<
" is in B " <<
getLabel(*module) <<
" but not in A" << endl);
201 DEBUG(
"Comparing module by module." << endl);
203 for (JDetector::iterator module_a = detector_a.begin(); module_a != detector_a.end(); ++module_a) {
214 DEBUG(
" Module " << setw(10) << module_a->
getID());
225 DEBUG(
" * different location: "
227 <<
getLabel(*module_b) <<
" (B)" << endl);
234 if (fabs(module_a->
getT0() - module_b->
getT0()) > precision.acal) {
236 DEBUG(
" * different T0: "
237 <<
FIXED(12,3) << module_a->
getT0() <<
" (A), "
238 <<
FIXED(12,3) << module_b->
getT0() <<
" (B) "
239 <<
", B - A " << module_b->
getT0() - module_a->
getT0() << endl);
250 DEBUG(
" * different quaternion calibration: "
262 DEBUG(
" * different position: "
272 if (module_a->size() != module_b->size()) {
274 DEBUG(
" * different number of PMTs: "
275 << module_a->size() <<
" (A), "
276 << module_b->size() <<
" (B)" << endl);
283 if (!module_a->empty() &&
284 !module_b->empty()) {
286 const JQuantile q = getQuantile(*module_a, *module_b);
288 if (fabs(q.
getMean()) > precision.tcal) {
290 DEBUG(
" * different average t0: "
302 DEBUG(
" * different status module " << module_a->
getID() <<
": "
314 for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
321 DEBUG(
" * different identifier PMT " << setw(2) << pmt <<
": "
322 << setw(8) << pmt_a.
getID() <<
" (A" <<
FILL(2,
'0') << pmt <<
"), " <<
FILL()
323 << setw(8) << pmt_b.
getID() <<
" (B" <<
FILL(2,
'0') << pmt <<
")" <<
FILL()
324 <<
", B - A " << pmt_b.
getID() - pmt_a.
getID()
333 for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
338 if (fabs(pmt_a.
getT0() - pmt_b.
getT0()) > precision.tcal) {
340 DEBUG(
" * different T0 PMT " << setw(2) << pmt <<
": "
343 <<
", B - A " << pmt_b.
getT0() - pmt_a.
getT0()
352 for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
361 DEBUG(
" * different PMT position: "
372 for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
381 if ((1.0 - dot) > precision.rcal) {
383 DEBUG(
" * different PMT direction: "
394 for (
unsigned int pmt = 0; pmt != module_a->size() && pmt != module_b->size(); ++pmt) {
401 DEBUG(
" * different status PMT " << setw(2) << pmt <<
": "
418 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
419 string.insert(module->getString());
420 floor .insert(module->getFloor ());
423 for (JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
424 string.insert(module->getString());
425 floor .insert(module->getFloor ());
431 string.size(), -0.5,
string.size() - 0.5,
432 floor .size(), -0.5, floor .size() - 0.5);
442 TH2D* X2 = (TH2D*) M2.Clone(
"X2" );
443 TH2D* Y2 = (TH2D*) M2.Clone(
"Y2" );
444 TH2D* Z2 = (TH2D*) M2.Clone(
"Z2" );
445 TH2D* T2 = (TH2D*) M2.Clone(
"T2" );
446 TH2D* RMS = (TH2D*) M2.Clone(
"RMS");
447 TH2D* R2 = (TH2D*) M2.Clone(
"R2" );
448 TH2D* QA = (TH2D*) M2.Clone(
"QA" );
449 TH2D* QB = (TH2D*) M2.Clone(
"QB" );
450 TH2D* QC = (TH2D*) M2.Clone(
"QC" );
451 TH2D* QD = (TH2D*) M2.Clone(
"QD" );
452 TH2D* Q2 = (TH2D*) M2.Clone(
"Q2" );
454 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
455 if (!module_router_b.
hasModule(module->getID()) ) {
456 M2.Fill(module->getString(), module->getFloor(), -1.0);
460 for (JDetector::iterator module = detector_b.begin(); module != detector_b.end(); ++module) {
461 if (!module_router_a.
hasModule(module->getID()) ) {
462 M2.Fill(module->getString(), module->getFloor(), +1.0);
467 for (JDetector::iterator module_a = detector_a.begin(); module_a != detector_a.end(); ++module_a) {
475 for (
size_t i = 0; i != numberOfPMTs; ++i) {
482 X2 ->Fill(getBin(
string, module_a->
getString()), getBin(floor, module_a->
getFloor()), module_a->
getX() - module_b->
getX() + numeric_limits<double>::min());
483 Y2 ->Fill(getBin(
string, module_a->
getString()), getBin(floor, module_a->
getFloor()), module_a->
getY() - module_b->
getY() + numeric_limits<double>::min());
484 Z2 ->Fill(getBin(
string, module_a->
getString()), getBin(floor, module_a->
getFloor()), module_a->
getZ() - module_b->
getZ() + numeric_limits<double>::min());
490 const JQuantile q = getQuantile(*module_a, *module_b);
496 R2 ->Fill(getBin(
string, module_a->
getString()), getBin(floor, module_a->
getFloor()), phi);
510 for (TH2D* h2 : { &M2, X2, Y2, Z2, T2, RMS, R2, QA, QB, QC, QD, Q2 }) {