18 from ROOT
import Belle2
19 from rundb
import RunDB
24 def fill(fillPatternHex, firstExp, firstRun, lastExp, lastRun):
25 """Create a payload with the given hexadecmal fill pattern for the given run range"""
27 if fillPatternHex
is None:
31 fillPatternBin = bin(int(fillPatternHex, 16))
32 fillPatternBin = fillPatternBin.replace(
'0b',
'')
34 for num, bucket
in enumerate(fillPatternBin):
36 bunches.setBucket(num)
38 print(
"Filling new payload. iov:", firstExp, firstRun, lastExp, lastRun)
43 db.storeData(
"BunchStructure", bunches, iov)
53 elif len(sys.argv) == 5:
59 basf2.B2ERROR(
"Wrong arguments. Options are:\n",
60 "1 arguments usage: basf2 ", argvs[0],
" <0> or <1003>\n"
61 "4 arguments usage: basf2 ", argvs[0],
" <minexp> <minrun> <maxexp> <maxrun>")
69 for b
in range(0, 5120, 2):
72 if((b % 300 == 0) & (b != 0)):
75 bunches.setBucket(b + extraStep)
80 db.storeData(
"BunchStructure", bunches, iov)
82 elif(minexp ==
"1003"):
84 username = input(
"Enter your username: ")
85 rundb = RunDB(username=username)
87 runInfo = rundb.get_run_info(
97 pattern = it[
'ler'][
'fill_pattern']
98 fill(pattern, 1003, 0, 1003, -1)
102 username = input(
"Enter your username: ")
103 rundb = RunDB(username=username)
105 runInfo = rundb.get_run_info(
106 min_experiment=minexp,
107 max_experiment=maxexp,
114 current_pattern =
None
115 current_start =
None,
None
116 current_end =
None,
None
124 exprun = it[
'experiment'], it[
'run']
125 pattern = it[
'ler'][
'fill_pattern']
131 if pattern != current_pattern:
134 runExpMaxBegin = current_start
135 runExpMaxEnd = current_end
139 fill(current_pattern, *current_start, *current_end)
140 if current_pattern
is not None:
141 print(f
"Corresponding to {lumi/1000.:.2f} pb-1\n")
144 current_pattern = pattern
145 current_start = exprun
148 lumi = it[
'statistics'][
'lumi_recorded']
153 lumi += it[
'statistics'][
'lumi_recorded']
156 fill(current_pattern, *current_start, *current_end)
157 print(f
"Corresponding to {lumi/1000.:.2f} pb-1\n")
160 f
"Most used filling pattern:\niov: \
161 {runExpMaxBegin[0]},{runExpMaxBegin[1]},{runExpMaxEnd[0]},{runExpMaxEnd[1]} \
162 \nIntegrated luminosity: {lumiMax/1000:.2f} pb-1")
Class to store the fill pattern of colliding bunches.
A class that describes the interval of experiments/runs for which an object in the database is valid.
static Database & Instance()
Instance of a singleton Database.