12from ROOT
import Belle2
13from ROOT.Belle2
import TOPDatabaseImporter
19main = b2.create_path()
22main.add_module(
'EventInfoSetter', evtNumList=[1])
25main.add_module(
'TOPGeometryParInitializer')
31b2.conditions.expert_settings(save_payloads=
"localDB/localDB.txt")
34dbImporter = TOPDatabaseImporter()
37fileNames = sorted(glob.glob(
'masks/*.root'))
38numFiles = len(fileNames)
40 print(
'No files found')
43if not os.path.exists(
'masks/imported'):
44 os.makedirs(
'masks/imported')
46for i, fileName
in enumerate(fileNames):
47 runFirst = int((fileName.split(
'_r')[1]).split(
'.')[0])
48 expNo = int((fileName.split(
'_e')[1]).split(
'_')[0])
51 if k < len(fileNames):
52 nextName = fileNames[k]
53 runLast = int((nextName.split(
'_r')[1]).split(
'.')[0]) - 1
54 expNext = int((nextName.split(
'_e')[1]).split(
'_')[0])
55 if expNext > expNo
or k == len(fileNames):
57 elif runLast < runFirst:
58 b2.B2ERROR(
"first run:", runFirst,
"last run:", runLast)
59 b2.B2ERROR(
"Last run is less than the first one: exiting!")
61 dbImporter.importChannelMask(fileName, expNo, runFirst, runLast)
62 os.rename(fileName, fileName.replace(
'masks/',
'masks/imported/'))