13 SVD Database importer.
14 Script to Import SVD Channel Mapping into a local DB
18 from ROOT.Belle2
import SVDLocalCalibrationsImporter
21 from termcolor
import colored
22 from basf2
import conditions
as b2conditions
24 parser = argparse.ArgumentParser(description=
"SVD Local Calibrations Importer")
25 parser.add_argument(
'--exp', metavar=
'experiment', dest=
'exp', type=int, nargs=1, help=
'Experiment Number, = 1 for GCR')
26 parser.add_argument(
'--run', metavar=
'run', dest=
'run', type=int, nargs=1, help=
'Run Number')
27 parser.add_argument(
'--mapXML', metavar=
'channel map xml', dest=
'mapp', type=str, nargs=1, help=
'Channel Mapping xml file')
31 if(str(sys.argv[1]) ==
"help"):
35 args = parser.parse_args()
37 experiment = args.exp[0]
40 if args.mapp
is not None:
41 mappingfile = args.mapp[0]
43 mappingfile = args.mapp
54 print(
'| ---> CHECK HERE: <---')
55 print(
'| experiment number = ' + str(experiment))
56 print(
'|first valid run number = ' + str(run))
57 print(
'| mapping xml = ' + str(mappingfile))
58 print(
'| ---> THANKS! <---')
59 sys.stdout.write(RESET)
63 proceed = input(
"Do you want to proceed? y/n ")
64 if not str(proceed) ==
'y':
65 print(colored(str(proceed) +
' != y, therefore we exit now',
'red'))
69 b2conditions.prepend_globaltag(
"svd_basic")
71 main = b2.create_path()
75 eventinfosetter = b2.register_module(
'EventInfoSetter')
76 eventinfosetter.param({
'evtNumList': [1],
'expList': experiment,
'runList': run})
77 main.add_module(eventinfosetter)
80 main.add_module(
"Gearbox")
86 '''channel mapping importer module'''
93 if args.mapp
is not None:
95 dbImporter.importSVDChannelMapping(mappingfile)
96 print(colored(
"V) Channel Mapping Imported",
'green'))
103 print(
"IMPORT COMPLETED, check the localDB folder and then proceeed with the upload to the central DB")