-
Notifications
You must be signed in to change notification settings - Fork 199
Implement integrated CMS Combine backend #520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
captainvogon
wants to merge
32
commits into
HEP-FCC:master
Choose a base branch
from
captainvogon:feature/combine-integration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
669946c
Draft: Implement Combine backend skeleton and object-oriented fit con…
399160d
Feat: Port datacard writer and validation to backend
2b3b38d
Feat: Integrate fit subcommand and parser into FCCAnalyses wrapper
70ea34a
Refactor: Modularize fit command to support multiple backends via --b…
03e42c1
Fix systematics matrix column alignment and add multi-channel ZH phys…
8a1b92c
feat: add -e/--execute and -l flags for direct combine fitting
4f1369b
chore: remove redundant dummy_fit.py example template
624a38b
feat: implement double-dash argument forwarding to wrapped tools
04c784f
feat: strip literal double-dash from tool arguments before execution
6b91783
feat: implement shape systematics validation and update example template
4532687
fix: resolve argument conflicts when forwarding custom combine methods
f250900
add CLI usage examples to example script and parser help
050e0bf
rename configuration validation to sanitization
c32f37c
handle keyboard interrupt to ensure termination on Ctrl+C
d7a9c59
feat: organize combine output files dynamically
55d8c31
optimize shape sanitization via bulk pre-loading and TFile disassocia…
b0868c4
ensure auto-creation of missing output directories and implement CI test
60000a4
fix: resolve combine argument positioning and update integration test…
ba183c6
fix: remove redundant duplicate subprocess execution block
4f9c713
fix test: enforce repository root cwd
a9267dd
fix test: enforce sys.executable and inject local PYTHONPATH for CI r…
b8fdc81
fix test: skip execution test in CI environments missing combine binary
fee4f2e
fix test: if/elif logic to prevent fallthrough on missing combine binary
695c632
refactor: rename user configuration class to Fit
52e2da2
Potential fix for pull request finding
captainvogon 50ab041
fix: apply copilot review suggestions for variable scoping, temp dirs…
fb64477
test: convert example systematic to lnN
f383fb1
feat: add combine_args support to Fit config, enforce --out, and hand…
83ef04e
update default Combine exec method from AsymptoticLimits to MultiDimFit
captainvogon 0642801
feat: enable autodiff by default and handle --out overrides
27a5faa
feat: integrate python-based ROOT extraction and add extract subcommand
9141122
docs: add man pages and documentation for fit and extract subcommands
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| """Example configuration script for FCC-ee ZH angular/mass fitting. | ||
|
|
||
| Usage Examples: | ||
| 1. Generate the text datacard only: | ||
| fccanalysis fit examples/fcc_ee_zh_mumu_bb.py -o outputs/datacard.txt | ||
|
|
||
| 2. Generate datacard and run the default AsymptoticLimits engine: | ||
| fccanalysis fit examples/fcc_ee_zh_mumu_bb.py -o outputs/datacard.txt -e | ||
|
|
||
| 3. Override the default engine with custom options (e.g. FitDiagnostics): | ||
| fccanalysis fit examples/fcc_ee_zh_mumu_bb.py -o outputs/datacard.txt -e -- -M FitDiagnostics | ||
| """ | ||
|
|
||
| class Fit: | ||
| def __init__(self): | ||
| # 1. Global framework configurations | ||
| self.autoMCStats = False | ||
|
|
||
| # 2. Path templates for the input shape histograms | ||
| self.shapes = { | ||
| "*": { | ||
| "mumu_bjets_channel": "fcc_ee_zh_shapes.root $CHANNEL/$PROCESS $CHANNEL/$PROCESS_$SYSTEMATIC", | ||
| "mumu_inter_channel": "fcc_ee_zh_shapes.root $CHANNEL/$PROCESS $CHANNEL/$PROCESS_$SYSTEMATIC" | ||
| } | ||
| } | ||
|
|
||
| # 3. Channel definitions based on event selection categories | ||
| # Category 1: High purity b-tagged category | ||
| # Category 2: Intermediate/loose b-tagged category (to constrain backgrounds) | ||
| self.channels = { | ||
| "mumu_bjets_channel": { | ||
| "observation": -1, # -1 instructs Combine to use asymptotic or toy datasets | ||
| "processes": { | ||
| "ZH_signal": {"type": "signal", "rate": -1}, | ||
| "ZZ_bkg": {"type": "background", "rate": -1}, | ||
| "Zjets_bkg": {"type": "background", "rate": -1} | ||
| } | ||
| }, | ||
| "mumu_inter_channel": { | ||
| "observation": -1, | ||
| "processes": { | ||
| "ZH_signal": {"type": "signal", "rate": -1}, | ||
| "ZZ_bkg": {"type": "background", "rate": -1}, | ||
| "Zjets_bkg": {"type": "background", "rate": -1} | ||
| } | ||
| } | ||
| } | ||
|
|
||
| # 4. Systematics Matrix | ||
| # Models how uncertainties affect each process in each distinct channel | ||
| self.systematics = { | ||
| # Integrated luminosity precision at FCC-ee (highly precise, ~0.1% to 0.5%) | ||
| "lumi_FCC": { | ||
| "type": "lnN", | ||
| "apply_to": { | ||
| "ZH_signal": 1.005, | ||
| "ZZ_bkg": 1.005, | ||
| "Zjets_bkg": 1.005 | ||
| } | ||
| }, | ||
| # Muon tracking and Identification efficiency uncertainty | ||
| "muon_eff": { | ||
| "type": "lnN", | ||
| "apply_to": { | ||
| "ZH_signal": 1.01, | ||
| "ZZ_bkg": 1.01, | ||
| "Zjets_bkg": 1.01 | ||
| } | ||
| }, | ||
| # B-tagging efficiency uncertainty (highly correlated with signal) | ||
| "btag_eff": { | ||
| "type": "lnN", | ||
| "apply_to": { | ||
| "ZH_signal": {"mumu_bjets_channel": 1.03, "mumu_inter_channel": 0.98}, | ||
| "ZZ_bkg": {"mumu_bjets_channel": 1.03, "mumu_inter_channel": 0.98} | ||
| } | ||
| }, | ||
| # Mistag rate uncertainty for light/charm jets leaking into the b-jet channel | ||
| "mistag_light": { | ||
| "type": "lnN", | ||
| "apply_to": { | ||
| "Zjets_bkg": {"mumu_bjets_channel": 1.10, "mumu_inter_channel": 1.04} | ||
| } | ||
| }, | ||
| # Theoretical cross-section uncertainty for electroweak backgrounds | ||
| "theory_ZZ_xsec": { | ||
| "type": "lnN", | ||
| "apply_to": { | ||
| "ZZ_bkg": 1.04 | ||
| } | ||
| }, | ||
| # Recoil mass resolution shape systematic | ||
| "recoil_res": { | ||
| "type": "lnN", | ||
| "apply_to": { | ||
| "ZH_signal": 1.05, | ||
| "ZZ_bkg": 1.05 | ||
| } | ||
| } | ||
| } | ||
|
|
||
| # Optional: Define default command-line arguments to pass to the Combine tool | ||
| # The framework will automatically append `--out <output_dir>` to this. | ||
| self.combine_args = "-M FitDiagnostics" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| .\" Manpage for fccanalysis-extract | ||
| .\" Contact FCC-PED-SoftwareAndComputing-Analysis@cern.ch to correct errors or typos. | ||
| .TH FCCANALYSIS\-EXTRACT 1 "August 2026" "0.12.0" "fccanalysis-extract man page" | ||
|
|
||
| .SH NAME | ||
| \fBfccanalysis\-extract\fR \- extract parameters and uncertainties from Combine ROOT files | ||
|
|
||
| .SH SYNOPSIS | ||
| .B fccanalysis extract | ||
| [\fB\-h\fR | \fB\-\-help\fR] | ||
| .B input_path | ||
|
|
||
| .SH DESCRIPTION | ||
| .B fccanalysis\-extract | ||
| is a standalone utility that reads ROOT files generated by Higgs Combine (e.g., | ||
| \fIhiggsCombineTest.MultiDimFit.mH120.root\fR). It performs dynamic branch detection | ||
| to locate the Parameter of Interest (POI) and applies linear interpolation to | ||
| calculate and display the 1-sigma (68% CL) crossing uncertainties. | ||
|
|
||
| It safely handles grid scans and gracefully falls back to displaying expected and | ||
| observed quantiles if the file was generated using the AsymptoticLimits method. | ||
|
|
||
| .SH OPTIONS | ||
| .TP | ||
| .B input_path | ||
| Path to a specific \fIhiggsCombine*.root\fR file, or a directory containing one. | ||
| If a directory is provided, the most recently modified Combine ROOT file will be used. | ||
| .TP | ||
| .BR \-h ", " \-\-help | ||
| Prints short help message and exits\&. | ||
|
|
||
| .SH SEE ALSO | ||
| fccanalysis(1), fccanalysis-fit(1) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| .\" Manpage for fccanalysis-fit | ||
| .\" Contact FCC-PED-SoftwareAndComputing-Analysis@cern.ch to correct errors or typos. | ||
| .TH FCCANALYSIS\-FIT 1 "August 2026" "0.12.0" "fccanalysis-fit man page" | ||
|
|
||
| .SH NAME | ||
| \fBfccanalysis\-fit\fR \- generate combine datacards and execute statistical fits | ||
|
|
||
| .SH SYNOPSIS | ||
| .B fccanalysis fit | ||
| [\fB\-h\fR | \fB\-\-help\fR] | ||
| [\fB\-o\fR \fIOUTPUT\fR | \fB\-\-output\fR \fIOUTPUT\fR] | ||
| [\fB\-b\fR \fIBACKEND\fR | \fB\-\-backend\fR \fIBACKEND\fR] | ||
| [\fB\-e\fR | \fB\-\-execute\fR] | ||
| .B analysis-script | ||
| \-\- | ||
| [\fICOMBINE ARGUMENTS\fR] | ||
|
|
||
| .SH DESCRIPTION | ||
| .B fccanalysis\-fit | ||
| parses an object-oriented Python configuration script containing a \fIFit\fR class | ||
| to dynamically generate a text-based datacard for statistical inference. | ||
|
|
||
| If the \fB\-\-execute\fR flag is provided, the script will automatically invoke the | ||
| underlying statistical engine (e.g., Higgs Combine) on the generated datacard. | ||
| Output ROOT files are automatically shifted to the datacard directory, and | ||
| 1-sigma crossing uncertainties are automatically extracted and displayed. | ||
|
|
||
| .SH OPTIONS | ||
| .TP | ||
| .B analysis-script | ||
| Path to the Python analysis script containing the \fIFit\fR class. | ||
| .TP | ||
| .BR \-h ", " \-\-help | ||
| Prints short help message and exits\&. | ||
| .TP | ||
| \fB\-o\fR \fIOUTPUT\fR, \fB\-\-output\fR \fIOUTPUT\fR | ||
| Path where the generated datacard.txt will be saved\&. | ||
| .TP | ||
| \fB\-b\fR \fIBACKEND\fR, \fB\-\-backend\fR \fIBACKEND\fR | ||
| Specify the statistical backend to use\&. Currently supported: \fBcombine\fR. | ||
| .br | ||
| Default value: \fBcombine\fR. | ||
| .TP | ||
| .BR \-e ", " \-\-execute | ||
| Execute the statistical backend after generating the datacard. | ||
| .TP | ||
| .I COMBINE ARGUMENTS | ||
| Command line arguments passed after the \fB\-\-\fR separator will not be parsed | ||
| by the framework and will be forwarded directly to the backend Combine engine | ||
| (e.g., \fB\-M FitDiagnostics\fR or \fB\-\-algo grid\fR). These override any default | ||
| arguments defined in the Python class. | ||
|
|
||
| .SH SEE ALSO | ||
| fccanalysis(1), fccanalysis-script(7), fccanalysis-extract(1) |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.