Skip to content

Commit e57823c

Browse files
committed
Ensure the ITS ramp-up offset to SOR orbit is multiple of orbitsPerTF
1 parent 3415bc6 commit e57823c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎MC/bin/o2dpg_sim_workflow_anchored.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def milliseconds_to_orbits(milliseconds):
327327
"""
328328
return int(math.ceil(1000. * milliseconds / LHCOrbitMUS))
329329

330-
def shift_anchor_past_ITS_rampup(run_start, first_orbit, ITS_rampup):
330+
def shift_anchor_past_ITS_rampup(run_start, first_orbit, orbitsPerTF, ITS_rampup):
331331
"""
332332
Moves the anchoring point past the ITS ramp-up period, in both of its
333333
coordinates, and returns the pair (start of run in ms, first orbit).
@@ -336,7 +336,10 @@ def shift_anchor_past_ITS_rampup(run_start, first_orbit, ITS_rampup):
336336
timestamp leaves a job at production offset 0 inside the ramp, where the ITS
337337
time-dead map masks every chip.
338338
"""
339-
return run_start + ITS_rampup, first_orbit + milliseconds_to_orbits(ITS_rampup)
339+
# convert ITS_rampup to orbits multiple to orbitsPerTF
340+
rampupOrbits = ((milliseconds_to_orbits(ITS_rampup) + orbitsPerTF - 1) // orbitsPerTF ) * orbitsPerTF
341+
342+
return run_start + int(rampupOrbits * LHCOrbitMUS / 1000.), first_orbit + rampupOrbits
340343

341344
def retrieve_MinBias_CTPScaler_Rate(raw_rate_at, finaltime, trig_eff_arg, NBunches, ColSystem, eCM, run_number = -1):
342345
"""
@@ -611,7 +614,7 @@ def main():
611614
# Adjust the anchoring point using the ITS ramp-up period
612615
ITS_rampup = retrieve_ITS_RampDuration(ccdbreader, run_start)
613616
print(f"ITS ramp-up time: {ITS_rampup} ms")
614-
effective_run_start, effective_first_orbit = shift_anchor_past_ITS_rampup(run_start, GLOparams["FirstOrbit"], ITS_rampup)
617+
effective_run_start, effective_first_orbit = shift_anchor_past_ITS_rampup(run_start, GLOparams["FirstOrbit"], GLOparams["OrbitsPerTF"], ITS_rampup)
615618
mid_run_timestamp = (effective_run_start + run_end) // 2
616619

617620
# --------

0 commit comments

Comments
 (0)