Conversation
kandrosov
commented
Jan 29, 2026
- Denominator is now defined at AnaTupleMerge stage
- updated weights naming
There was a problem hiding this comment.
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 monolithicweight_MC_Lumi_puinto separate components (weight_lumi,weight_xs,weight_gen,weight_pu_*) that are combined intoweight_base - Added stage-based conditional enabling of pileup corrections with new
enabledparameter inpuWeightProducer.getWeight() - Updated weight naming from
puWeight_*toweight_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 |
| 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) |
There was a problem hiding this comment.
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.
| 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) |
|
tested with cms-flaf/FLAF#215 |