5 SVD Detector Configuration Importer.
6 Script to the configuration parameters, Local and Global, into a local DB
11 from ROOT.Belle2
import SVDDetectorConfigurationImporter
12 from ROOT.Belle2
import FileSystem
19 from fnmatch
import fnmatch
20 from termcolor
import colored
22 parser = argparse.ArgumentParser(description=
"SVD Detector Configuration Importer")
23 parser.add_argument(
'--exp', metavar=
'experiment', dest=
'exp', type=int, nargs=1, help=
'Experiment Number, = 1 for GCR')
24 parser.add_argument(
'--run', metavar=
'run', dest=
'run', type=int, nargs=1, help=
'Run Number')
25 parser.add_argument(
'--cfgXML', metavar=
'config xml', dest=
'calib', type=str, nargs=1, help=
'GlobalRun Calibration XML file')
29 if(str(sys.argv[1]) ==
"help"):
33 args = parser.parse_args()
35 experiment = args.exp[0]
38 if args.calib
is not None:
39 calibfile = args.calib[0]
41 calibfile = args.calib
53 print(
'| ---> CHECK HERE: <---')
54 print(
'| experiment number = ' + str(experiment))
55 print(
'|first valid run number = ' + str(run))
56 print(
'| global xml = ' + str(calibfile))
57 print(
'| ---> THANKS! <---')
58 sys.stdout.write(RESET)
62 proceed = input(
"Do you want to proceed? y/n ")
63 if not str(proceed) ==
'y':
64 print(colored(str(proceed) +
' != y, therefore we exit now',
'red'))
72 use_central_database(GLOBAL_TAG)
73 use_local_database(
"localDB_test/database.txt",
"localDB_test", invertLogging=
True)
81 eventinfosetter = register_module(
'EventInfoSetter')
82 eventinfosetter.param({
'evtNumList': [1],
'expList': experiment,
'runList': run})
83 main.add_module(eventinfosetter)
86 main.add_module(
"Gearbox")
92 '''detector configuration importer'''
99 if args.calib
is not None:
101 configImporterToDB.importSVDGlobalConfigParametersFromXML(calibfile)
102 print(colored(
"V) Global Detector Configuration parameters: (ZS, latency, mask, APVClock units) Imported",
'green'))
104 configImporterToDB.importSVDLocalConfigParametersFromXML(calibfile)
105 print(colored(
"V) Local Detector Configuration parameters Imported",
'green'))
107 print(colored(
"X) Detector Configuration parameters are not NOT imported.",
'red'))
114 print(
"IMPORT COMPLETED, check the localDB folder and then proceeed with the upload to the central DB")