6 Script to Import SVD Channel Mapping into a local DB
11 from ROOT.Belle2
import SVDLocalCalibrationsImporter
12 from ROOT.Belle2
import FileSystem
19 from fnmatch
import fnmatch
20 from termcolor
import colored
22 parser = argparse.ArgumentParser(description=
"SVD Local Calibrations 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(
'--mapXML', metavar=
'channel map xml', dest=
'mapp', type=str, nargs=1, help=
'Channel Mapping xml file')
29 if(str(sys.argv[1]) ==
"help"):
33 args = parser.parse_args()
35 experiment = args.exp[0]
38 if args.mapp
is not None:
39 mappingfile = args.mapp[0]
41 mappingfile = args.mapp
52 print(
'| ---> CHECK HERE: <---')
53 print(
'| experiment number = ' + str(experiment))
54 print(
'|first valid run number = ' + str(run))
55 print(
'| mapping xml = ' + str(mappingfile))
56 print(
'| ---> THANKS! <---')
57 sys.stdout.write(RESET)
61 proceed = input(
"Do you want to proceed? y/n ")
62 if not str(proceed) ==
'y':
63 print(colored(str(proceed) +
' != y, therefore we exit now',
'red'))
69 GLOBAL_TAG =
"svd_basic"
70 use_central_database(GLOBAL_TAG)
71 use_local_database(
"localDBchannelMapping/database.txt",
"localDBchannelMapping", invertLogging=
True)
79 eventinfosetter = register_module(
'EventInfoSetter')
80 eventinfosetter.param({
'evtNumList': [1],
'expList': experiment,
'runList': run})
81 main.add_module(eventinfosetter)
84 main.add_module(
"Gearbox")
92 '''channel mapping importer module'''
99 if args.mapp
is not None:
101 dbImporter.importSVDChannelMapping(mappingfile)
102 print(colored(
"V) Channel Mapping Imported",
'green'))
109 print(
"IMPORT COMPLETED, check the localDBchannelMapping folder and then proceeed with the upload to the central DB")