Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistency fixes for SOR determination in unanchored MC #1780

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions MC/bin/o2dpg_sim_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
parser.add_argument('--no-tpc-digitchunking', action='store_true', help=argparse.SUPPRESS)
parser.add_argument('--no-strangeness-tracking', action='store_true', default=False, help="Disable strangeness tracking")
parser.add_argument('--combine-tpc-clusterization', action='store_true', help=argparse.SUPPRESS) #<--- useful for small productions (pp, low interaction rate, small number of events)
parser.add_argument('--first-orbit', default=0, type=int, help=argparse.SUPPRESS) # to set the first orbit number of the run for HBFUtils (only used when anchoring)
parser.add_argument('--first-orbit', default=256, type=int, help=argparse.SUPPRESS) # to set the first orbit number of the run for HBFUtils (only used when anchoring); default 256 for convenience to allow for some orbits-early
# (consider doing this rather in O2 digitization code directly)
parser.add_argument('--orbits-early', default=0, type=float, help=argparse.SUPPRESS) # number of orbits to start simulating earlier
# to reduce start of timeframe effects in MC --> affects collision context
Expand Down 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