Skip to content

Update yr5#1255

Open
nucleosynthesis wants to merge 6 commits into
mainfrom
update_yr5
Open

Update yr5#1255
nucleosynthesis wants to merge 6 commits into
mainfrom
update_yr5

Conversation

@nucleosynthesis

@nucleosynthesis nucleosynthesis commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Updating scripts and numbers from latest from LHC HXSWG

Using https://gitlab.cern.ch/LHCHIGGSXS/LHCHXSWG1/crosssections

Summary by CodeRabbit

  • New Features

    • Added cross-section datasets for 13.6 TeV and explicit support for multiple collision energies (7, 8, 13, 13.6, 14 TeV).
  • Updates

    • Resampled and reformatted cross-section tables and refined column definitions across energies.
    • Spline generation updated to include additional processes and energies.
  • Documentation

    • Updated references for Year‑5 values, clarified coupling-source wording, expanded notes on tHW/tH spline usage and rateParam examples; removed prior PDF/alpha_S split note.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates README metadata for YR5, refactors makeSMtables.py to a new column schema and persistent output with OpenPyXL fallback, changes makeAllSMSplines.C to accept string sqrts and add 13.6 TeV (splitting tH into schan/tchan and adding tHW), and replaces SM cross-section tables across energies with the new schema.

Changes

YR5 Cross-Section Data Migration and 13.6TeV Support

Layer / File(s) Summary
Documentation and YR5 metadata updates
data/lhc-hxswg/README.md
Updated to point to a spreadsheet directory, added YR5 usage note, clarified kappa-framework sourcing, added RooWorkspace spline usage guidance and notes about tHW repeating at 125.0 GeV; removed separate PDF/alpha_S note.
Table generation script refactoring
data/lhc-hxswg/makeSMtables.py
Reworked headings (stdHeading, xsecGroups) and specs keys; added OpenPyXL fallback loader; formatval now rounds to 4 decimals; find_filename added; print_table can save files and is invoked to persist tables; SKIP columns filtered when building tables; -s/--savefiles option added but not gating saving.
Spline generation for 13.6TeV and process list
data/lhc-hxswg/sm/makeAllSMSplines.C
Changed makeXSSplines signature to std::string sqrts, updated output/workspace and spline names to include sqrts, replaced tHq by tH_schan+tH_tchan and added tHW, and call generation for 14, 13.6, 13, 8, 7.
13.6TeV cross-section data (new energy)
data/lhc-hxswg/sm/xs/13.6TeV/*.txt
Added complete set of 13.6 TeV tables (WH, ZH, bbH, ggH, ggZH, ttH, vbfH, tH_schan, tH_tchan, tHW) with standardized headers and mass points 120–130 GeV.
13TeV cross-section data schema migration
data/lhc-hxswg/sm/xs/13TeV/*.txt
Rewrote files to new schema (Sca_Hi/Sca_Lo/Pdf_alpha_s/Total_pos/Total_neg), added tH_schan and tH_tchan, refined mass-point sampling, and removed README content in updated files.
14TeV cross-section data schema migration
data/lhc-hxswg/sm/xs/14TeV/*.txt
Updated to standardized schema and resampled mass grid; added tH_schan/tH_tchan/tHW files; README content removed.
8TeV cross-section data schema migration
data/lhc-hxswg/sm/xs/8TeV/*.txt
Converted to standardized schema, added tH_schan/tH_tchan/tHW tables, resampled mass points, and removed README text.
7TeV cross-section data schema migration
data/lhc-hxswg/sm/xs/7TeV/*.txt
Updated headers and mass-point selection to new schema, added tH_schan/tH_tchan/tHW tables, and removed README text.

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs:

"A rabbit hops through data sheets with care,
Old columns renamed, new energies fair,
From seven to fourteen—point six joins the race,
Splines now flow where tHW gave its place! 🐰✨"

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Update yr5' is vague and generic—it does not clearly describe the specific changes made (e.g., cross-section table updates, new 13.6 TeV data, script modifications, tHW additions). Provide a more specific and descriptive title that summarizes the main changes, such as 'Add YR5 Higgs cross-section data and update SM spline generation' or 'Update to LHCHXSWG YR5 cross-sections and tHW support'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update_yr5

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Infer (1.2.0)
data/lhc-hxswg/sm/makeAllSMSplines.C

data/lhc-hxswg/sm/makeAllSMSplines.C:2:7: error: use of undeclared identifier 'std'
2 | const std::string location = "./"; //"$CMSSW_BASE/src/HiggsAnalysis/CombinedLimit/data/lhc-hxswg/sm/";
| ^
data/lhc-hxswg/sm/makeAllSMSplines.C:9:2: error: unknown type name 'RooRealVar'
9 | RooRealVar MH("MH","MH",125.09,120,130); MH.setConstant();
| ^
data/lhc-hxswg/sm/makeAllSMSplines.C:10:9: error: unknown type name 'TFile'
10 | TFile *fout = new TFile("sm_br_yr4.root","RECREATE");
| ^
data/lhc-hxswg/sm/makeAllSMSplines.C:10:27: error: unknown type name 'TFile'
10 | TFile *fout = new TFile("sm_br_yr4.root","RECREATE");
| ^
data/lhc-hxswg/sm/makeAllSMSplines.C:12:2: error: unknown type name 'RooWorkspace'
12 | RooWorkspace ws("br","br");
| ^
data/lhc-hxswg/sm/makeAllSMSplines.C:14:2: error: use of undeclared identifier 'std'
14 | std::string br[nbr]

... [truncated 2200 characters] ...

s.C:26:26: error: subscripted value is not an array, pointer, or vector
26 | std::string name = br4f[bri];
| ~~~~^~~~
data/lhc-hxswg/sm/makeAllSMSplines.C:27:3: error: unknown type name 'RooSpline1D'
27 | RooSpline1D spline(Form("%s",name.c_str()),Form("file br/BR4_4f.txt, x=%d, y=%d",0,1),MH,Form("%s/br/BR4_4f.txt",location.c_str()),0,bri+1,1,"CSPLINE");
| ^
data/lhc-hxswg/sm/makeAllSMSplines.C:27:46: error: use of undeclared identifier 'Form'
27 | RooSpline1D spline(Form("%s",name.c_str()),Form("file br/BR4_4f.txt, x=%d, y=%d",0,1),MH,Form("%s/br/BR4_4f.txt",location.c_str()),0,bri+1,1,"CSPLINE");
| ^
data


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 20.90%. Comparing base (da0a2f4) to head (c5658ff).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1255   +/-   ##
=======================================
  Coverage   20.90%   20.90%           
=======================================
  Files         195      195           
  Lines       26316    26316           
  Branches     3947     3947           
=======================================
  Hits         5502     5502           
  Misses      20814    20814           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
data/lhc-hxswg/makeSMtables.py (1)

277-299: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

--savefiles is ignored, so the script always overwrites the txt outputs.

Line 278 always passes a path into print_table, which makes -s/--savefiles ineffective and turns every run into a write-back run. That is a risky CLI contract change for a generator that rewrites checked-in reference data.

Suggested fix
-            file_name=find_filename(s.name,group)
-            print_table(table, save_file=file_name)
+            file_name = find_filename(s.name, group) if o.savefiles else None
+            print_table(table, save_file=file_name)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@data/lhc-hxswg/makeSMtables.py` around lines 277 - 299, The CLI flag handling
currently always writes outputs because the code unconditionally computes
file_name (via find_filename) and passes it to print_table; update the __main__
flow so that after parsing options you check options.savefiles and only
compute/find and pass save_file to print_table when options.savefiles is True
(otherwise call print_table without the save_file argument or pass None),
referencing the existing symbols parser/options, options.savefiles,
find_filename, file_name and print_table to locate the change; ensure the
default behavior leaves files untouched unless -s/--savefiles is provided.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@data/lhc-hxswg/README.md`:
- Around line 15-18: Update the README note that references removed tHW inputs:
remove or revise the sentence stating "The tHW cross-sections given are
repeated..." and any YR4-specific guidance that points readers to tHW, and
instead reference the current tH channel names (tH_schan and tH_tchan) and the
updated spline-generation source (makeAllSMSplines.C) so readers are directed to
the YR5 inputs and correct spline creation; ensure the example
datacard/rateParams guidance remains accurate for using the tH_schan/tH_tchan
splines.

In `@data/lhc-hxswg/sm/makeAllSMSplines.C`:
- Around line 45-57: The xs list in makeAllSMSplines.C (std::string xs[]) omits
the tH channels, so add "tH_schan" and "tH_tchan" to the xs array and
construct/import RooSpline1D objects for them just like the other modes (using
the same Form(...) patterns and ws.import calls); ensure you create splines
named Form("%s_%sTeV",name.c_str(),sqrts.c_str()) and pass the correct file path
Form("%s/xs/%sTeV/%sTeV-%s.txt",location.c_str(),sqrts.c_str(),sqrts.c_str(),name.c_str())
so both tH_schan and tH_tchan are included in the workspace (and handle any
special x/y indices if those channels need different indices similar to WH's
separate plus/minus handling).

In `@data/lhc-hxswg/sm/xs/14TeV/14TeV-tH_schan.txt`:
- Around line 1-15: The Sca_Lo column currently uses positive values (+1.8) but
must be negative to match the project's uncertainty sign convention; update
every Sca_Lo entry in the table under the header "mH_GeV   XS_pb    Sca_Hi 
Sca_Lo  Pdf_alpha_s  Total_pos  Total_neg  XS_tH_pb  XS_tbarH_pb" from +1.8 to
-1.8 (preserving spacing/format), ensuring Sca_Hi remains positive and Sca_Lo
negative so downstream uncertainty calculations use the correct sign.

In `@data/lhc-hxswg/sm/xs/14TeV/14TeV-tH_tchan.txt`:
- Around line 2-15: The Sca_Lo column in the tH_tchan table uses a positive sign
while the project convention is negative; update the Sca_Lo entries in the
tH_tchan data block (rows showing +15.0, etc.) to use the negative sign (e.g.,
change +15.0 → -15.0) so Sca_Lo values match the established sign convention
used by other production-mode tables.

In `@data/lhc-hxswg/sm/xs/7TeV/7TeV-bbH.txt`:
- Line 4: The Sca_Lo value in the row "124.0   +0.176  +9.6    +9.6    +3.6     
+10.2      -10.2" is incorrectly positive; change the Sca_Lo entry from +9.6 to
-9.6 so the line reads "124.0   +0.176  -9.6    +9.6    +3.6       +10.2     
-10.2" to match the negative downward scale uncertainty pattern used by Sca_Lo
in the other rows.

In `@data/lhc-hxswg/sm/xs/8TeV/8TeV-bbH.txt`:
- Line 8: The Sca_Lo value in the row starting with "125.09" is incorrectly
positive; change the third uncertainty column labeled Sca_Lo from "+9.3" to
"-9.3" so it matches the negative scale-down sign convention and remains
consistent with the Total_neg = -9.9; update only the sign for Sca_Lo in that
row (the other columns and Total_neg stay as-is).

---

Outside diff comments:
In `@data/lhc-hxswg/makeSMtables.py`:
- Around line 277-299: The CLI flag handling currently always writes outputs
because the code unconditionally computes file_name (via find_filename) and
passes it to print_table; update the __main__ flow so that after parsing options
you check options.savefiles and only compute/find and pass save_file to
print_table when options.savefiles is True (otherwise call print_table without
the save_file argument or pass None), referencing the existing symbols
parser/options, options.savefiles, find_filename, file_name and print_table to
locate the change; ensure the default behavior leaves files untouched unless
-s/--savefiles is provided.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 773d9e3b-470c-418e-be4b-40ad9f0755d5

📥 Commits

Reviewing files that changed from the base of the PR and between da0a2f4 and df34466.

📒 Files selected for processing (57)
  • data/lhc-hxswg/README.md
  • data/lhc-hxswg/makeSMtables.py
  • data/lhc-hxswg/sm/makeAllSMSplines.C
  • data/lhc-hxswg/sm/sm_yr5_13.6TeV.root
  • data/lhc-hxswg/sm/sm_yr5_13TeV.root
  • data/lhc-hxswg/sm/sm_yr5_14TeV.root
  • data/lhc-hxswg/sm/sm_yr5_7TeV.root
  • data/lhc-hxswg/sm/sm_yr5_8TeV.root
  • data/lhc-hxswg/sm/xs/13.6TeV/13.6TeV-WH.txt
  • data/lhc-hxswg/sm/xs/13.6TeV/13.6TeV-ZH.txt
  • data/lhc-hxswg/sm/xs/13.6TeV/13.6TeV-bbH.txt
  • data/lhc-hxswg/sm/xs/13.6TeV/13.6TeV-ggH.txt
  • data/lhc-hxswg/sm/xs/13.6TeV/13.6TeV-ggZH.txt
  • data/lhc-hxswg/sm/xs/13.6TeV/13.6TeV-tH_schan.txt
  • data/lhc-hxswg/sm/xs/13.6TeV/13.6TeV-tH_tchan.txt
  • data/lhc-hxswg/sm/xs/13.6TeV/13.6TeV-ttH.txt
  • data/lhc-hxswg/sm/xs/13.6TeV/13.6TeV-vbfH.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-WH.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-ZH.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-bbH.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-ggH.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-ggZH.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-tH_schan.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-tH_tchan.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-ttH.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-vbfH.txt
  • data/lhc-hxswg/sm/xs/13TeV/README.txt
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-WH.txt
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-ZH.txt
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-bbH.txt
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-ggH.txt
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-ggZH.txt
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-tH_schan.txt
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-tH_tchan.txt
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-ttH.txt
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-vbfH.txt
  • data/lhc-hxswg/sm/xs/14TeV/README.txt
  • data/lhc-hxswg/sm/xs/7TeV/7TeV-WH.txt
  • data/lhc-hxswg/sm/xs/7TeV/7TeV-ZH.txt
  • data/lhc-hxswg/sm/xs/7TeV/7TeV-bbH.txt
  • data/lhc-hxswg/sm/xs/7TeV/7TeV-ggH.txt
  • data/lhc-hxswg/sm/xs/7TeV/7TeV-ggZH.txt
  • data/lhc-hxswg/sm/xs/7TeV/7TeV-tH_schan.txt
  • data/lhc-hxswg/sm/xs/7TeV/7TeV-tH_tchan.txt
  • data/lhc-hxswg/sm/xs/7TeV/7TeV-ttH.txt
  • data/lhc-hxswg/sm/xs/7TeV/7TeV-vbfH.txt
  • data/lhc-hxswg/sm/xs/7TeV/README.txt
  • data/lhc-hxswg/sm/xs/8TeV/8TeV-WH.txt
  • data/lhc-hxswg/sm/xs/8TeV/8TeV-ZH.txt
  • data/lhc-hxswg/sm/xs/8TeV/8TeV-bbH.txt
  • data/lhc-hxswg/sm/xs/8TeV/8TeV-ggH.txt
  • data/lhc-hxswg/sm/xs/8TeV/8TeV-ggZH.txt
  • data/lhc-hxswg/sm/xs/8TeV/8TeV-tH_schan.txt
  • data/lhc-hxswg/sm/xs/8TeV/8TeV-tH_tchan.txt
  • data/lhc-hxswg/sm/xs/8TeV/8TeV-ttH.txt
  • data/lhc-hxswg/sm/xs/8TeV/8TeV-vbfH.txt
  • data/lhc-hxswg/sm/xs/8TeV/README.txt
💤 Files with no reviewable changes (4)
  • data/lhc-hxswg/sm/xs/13TeV/README.txt
  • data/lhc-hxswg/sm/xs/14TeV/README.txt
  • data/lhc-hxswg/sm/xs/7TeV/README.txt
  • data/lhc-hxswg/sm/xs/8TeV/README.txt

Comment thread data/lhc-hxswg/README.md
Comment on lines +15 to +18
- The tHW cross-sections given are repeated from the value at 125.0 GeV. This is only to allow bulding a spline. These numbers are from YR4
- The cross-sections and branching ratios are also provided inside `RooWorkspaces` as splines for your convenience as a function of `MH`. You can use these inside your datacards using `rateParams` to normalise the different Higgs processes. An example datacard is provided in `data/tutorials/rate_params/simple_sm_datacard.txt`.

Please see the full set of notes from [here](https://gitlab.cern.ch/LHCHIGGSXS/LHCHXSWG1/crosssections) for all details.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

The notes still describe removed tHW inputs.

This migration switches the supported tH channels to tH_schan/tH_tchan, and data/lhc-hxswg/sm/makeAllSMSplines.C no longer builds tHW. Keeping this YR4-specific note here will send readers to the wrong inputs for YR5.

🧰 Tools
🪛 LanguageTool

[grammar] ~15-~15: Ensure spelling is correct
Context: ...lue at 125.0 GeV. This is only to allow bulding a spline. These numbers are from YR4 - ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🪛 markdownlint-cli2 (0.22.1)

[warning] 18-18: Link text should be descriptive

(MD059, descriptive-link-text)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@data/lhc-hxswg/README.md` around lines 15 - 18, Update the README note that
references removed tHW inputs: remove or revise the sentence stating "The tHW
cross-sections given are repeated..." and any YR4-specific guidance that points
readers to tHW, and instead reference the current tH channel names (tH_schan and
tH_tchan) and the updated spline-generation source (makeAllSMSplines.C) so
readers are directed to the YR5 inputs and correct spline creation; ensure the
example datacard/rateParams guidance remains accurate for using the
tH_schan/tH_tchan splines.

Comment thread data/lhc-hxswg/sm/makeAllSMSplines.C Outdated
Comment on lines +1 to +15
mH_GeV XS_pb Sca_Hi Sca_Lo Pdf_alpha_s Total_pos Total_neg XS_tH_pb XS_tbarH_pb
+120.0 +0.0036 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0024 +0.0013
+122.0 +0.0035 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0023 +0.0012
+124.0 +0.0034 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0012
+124.6 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0012
+124.8 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0012
+125.0 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0011
+125.09 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0011
+125.2 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
+125.3 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
+125.38 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
+125.6 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
+126.0 +0.0032 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
+128.0 +0.0031 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.002 +0.0011
+130.0 +0.003 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0019 +0.001

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Incorrect sign convention for Sca_Lo column.

The Sca_Lo column has positive values (+1.8) throughout the table, but based on the naming convention and all other files in this PR, Sca_Lo should contain negative values representing the downward scale uncertainty. All other production modes use negative values for Sca_Lo:

  • 13TeV-ttH.txt: Sca_Lo ranges from -2.47 to -2.28
  • 13TeV-vbfH.txt: Sca_Lo ranges from -1.11 to -1.03
  • 14TeV-WH.txt: Sca_Lo ranges from -0.74 to -0.71
  • 14TeV-ZH.txt: Sca_Lo ranges from -2.8 to -2.6
  • 14TeV-bbH.txt: Sca_Lo = -8.2 to -8.3
  • 14TeV-ggH.txt: Sca_Lo = -4.6 to -4.7

The sign should be changed from +1.8 to -1.8 to maintain consistency with the schema and ensure correct downstream uncertainty calculations.

🔧 Proposed fix
-mH_GeV   XS_pb    Sca_Hi  Sca_Lo  Pdf_alpha_s  Total_pos  Total_neg  XS_tH_pb  XS_tbarH_pb
-+120.0   +0.0036  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0024   +0.0013    
-+122.0   +0.0035  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0023   +0.0012    
-+124.0   +0.0034  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0022   +0.0012    
-+124.6   +0.0033  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0022   +0.0012    
-+124.8   +0.0033  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0022   +0.0012    
-+125.0   +0.0033  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0022   +0.0011    
-+125.09  +0.0033  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0022   +0.0011    
-+125.2   +0.0033  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0021   +0.0011    
-+125.3   +0.0033  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0021   +0.0011    
-+125.38  +0.0033  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0021   +0.0011    
-+125.6   +0.0033  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0021   +0.0011    
-+126.0   +0.0032  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0021   +0.0011    
-+128.0   +0.0031  +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.002    +0.0011    
-+130.0   +0.003   +2.4    +1.8    +2.3         +3.3242    -2.9206    +0.0019   +0.001     
+mH_GeV   XS_pb    Sca_Hi  Sca_Lo  Pdf_alpha_s  Total_pos  Total_neg  XS_tH_pb  XS_tbarH_pb
++120.0   +0.0036  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0024   +0.0013    
++122.0   +0.0035  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0023   +0.0012    
++124.0   +0.0034  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0022   +0.0012    
++124.6   +0.0033  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0022   +0.0012    
++124.8   +0.0033  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0022   +0.0012    
++125.0   +0.0033  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0022   +0.0011    
++125.09  +0.0033  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0022   +0.0011    
++125.2   +0.0033  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0021   +0.0011    
++125.3   +0.0033  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0021   +0.0011    
++125.38  +0.0033  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0021   +0.0011    
++125.6   +0.0033  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0021   +0.0011    
++126.0   +0.0032  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0021   +0.0011    
++128.0   +0.0031  +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.002    +0.0011    
++130.0   +0.003   +2.4    -1.8    +2.3         +3.3242    -2.9206    +0.0019   +0.001     
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mH_GeV XS_pb Sca_Hi Sca_Lo Pdf_alpha_s Total_pos Total_neg XS_tH_pb XS_tbarH_pb
+120.0 +0.0036 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0024 +0.0013
+122.0 +0.0035 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0023 +0.0012
+124.0 +0.0034 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0012
+124.6 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0012
+124.8 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0012
+125.0 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0011
+125.09 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0011
+125.2 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
+125.3 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
+125.38 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
+125.6 +0.0033 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
+126.0 +0.0032 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
+128.0 +0.0031 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.002 +0.0011
+130.0 +0.003 +2.4 +1.8 +2.3 +3.3242 -2.9206 +0.0019 +0.001
mH_GeV XS_pb Sca_Hi Sca_Lo Pdf_alpha_s Total_pos Total_neg XS_tH_pb XS_tbarH_pb
120.0 +0.0036 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0024 +0.0013
122.0 +0.0035 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0023 +0.0012
124.0 +0.0034 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0012
124.6 +0.0033 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0012
124.8 +0.0033 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0012
125.0 +0.0033 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0011
125.09 +0.0033 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0022 +0.0011
125.2 +0.0033 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
125.3 +0.0033 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
125.38 +0.0033 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
125.6 +0.0033 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
126.0 +0.0032 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0021 +0.0011
128.0 +0.0031 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.002 +0.0011
130.0 +0.003 +2.4 -1.8 +2.3 +3.3242 -2.9206 +0.0019 +0.001
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@data/lhc-hxswg/sm/xs/14TeV/14TeV-tH_schan.txt` around lines 1 - 15, The
Sca_Lo column currently uses positive values (+1.8) but must be negative to
match the project's uncertainty sign convention; update every Sca_Lo entry in
the table under the header "mH_GeV   XS_pb    Sca_Hi  Sca_Lo  Pdf_alpha_s 
Total_pos  Total_neg  XS_tH_pb  XS_tbarH_pb" from +1.8 to -1.8 (preserving
spacing/format), ensuring Sca_Hi remains positive and Sca_Lo negative so
downstream uncertainty calculations use the correct sign.

Comment on lines +2 to +15
+120.0 +0.0952 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0622 +0.0329
+122.0 +0.0939 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0614 +0.0325
+124.0 +0.0926 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0605 +0.0321
+124.6 +0.0922 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0602 +0.032
+124.8 +0.0921 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0602 +0.0319
+125.0 +0.092 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0601 +0.0319
+125.09 +0.0919 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.06 +0.0319
+125.2 +0.0918 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0602 +0.0316
+125.3 +0.0918 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0602 +0.0315
+125.38 +0.0917 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0599 +0.0318
+125.6 +0.0917 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.06 +0.0317
+126.0 +0.0913 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0596 +0.0317
+128.0 +0.09 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0588 +0.0313
+130.0 +0.0887 +6.3 +15.0 +2.1 +6.6408 -15.1463 +0.0579 +0.0309

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check Sca_Lo column signs in all tH_tchan files
echo "=== Checking Sca_Lo signs in tH_tchan files ==="
fd -e txt 'tH_tchan' data/lhc-hxswg/sm/xs/ --exec sh -c 'echo "File: {}"; head -3 {}'

Repository: cms-analysis/HiggsAnalysis-CombinedLimit

Length of output: 1757


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Compare Sca_Lo / Total_neg sign conventions across a few other production modes
# (same file naming pattern: <energy>TeV-<mode>.txt)
echo "=== Comparing Sca_Lo/Total_neg signs across modes ==="

for f in \
  data/lhc-hxswg/sm/xs/14TeV/14TeV-ttH.txt \
  data/lhc-hxswg/sm/xs/14TeV/14TeV-vbfH.txt \
  data/lhc-hxswg/sm/xs/8TeV/8TeV-WH.txt \
  data/lhc-hxswg/sm/xs/8TeV/8TeV-WH-ZZ.txt  \
  data/lhc-hxswg/sm/xs/14TeV/14TeV-tH_tchan.txt
do
  if [ -f "$f" ]; then
    echo "File: $f"
    head -3 "$f" | tail -2
  else
    echo "File missing (skip): $f"
  fi
done

Repository: cms-analysis/HiggsAnalysis-CombinedLimit

Length of output: 1047


Fix sign convention for Sca_Lo in tH_tchan tables

data/lhc-hxswg/sm/xs/14TeV/14TeV-tH_tchan.txt has Sca_Lo values with a leading + (e.g., +15.0 for mH=120–130) while other production-mode tables encode the scale-down term with a leading - (e.g., 14TeV-ttH.txt Sca_Lo=-2.0125, 14TeV-vbfH.txt Sca_Lo=-1.0911, 8TeV-WH.txt Sca_Lo=-0.859), making tH_tchan inconsistent with the established convention.

🔧 Proposed fix

Update the Sca_Lo column in 14TeV-tH_tchan.txt to be negative (e.g. +15.0-15.0).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@data/lhc-hxswg/sm/xs/14TeV/14TeV-tH_tchan.txt` around lines 2 - 15, The
Sca_Lo column in the tH_tchan table uses a positive sign while the project
convention is negative; update the Sca_Lo entries in the tH_tchan data block
(rows showing +15.0, etc.) to use the negative sign (e.g., change +15.0 → -15.0)
so Sca_Lo values match the established sign convention used by other
production-mode tables.

mH_GeV XS_pb Sca_Hi Sca_Lo Pdf_as_mb Total_pos Total_neg
+120.0 +0.197 +9.7 -9.7 +3.7 +10.4 -10.4
+122.0 +0.186 +9.6 -9.6 +3.7 +10.3 -10.3
+124.0 +0.176 +9.6 +9.6 +3.6 +10.2 -10.2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical sign error in Sca_Lo value.

Line 4 shows Sca_Lo as +9.6, but this should be -9.6 to match the pattern in all other rows (lines 2-3, 5-15 all have negative Sca_Lo values ranging from -9.4 to -9.7). The Sca_Lo column represents the downward scale uncertainty and must be negative. This sign error will corrupt uncertainty calculations.

🐛 Proposed fix
-+124.0   +0.176  +9.6    +9.6    +3.6       +10.2      -10.2    
++124.0   +0.176  +9.6    -9.6    +3.6       +10.2      -10.2    
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
+124.0 +0.176 +9.6 +9.6 +3.6 +10.2 -10.2
124.0 +0.176 +9.6 -9.6 +3.6 +10.2 -10.2
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@data/lhc-hxswg/sm/xs/7TeV/7TeV-bbH.txt` at line 4, The Sca_Lo value in the
row "124.0   +0.176  +9.6    +9.6    +3.6       +10.2      -10.2" is incorrectly
positive; change the Sca_Lo entry from +9.6 to -9.6 so the line reads "124.0  
+0.176  -9.6    +9.6    +3.6       +10.2      -10.2" to match the negative
downward scale uncertainty pattern used by Sca_Lo in the other rows.

+124.6 +0.224 +9.3 -9.3 +3.4 +9.9 -9.9
+124.8 +0.223 +9.3 -9.3 +3.4 +9.9 -9.9
+125.0 +0.221 +9.3 -9.3 +3.4 +9.9 -9.9
+125.09 +0.221 +9.3 +9.3 +3.4 +9.9 -9.9

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: Missing minus sign in Sca_Lo column.

Line 8 shows Sca_Lo = +9.3, but all other rows correctly use negative values (e.g., line 2: -9.5, line 7: -9.3, line 9: -9.3). The Total_neg value of -9.9 confirms the scale-down uncertainty should be negative.

🔧 Proposed fix
-+125.09  +0.221  +9.3    +9.3    +3.4       +9.9       -9.9     
++125.09  +0.221  +9.3    -9.3    +3.4       +9.9       -9.9     
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
+125.09 +0.221 +9.3 +9.3 +3.4 +9.9 -9.9
125.09 +0.221 +9.3 -9.3 +3.4 +9.9 -9.9
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@data/lhc-hxswg/sm/xs/8TeV/8TeV-bbH.txt` at line 8, The Sca_Lo value in the
row starting with "125.09" is incorrectly positive; change the third uncertainty
column labeled Sca_Lo from "+9.3" to "-9.3" so it matches the negative
scale-down sign convention and remains consistent with the Total_neg = -9.9;
update only the sign for Sca_Lo in that row (the other columns and Total_neg
stay as-is).

@amarini amarini mentioned this pull request Jun 4, 2026
@amarini

amarini commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator
  • I added tHW, as well and a tHq spline (tH_s+tH_t).
  • The 7 and 8TeV tHW points are replicated to 120 and 130 to make a spline (as in the past). for 13/13.6/14TeV the calculation are fully present.
  • I added the xlsx file for book keeping. (I need to open it with openpyxl because xlrd does not support it anymore)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
data/lhc-hxswg/makeSMtables.py (1)

220-232: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

filename may be undefined if no match is found.

If no spec key matches sheet_name or no group key matches group_name, the loop completes without assigning filename, causing an UnboundLocalError on the return statement.

🛡️ Proposed fix
 def find_filename(sheet_name, group_name):
     # given the sheet name and group name, find which of the dictionary keys match 
     # and return the filename in the format sm/xs/{sheet_name}/{group_name}.txt
+    filename = None
     for key in specs.keys():
         if key in sheet_name:
             for group_key in specs[key]["groups"].keys():
                 if group_key in group_name:
                     if "BR" in group_key:
                         filename = f"sm/br/{group_name}.txt"
                     else:
                         xsfoldername = sheet_name.replace(" ", "")
                         filename = f"sm/xs/{xsfoldername}/{xsfoldername}-{group_name}.txt"
+    if filename is None:
+        raise ValueError(f"No matching spec found for sheet '{sheet_name}' and group '{group_name}'")
     return filename
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@data/lhc-hxswg/makeSMtables.py` around lines 220 - 232, The function
find_filename can return an uninitialized filename if no spec/group matches;
initialize filename to None at start (or explicitly return early when a match is
found) and ensure you either return a sensible default or raise a clear
exception when no match is found. Update find_filename to set filename when
matching and break out of loops (or return immediately) to avoid accidental
overwrites, and at the end check if filename is still None and raise ValueError
with context including sheet_name and group_name (or return an explicit fallback
path) so callers never hit an UnboundLocalError.
🧹 Nitpick comments (1)
data/lhc-hxswg/makeSMtables.py (1)

332-337: 💤 Low value

--savefiles option is defined but never used.

The -s/--savefiles flag is added to the argument parser but o.savefiles is never checked. Tables are always saved unconditionally at line 316. Either gate the save behavior on this flag or remove the unused option.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@data/lhc-hxswg/makeSMtables.py` around lines 332 - 337, The --savefiles/-s
option is defined via parser.add_option but never used (o.savefiles), so update
the save logic to honor this flag: locate the block that unconditionally writes
tables to the "sm" directory (the code that currently saves tables) and wrap it
in a conditional checking o.savefiles (or conversely remove the
parser.add_option if you prefer disabling the feature). Ensure you reference
o.savefiles in the main flow (where tables are written) so saving only happens
when the flag is set, and keep existing filenames/paths unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@data/lhc-hxswg/makeSMtables.py`:
- Around line 277-280: The bare except should be replaced with specific
exception handling: call xlrd.open_workbook(o.input) in a try and catch only
ImportError to fall back to open_workbook (openpyxl), while letting xlrd parsing
errors bubble up (catch xlrd.XLRDError if you need to handle them explicitly)
and not silently swallow KeyboardInterrupt/SystemExit; e.g. import xlrd and
catch ImportError to assign f = open_workbook(o.input), and otherwise re-raise
or handle xlrd.XLRDError/FileNotFoundError explicitly so failures aren’t masked.

In `@data/lhc-hxswg/sm/xs/7TeV/7TeV-tHW.txt`:
- Around line 2-4: The table shows identical XS_pb and identical uncertainty
columns (Sca_Hi, Sca_Lo, Pdf_alpha_s, Total_pos, Total_neg) for mH=120/125/130
in data/lhc-hxswg/sm/xs/7TeV/7TeV-tHW.txt which likely produces an artificially
flat spline; verify the original upstream/source numbers for these mass points
and, if they differ, update the three rows so XS_pb and the uncertainty columns
reflect the true per-mass values (or restore the original higher-resolution
points), otherwise annotate the file header (or replace the repeated rows) to
indicate these masses were merged/rounded by the source so downstream code can
treat them specially; ensure Total_pos/Total_neg are recomputed as quadrature of
Sca and Pdf components if you change any component to keep consistency.

---

Outside diff comments:
In `@data/lhc-hxswg/makeSMtables.py`:
- Around line 220-232: The function find_filename can return an uninitialized
filename if no spec/group matches; initialize filename to None at start (or
explicitly return early when a match is found) and ensure you either return a
sensible default or raise a clear exception when no match is found. Update
find_filename to set filename when matching and break out of loops (or return
immediately) to avoid accidental overwrites, and at the end check if filename is
still None and raise ValueError with context including sheet_name and group_name
(or return an explicit fallback path) so callers never hit an UnboundLocalError.

---

Nitpick comments:
In `@data/lhc-hxswg/makeSMtables.py`:
- Around line 332-337: The --savefiles/-s option is defined via
parser.add_option but never used (o.savefiles), so update the save logic to
honor this flag: locate the block that unconditionally writes tables to the "sm"
directory (the code that currently saves tables) and wrap it in a conditional
checking o.savefiles (or conversely remove the parser.add_option if you prefer
disabling the feature). Ensure you reference o.savefiles in the main flow (where
tables are written) so saving only happens when the flag is set, and keep
existing filenames/paths unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f8ddacb-1a1e-42c7-8af8-f982eaa7ae68

📥 Commits

Reviewing files that changed from the base of the PR and between df34466 and c5658ff.

⛔ Files ignored due to path filters (1)
  • data/lhc-hxswg/Higgs_cross_sections_YR5.xlsx is excluded by !**/*.xlsx
📒 Files selected for processing (12)
  • data/lhc-hxswg/makeSMtables.py
  • data/lhc-hxswg/sm/makeAllSMSplines.C
  • data/lhc-hxswg/sm/sm_yr5_13.6TeV.root
  • data/lhc-hxswg/sm/sm_yr5_13TeV.root
  • data/lhc-hxswg/sm/sm_yr5_14TeV.root
  • data/lhc-hxswg/sm/sm_yr5_7TeV.root
  • data/lhc-hxswg/sm/sm_yr5_8TeV.root
  • data/lhc-hxswg/sm/xs/13.6TeV/13.6TeV-tHW.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-tHW.txt
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-tHW.txt
  • data/lhc-hxswg/sm/xs/7TeV/7TeV-tHW.txt
  • data/lhc-hxswg/sm/xs/8TeV/8TeV-tHW.txt
✅ Files skipped from review due to trivial changes (2)
  • data/lhc-hxswg/sm/xs/14TeV/14TeV-tHW.txt
  • data/lhc-hxswg/sm/xs/13TeV/13TeV-tHW.txt

Comment on lines +277 to +280
try:
f = xlrd.open_workbook(o.input)
except:
f = open_workbook(o.input) ## openpyxl

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Bare except catches all exceptions including unexpected errors.

The bare except: catches everything including KeyboardInterrupt, SystemExit, and actual bugs in xlrd parsing. If xlrd opens a corrupt file and raises a parsing error, it silently falls back to openpyxl (which will also likely fail with a confusing error).

🐛 Proposed fix to catch specific exceptions
     try:
         f = xlrd.open_workbook(o.input) 
-    except:
+    except (xlrd.XLRDError, FileNotFoundError, PermissionError):
         f = open_workbook(o.input) ## openpyxl

Or if xlrd may not be installed:

     try:
         f = xlrd.open_workbook(o.input) 
-    except:
+    except Exception as e:
+        logging.debug("xlrd failed (%s), trying openpyxl", e)
         f = open_workbook(o.input) ## openpyxl
🧰 Tools
🪛 Ruff (0.15.15)

[error] 279-279: Do not use bare except

(E722)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@data/lhc-hxswg/makeSMtables.py` around lines 277 - 280, The bare except
should be replaced with specific exception handling: call
xlrd.open_workbook(o.input) in a try and catch only ImportError to fall back to
open_workbook (openpyxl), while letting xlrd parsing errors bubble up (catch
xlrd.XLRDError if you need to handle them explicitly) and not silently swallow
KeyboardInterrupt/SystemExit; e.g. import xlrd and catch ImportError to assign f
= open_workbook(o.input), and otherwise re-raise or handle
xlrd.XLRDError/FileNotFoundError explicitly so failures aren’t masked.

Comment on lines +2 to +4
+120 +0.0022 +4.2 -5.5 +8.4 +9.3915 -10.0404
+125 +0.0022 +4.2 -5.5 +8.4 +9.3915 -10.0404
+130 +0.0022 +4.2 -5.5 +8.4 +9.3915 -10.0404

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

❓ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Description: Check if identical-row pattern appears in other tHW tables and compare with other processes

echo "=== Checking tHW tables across energies ==="
for energy in 7TeV 8TeV 13TeV 13.6TeV 14TeV; do
  file="data/lhc-hxswg/sm/xs/${energy}/${energy}-tHW.txt"
  if [ -f "$file" ]; then
    echo -e "\n--- $energy tHW ---"
    # Show data rows (skip header)
    tail -n +2 "$file" | head -5
    # Check for duplicate rows
    dups=$(tail -n +2 "$file" | grep -v '^$' | sort | uniq -d | wc -l)
    echo "Duplicate rows: $dups"
  fi
done

echo -e "\n=== Comparing with ttH at 7TeV (reference) ==="
if [ -f "data/lhc-hxswg/sm/xs/7TeV/7TeV-ttH.txt" ]; then
  echo "--- 7TeV ttH (first 5 data rows) ---"
  tail -n +2 "data/lhc-hxswg/sm/xs/7TeV/7TeV-ttH.txt" | head -5
fi

Repository: cms-analysis/HiggsAnalysis-CombinedLimit

Length of output: 2160


🏁 Script executed:

#!/bin/bash
set -euo pipefail

target="data/lhc-hxswg/sm/xs/7TeV/7TeV-tHW.txt"
echo "=== Line counts ==="
wc -l "$target"

echo
echo "=== Unique values per column for 7TeV-tHW (excluding header) ==="
python3 - <<'PY'
from collections import defaultdict
import re, sys

path="data/lhc-hxswg/sm/xs/7TeV/7TeV-tHW.txt"
rows=[]
with open(path,'r',encoding='utf-8') as f:
    header=next(f).strip()
    for line in f:
        line=line.strip()
        if not line: 
            continue
        parts=line.split()
        rows.append(parts)

# columns: 0 mH_GeV, 1 XS_pb, 2 Sca_Hi, 3 Sca_Lo, 4 Pdf_alpha_s, 5 Total_pos, 6 Total_neg
cols=defaultdict(list)
for r in rows:
    for i,v in enumerate(r[:7]):
        cols[i].append(v)

print("Header:", header)
for i in range(7):
    uniq=sorted(set(cols[i]))
    print(f"col {i} ({'mH_GeV XS_pb Sca_Hi Sca_Lo Pdf_alpha_s Total_pos Total_neg'.split()[i]}): unique={len(uniq)}")
    if len(uniq)<=10:
        print("  values:", " | ".join(uniq))
    else:
        print("  sample:", " | ".join(uniq[:5]), "...", " | ".join(uniq[-3:]))
PY

echo
echo "=== Same uniqueness summary for all available tHW tables across energies ==="
python3 - <<'PY'
from pathlib import Path
from collections import defaultdict
import re

base=Path("data/lhc-hxswg/sm/xs")
energies=["7TeV","8TeV","13TeV","13.6TeV","14TeV"]
cols_names=["mH_GeV","XS_pb","Sca_Hi","Sca_Lo","Pdf_alpha_s","Total_pos","Total_neg"]

for energy in energies:
    file=base/energy/f"{energy}-tHW.txt"
    if not file.exists():
        continue
    rows=[]
    with file.open('r',encoding='utf-8') as f:
        header=f.readline().strip()
        for line in f:
            line=line.strip()
            if not line:
                continue
            parts=line.split()
            if len(parts)>=7:
                rows.append(parts[:7])

    cols=defaultdict(list)
    for r in rows:
        for i,v in enumerate(r):
            cols[i].append(v)

    print("\n---", file, "---")
    print("rows:", len(rows), "header_ok:", " ".join(header.split()[:7]).count("mH_GeV")>0 or True)
    for i,name in enumerate(cols_names):
        uniq=set(cols[i])
        print(f"{name}: unique={len(uniq)}")
PY

Repository: cms-analysis/HiggsAnalysis-CombinedLimit

Length of output: 1701


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
import math

base=Path("data/lhc-hxswg/sm/xs")
energies=["7TeV","8TeV","13TeV","13.6TeV","14TeV"]

def parse_rows(path):
    rows=[]
    with path.open() as f:
        header=f.readline()
        for line in f:
            line=line.strip()
            if not line: 
                continue
            parts=line.split()
            if len(parts)<7: 
                continue
            mH, XS, Sca_Hi, Sca_Lo, Pdf, Tot_pos, Tot_neg = parts[:7]
            rows.append((float(mH), float(Sca_Hi), float(Sca_Lo), float(Pdf), float(Tot_pos), float(Tot_neg)))
    return header, rows

for energy in energies:
    path=base/energy/f"{energy}-tHW.txt"
    if not path.exists():
        continue
    header, rows=parse_rows(path)

    # since uncertainty columns are constant within each file (per earlier result),
    # just compare using the first row
    mH, Sca_Hi, Sca_Lo, Pdf, Tot_pos, Tot_neg = rows[0]
    quad_pos=math.sqrt(Sca_Hi**2 + Pdf**2)
    quad_neg=math.sqrt(Sca_Lo**2 + Pdf**2)

    # also check across all rows for consistency
    ok_pos=True
    ok_neg=True
    for mH, Sca_Hi, Sca_Lo, Pdf, Tot_pos, Tot_neg in rows:
        if abs(math.sqrt(Sca_Hi**2 + Pdf**2) - Tot_pos) > 1e-6:
            ok_pos=False
            break
    for mH, Sca_Hi, Sca_Lo, Pdf, Tot_pos, Tot_neg in rows:
        if abs(math.sqrt(Sca_Lo**2 + Pdf**2) - Tot_neg) > 1e-6:
            ok_neg=False
            break

    print(f"{path}")
    print(f"  Sca_Hi={rows[0][1]} Pdf={rows[0][3]} => quad_pos={quad_pos} table Total_pos={rows[0][4]} ok={ok_pos}")
    print(f"  Sca_Lo={rows[0][2]} Pdf={rows[0][3]} => quad_neg={quad_neg} table Total_neg={rows[0][5]} ok={ok_neg}")
    print(f"  rows={len(rows)}")
PY

Repository: cms-analysis/HiggsAnalysis-CombinedLimit

Length of output: 1158


🏁 Script executed:

#!/bin/bash
set -euo pipefail

ls -1 data/lhc-hxswg/sm/xs/7TeV | sort | sed -n '1,120p'
echo "----"
ls -1 data/lhc-hxswg/sm/xs/8TeV | sort | sed -n '1,120p'

echo "----"
for f in data/lhc-hxswg/sm/xs/7TeV/*tH*.txt; do
  echo "== $f =="
  wc -l "$f"
  head -n 1 "$f"
  tail -n +2 "$f" | head -n 5
done

Repository: cms-analysis/HiggsAnalysis-CombinedLimit

Length of output: 2930


Flag potential flat tHW XS_pb at 7/8 TeV (needs upstream/source confirmation)

In data/lhc-hxswg/sm/xs/7TeV/7TeV-tHW.txt, XS_pb is identical (+0.0022 pb) for mH=120/125/130, with all uncertainty columns (Sca_Hi/Sca_Lo/Pdf_alpha_s/Total_pos/Total_neg) also constant across those masses. The same flat XS_pb behavior is present in data/lhc-hxswg/sm/xs/8TeV/8TeV-tHW.txt; for 13–14TeV tables, XS_pb varies with mH while the uncertainty columns remain constant within each file.

Total_pos/Total_neg are consistent with quadrature of the scale/PDF pieces within the table’s rounding. Constant uncertainty columns also show up in other related single-top Higgs tables at 7TeV (e.g., 7TeV-tH_schan.txt, 7TeV-tH_tchan.txt), so the main question is whether tHW’s exactly-flat XS_pb at 7/8 TeV over this grid is intended (rounding vs missing/mass-merged points) to avoid producing an overly-flat spline.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@data/lhc-hxswg/sm/xs/7TeV/7TeV-tHW.txt` around lines 2 - 4, The table shows
identical XS_pb and identical uncertainty columns (Sca_Hi, Sca_Lo, Pdf_alpha_s,
Total_pos, Total_neg) for mH=120/125/130 in
data/lhc-hxswg/sm/xs/7TeV/7TeV-tHW.txt which likely produces an artificially
flat spline; verify the original upstream/source numbers for these mass points
and, if they differ, update the three rows so XS_pb and the uncertainty columns
reflect the true per-mass values (or restore the original higher-resolution
points), otherwise annotate the file header (or replace the repeated rows) to
indicate these masses were merged/rounded by the source so downstream code can
treat them specially; ensure Total_pos/Total_neg are recomputed as quadrature of
Sca and Pdf components if you change any component to keep consistency.

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.

2 participants