Repository navigation
Correctionlib JECs for 2022-2023, JES/JER of the AK4 BDT inputs, Type-1 PUPPI MET with the re-applied JECs - #367
Conversation
corrections.JECs now builds the jet factories of every Run 3 year from the CMS analysis-corrections JSONs (jec_clib), pinned to the latest dated JME folders: 2022/2022EE Summer22(EE)_22Sep2023_V4 with JER JRV2, 2023/2023BPix Summer23(BPix)Prompt23_V4 with JER RunCv1234/RunD_JRV3 (run-dependent data residuals), 2024/2025 unchanged. The compiled text-file JECs are read for Run 2 only. Checked on 2022 and 2023 MC and data: correctionlib reproduces the text-file JECs of the same version to a few 1e-6, and the update to V4 leaves the AK8 jets unchanged; AK4 jets move only at 4.25 < |eta| < 4.5 in 2022 (below 0.2%) and at raw pT 15-30 GeV, 1.3 < |eta| < 2.5 in 2023 data (about -1%).
Since the correctionlib JECs of every Run 3 year (#363 for 2024/2025, #366 for 2022/2023), jec_compiled.pkl.gz, jec_compiled_upto2023BPix.pkl.gz and their builder build_jec.py are no longer read: moved to corrections/archive/ with a README on their contents and the skims that used them. The corrections README describes the correctionlib JECs; comments point to the new path. Run 2 keeps jec_compiled_run2.pkl.gz and build_jec_run2.py.
The skims had no JES/JER-shifted columns for the two AK4 jets away from the
bb jets and none for the VBF jet mass, so in every JES/JER variation the BDT
inputs H1AK4JetAway1mass and H2AK4JetAway2mass stayed nominal and the VBF
dijet mass used the nominal jet masses. The MC signal-region skims now save
the shifted pT and mass of the AK4-away jets
(AK4JetAway{Pt,Mass}_{JES,JER}_{up,down}) and the shifted VBF jet mass
(VBFJetMass_*), from the AK4 PUPPI JERC of these jets, and the skimmer's
shifted BDT scores use them. In a 2024 TTto4Q chunk the JES-up shift of
bdt_score_vbf widens from 4.7e-3 to 5.5e-3 RMS. The loop over the shifted
AK4 jet pT is now skipped when get_jec_jets applied no JECs (it returns
None, e.g. in a chunk without AK4 jets, and the loop failed with a
TypeError), as the other shifted jet variables already were.
In postprocessing, jec_vars has VBFJetMass, AK4JetAwayPt and AK4JetAwayMass,
and their shifted columns are loaded with the systematics where the skims
have them (load_samples optional_columns). For skims made before they were
saved, fill_ak4_jec_shifts derives the shifted VBF jet mass from the shifted
VBF pT (the jet factory scales pT and mass by the same factor) and keeps the
AK4-away jets nominal; the load_run3_samples unit test that checks the
requested columns stubs it, since its fake frames have no jet columns. On
the current 2024 VBF HH skim only VBFjjMass of the shifted inputs changes
(0.15% RMS, in the 57% of events with two VBF jets); the nominal inputs do
not.
The data MET went through coffea's CorrectedMETFactory, which in coffea <= 0.7.26 (we pin 0.7.21) adds the change of the jet pT relative to the raw pT with the wrong sign: applied on top of the Type-1 PuppiMET, it undid the Type-1 correction (data MET close to RawPuppiMET), while MC kept NanoAOD PuppiMET. NanoAOD PuppiMET itself carries the Type-1 correction of the JECs of its production, not the ones the skimmer re-applies to the jets. For the correctionlib (Run 3) years the MET is now the Type-1 PUPPI MET recomputed from RawPuppiMET with the re-applied AK4 PUPPI JECs, as CMSSW does for PUPPI (Jet and CorrT1METJet, muon-subtracted corrected pT above 15 GeV, EM fraction below 0.9, unsmeared jets), for data and MC alike. MET_pt and the new MET_phi hold it; PuppiMET_pt/phi and RawPuppiMET_pt/phi are saved as well. Other years keep the NanoAOD MET, also for data. ttSkimmer gets the same MET. The skimmer's BDT scores and the v15 BDT config of postprocessing take this MET_pt as their MET input; the config reads it through key_map, so that a shifted MET column can replace it. With the JECs of the production it reproduces NanoAOD PuppiMET (CMSSW) to 0.3 GeV RMS (2022 and 2024 ttbar), and its output is identical to the Type-1 MET of coffea's CorrectedMETFactory (scikit-hep/coffea#1537), as used in DAZSLE/hbb-run3#74.
In MC the skims now also save MET_pt/MET_phi for JES_up/down, JER_up/down and UES_up/down, and the JES/JER-shifted BDT scores use the shifted MET instead of the nominal: in the skimmer, and in postprocessing, where jec_vars has MET_pt, so that the key_map of the BDT config reads the shifted MET. Postprocessing reads the shifted MET where the skims have it and keeps the nominal MET for older skims (fill_ak4_jec_shifts). The variations are those of the unsmeared Type-1 MET in CMSJMECalculators (Type1METVariationsCalculator, isT1SmearedMET false), the same as the MET_T1 variations of nanoAOD-tools' jetmetUncertainties, for the jets of the Type-1 sum at their corrected pT (muon-subtracted part corrected, muon added back): JES up/down puts each of them at that pT x (1 +- the total JES uncertainty there); JER up and down are both the Type-1 MET with the Jets smeared by their nominal smearing factors (the CorrT1METJets unsmeared, as coffea's Type-1 MET does without their factors); UES up/down adds/subtracts the unclustered-energy shift of NanoAOD PuppiMET. coffea's Type-1 CorrectedMETFactory instead scales the jets by the JER-varied over the nominal smeared pT, which blows up for jets that the nominal smearing pushes to ~0 GeV.
|
LGTM, before merging could you post a comparison of the ntuple w Aashwin and Thierry to make sure that the JECs make the jet pt etc agree? |
|
So far we have one ntuple comparison, with Aashwin's (approach 1): AK8 jets of a 2024 SM ggHH NanoAOD file (10,030 events), Summer24Prompt24_V5 JECs on both sides, no JER, pT > 180 GeV.
This validates the 2024 AK8 JECs, which this PR does not change. For 2022-2023, the JECs of this PR are compared with our results before it in the table of the description: the same versions through correctionlib agree with the text-file JECs to a few 1e-6, and the update to V4 leaves the AK8 jets unchanged. |
|
Thanks, Thierry's file can be found in this link Can you produce plots like this (i.e. comparing Pocket Coffea PC, Approach One from Ashwin, and Approach Two yours?) Additionally the directory from Aashwin now should contain MET and AK4 jet information as well: https://cernbox.cern.ch/s/ryJNVocadBXpsxm |
| same MC truth and JES uncertainty as 2024, residuals and JER scale factors derived on 2025 data. | ||
| """ | ||
| cat_correction_path = "/cvmfs/cms-griddata.cern.ch/cat/metadata" | ||
| cat_corrections = { |
There was a problem hiding this comment.
Why are the 2022 and 2023 corrections not defined directly in these cat_corrections dictionary? What are the choices for jetveto, pileup_json or pileup for those years?
There was a problem hiding this comment.
I had left the old logic for 2022-2023 intact (jet veto maps and pileup weights from jsonpog-integration), but for readability they are now in cat_corrections too, with the same keys as the other years (jme, jec, jer, jetveto, pileup_json, pileup). For 2022-2023:
- jetveto:
Summer22_23Sep2023_RunCD_V1,Summer22EE_23Sep2023_RunEFG_V1,Summer23Prompt23_RunC_V1,Summer23BPixPrompt23_RunD_V1 - pileup_json:
puWeights.json.gzof the LUM foldersRun3-22CDSep23-Summer22-NanoAODv12/2024-01-31(and the 22EFG, 23C, 23D ones) - pileup:
Collisions2022_355100_357900_eraBCD_GoldenJson,Collisions2022_359022_362760_eraEFG_GoldenJson,Collisions2023_366403_369802_eraBC_GoldenJson,Collisions2023_369803_370790_eraD_GoldenJson
The files are the same as before, so the skims do not change.
Note: The 2022-2023 weights are still evaluated at Pileup_nPU; Pileup_nTrueInt comes in the next PR.
cat_jerc (the JEC and JER of 2022-2025) and cat_corrections (the 2024-2025 JERC, jet veto maps and pileup weights) become one cat_corrections with every Run 3 year and the same keys. The 2022-2023 jet veto maps and pileup weights come from its pinned CAT folders instead of the frozen jsonpog-integration area; the files are identical. The pileup weights of every year go through get_pileup_weights. 2018 and 2022-2023 keep evaluating them at nPU, so nothing changes: one-chunk skims of 2022 and 2024 TTto4Q, 2023 Run C v4 and 2025C JetMET are identical to the previous commit.
NanoAOD stores phi with 12 mantissa bits, so jets within about 2.4e-4 of pi have |phi| = 3.1416016, outside the phi binning of the 2023BPix-2025 L2Relative (edges +-3.1416, value 1 outside): they got no L2Relative, their pT 7-28% too low (one low-pT forward jet 48%), about 0.01% of the jets. The correctionlib inputs of the jet factories and of the Type-1 MET clip JetPhi to +-3.1415, as get_jetveto_event does for the veto maps; the MET keeps the unclipped jet direction. In the 2024 ggHH and 2024C data files of the ntuple comparison only these jets change, and they then agree with approach 1.
Here is the comparison of the three ntuples on the same events. Names in the plots and below:
Plots: https://cernbox.cern.ch/s/zipzR0stIAkZccK (
Our AK8 jets are identical to PC's: every quantity agrees to float precision, except the softdrop mass, where our skim keeps NanoAOD's Numbers, including AK4 jets and data: ratios of matched jets, median (68% half-width), for jets with
The spreads are NanoAOD's storage precision. What the comparison found:
|
|
Lgtm, we could understand better the differences in MET and softdrop. To follow up with Ashwin, but merging this now |
NanoAOD msoftdrop sums the subjets with the JEC of the MiniAOD production, while the jets carry the re-applied JECs. In 2024 that subjet JEC (Winter24 in MC, a pre-Summer24 payload in the 2024C data) puts msoftdrop +0.6% (MC) and -1.6% (data) away from Summer24Prompt24_V5, and in the 2023 PFNano data msoftdrop is 7% below the mass of its own subjets. As in PocketCoffea's msoftdrop_correction, each raw subjet is now corrected with the AK4 PUPPI JEC of the AK4 jets (L1L2L3 in MC, with the residuals in data), without JER, and the softdrop mass is the mass of their sum; jets without subjets or with msoftdrop <= 0, and NaN masses, keep NanoAOD's value, which is saved as MsdNano. The cuts and the JMS/JMR variations use the new mass. On the 2024 ggHH file of the #367 ntuple comparison it equals the V5 softdrop mass of that comparison to 6e-8, which approach 1 and PocketCoffea reproduce. In one-chunk skims only the softdrop columns change: by 0.992 in 2024 MC, 1.000 in 2022 MC, 1.04 in 2025C data and 1.11 in 2023C data (median ratio to NanoAOD), with 1 and 12 more data events passing the msd cuts.
…leup and jet ID, VBF jets, trigger-SF uncertainty, job image option, softdrop mass (#368) * Samples: the valid 2024 W->qq PTQQ-600 production, W -> cs flags of the dibosons The indexed Wto2Q-2Jets_Bin-PTQQ-600 v2-v2 production is INVALID in DAS (generated with the LHE V pT filter at 400 GeV), so it was left out of the V+jets stitch. The index and make_filelists_v15.py now point to the v2-v3 production (filter at 600 GeV, 72 files on T1_US_FNAL_Disk), with its GenXSecAnalyzer cross section (1.217 pb, 18 MiniAOD files), and the stitch selectors include the sample again. The static guard that raised for W-600 is replaced by a check of the skim: load_samples uses a W-600 skim only if its per-LHE-V-pT-bin totals show no generated event below 600 GeV, so skims of the old production (or without those totals) are left out with a warning, as before. The PTQQ stitch comments in utils.py are shortened. GenV1CS and GenV2CS tested the (c, s) daughter order twice. In the 2024 WW sample every hard-process W -> cs has its daughters as (s, c) (32,008 of 32,008 in the first 50k events), so both flags were always False. They now accept (c, s) and (s, c). * Index the missing 2024I and 2025C/F JetMET data The data index lacked part of three eras: 2024I MINIv6NANOv15_v2 (runs 386694-386951) and 2025C/F PromptReco-v1 (runs 392174-393087 and 396629-397596). Each holds the runs of its era that the indexed dataset does not (the prompt processing changed version mid-era), so the skims missed 49% of the 2024I and 61% and 72% of the 2025C and 2025F golden luminosity. They are added to make_filelists_v15.py and to those three entries of nanoindex_v15.json; JetMET0 2025C-v1 and JetMET1 2025F-v1 are not on FNAL disk and are read through the global redirector. * Luminosity: golden JSON mask, LUMI, unreadable data files and lost lumisections The Run 3 golden JSONs are pinned in corrections/data/golden_json/ (fetch_golden_json.py updates them from the CMS CAT area). utils.load_samples now drops the data events outside the year's golden JSON (hh_vars.GOLDEN_JSON); run and luminosityBlock are read for it and dropped again unless requested. No lumi mask was applied before: about 2% of the 2024/2025 data events (up to 5.6% per era) and up to 0.5% in 2022-2023 were in uncertified lumisections. LUMI is the recorded luminosity of these golden JSONs in the analyzed eras, now covered by the data index, from brilcalc (corrections/golden_lumi.py, which also reports how much of it the data skims of a tag cover; install_brilcalc.sh installs brilcalc for offsite use): normtag_PHYSICS, and for 2025, which normtag_PHYSICS does not cover yet, normtag_BRIL (preliminary). 2025 now includes era G. 2022-2025: 282484.9 pb^-1 instead of 261808.6. MC skims keep the luminosity they were made with until the next re-skim; the 1x/2x check of the 2022-2023 W cross sections now tolerates a LUMI update since the skim. The FOM slim cache key gets "__lumi<hash>" (content of the golden JSON, LUMI of the year and of its MC source year), so caches built before are not read. coffea skips a data file that raises FileNotFoundError at once, and a chunk whose reads keep timing out after its retries, with only a warning in the job log, so lost data went unnoticed (run.py meant to stop skipping for data, but compared the fileset keys with the sample names, which never match). Data jobs now open every file first, three times one minute apart (an authentication error still fails the job), leave out the files that never open, and save in the job pickle these files with their error, the entries of the others, and the entries the skimmer read from each file. A job whose processor fails exits non-zero without copying any output. src/condor/check_data_files.py (logic in HH4b/data_files.py) lists per data sample the lost files (not opened, read incompletely, in no job's output) and the files read twice, with their jobs, and resubmits those jobs with --submit-missing. The first load of a year now writes <tag>/lumi_<year>.json (HH4b/data_lumi.py): {} if the data skims hold every golden lumisection of LUMI[year], else the lumisections they lost and lumi_pb, the luminosity they hold. The lost lumisections come from the job records (those of the lost files from DAS, or from the file), or, for skims made before the records, are the golden lumisections without any data event in the skims. lumi_pb = LUMI x (1 - f), f the lost fraction of the golden luminosity from the per-lumisection luminosity of the DC pileup JSON. utils.load_samples drops the lost lumisections from the data (whole lumisections: they are split between JetMET0 and JetMET1 and over several files) and scales the MC used for the year by lumi_pb / LUMI; the FOM cache key includes the file and golden_lumi.py --tag leaves the lost lumisections out. The era run ranges move to hh_vars.DATA_ERAS. On the current skims, which have no records, this matches the brilcalc coverage within 0.2%; their 2024 and 2025 MC are scaled by 0.9475 and 0.7046. * MET filters: era-dependent lists, 2022-2023 bad-crystal veto, 2025 ecalBadCalibFilter at load time bbbbSkimmer listed eeBadScFilter twice. The base list now has each Run 3 flag once, and Flag_ecalBadCalibFilter is added for 2024 only: in 2022-2023 NanoAOD it is still the Run 2 filter of 35 EE crystals and misses the bad EB crystal of those years, for which the JME recipe is a data-only jet veto instead. A listed flag that is missing from the input is now logged instead of skipped silently. ttSkimmer listed "hfNoisyHitsFilt", which the silent check dropped, so hfNoisyHitsFilter was never applied there. In 2022-2023 NanoAOD Flag_ecalBadCalibFilter is still the Run 2 filter of 35 EE crystals and misses the bad EB crystal of runs 362433-367144, so data get the JME jet-based veto: an event of those runs is rejected if PuppiMET pT > 100 GeV and a jet has pT > 50 GeV, -0.5 < eta < -0.1, -2.1 < phi < -1.8, a neutral or charged EM fraction > 0.9 and |dphi(jet, PuppiMET)| > 2.9. It removes a few ppm of the 2022G JetMET events. The skims save Flag_ecalBadCalibFilter for data, and utils.load_samples requires it for the 2025 data (MC_SHARING_DATA_FILTERS, TODO(mc-sharing)): their MC is the 2024 MC, whose MET filter list has it, while the 2025 recommendation omits it, so the skimmer keeps the per-year lists. Data skims without the column are loaded as before, with a warning. The flag passes 99.93% of the 2025C JetMET events. * Corrections: 2022-2023 pileup at nTrueInt and AK4 jet ID from the JSON The 2022-2023 inputs are the PFNano 25v2, NanoAODv14 files skimmed through the v15 path, where their jets went through jetid_v12, the fix for the wrong NanoAODv12 jetId bits: beyond |eta| = 3 it kept 46-57% of the jets instead of the 89-93% the JetID criteria keep, so 2022-2023 had fewer VBF jets (SM VBF HH events with two VBF jets: 49.9% in 2022EE, 57.6% in 2024). Their Tight and TightLeptonVeto now come from the JME JetID JSON, corrections/data/jetid.json.gz (the file of the 2022-2025 JME folders of the CAT area), with its int inputs read as real, since correctionlib 2.2.2 cannot bin on int inputs; a TODO falls back to jetid_v15 once the 2022-2023 NanoAODv15 MCs are ready. 2024-2025 keep jetid_v15, which the JSON reproduces except at |eta| = 3.0 exactly. Below |eta| = 3 the 2022-2023 ID changes for 0.2% of the jets; a 2022EE SM VBF HH chunk now has two VBF jets in 56.5% of the events. The 2022-2023 pileup weights are a function of the true number of interactions but were evaluated at Pileup_nPU, kept there so that new skims of those years matched the existing ones, which the re-skim of every year no longer needs; they are now evaluated at Pileup_nTrueInt (2018 keeps nPU). The 2018, 2024 and 2025 weights, the JECs and the jet veto decisions are unchanged; in 50k TTto4Q events of each 2022-2023 era the mean pileup weight is now 1.000 within 0.2% (it was 0.955-1.058) and its RMS drops from 0.53-0.78 to 0.48-0.62. The sample normalization, divided by the sum of these weights, does not change. * Skimmer: VBF jets are the two highest-pT candidates objects.vbf_jets returned the first two jets passing its selection, and the jets keep the NanoAOD order, the pT order with the production's JECs; with the re-applied JECs and JER the second VBF jet had the higher pT in 2-3.5% of the 2024 events. It now takes the two candidates with the highest corrected pT; the jet collections and the other selections are unchanged. In a 2024 TTto4Q chunk no VBF pair is out of order. * Postprocessing: per-event trigger-SF uncertainty, jets outside the efficiency maps at the edge bins The trigger-SF uncertainty multiplied the absolute errors of the (pT, mSD) and TXbb efficiencies of each jet instead of adding the relative errors in quadrature, and the templates then took a flat per-sample factor of 1 ± 1e-5-1e-3 instead of the per-event uncertainty that trigger_SF already computed. Jets outside the maps (in 2022-2023 mostly second jets with mSD below 50 GeV, in 53% of the ggF HH events) got efficiency and error 1.0 from the map flow, i.e. SF = 1; they now take the edge bins. weight_triggerUp/Down use the per-event uncertainty, with the OR of the two jets written without dividing by 1 - efficiency. On the ggF HH skims the uncertainty is now 1.5% (2022EE), 3.7% (2023BPix) and 1.9% (2024) per event, and the nominal SF moves by -0.13%, -0.43% and 0; the FOM cache key gets "__trigedge". The unit tests of calculate_trigger_weights expect the per-event uncertainty. * Condor: job image option, zichun/hh4b-docker by default The jobs asked for coffeateam/coffea-dask:latest-py3.8, which is no longer on /cvmfs/unpacked.cern.ch, so every job failed at the container. submit.py --image now chooses the image of the jobs: - zichun/hh4b-docker (default): gitlab-registry.cern.ch/zichun/hh4b-docker, the coffea-base-almalinux8:0.7.22-py3.8 image with a Python 3.11 environment that holds the pinned requirements. The job runs HH4b from the clone with PYTHONPATH=src, without pip install. - coffeateam/coffea-base-almalinux8: coffea-base-almalinux8:0.7.22-py3.8 (Python 3.8 and coffea); the job pip installs HH4b and requirements.txt, as before. requirements.txt keeps its pins, which the pip install on Python 3.8 needs, with a note on the versions Python 3.11 needs, which the image has: correctionlib 2.9.0 (2.2.2 has no Python 3.11 wheel) and numba 0.60.0 (newer numba breaks the numba code of awkward 1.10). pytest ignores the DeprecationWarnings of sre_parse and sre_constants, which the lark parser of awkward 1.10 imports on Python 3.11. One-chunk skims of 2024 TTto4Q and 2025C JetMET in the hh4b-docker environment equal those of the current environment, up to 6e-17 in two MET phi columns; a test of 22 one-file jobs (TTto4Q and one JetMET era per year, 2022-2025) ran with the coffea-base image. * GloParT-v3 JMR placeholder: one-sided, up 1.05 The GloParT-v3 JMR placeholder goes from up 1.15 to up 1.05, down 1 (no extra smearing). JMR can only widen the mass, so CreateDatacard --jmr-symmetrize (on by default) ignores the JMR-down templates of the GloParT-v3 placeholder and gives combine the up variation mirrored about the nominal, Down = max(2 x Nominal - Up, 0) per bin, instead of a one-sided morph; rhalphalib's own symmetrization is wrong for shape effects. The measured GloParT-v2 and PNet JMR keep their down templates. * Skimmers: softdrop mass from the subjets re-corrected with the AK4 JEC NanoAOD msoftdrop sums the subjets with the JEC of the MiniAOD production, while the jets carry the re-applied JECs. In 2024 that subjet JEC (Winter24 in MC, a pre-Summer24 payload in the 2024C data) puts msoftdrop +0.6% (MC) and -1.6% (data) away from Summer24Prompt24_V5, and in the 2023 PFNano data msoftdrop is 7% below the mass of its own subjets. As in PocketCoffea's msoftdrop_correction, each raw subjet is now corrected with the AK4 PUPPI JEC of the AK4 jets (L1L2L3 in MC, with the residuals in data), without JER, and the softdrop mass is the mass of their sum; jets without subjets or with msoftdrop <= 0, and NaN masses, keep NanoAOD's value, which is saved as MsdNano. The cuts and the JMS/JMR variations use the new mass. On the 2024 ggHH file of the #367 ntuple comparison it equals the V5 softdrop mass of that comparison to 6e-8, which approach 1 and PocketCoffea reproduce. In one-chunk skims only the softdrop columns change: by 0.992 in 2024 MC, 1.000 in 2022 MC, 1.04 in 2025C data and 1.11 in 2023C data (median ratio to NanoAOD), with 1 and 12 more data events passing the msd cuts.

Supersedes #366: the same changes on top of the current
main, regrouped into one commit per topic: correctionlib JECs, archive, JES/JER of the AK4-jet inputs (skimmer and postprocessing, with the fix of the shifted AK4 jet pT loop for chunks without JECs), Type-1 PUPPI MET recomputed (with the BDT reading it), its JES/JER/UES variations (with their use in the shifted BDT inputs of postprocessing).Summary
corrections.JECsbuilds the AK4 and AK8 jet factories of every Run 3 year (2022-2025) from the official JME correctionlib files on CVMFS (/cvmfs/cms-griddata.cern.ch/cat/metadata/JME/, dated folders pinned incat_jerc), with the coffea 0.7 adapters ofprocessors/jec_clib.pythat 2024 and 2025 already use. No text files for Run 3: the compiled text-file JECs are read for Run 2 only.Summer22(EE)_22Sep2023_V2, JERJRV1Summer22(EE)_22Sep2023_V4, JERJRV2Summer23(BPix)Prompt23_V1, JERJRV1Summer23(BPix)Prompt23_V4, JERRunCv1234_JRV3/RunD_JRV3Summer24Prompt24_V5, JERJRV2(correctionlib)Summer24Prompt25_V3, JERJRV2(correctionlib)jec_clibpasses the run number per jet instead of picking a per-era stack by dataset name.Relation to DAZSLE/hbb-run3#74
Same approach as DAZSLE/hbb-run3#74: the official JSON files with the same versions, and the compound
L1L2L3Rescorrection fed into coffea'sCorrectedJetsFactory. There the stack is coffea'sCorrectionLibJECStack(newer coffea); our coffea 0.7 has no such class, sojec_clib.pyprovides the equivalent adapters. The data corrections take the run number as an input, whichjec_clibpasses per jet; the MC stack keeps the total JES uncertainty and the JER scale-factor variations.Effect on 2022 and 2023
Jets of the first 20,000 events of a 2022 HH4b MC file, a 2022C JetHT, a 2023 HH4b (κλ = 5) MC and a 2023Cv1 JetMET0 file, corrected with the old code and the new one, with the call of
bbbbSkimmer:2023_runCv4only ifRun2023Cv4is in the dataset name, whichJetMET_Run2023C-22Sep2023_v4-v1never matches, so all Run C v4 files (56% of the 2023 pre-BPix JetMET files) got the Run C v1-3 residuals. The V4 data correction is 4.5% (raw pT 50 GeV) to 5.8% (600 GeV) higher for central AK4 jets at run 368000 (v4) than at run 367300 (v1-3); in the skims the AK8 pT is 0.956 and the AK4 pT 0.963 of the NanoAOD values (2023BPix: 1.0001). The GloParT-v3 masses come from the NanoAOD raw mass and are unaffected. With the run passed per jet this is fixed.Type-1 PUPPI MET with the re-applied JECs
CorrectedMETFactory, which in coffea <= 0.7.26 (we pin 0.7.21) adds the change of the jet pT relative to the raw pT with the wrong sign. Applied on top of the Type-1 PuppiMET, it undid the Type-1 correction (data MET close to RawPuppiMET), while MC kept NanoAOD PuppiMET. NanoAOD PuppiMET itself carries the Type-1 correction of the production JECs, not of the JECs the skimmer re-applies. In the 2024C sidebands the Type-1 data MET changes the data above BDT score 0.5 by −3.9% (data-driven QCD BDT) and −2.7% (MC QCD BDT).jec_clib.type1_puppi_met,corrections.JECs.type1_puppi_met): for the correctionlib years, i.e. all of Run 3 with this PR, the MET is recomputed from RawPuppiMET with the re-applied AK4 PUPPI JECs, as CMSSW'sPFJetMETcorrInputProducerdoes for PUPPI: every Jet and CorrT1METJet with muon-subtracted corrected pT > 15 GeV and EM fraction < 0.9 shifts it by −(f_L1L2L3Res − f_L1) × the muon-subtracted raw pT, unsmeared, for data and MC alike.MET_ptand the newMET_phihold it;PuppiMET_pt/phiandRawPuppiMET_pt/phiare saved as well. ttSkimmer gets the same MET. The skimmer's BDT scores and the v15 BDT config take thisMET_ptas their MET input (the config throughkey_map).MET_pt/MET_phiforJES_up/down,JER_up/downandUES_up/down, and the JES/JER-shifted BDT scores use the shifted MET. They are the variations of the unsmeared Type-1 MET in CMSJMECalculators (gitlab.cern.ch/cms-analysis/general/CMSJMECalculators,Type1METVariationsCalculatorwithisT1SmearedMETfalse), the same as theMET_T1variations of nanoAOD-tools'jetmetUncertainties, for the jets of the Type-1 sum at their corrected pT (muon-subtracted part corrected, muon added back): JES up/down puts each jet (Jet and CorrT1METJet) at that pT × (1 ± the total JES uncertainty there); JER up and down are both the Type-1 MET with the Jets smeared by their nominal smearing factors (the CorrT1METJets unsmeared, as coffea's Type-1 MET does without their factors); UES up/down adds/subtracts NanoAOD PuppiMET's unclustered shift. coffea's Type-1CorrectedMETFactoryscales the jets by the JER-varied over the nominal smeared pT instead, which blows up for jets that the nominal smearing pushes to ~0 GeV (a JER_down MET shift of +724 GeV on average in 2024 ttbar). Against a per-jet loop written after CMSJMECalculators'addVariations, all variations agree to 1e-13 GeV (20,000 2022 and 2024 TTto4Q events); the mean (RMS) shifts there are JES up +0.8 GeV (1.9), JES down −0.7 GeV (1.9), JER +2.2 GeV (5.7 in 2024, 6.4 in 2022), UES ±0.2-0.3 GeV (1.3).correct_metof Framework Updates DAZSLE/hbb-run3#74 (coffea's Type-1CorrectedMETFactory, feat: implement CMS Type-1 MET correction in CorrectedMETFactory scikit-hep/coffea#1537) for the same JECs. With our JECs, recomputed − NanoAOD PuppiMET (mean / RMS): −1.6 / 6.7 GeV in 2024C data, −3.1 / 8.5 GeV in 2024 TTto4Q, −1.8 / 9.8 GeV in 2022C data, −0.05 / 1.7 GeV in 2023 TTto4Q. One-chunk skims of this branch run for 2024 TTto4Q, 2023 JetMET Run C v4 and 2022 TTto4Q.jes_uncertainties, the same JES variations, but not this JER variation.JES/JER of the other BDT inputs
H1AK4JetAway1massandH2AK4JetAway2massstayed nominal and the VBF dijet mass used the nominal jet masses. The MC signal-region skims now saveAK4JetAway{Pt,Mass}_{JES,JER}_{up,down}andVBFJetMass_*, from the AK4 PUPPI JERC of these jets, and the skimmer's shifted BDT scores use them.hh_vars.jec_varsgetsVBFJetMass,AK4JetAwayPtandAK4JetAwayMass, and their shifted columns are loaded with the systematics where the skims have them (utils.load_samples(optional_columns=...)); for skims made before,postprocessing.fill_ak4_jec_shiftsderives the shifted VBF jet mass from the shifted VBF pT (the jet factory scales pT and mass by the same factor) and keeps the AK4-away jets nominal. The unit test ofload_run3_samplesthat checks the requested columns stubs this fill, since its fake frames have no jet columns. The MET-recompute commit makes the v15 BDT config read the MET throughkey_map, and the MET-variations commit addsMET_ptto the same list (so the shifted BDT inputs use the shifted MET) and keeps the MET nominal for older skims.get_jec_jetsapplied no JECs (it returns None, e.g. in a chunk without AK4 jets, and the loop failed with a TypeError), as the other shifted jet variables already were.VBFjjMassof the shifted inputs changes (0.15% RMS, in the 57% of events with two VBF jets) and the nominal inputs are identical; one-chunk 2024 TTto4Q skims of the branch (at this commit and at the tip) write the new columns, andload_run3_samplesreads them (each shifted column differs from its nominal for every event with the jet); unit tests: 286 passed at every commit from this one on. For scale, shifting the MET with the jets changes the JES/JER-shifted ggF BDT score of the 2022-2025 BDT by about 0.001 (JES) and 0.002 (JER) per event on average (one-chunk 2022 and 2024 TTto4Q skims).Archive
The Run 3 text-file JECs are no longer read, so the second commit moves
jec_compiled.pkl.gz,jec_compiled_upto2023BPix.pkl.gzand their builderbuild_jec.pytosrc/HH4b/corrections/archive/, with a README on what they contain and which skims used them (e.g.20260820_glopartv3_v15_signal).corrections/README.mdnow describes the correctionlib JECs (a version update is a new dated folder and tag incat_jerc, nothing to build), and the comments that namedbuild_jec.pypoint to the new path. Run 2 keepsjec_compiled_run2.pkl.gzandbuild_jec_run2.py;JECs(year)loads for 2022-2025 and 2018.