12from ROOT.Belle2
import TOPDatabaseImporter
18main = b2.create_path()
21main.add_module(
'EventInfoSetter', evtNumList=[1])
24main.add_module(
'TOPGeometryParInitializer')
30b2.conditions.expert_settings(save_payloads=
"localDB/localDB.txt")
33dbImporter = TOPDatabaseImporter()
36fileNames = sorted(glob.glob(
'masks/*.root'))
37numFiles = len(fileNames)
39 print(
'No files found')
42if not os.path.exists(
'masks/imported'):
43 os.makedirs(
'masks/imported')
45for i, fileName
in enumerate(fileNames):
46 runFirst = int((fileName.split(
'_r')[1]).split(
'.')[0])
47 expNo = int((fileName.split(
'_e')[1]).split(
'_')[0])
50 if k < len(fileNames):
51 nextName = fileNames[k]
52 runLast = int((nextName.split(
'_r')[1]).split(
'.')[0]) - 1
53 expNext = int((nextName.split(
'_e')[1]).split(
'_')[0])
54 if expNext > expNo
or k == len(fileNames):
56 elif runLast < runFirst:
57 b2.B2ERROR(
"first run:", runFirst,
"last run:", runLast)
58 b2.B2ERROR(
"Last run is less than the first one: exiting!")
60 dbImporter.importChannelMask(fileName, expNo, runFirst, runLast)
61 os.rename(fileName, fileName.replace(
'masks/',
'masks/imported/'))