Skip to content

Commit

Permalink
Better SOR determination
Browse files Browse the repository at this point in the history
Fixes a problem with wrong/inconsistent timestamps
for some runs (when not using anchoring).

Now consistent with other code in O2.
  • Loading branch information
sawenzel committed Nov 1, 2024
1 parent 91da4e6 commit 288edf2
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions MC/bin/o2dpg_sim_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,21 +244,44 @@ def retrieve_sor(run_number):
"""
retrieves start of run (sor)
from the RCT/Info/RunInformation table with a simple http request
in case of problems, 0 will be returned
in case of problems, 0 will be returned. Simple http request has advantage
of not needing to initialize a Ccdb object.
"""

url="http://alice-ccdb.cern.ch/browse/RCT/Info/RunInformation/"+str(run_number)
ansobject=requests.get(url)
tokens=ansobject.text.split("\n")

# determine start of run, earlier values take precedence (see also implementation in BasicCCDBManager::getRunDuration)
STF=0
# extract SOR by pattern matching
for t in tokens:
match_object=re.match(r"\s*(STF\s*=\s*)([0-9]*)\s*", t)
if match_object != None:
STF=int(match_object[2])
break
if STF > 0:
return STF

SOX=0
# extract SOX by pattern matching
for t in tokens:
match_object=re.match(r"\s*(STF\s*=\s*)([0-9]*)\s*", t)
if match_object != None:
SOX=int(match_object[2])
break
if SOX > 0:
return SOX

SOR=0
# extract SOR by pattern matching
for t in tokens:
match_object=re.match(r"\s*(SOR\s*=\s*)([0-9]*)\s*", t)
if match_object != None:
SOR=match_object[2]
SOR=int(match_object[2])
break

return int(SOR)
return SOR


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

0 comments on commit 288edf2

Please sign in to comment.