Skip to content

Add multidimentional sWeights from X2VV project#30

Open
IlyaSegal wants to merge 1 commit into
mainfrom
2d_sweights
Open

Add multidimentional sWeights from X2VV project#30
IlyaSegal wants to merge 1 commit into
mainfrom
2d_sweights

Conversation

@IlyaSegal

Copy link
Copy Markdown
Contributor

I have added 2D sWeights calculation that I used in ccbar->phiphi analysis.
Plus some tests, example and documentation.

@IlyaSegal IlyaSegal self-assigned this Oct 2, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds multidimensional sWeights functionality to HighEnergyTools.jl, enabling statistical background subtraction for complex multi-component analyses like the X2VV ccbar->phi phi decay study. The implementation follows the Pivk & Le Diberder method for generalized sWeights calculation.

Key changes:

  • Added sWeights_general() for arbitrary component sWeights calculation with pre-computed shape values
  • Added sWeights_multidimensional() wrapper for multi-dimensional data using shape functions
  • Added check_sweights_closure() utility for validating closure property

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/sweights.jl Core implementation of generalized sWeights algorithms and utility functions
src/HighEnergyTools.jl Exported new public API functions
test/test-sweights.jl Comprehensive test suite for new functionality including edge cases
examples/phi_phi_2d_sweights_example.jl Complete demonstration script for 2D phi-phi analysis
2D_sWeights_README.md Documentation and usage examples for the new functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread 2D_sWeights_README.md
Comment thread src/sweights.jl
Comment thread src/sweights.jl
Comment thread test/test-sweights.jl
Generate synthetic 2D phi-phi data for demonstration
"""
function generate_synthetic_phi_phi_data(n_events::Int=1000)
Random.seed!(42) # For reproducibility

Copilot AI Oct 2, 2025

Copy link

Choose a reason for hiding this comment

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

Similar to the test file, the Random.seed! call should be at the module level or function entry point for better control over reproducibility throughout the entire example.

Copilot uses AI. Check for mistakes.
@codecov

codecov Bot commented Oct 2, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.52239% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.58%. Comparing base (3a5fae0) to head (d831ca8).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/sweights.jl 95.52% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #30      +/-   ##
==========================================
+ Coverage   68.64%   74.58%   +5.94%     
==========================================
  Files           8        8              
  Lines         236      303      +67     
==========================================
+ Hits          162      226      +64     
- Misses         74       77       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mmikhasenko

Copy link
Copy Markdown
Collaborator

The Linter error comes from README that reference

Error:  file:///home/runner/work/HighEnergyTools.jl/HighEnergyTools.jl/x | Cannot find file

which is broken.

@mmikhasenko

Copy link
Copy Markdown
Collaborator

ping @IlyaSegal for completing.

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.

3 participants