From 73d54aa70f703fc3ce371abcbf9b58403a166bd2 Mon Sep 17 00:00:00 2001 From: Sandro Wenzel Date: Sun, 29 Nov 2026 09:42:52 +0100 Subject: [PATCH] Replace the sim_alignment task by align-geom.mAlignPaths This simplifies the alignment procedure for MC by getting rid of the sim_alignment task. o2-sim now uses MCH/MisCalib/Align when these objects are available and falls back to MCH/Calib/Align when not. This builds upon https://github.com/AliceO2Group/O2DPG/pull/2566 but makes it leaner, and fixes a failure in the nightly productions. - Fixes the crashes in the nightly GRID test, introduced since https://github.com/AliceO2Group/AliceO2/pull/16215. - Keeps only standard objects in the local CCDB cache, so the task ordering of #2566 is no longer needed. - Requires https://github.com/AliceO2Group/AliceO2/pull/16216 (daily-20261129 or later). - Allows switching the residual off with -confKey "align-geom.mAlignPaths=MCH:MCH/Calib/Align". https://its.cern.ch/jira/browse/O2-7374 Co-Authored-By: Claude Opus 5.5 --- MC/bin/o2dpg_sim_config.py | 3 +++ MC/bin/o2dpg_sim_workflow.py | 13 +------------ MC/bin/tests/test_sim_config_embedding.py | 14 +++++++++++++- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/MC/bin/o2dpg_sim_config.py b/MC/bin/o2dpg_sim_config.py index 57e6d1a18..0728a29e7 100755 --- a/MC/bin/o2dpg_sim_config.py +++ b/MC/bin/o2dpg_sim_config.py @@ -204,6 +204,9 @@ def add(cfg, flatconfig): add(config, {"MFTBase.buildAlignment" : "true"}) + # residual MCH misalignment for simulation only, not reconstruction (falls back to MCH/Calib/Align where absent) + add(config, {"align-geom.mAlignPaths" : "MCH:MCH/MisCalib/Align"}) + # Keep the ZEM calorimeters, drop the +-113 m beam line that makes the ZDC # expensive to transport. --with-ZDC asks for the whole thing, and an explicit # "--skipModules ZDC" still removes the module altogether. diff --git a/MC/bin/o2dpg_sim_workflow.py b/MC/bin/o2dpg_sim_workflow.py index 2cc0b5bde..eb0d99a8a 100755 --- a/MC/bin/o2dpg_sim_workflow.py +++ b/MC/bin/o2dpg_sim_workflow.py @@ -663,17 +663,6 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True, runcommand=True): GEOM_PREFETCH_TASK['cmd'] = 'chmod +x ${PWD}/geomprefetcher_script.sh; ${PWD}/geomprefetcher_script.sh' workflow['stages'].append(GEOM_PREFETCH_TASK) -# Fix (residual) geometry alignment for simulation stage -# Detectors that prefer to apply special alignments (for example residual effects) should be listed here and download these files. -# These object will take precedence over ordinary align objects **and** will only be applied in transport simulation -# and digitization (Det/Calib/Align is only read in simulation since reconstruction tasks use GLO/Config/AlignedGeometry automatically). -SIM_ALIGNMENT_PREFETCH_TASK = createTask(name='sim_alignment', needs=['geomprefetch'], cpu='0') -SIM_ALIGNMENT_PREFETCH_TASK['cmd'] = '${O2_ROOT}/bin/o2-ccdb-downloadccdbfile --host http://alice-ccdb.cern.ch -p MID/MisCalib/Align --timestamp ' + str(args.timestamp) + ' --created-not-after ' \ - + str(args.condition_not_after) + ' -d ${ALICEO2_CCDB_LOCALCACHE}/MID/Calib/Align --no-preserve-path ; ' -SIM_ALIGNMENT_PREFETCH_TASK['cmd'] += '${O2_ROOT}/bin/o2-ccdb-downloadccdbfile --host http://alice-ccdb.cern.ch -p MCH/MisCalib/Align --timestamp ' + str(args.timestamp) + ' --created-not-after ' \ - + str(args.condition_not_after) + ' -d ${ALICEO2_CCDB_LOCALCACHE}/MCH/Calib/Align --no-preserve-path ' -workflow['stages'].append(SIM_ALIGNMENT_PREFETCH_TASK) - # create/publish the GRPs and other GLO objects for consistent use further down the pipeline orbitsPerTF=int(args.orbitsPerTF) GRP_TASK = createTask(name='grpcreate', needs=["geomprefetch"], cpu='0') @@ -698,7 +687,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True, runcommand=True): vtxmode_sgngen = 'kNoVertex' if args.make_evtpool else 'kCollContext' # preproduce the collision context / timeframe structure for all timeframes at once -precollneeds=[GRP_TASK['name'], SIM_ALIGNMENT_PREFETCH_TASK['name']] +precollneeds=[GRP_TASK['name']] # max number of QED events simulated per timeframe. # A large pool of QED events (0.6*INTRATE) is needed to avoid repetition of events in the same or # neighbouring ITS readout frames, which would fire already activated pixel, discarding the event. diff --git a/MC/bin/tests/test_sim_config_embedding.py b/MC/bin/tests/test_sim_config_embedding.py index 87ee44ae8..80332f038 100644 --- a/MC/bin/tests/test_sim_config_embedding.py +++ b/MC/bin/tests/test_sim_config_embedding.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Offline tests: MC-DATA embedding switches the TPC looper generator and the QED background off.""" +"""Offline tests: default transport config keys (MC-DATA embedding switches, residual alignment) and the QED background.""" import argparse import os import sys @@ -32,6 +32,18 @@ def test_explicit_key_wins(self): self.assertEqual(cfg["GenTPCLoopers"].get("loopersVeto"), "false") +class TestAlignPaths(unittest.TestCase): + + def test_mch_residual_alignment_by_default(self): + cfg = simconfig.create_geant_config(args(), "") + self.assertEqual(cfg["align-geom"].get("mAlignPaths"), "MCH:MCH/MisCalib/Align") + self.assertIn("align-geom.mAlignPaths=MCH:MCH/MisCalib/Align;", simconfig.constructConfigKeyArg(cfg)) + + def test_explicit_key_wins(self): + cfg = simconfig.create_geant_config(args(), "align-geom.mAlignPaths=MCH:MCH/Other/Align") + self.assertEqual(cfg["align-geom"].get("mAlignPaths"), "MCH:MCH/Other/Align") + + class TestQED(unittest.TestCase): PB = 1000822080