Skip to content

Commit

Permalink
Consistency fixes for SOR determination in unanchored MC (#1780)
Browse files Browse the repository at this point in the history
* Set default firstOrbit to 256

just a preventive measure in case someone is using --early-orbits
(avoid to get negative).
In the worst case we skip few timeframes ... and in any case not
a relevant change for anchored MC.

* Better SOR determination

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 authored Nov 5, 2024
1 parent e46d231 commit 5f6131a
Showing 1 changed file with 28 additions and 5 deletions.
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

0 comments on commit 5f6131a

Please sign in to comment.