Skip to content

Commit 48d175a

Browse files
committed
Scripts for MC-DATA embedding
This commit provides: - anchorMC_DataEmbedding.sh performing an MC to producing an AO2D corresponding to a given DATA AOD as specified by ALIEN_JDL_MC_DATA_EMBEDDING_AO2D - A test showing how this is used - changes or additions to python scripts for the anchoring or extraction of collision structure from given AO2D
1 parent 338d1be commit 48d175a

File tree

4 files changed

+860
-1
lines changed

4 files changed

+860
-1
lines changed

MC/bin/o2dpg_sim_workflow_anchored.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,29 @@ def determine_timestamp(sor, eor, splitinfo, cycle, ntf, HBF_per_timeframe = 256
394394
assert (timestamp_of_production <= eor)
395395
return int(timestamp_of_production), production_offset
396396

397+
def determine_timestamp_from_timeframeID(sor, eor, timeframeID, HBF_per_timeframe = 256):
398+
"""
399+
Determines the timestamp based on the given timeframeID within a run
400+
Args:
401+
sor: int
402+
start-of-run in milliseconds since epoch
403+
eor: int
404+
end-of-run in milliseconds since epoch
405+
timeframeID: int
406+
timeframe id
407+
HBF_per_timeframe: int
408+
number of orbits per timeframe
409+
Returns:
410+
int: timestamp in milliseconds
411+
"""
412+
# length of this run in micro seconds, since we use the orbit duration in micro seconds
413+
414+
timestamp_of_production = sor + timeframeID * HBF_per_timeframe * LHCOrbitMUS / 1000
415+
# this is a closure test. If we had perfect floating point precision everywhere, it wouldn't fail.
416+
# But since we don't have that and there are some int casts as well, better check again.
417+
assert (timestamp_of_production >= sor)
418+
assert (timestamp_of_production <= eor)
419+
return int(timestamp_of_production)
397420

398421
def exclude_timestamp(ts, orbit, run, filename, global_run_params):
399422
"""
@@ -481,6 +504,7 @@ def main():
481504
parser.add_argument("--invert-irframe-selection", action='store_true', help="Inverts the logic of --run-time-span-file")
482505
parser.add_argument("--orbitsPerTF", type=str, help="Force a certain orbits-per-timeframe number; Automatically taken from CCDB if not given.", default="")
483506
parser.add_argument('--publish-mcprodinfo', action='store_true', default=False, help="Publish MCProdInfo metadata to CCDB")
507+
parser.add_argument('--timeframeID', type=int, help="If given, anchor to this specific timeframe id within a run. Takes precendence over determination based on (split-id, prod-split, cycle)", default=-1)
484508
parser.add_argument('forward', nargs=argparse.REMAINDER) # forward args passed to actual workflow creation
485509
args = parser.parse_args()
486510
print (args)
@@ -553,7 +577,13 @@ def main():
553577
GLOparams["OrbitsPerTF"] = determined_orbits
554578

555579
# determine timestamp, and production offset for the final MC job to run
556-
timestamp, prod_offset = determine_timestamp(run_start, run_end, [args.split_id - 1, args.prod_split], args.cycle, args.tf, GLOparams["OrbitsPerTF"])
580+
timestamp = 0
581+
prod_offset = 0
582+
if args.timeframeID != -1:
583+
timestamp = determine_timestamp_from_timeframeID(run_start, run_end, args.timeframeID, GLOparams["OrbitsPerTF"])
584+
prod_offset = args.timeframeID
585+
else:
586+
timestamp, prod_offset = determine_timestamp(run_start, run_end, [args.split_id - 1, args.prod_split], args.cycle, args.tf, GLOparams["OrbitsPerTF"])
557587

558588
# determine orbit corresponding to timestamp (mainly used in exclude_timestamp function)
559589
orbit = GLOparams["FirstOrbit"] + int((timestamp - GLOparams["SOR"]) / ( LHCOrbitMUS / 1000))

0 commit comments

Comments
 (0)