Skip to content

Conversation

@kandrosov
Copy link
Contributor

  • Denominator is now defined at AnaTupleMerge stage
  • updated weights naming

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request removes the anaCache step from the corrections workflow, moving the denominator definition to the AnaTupleMerge stage, and updates weight naming conventions to be more modular and consistent.

Changes:

  • Refactored getNormalisationCorrections() to decompose the monolithic weight_MC_Lumi_pu into separate components (weight_lumi, weight_xs, weight_gen, weight_pu_*) that are combined into weight_base
  • Added stage-based conditional enabling of pileup corrections with new enabled parameter in puWeightProducer.getWeight()
  • Updated weight naming from puWeight_* to weight_pu_* for consistency with other weight naming conventions

Reviewed changes

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

File Description
pu.py Added enabled and return_list_of_branches parameters to support conditional branch definition and explicit branch tracking; renamed branches from puWeight_* to weight_pu_*
Corrections.py Decomposed monolithic weight into modular components, added stage-based PU weight enabling, and renamed weights from weight_MC_Lumi_* to weight_base_* for clarity

Comment on lines 67 to 71
key = (source, scale)
if shape_weights_dict:
if key not in shape_weights_dict:
shape_weights_dict[key] = []
shape_weights_dict[key].append(branch_name)
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

When enabled=False, the branch is not defined (line 60-65) but it is still added to shape_weights_dict (line 68-71). This means shape_weights_dict will contain references to undefined branches, which will cause runtime errors when these branches are later accessed in the weight formula calculation in Corrections.py (line 464). Either the branch should always be added to shape_weights_dict regardless of the enabled flag, or the addition to shape_weights_dict should also be conditional on enabled=True.

Suggested change
key = (source, scale)
if shape_weights_dict:
if key not in shape_weights_dict:
shape_weights_dict[key] = []
shape_weights_dict[key].append(branch_name)
if shape_weights_dict:
key = (source, scale)
if key not in shape_weights_dict:
shape_weights_dict[key] = []
shape_weights_dict[key].append(branch_name)

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@kandrosov
Copy link
Contributor Author

tested with cms-flaf/FLAF#215

@kandrosov kandrosov merged commit dbecc97 into cms-flaf:main Jan 30, 2026
3 checks passed
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.

1 participant