11 if (runnumber<236107):
12 print (
"WARNING BunchSpacingUtils don't work for run-1 data")
15 tdaqDBName=
"COOLONL_TDAQ/CONDBR2"
16 folder=
"/TDAQ/OLC/LHC/FILLPARAMS"
17 iovtime=
getTimeForLB(runnumber,LB,readOracle=
"DBRELEASE" not in environ)
20 print (
"ERROR, can't get start time of run %i, LB %i" % (runnumber,LB))
29 f=db.getFolder(folder)
30 obj=f.findObject(cool.ValidityKey(iovtime),0)
31 except Exception
as e:
33 if len(e.args)>1
and e.args[0].
find(
"Object not found - 0"):
34 print (
"WARNING No data found in folder %s for run/LB %i/%i" % (folder,runnumber,LB))
36 print (
"BunchSpacingUtils: ERROR accesssing folder",folder,
"on db",tdaqDBName)
52 for iBucket,filled
in enumerate(buf):
54 if (verbose):
print (
"Bucket",iBucket,
"filled")
58 if (verbose):
print (
"First filled bucket=",iBucket)
60 if (verbose):
print (
"Bucket #%i, bunch spacing=%i * 25ns" % (iBucket,bucketDiff))
61 bucketDiffs.append(bucketDiff)
66 if (verbose):
print (
"Bucket",iBucket,
"not filled")
71 if (firstFilled>=0
and lastFilled>0):
72 bucketDiffs.append(len(buf)-lastFilled+firstFilled)
73 if (verbose):
print (
"Bunchdiff at wrap-around:",(len(buf)-lastFilled+firstFilled))
76 if len(bucketDiffs)==0:
79 return min(bucketDiffs)