Skip to content

Commit 288edf2

Browse files
committed
Better SOR determination
Fixes a problem with wrong/inconsistent timestamps for some runs (when not using anchoring). Now consistent with other code in O2.
1 parent 91da4e6 commit 288edf2

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,21 +244,44 @@ def retrieve_sor(run_number):
244244
"""
245245
retrieves start of run (sor)
246246
from the RCT/Info/RunInformation table with a simple http request
247-
in case of problems, 0 will be returned
247+
in case of problems, 0 will be returned. Simple http request has advantage
248+
of not needing to initialize a Ccdb object.
248249
"""
250+
249251
url="http://alice-ccdb.cern.ch/browse/RCT/Info/RunInformation/"+str(run_number)
250252
ansobject=requests.get(url)
251253
tokens=ansobject.text.split("\n")
252254

255+
# determine start of run, earlier values take precedence (see also implementation in BasicCCDBManager::getRunDuration)
256+
STF=0
257+
# extract SOR by pattern matching
258+
for t in tokens:
259+
match_object=re.match(r"\s*(STF\s*=\s*)([0-9]*)\s*", t)
260+
if match_object != None:
261+
STF=int(match_object[2])
262+
break
263+
if STF > 0:
264+
return STF
265+
266+
SOX=0
267+
# extract SOX by pattern matching
268+
for t in tokens:
269+
match_object=re.match(r"\s*(STF\s*=\s*)([0-9]*)\s*", t)
270+
if match_object != None:
271+
SOX=int(match_object[2])
272+
break
273+
if SOX > 0:
274+
return SOX
275+
253276
SOR=0
254277
# extract SOR by pattern matching
255278
for t in tokens:
256279
match_object=re.match(r"\s*(SOR\s*=\s*)([0-9]*)\s*", t)
257280
if match_object != None:
258-
SOR=match_object[2]
281+
SOR=int(match_object[2])
259282
break
260-
261-
return int(SOR)
283+
284+
return SOR
262285

263286

264287
# check and sanitize config-key values (extract and remove diamond vertex arguments into finalDiamondDict)

0 commit comments

Comments
 (0)