Skip to content

Record FirstOrbitMC in MCProdInfo and round the ITS ramp-up shift with the final orbitsPerTF - #2558

Open
sawenzel wants to merge 2 commits into
AliceO2Group:masterfrom
sawenzel:o2-7335-firstorbitmc
Open

sawenzel wants to merge 2 commits into
AliceO2Group:masterfrom
sawenzel:o2-7335-firstorbitmc

Conversation

@sawenzel

@sawenzel sawenzel commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

This fixes the anchoring for productions that override orbitsPerTF and records the first orbit of each anchored run, so that analysis can align its timeframes with the MC.

The ITS ramp-up shift was rounded with the TF length of the data run (32), before the --orbitsPerTF override was applied. With 128 orbits per TF this left the MC timeframes 64 orbits off. The shift is now recomputed after the override; explicit timeframe IDs (MC-DATA embedding) stay unshifted.

In addition, MCProdInfo now carries FirstOrbitMC and the software version in McTag. A stored FirstOrbitMC is never replaced, since it describes the data already produced for the run; a job that would use a different first orbit keeps it and prints a warning. AggregatedRunInfo will use FirstOrbitMC instead of a list of productions (AliceO2Group/AliceO2#16154).

The new tool MC/prodinfo/mcprodinfo_firstorbit.py adds FirstOrbitMC to existing productions. It reads the first orbit of each run from its GRID job logs, takes the software from the masterjob JDL and the logs, and skips runs without MC output. Runs without logs are filled, and a sample cross-checked, by rerunning the anchoring with the run's software:

mcprodinfo_firstorbit.py scan --tag LHC26h3 -o LHC26h3.json
mcprodinfo_firstorbit.py rerun LHC26h3.json --crosscheck 3
mcprodinfo_firstorbit.py apply LHC26h3.json --comment "FirstOrbitMC added because of O2-7335" --yes

For LHC26h3 this gives 60 runs made with MC-prod-2026-v12 (shift 2), 3 runs made with v14 (aligned) and 4 runs without jobs.

Fixes https://its.cern.ch/jira/browse/O2-7335

Assisted by Claude Code.

This fixes the anchoring for productions that override orbitsPerTF.

- The ramp-up shift was rounded with the orbitsPerTF of the data run, before the --orbitsPerTF override.
- With 128 orbits per TF this left the MC timeframes 64 orbits off.
- The shift is now recomputed after the override.

https://its.cern.ch/jira/browse/O2-7335

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawenzel
sawenzel requested a review from jackal1-66 as a code owner November 18, 2026 16:51
@github-actions

Copy link
Copy Markdown

REQUEST FOR PRODUCTION RELEASES:
To request your PR to be included in production software, please add the corresponding labels called "async-" to your PR. Add the labels directly (if you have the permissions) or add a comment of the form (note that labels are separated by a ",")

+async-label <label1>, <label2>, !<label3> ...

This will add <label1> and <label2> and removes <label3>.

The following labels are available
async-2023-pbpb-apass4
async-2023-pp-apass4
async-2024-pp-apass1
async-2022-pp-apass7
async-2024-pp-cpass0
async-2024-PbPb-apass1
async-2024-ppRef-apass1
async-2024-PbPb-apass2
async-2023-PbPb-apass5

This stores the first orbit used by an anchored MC job and its software version in its MCProdInfo object, and provides a new tool mcprodinfo_firstorbit.py that adds the first orbit to existing productions.

- Analysis uses FirstOrbitMC to align its timeframes with the MC.
- McTag is now filled at job time from ALIEN_JDL_PACKAGES.
- A stored FirstOrbitMC is never replaced; a job with a different value keeps it and prints a warning. Only force_overwrite, as used by the tool, replaces it.
- A writer without FirstOrbitMC, e.g. the harvester with --overwrite, keeps the stored value.
- Optional metadata with value None is no longer uploaded as the string "None".
- Reading an object that lacks a required field no longer raises a TypeError.
- The tool reads FirstOrbitMC per run from the log archives of the run's own jobs, found via MonALISA.
- The software of each run is taken from its masterjob JDL and log archives; runs whose jobs disagree are flagged and skipped.
- Runs without reachable archive are filled, and a sample cross-checked, by rerunning the anchoring with the run's software.
- apply skips runs that already carry the value and stops if a run changed since the scan.

Usage:

    mcprodinfo_firstorbit.py scan --tag LHC26h3 -o LHC26h3.json
    mcprodinfo_firstorbit.py rerun LHC26h3.json --crosscheck 3
    mcprodinfo_firstorbit.py apply LHC26h3.json --comment "FirstOrbitMC added because of O2-7335" --yes

For LHC26h3 the scan gives 60 runs made with MC-prod-2026-v12 (shift 2), 3 runs made with v14 (aligned) and 4 runs without jobs.

https://its.cern.ch/jira/browse/O2-7335

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawenzel
sawenzel force-pushed the o2-7335-firstorbitmc branch from 8954a02 to e25fbe9 Compare November 18, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant