Skip to content

Commit 29203ab

Browse files
committed
Fix unit problem determining orbit for exclusion
1 parent 242e1b8 commit 29203ab

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

MC/bin/o2dpg_sim_workflow_anchored.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,6 @@ def parse_file(filename):
390390
exclude_list = list(zip(filtered["From"].to_list() , filtered["To"].to_list()))
391391

392392
print("Exclusion list has " + str(len(exclude_list)) + " entries")
393-
print(exclude_list)
394-
395393
if len(exclude_list) == 0:
396394
return False
397395

@@ -406,11 +404,13 @@ def parse_file(filename):
406404
if data_is_in_orbits:
407405
total_excluded_fraction = total_excluded_fraction + (exclusion_entry[1] - exclusion_entry[0]) / (1.*timeframelength_inorbits)
408406
if exclusion_entry[0] <= orbit and orbit <= exclusion_entry[1]:
409-
excluded = True
407+
print ("Excluding orbit ", str(orbit))
408+
excluded = True
410409
else:
411410
total_excluded_fraction = total_excluded_fraction + (exclusion_entry[1] - exclusion_entry[0]) / (1.*timeframelength_intime)
412411
if exclusion_entry[0] <= ts and ts <= exclusion_entry[1]:
413-
excluded = True
412+
print ("Excluding timestamp ", str(ts))
413+
excluded = True
414414

415415
print(f"This run as globally {total_excluded_fraction} of it's data marked to be exluded")
416416
return excluded
@@ -489,20 +489,27 @@ def main():
489489

490490
# determine timestamp, and production offset for the final MC job to run
491491
timestamp, prod_offset = determine_timestamp(run_start, run_end, [args.split_id - 1, args.prod_split], args.cycle, args.tf, GLOparams["OrbitsPerTF"])
492-
# determine orbit corresponding to timestamp
493-
orbit = GLOparams["FirstOrbit"] + (timestamp - GLOparams["SOR"]) / LHCOrbitMUS
494492

495-
# check if timestamp is to be excluded
496-
job_is_exluded = exclude_timestamp(timestamp, orbit, args.run_number, args.run_span_file, GLOparams)
497-
# possibly invert the selection
498-
if args.invert_irframe_selection:
499-
job_is_exluded = not job_is_exluded
493+
# determine orbit corresponding to timestamp (mainly used in exclude_timestamp function)
494+
orbit = GLOparams["FirstOrbit"] + int((timestamp - GLOparams["SOR"]) / ( LHCOrbitMUS / 1000))
500495

501496
# this is anchored to
502497
print ("Determined start-of-run to be: ", run_start)
503498
print ("Determined end-of-run to be: ", run_end)
504499
print ("Determined timestamp to be : ", timestamp)
505500
print ("Determined offset to be : ", prod_offset)
501+
print ("SOR ", GLOparams["SOR"])
502+
print ("EOR ", GLOparams["EOR"])
503+
print ("TIM ", timestamp) # this timestamp
504+
print ("OS ", GLOparams["FirstOrbit"])
505+
print ("OE ", GLOparams["LastOrbit"])
506+
print ("TO ", orbit) # this orbit
507+
508+
# check if timestamp is to be excluded
509+
job_is_exluded = exclude_timestamp(timestamp, orbit, args.run_number, args.run_span_file, GLOparams)
510+
# possibly invert the selection
511+
if args.invert_irframe_selection:
512+
job_is_exluded = not job_is_exluded
506513

507514
forwardargs = " ".join([ a for a in args.forward if a != '--' ])
508515
# retrieve interaction rate

0 commit comments

Comments
 (0)