Repository navigation
Rename period to era and pass a Corrections instance to the analysis hooks - #347
Merged
Merged
Conversation
# Conflicts: # .github/workflows/unit-tests.yaml # Analysis/tasks.py # docs/ci/integration-pipeline.md # docs/concepts/eras.md # docs/troubleshooting.md
…ds build Corrections directly
This was referenced Oct 18, 2026
Contributor
Author
Contributor
Author
Collaborator
|
pipeline#16078958 started |
Collaborator
|
GitHub Actions integration workflow dispatched for HH_bbWW, HH_bbtautau, H_mumu |
Collaborator
Collaborator
|
✅ GitHub Actions integration pipeline passed. |
This was referenced Oct 18, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The FLAF part of the multi-era change set. It does two things: the
period→erarename, and an explicit Corrections instance instead of a global one. Single-era behaviour and every output path and file name are unchanged. Thecorebundle hash changes.For users:
--era Run3_2022EEreplaces--period Run3_2022EE. These forms stop with a message naming the replacement:--period,--<Task>-periodand[<Task>] periodin a law config:'period' was renamed to 'era' (--era);period=keyword:'period' was renamed to 'era' (use era=...).--<Task>-eraand[<Task>] eraare refused too. Several eras (--era A,B) are refused for now (several eras in one task are not supported yet); this is what the next step of the change set enables. An unknown era lists the known ones.{era};{period}is refused.--era.law indexhas to be re-run once (task ids change).--period, which the new code refuses.For analysis code (companion PRs): the hooks get the Corrections instance as a required keyword:
addAllVariables(..., *, corrections);GetDfw(df, setup, dataset_name, *, corrections[, stage]);DefineWeightForHistograms(..., corrections).Utilities.CreateCorrections(setup, dataset_name, stage, aggregated_caches=None)builds the instance for the HistTuple and AnalysisCache payloads and keeps it on theDataFrameWrapper(dfw.corrections) for as long as the dataframe lives.anaTupleProducerandMergeAnaTuplesconstruct theirs directly. The AnaTuple column namedperiodkeeps its name.Inputs: the existing AnaTuples are found and read by path. The v2610 AnaTuples as input are checked below.
Changes
run_tools/law_customizations.py:EraParameter: a sorted, unique CSV parameter, limited to one era for now;periodtombstone and the command-line/config scan;setupas a property andsetup_for(era);{era}in bundle patterns; the era string in every path, never the tuple.Common/Setup.py:Setup(era).Common/Utilities.py:CreateCorrections,dfw.corrections.AnaProd/,Analysis/,Common/:self.era[0]and--eraeverywhere; the hooks getcorrections=.run_tools/check_era_rename.py, withtest/test_check_era_rename.py: the leftover check (periodidentifiers outside an allow-list,--period,{period}, the era tuple used as a string). It runs inunit-tests.yamlover FLAF's own files, and the other repos will run it from FLAFmainonce this PR is merged.test/test_era_parameter.py: identity, round trip, every refused form including{period}in a bundle pattern;era=.mainwhen this merges): the era pages, the arguments, troubleshooting, the architecture (Corrections in the hooks), the integration pipeline (the GitLabtest_correctionsjob), GitHub Actions (the rename check);.github/copilot-instructions.md.Companions: cms-flaf/Corrections#144 (merge first), cms-flaf/flaf_integration!33, cms-flaf/StatInference#27, cms-flaf/HH_bbtautau#98, cms-flaf/HH_bbWW#167, cms-flaf/H_mumu#80.
Testing
unit-tests.yaml), at 3e930ed: 762 passed, 807 subtests, 0 skipped inflaf_envon lxplus. At a67b5c9, beforemain(Ship the existing outputs of the submitted branches' requirements in the CRAB path-cache snapshot #346) was merged in, 753 passed both there and in a ROOT-free venv built like the workflow's. The rename check over FLAF's own files gives rc 0, and the docs build passes withmkdocs build --strict.mainwas merged in at 64323ff for Ship the existing outputs of the submitted branches' requirements in the CRAB path-cache snapshot #346 (the CRAB path-cache snapshot). Its new test task now usesself.era[0](00acacb). Ship the existing outputs of the submitted branches' requirements in the CRAB path-cache snapshot #346's code runs here with the era parameter in its own unit tests (TheJobChecksItsRequirementsFromTheSnapshot). The HTCondor and CRAB chains below ran before Ship the existing outputs of the submitted branches' requirements in the CRAB path-cache snapshot #346 existed, at a67b5c9 and 1021607.main; "new" is this change set before review round 1, which changes only formatting, docs, tests and one column name inbTagEffprod.py.run_ci_test.sh <ana> <era> htcondor(TestModel,--test 1000), then every ROOT file compared column by column and histogram by histogram, and the JSONs without timing fields: all 42 chains completed with RC 0.b1_HHbtag,b2_HHbtag,VBFJet_HHbtagand their shifts, |diff| <= 2.4e-4); HistTuples and histograms are identical.Run3_Model, Run3_2022EE; a signal, TT, DY and a data stream): identical.--ana-version v2610, old vs new. Both find the v2610 merge outputs complete at the same URIs. Result: Run3_2023 is identical. In Run3_2022, 2022EE and 2023BPix only the DeepHME cache columns differ (about 1e-5 relative; the integer mass is off by 1 in a few events), and the HistTuples are identical. The old code run twice on two CPU types differs in the same way, and old vs new re-run on one node is identical. Both versions found every v2610 AnaTuple-side task complete, at identical merge-output URIs.AnaTupleFileListTask, which keeps a local copy indata/, was run first, on both sides.out_name, every output URI and its existence, store/log/heartbeat/worker-file directories, bundle URIs, job-file names, CRAB request-name prefix), old vs new: identical for 415 stage lines, apart from thecorehash.createAnatuple(H_mumu, HH_bbWW, HH_bbtautau) andmergeAnaTuplesgive the same output as separate processes. The old code leaks the first era's tau ES, PU, b-tag and JEC into the second. With the instance kept only ondfw.corrections, values are identical to keeping a local reference.run_ci_test.sh <ana> Run3_2022EE htcondorat the final commits (FLAF a67b5c9, Corrections be08572):afinal_HH_bbtautau_Run3_2022EE_10180010), HH_bbWW f0c8eb0 (afinal_HH_bbWW_Run3_2022EE_10180010, plus Run3_2022) and H_mumu 24c893a (afinal_H_mumu_Run3_2022EE_10180010) all completed with RC 0 and no failed task;/eos/user/k/kandroso/FLAF_all/<ana>/<version>/Plots/.bTagEffprodcolumn name). Runs:run_ci_test.sh <ana> Run3_2022EE crabfor the three analyses (aval_crab_<ana>_10172044), and withtest_crab_prodfs(fs_defaultT3_US_FNALLPC:/store/user/lpcflaf/FLAF_ci_prodfs/<ana>/) for HH_bbtautau and HH_bbWW (aval_prodfs_<ana>_10172044).Host is down), T2_US_Florida (a node with a broken interpreter), T3_UK_London_RHUL, T3_KR_KNU and T2_US_Caltech. law resubmitted each one, and the retries succeeded.--periodon the real CLI: HelloWorld with--erapasses for the three analyses: local success, local force-fail and HTCondor success. The HTCondor force-fail and--bundlevariants fail the same way on the old code, so they are pre-existing and not caused by this change. The test's log regex keeps the trailing comma of law'slog: <uri>, remote host: …line, and the bundle variant has failed onmainsince at least f642ddb.law run FLAF.AnaProd.tasks.AnaTupleFileTask --period Run3_2022EE --print-status 0stops withValueError: --period: 'period' was renamed to 'era' (--era), and--eraworks.REVIEWER OK(flaf-reviewer, a67b5c9);TESTER VERDICT: PASS (htcondor, HH_bbtautau / HH_bbWW / H_mumu, FLAF a67b5c9 / Corrections be08572);TESTER VERDICT: PASS (crab and test_crab_prodfs, FLAF 1021607 / Corrections a9ca7e4).test_corrections(47 of 47 at Corrections be08572); everyverify_revisionnames the heads above.--era <its era>; no job uses--period.