1"""Compare two geofiles with or without the calibration constants."""
3from argparse
import ArgumentParser
7parser = ArgumentParser()
9 "-g1",
"--geofile1", help=
"first geometry file: geo1", required=
True
12 "-g2",
"--geofile2", help=
"second geometry file: geo2", required=
True
15 "--compare_calibration", help=
"compare calibration constants", action=
"store_true"
17options = parser.parse_args()
23if options.compare_calibration:
24 print(
"Run comparing the geo calibration constants")
26 print(
"Run WITHOUT comparing the geo calibration constants")
28calibration_subkeys = [
"Loc",
"RotPhi",
"RotPsi",
"RotTheta",
"station",
"DSTcor",
"Shift"]
29detector_list = [
"EmulsionDet",
"Scifi",
"MuFilter"]
31for detector
in detector_list:
32 print(
"Running over", detector)
33 print(
" Checking if geo1 elements exist in geo2")
34 for key
in geo1.snd_geo[detector].keys():
35 if not options.compare_calibration:
36 if any(subkey
in key
for subkey
in calibration_subkeys)
and not detector==
'EmulsionDet':
38 if key
not in geo2.snd_geo[detector].keys():
39 print(
" ", key,
"is missing from geo2")
40 print(
" Checking if geo2 elements exist in geo1")
41 for key
in geo2.snd_geo[detector].keys():
42 if not options.compare_calibration:
43 if any(subkey
in key
for subkey
in calibration_subkeys)
and not detector==
'EmulsionDet':
45 if key
not in geo1.snd_geo[detector].keys():
46 print(
" ", key,
"is missing from geo1")
48 print(
" Checking the values of the elements that exist in both files")
49 for key
in geo1.snd_geo[detector].keys():
50 if not options.compare_calibration:
51 if any(subkey
in key
for subkey
in calibration_subkeys)
and not detector==
'EmulsionDet':
54 key
in geo2.snd_geo[detector].keys()
55 and abs(geo1.snd_geo[detector][key] - geo2.snd_geo[detector][key]) != 0
60 "Different value detected! geo1:",
61 geo1.snd_geo[detector][key],
63 geo2.snd_geo[detector][key],