13 SVD Detector Configuration Importer.
14 Script to the configuration parameters, Local and Global, into a local DB
18 from ROOT.Belle2
import SVDDetectorConfigurationImporter
21 from termcolor
import colored
22 from basf2
import conditions
as b2conditions
24 parser = argparse.ArgumentParser(description=
"SVD Detector Configuration 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(
'--cfgXML', metavar=
'config xml', dest=
'calib', type=str, nargs=1, help=
'GlobalRun Calibration XML file')
31 if(str(sys.argv[1]) ==
"help"):
35 args = parser.parse_args()
37 experiment = args.exp[0]
40 if args.calib
is not None:
41 calibfile = args.calib[0]
43 calibfile = args.calib
55 print(
'| ---> CHECK HERE: <---')
56 print(
'| experiment number = ' + str(experiment))
57 print(
'|first valid run number = ' + str(run))
58 print(
'| global xml = ' + str(calibfile))
59 print(
'| ---> THANKS! <---')
60 sys.stdout.write(RESET)
64 proceed = input(
"Do you want to proceed? y/n ")
65 if not str(proceed) ==
'y':
66 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 '''detector configuration importer'''
93 if args.calib
is not None:
95 configImporterToDB.importSVDGlobalConfigParametersFromXML(calibfile)
96 print(colored(
"V) Global Detector Configuration parameters: (ZS, latency, mask, APVClock units) Imported",
'green'))
98 configImporterToDB.importSVDLocalConfigParametersFromXML(calibfile)
99 print(colored(
"V) Local Detector Configuration parameters Imported",
'green'))
101 print(colored(
"X) Detector Configuration parameters are not NOT imported.",
'red'))
108 print(
"IMPORT COMPLETED, check the localDB folder and then proceeed with the upload to the central DB")