Skip to content

Conversation

@anigamova
Copy link
Collaborator

@anigamova anigamova commented Nov 13, 2025

Fixes issue reported https://cms-talk.web.cern.ch/t/combinecreatenll-not-properly-integrated-with-pyroot-on-with-combine-v10-2-0-onwards/137088

Summary by CodeRabbit

  • New Features

    • Per-parameter canvases for FastScan plotting, producing independent per-parameter PDF outputs.
  • Tests

    • FastScan template analysis added to CI to run template-to-workspace and analysis steps.
  • Refactor

    • Negative log-likelihood creation unified under a single namespaced API and updated across tools for consistency.
  • Chores

    • CI workflow and build matrix updated; conditional runtime library loading added for specific platform versions.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

Walkthrough

Move free function combineCreateNLL into class scope as Combine::combineCreateNLL and update all call sites. Add Combine header and register Combine in ROOT dictionary. Update Python FastScan to call ROOT.Combine.combineCreateNLL, create per-parameter canvases, and save per-parameter PDFs. Add CVMFS FastScan CI step and bump CI ROOT/gcc entries.

Changes

Cohort / File(s) Summary
API Migration
\interface/Combine.h`, `src/Combine.cc``
Move free function combineCreateNLL(...) into class scope as Combine::combineCreateNLL(...) (signature unchanged); update definition accordingly.
Call-site updates (core)
\src/...`*<br>`src/AsimovUtils.cc`, `src/AsymptoticLimits.cc`, `src/BayesianToyMC.cc`, `src/BestFitSigmaTestStat.cc`, `src/HybridNew.cc`, `src/MultiDimFit.cc`, `src/ProfiledLikelihoodRatioTestStatExt.cc`, `src/Significance.cc``
Replace unqualified combineCreateNLL(...) calls with Combine::combineCreateNLL(...).
Call-site updates (diagnostics & tests)
\src/DebugProposal.cc`, `src/FitDiagnostics.cc`, `src/FitterAlgoBase.cc`, `src/GoodnessOfFit.cc`, `test/testCreateNLL.cxx``
Replace unqualified combineCreateNLL(...) calls with Combine::combineCreateNLL(...).
ROOT dictionary / headers
\src/classes.h`, `src/classes_def.xml``
Add #include "interface/Combine.h" to classes.h and register Combine in classes_def.xml.
Python FastScan tweak
\python/tool_base/FastScan.py``
Use ROOT.Combine.combineCreateNLL(...); create per-parameter canvases named par_<ParamName> via ROOT.TCanvas(canv_name, canv_name) and save per-parameter PDF outputs with canv.Print("%s.pdf%s" % (self.args.output, extra)).
CI workflows
\.github/workflows/cvmfs-ci.yml`, `.github/workflows/ci.yml``
Add CVMFS CI step to run FastScan template analysis (text2workspace.py + combineTool.py FastScan); update CI matrix entries (ROOT/gcc versions) and install gcc via mamba in setup step.

Sequence Diagram(s)

sequenceDiagram
    participant Caller as C++ caller (e.g. MultiDimFit)
    participant Combine as Combine::combineCreateNLL
    participant Roo as RooFit (pdf/data)
    Caller->>Combine: Combine::combineCreateNLL(pdf, data, constraints, offset)
    Combine->>Roo: build NLL from pdf + data (+constraints)
    Roo-->>Combine: RooAbsReal* (NLL)
    Combine-->>Caller: unique_ptr<RooAbsReal>
    rect rgba(208,240,192,0.6)
      Note right of Combine: Static member now used across call sites
    end
Loading
sequenceDiagram
    participant FastScan as FastScan.py
    participant ROOT as ROOT bindings
    FastScan->>ROOT: for each parameter: canv_name = "par_<name>"
    FastScan->>ROOT: ROOT.TCanvas(canv_name, canv_name)
    FastScan->>ROOT: ROOT.Combine.combineCreateNLL(pdf, data)
    FastScan->>ROOT: canv.Print("%s.pdf%s" % (self.args.output, extra))
    rect rgba(224,235,255,0.6)
      Note right of FastScan: Per-parameter canvases and namespaced NLL call
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Widespread but consistent namespace refactor across many files.
  • Areas to inspect carefully:
    • interface/Combine.h / src/Combine.cc — ensure static method visibility and behavior match the previous free function.
    • src/classes_def.xml and src/classes.h — verify ROOT dictionary registration and include correctness.
    • python/tool_base/FastScan.py — confirm ROOT Python binding exposes Combine and per-parameter canvas naming/printing are correct.

Possibly related PRs

Poem

🐰 Hopping through headers, tidy and spry,

I tucked the NLL in Combine with a sigh.
Each parameter gets a canvas, neat and small,
CI wakes, runs FastScan, and prints them all.
A rabbit's nibble: code tidy and tall.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title references a bug fix in FastScan.py, but the changeset includes extensive refactoring of combineCreateNLL function across 15+ files, updated CI configurations, and library loading logic. The title only covers one aspect. Update title to reflect the primary change: 'Move combineCreateNLL to Combine class namespace' or 'Refactor combineCreateNLL as Combine class member' to accurately represent the main refactoring across the codebase.
Docstring Coverage ⚠️ Warning Docstring coverage is 3.85% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fast_scan_fix

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 82ab65b and ef93560.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Compile (py3.10, root6.26.4)
  • GitHub Check: LCG_102 - ROOT 6.26.04
  • GitHub Check: CMSSW_11_3_4 - ROOT 6.22.09
  • GitHub Check: LCG_108 - ROOT 6.36.02
  • GitHub Check: CMSSW_14_0_0_pre1 - ROOT 6.26.11
  • GitHub Check: LCG_106 - ROOT 6.32.02
  • GitHub Check: dev3/latest - ROOT LCG master
  • GitHub Check: CMSSW_14_1_0_pre4 - ROOT 6.30.07

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
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 13.88889% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.25%. Comparing base (1e5a2b6) to head (ef93560).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/Significance.cc 0.00% 35 Missing ⚠️
src/ProfiledLikelihoodRatioTestStatExt.cc 33.33% 8 Missing ⚠️
src/BestFitSigmaTestStat.cc 0.00% 6 Missing ⚠️
src/DebugProposal.cc 0.00% 4 Missing ⚠️
src/AsymptoticLimits.cc 0.00% 3 Missing ⚠️
src/GoodnessOfFit.cc 0.00% 3 Missing ⚠️
src/AsimovUtils.cc 0.00% 1 Missing ⚠️
src/HybridNew.cc 50.00% 1 Missing ⚠️
src/MultiDimFit.cc 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (13.88%) is below the target coverage (98.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1182   +/-   ##
=======================================
  Coverage   22.25%   22.25%           
=======================================
  Files         195      195           
  Lines       26154    26160    +6     
  Branches     3883     3884    +1     
=======================================
+ Hits         5820     5822    +2     
- Misses      20334    20338    +4     
Files with missing lines Coverage Δ
interface/Combine.h 100.00% <ø> (ø)
src/BayesianToyMC.cc 7.53% <ø> (ø)
src/Combine.cc 51.87% <100.00%> (ø)
src/FitDiagnostics.cc 34.91% <100.00%> (+0.06%) ⬆️
src/FitterAlgoBase.cc 32.15% <100.00%> (ø)
src/AsimovUtils.cc 0.00% <0.00%> (ø)
src/HybridNew.cc 35.78% <50.00%> (ø)
src/MultiDimFit.cc 26.88% <0.00%> (ø)
src/AsymptoticLimits.cc 3.38% <0.00%> (ø)
src/GoodnessOfFit.cc 3.58% <0.00%> (ø)
... and 4 more
Files with missing lines Coverage Δ
interface/Combine.h 100.00% <ø> (ø)
src/BayesianToyMC.cc 7.53% <ø> (ø)
src/Combine.cc 51.87% <100.00%> (ø)
src/FitDiagnostics.cc 34.91% <100.00%> (+0.06%) ⬆️
src/FitterAlgoBase.cc 32.15% <100.00%> (ø)
src/AsimovUtils.cc 0.00% <0.00%> (ø)
src/HybridNew.cc 35.78% <50.00%> (ø)
src/MultiDimFit.cc 26.88% <0.00%> (ø)
src/AsymptoticLimits.cc 3.38% <0.00%> (ø)
src/GoodnessOfFit.cc 3.58% <0.00%> (ø)
... and 4 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Updated the root version for Python 3.10 in CI workflow.
@anigamova
Copy link
Collaborator Author

anigamova commented Nov 13, 2025

Not sure what is happening in ROOT 6.32 build from Conda, other Conda versions, LCG_106 with ROOT 6.32 seem to be working, as well as CMSSW

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